2 * Initial main.c file generated by Glade. Edit as required.
3 * Glade will not overwrite this file.
12 #include <lttv/lttv.h>
13 #include <lttv/attribute.h>
14 #include <lttv/hook.h>
15 #include <lttv/option.h>
16 #include <lttv/module.h>
17 #include <lttv/processTrace.h>
18 #include <lttv/state.h>
19 #include <lttv/stats.h>
20 #include <lttv/menu.h>
21 #include <lttv/toolbar.h>
23 #include "interface.h"
25 #include <lttv/mainWindow.h>
26 #include "callbacks.h"
29 LttvTracesetStats
* gTracesetContext
= NULL
;
30 static LttvTraceset
* traceset
;
32 /** Array containing instanced objects. */
33 GSList
* Main_Window_List
= NULL
;
48 void lttv_trace_option(void *hook_data
)
52 trace
= ltt_trace_open(a_trace
);
53 if(trace
== NULL
) g_critical("cannot open trace %s", a_trace
);
54 lttv_traceset_add(traceset
, trace
);
57 /*****************************************************************************
58 * Functions for module loading/unloading *
59 *****************************************************************************/
61 * plugin's init function
63 * This function initializes the GUI.
66 static gboolean
Window_Creation_Hook(void *hook_data
, void *call_data
)
68 WindowCreationData
* Window_Creation_Data
= (WindowCreationData
*)hook_data
;
70 g_critical("GUI Window_Creation_Hook()");
72 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
73 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
74 textdomain (GETTEXT_PACKAGE
);
78 gtk_init (&(Window_Creation_Data
->argc
), &(Window_Creation_Data
->argv
));
80 add_pixmap_directory (PACKAGE_DATA_DIR
"/" PACKAGE
"/pixmaps");
81 add_pixmap_directory ("pixmaps");
82 add_pixmap_directory ("modules/gui/mainWin/pixmaps");
85 if(!gTracesetContext
){
86 gTracesetContext
= g_object_new(LTTV_TRACESET_STATS_TYPE
, NULL
);
87 //FIXME: lttv_context_fini should be called some where.
88 lttv_context_init(LTTV_TRACESET_CONTEXT(gTracesetContext
), traceset
);
91 constructMainWin(NULL
, Window_Creation_Data
);
101 G_MODULE_EXPORT
void init(LttvModule
*self
, int argc
, char *argv
[]) {
103 LttvAttributeValue value
;
104 WindowCreationData
*Window_Creation_Data
= g_new(WindowCreationData
, 1);
106 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
108 g_critical("GUI init()");
110 lttv_option_add("trace", 't',
111 "add a trace to the trace set to analyse",
112 "pathname of the directory containing the trace",
113 LTTV_OPT_STRING
, &a_trace
, lttv_trace_option
, NULL
);
115 traceset
= lttv_traceset_new();
117 before_traceset
= lttv_hooks_new();
118 after_traceset
= lttv_hooks_new();
119 before_trace
= lttv_hooks_new();
120 after_trace
= lttv_hooks_new();
121 before_tracefile
= lttv_hooks_new();
122 after_tracefile
= lttv_hooks_new();
123 before_event
= lttv_hooks_new();
124 after_event
= lttv_hooks_new();
126 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/traceset/before",
127 LTTV_POINTER
, &value
));
128 *(value
.v_pointer
) = before_traceset
;
129 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/traceset/after",
130 LTTV_POINTER
, &value
));
131 *(value
.v_pointer
) = after_traceset
;
132 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/trace/before",
133 LTTV_POINTER
, &value
));
134 *(value
.v_pointer
) = before_trace
;
135 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/trace/after",
136 LTTV_POINTER
, &value
));
137 *(value
.v_pointer
) = after_trace
;
138 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/tracefile/before",
139 LTTV_POINTER
, &value
));
140 *(value
.v_pointer
) = before_tracefile
;
141 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/tracefile/after",
142 LTTV_POINTER
, &value
));
143 *(value
.v_pointer
) = after_tracefile
;
144 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/event/before",
145 LTTV_POINTER
, &value
));
146 *(value
.v_pointer
) = before_event
;
147 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/event/after",
148 LTTV_POINTER
, &value
));
149 *(value
.v_pointer
) = after_event
;
151 g_assert(lttv_iattribute_find_by_path(attributes
, "hooks/main/before",
152 LTTV_POINTER
, &value
));
153 g_assert((main_hooks
= *(value
.v_pointer
)) != NULL
);
155 Window_Creation_Data
->argc
= argc
;
156 Window_Creation_Data
->argv
= argv
;
158 lttv_hooks_add(main_hooks
, Window_Creation_Hook
, Window_Creation_Data
);
162 void destroy_walk(gpointer data
, gpointer user_data
)
164 //GuiControlFlow_Destructor((ControlFlowData*)data);
170 * plugin's destroy function
172 * This function releases the memory reserved by the module and unregisters
173 * everything that has been registered in the gtkTraceSet API.
175 G_MODULE_EXPORT
void destroy() {
177 WindowCreationData
*Window_Creation_Data
;
178 LttvAttributeValue value
;
182 lttv_option_remove("trace");
184 lttv_hooks_destroy(before_traceset
);
185 lttv_hooks_destroy(after_traceset
);
186 lttv_hooks_destroy(before_trace
);
187 lttv_hooks_destroy(after_trace
);
188 lttv_hooks_destroy(before_tracefile
);
189 lttv_hooks_destroy(after_tracefile
);
190 lttv_hooks_destroy(before_event
);
191 lttv_hooks_destroy(after_event
);
192 lttv_hooks_remove_data(main_hooks
, Window_Creation_Hook
, NULL
);
194 nb
= lttv_traceset_number(traceset
);
195 for(i
= 0 ; i
< nb
; i
++) {
196 ltt_trace_close(lttv_traceset_get(traceset
, i
));
199 lttv_traceset_destroy(traceset
);
201 g_critical("GUI destroy()");
205 //ControlFlowData *Control_Flow_Data;
208 g_slist_foreach(Main_Window_List
, destroy_walk
, NULL
);
211 //lttv_hooks_remove_data(main_hooks,Window_Creation_Hook, NULL);
212 //lttv_hooks_remove_data(before_traceset, get_traceset_context, NULL);
214 // g_free(Window_Creation_Data);
216 g_object_unref(gTracesetContext
);
This page took 0.033386 seconds and 4 git commands to generate.