rename to gtktraceset.h to viewer.h, includes
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / module.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19
20
21 /*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */
22 /*\@{*/
23
24 /*! \file guiControlFlow.c
25 * \brief Graphical plugin for showing control flow of a trace.
26 *
27 * This plugin adds a Control Flow Viewer functionnality to Linux TraceToolkit
28 * GUI when this plugin is loaded. The init and destroy functions add the
29 * viewer's insertion menu item and toolbar icon by calling viewer.h's
30 * API functions. Then, when a viewer's object is created, the constructor
31 * creates ans register through API functions what is needed to interact
32 * with the TraceSet window.
33 *
34 * This plugin uses the gdk library to draw the events and gtk to interact
35 * with the user.
36 *
37 * Author : Mathieu Desnoyers, June 2003
38 */
39
40 #include <glib.h>
41 #include <lttv/lttv.h>
42 #include <lttv/module.h>
43 #include <lttvwindow/viewer.h>
44
45 #include "cfv.h"
46 #include "eventhooks.h"
47
48 #include "hGuiControlFlowInsert.xpm"
49
50 static LttvModule *Main_Win_Module;
51
52
53 /** Array containing instanced objects. Used when module is unloaded */
54 GSList *g_control_flow_data_list = NULL ;
55
56
57
58
59 /*****************************************************************************
60 * Functions for module loading/unloading *
61 *****************************************************************************/
62 /**
63 * plugin's init function
64 *
65 * This function initializes the Control Flow Viewer functionnality through the
66 * gtkTraceSet API.
67 */
68 static void init() {
69
70 g_info("GUI ControlFlow Viewer init()");
71
72 /* Register the toolbar insert button */
73 toolbar_item_reg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer",
74 h_guicontrolflow);
75
76 /* Register the menu item insert entry */
77 menu_item_reg("/", "Insert Control Flow Viewer", h_guicontrolflow);
78
79 }
80
81 void destroy_walk(gpointer data, gpointer user_data)
82 {
83 g_info("Walk destroy GUI Control Flow Viewer");
84 guicontrolflow_destructor_full((ControlFlowData*)data);
85 }
86
87
88
89 /**
90 * plugin's destroy function
91 *
92 * This function releases the memory reserved by the module and unregisters
93 * everything that has been registered in the gtkTraceSet API.
94 */
95 static void destroy() {
96 g_info("GUI Control Flow Viewer destroy()");
97 int i;
98
99 g_slist_foreach(g_control_flow_data_list, destroy_walk, NULL );
100
101 g_slist_free(g_control_flow_data_list);
102
103 /* Unregister the toolbar insert button */
104 toolbar_item_unreg(h_guicontrolflow);
105
106 /* Unregister the menu item insert entry */
107 menu_item_unreg(h_guicontrolflow);
108
109 }
110
111
112 LTTV_MODULE("guicontrolflow", "Control flow viewer", \
113 "Graphical module to view processes state and control flow", \
114 init, destroy, "lttvwindow")
This page took 0.031605 seconds and 4 git commands to generate.