state update hooks are added by the main window
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / module.c
CommitLineData
f0d936c0 1/*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */
2/*\@{*/
3
4/*! \file guiControlFlow.c
5 * \brief Graphical plugin for showing control flow of a trace.
6 *
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.
13 *
14 * This plugin uses the gdk library to draw the events and gtk to interact
15 * with the user.
16 *
17 * Author : Mathieu Desnoyers, June 2003
18 */
19
189a5d08 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)
22
558aa013 23#include <glib.h>
f0d936c0 24#include <gmodule.h>
25#include <lttv/module.h>
1ab818de 26#include <lttv/gtkTraceSet.h>
558aa013 27
1ab818de 28#include "CFV.h"
29#include "Event_Hooks.h"
558aa013 30
1ab818de 31 #include "../icons/hGuiControlFlowInsert.xpm"
558aa013 32
ae4e77e0 33static LttvModule *Main_Win_Module;
558aa013 34
35
36/** Array containing instanced objects. Used when module is unloaded */
1ab818de 37GSList *gControl_Flow_Data_List = NULL ;
558aa013 38
39
f0d936c0 40
f0d936c0 41
42/*****************************************************************************
43 * Functions for module loading/unloading *
44 *****************************************************************************/
45/**
46 * plugin's init function
47 *
48 * This function initializes the Control Flow Viewer functionnality through the
49 * gtkTraceSet API.
50 */
558aa013 51G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
52
53 Main_Win_Module = lttv_module_require(self, "mainwin", argc, argv);
54
55 if(Main_Win_Module == NULL)
56 {
57 g_critical("Can't load Control Flow Viewer : missing mainwin\n");
58 return;
59 }
60
189a5d08 61 g_info("GUI ControlFlow Viewer init()");
f0d936c0 62
63 /* Register the toolbar insert button */
41a76985 64 toolbar_item_reg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer",
3cff8cc1 65 h_guicontrolflow);
f0d936c0 66
67 /* Register the menu item insert entry */
3cff8cc1 68 menu_item_reg("/", "Insert Control Flow Viewer", h_guicontrolflow);
f0d936c0 69
70}
71
72void destroy_walk(gpointer data, gpointer user_data)
73{
189a5d08 74 g_info("Walk destroy GUI Control Flow Viewer");
cb1686f6 75 guicontrolflow_destructor_full((ControlFlowData*)data);
f0d936c0 76}
77
78
79
80/**
81 * plugin's destroy function
82 *
83 * This function releases the memory reserved by the module and unregisters
84 * everything that has been registered in the gtkTraceSet API.
85 */
86G_MODULE_EXPORT void destroy() {
189a5d08 87 g_info("GUI Control Flow Viewer destroy()");
f0d936c0 88 int i;
89
1ab818de 90 g_slist_foreach(gControl_Flow_Data_List, destroy_walk, NULL );
f0d936c0 91
f7afe191 92 g_slist_free(gControl_Flow_Data_List);
93
f0d936c0 94 /* Unregister the toolbar insert button */
3cff8cc1 95 toolbar_item_unreg(h_guicontrolflow);
f0d936c0 96
97 /* Unregister the menu item insert entry */
3cff8cc1 98 menu_item_unreg(h_guicontrolflow);
558aa013 99
558aa013 100}
This page took 0.026603 seconds and 4 git commands to generate.