1 /*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */
4 /*! \file guiControlFlow.c
5 * \brief Graphical plugin for showing control flow of a trace.
7 * This plugin adds a Control Flow Viewer functionnality to Linux TraceToolkit
8 * GUI when this plugin is loaded. The init and destroy functions add the
9 * viewer's insertion menu item and toolbar icon by calling gtkTraceSet's
10 * API functions. Then, when a viewer's object is created, the constructor
11 * creates ans register through API functions what is needed to interact
12 * with the TraceSet window.
14 * This plugin uses the gdk library to draw the events and gtk to interact
17 * Author : Mathieu Desnoyers, June 2003
20 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
21 #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
25 #include <lttv/module.h>
26 #include <lttv/gtkTraceSet.h>
29 #include "Event_Hooks.h"
31 #include "../icons/hGuiControlFlowInsert.xpm"
33 static LttvModule
*Main_Win_Module
;
36 /** Array containing instanced objects. Used when module is unloaded */
37 GSList
*gControl_Flow_Data_List
= NULL
;
42 /*****************************************************************************
43 * Functions for module loading/unloading *
44 *****************************************************************************/
46 * plugin's init function
48 * This function initializes the Control Flow Viewer functionnality through the
51 G_MODULE_EXPORT
void init(LttvModule
*self
, int argc
, char *argv
[]) {
53 Main_Win_Module
= lttv_module_require(self
, "mainwin", argc
, argv
);
55 if(Main_Win_Module
== NULL
)
57 g_critical("Can't load Control Flow Viewer : missing mainwin\n");
61 g_info("GUI ControlFlow Viewer init()");
63 /* Register the toolbar insert button */
64 toolbar_item_reg(hGuiControlFlowInsert_xpm
, "Insert Control Flow Viewer",
67 /* Register the menu item insert entry */
68 menu_item_reg("/", "Insert Control Flow Viewer", h_guicontrolflow
);
72 void destroy_walk(gpointer data
, gpointer user_data
)
74 g_info("Walk destroy GUI Control Flow Viewer");
75 guicontrolflow_destructor_full((ControlFlowData
*)data
);
81 * plugin's destroy function
83 * This function releases the memory reserved by the module and unregisters
84 * everything that has been registered in the gtkTraceSet API.
86 G_MODULE_EXPORT
void destroy() {
87 g_info("GUI Control Flow Viewer destroy()");
90 g_slist_foreach(gControl_Flow_Data_List
, destroy_walk
, NULL
);
92 g_slist_free(gControl_Flow_Data_List
);
94 /* Unregister the toolbar insert button */
95 toolbar_item_unreg(h_guicontrolflow
);
97 /* Unregister the menu item insert entry */
98 menu_item_unreg(h_guicontrolflow
);