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>
19 #include "interface.h"
21 #include "mainWindow.h"
22 #include "callbacks.h"
25 systemView
* gSysView
;
27 typedef view_constructor (* constructor
)();
28 constructor get_constructor
= NULL
;
29 typedef void (*call_Event_Selected_Hook
)(void * call_data
);
30 call_Event_Selected_Hook selected_hook
= NULL
;
32 view_constructor gConstructor
= NULL
;
39 /*****************************************************************************
40 * Functions for module loading/unloading *
41 *****************************************************************************/
43 * plugin's init function
45 * This function initializes the GUI.
48 typedef struct _WindowCreationData
{
54 static gboolean
Window_Creation_Hook(void *hook_data
, void *call_data
)
57 GtkWidget
* ToolMenuTitle_menu
, *insert_view
;
59 mainWindow
* mw
= g_new(mainWindow
, 1);
60 gSysView
= g_new(systemView
, 1);
61 WindowCreationData
*Window_Creation_Data
= (WindowCreationData
*)call_data
;
63 g_critical("GUI init()");
65 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
66 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
67 textdomain (GETTEXT_PACKAGE
);
71 gtk_init (&(Window_Creation_Data
->argc
), &(Window_Creation_Data
->argv
));
73 add_pixmap_directory (PACKAGE_DATA_DIR
"/" PACKAGE
"/pixmaps");
74 add_pixmap_directory ("pixmaps");
75 add_pixmap_directory ("modules/gui/mainWin/pixmaps");
78 * The following code was added by Glade to create one of each component
79 * (except popup menus), just so that you see something after building
80 * the project. Delete any components that you don't want shown initially.
82 window1
= create_MWindow ();
83 gtk_widget_show (window1
);
85 mw
->MWindow
= window1
;
86 mw
->SystemView
= gSysView
;
88 mw
->CurrentTab
= NULL
;
89 // mw->Attributes = lttv_attributes_new();
93 gm
= g_module_open("/home1/yangxx/poly/lttv/modules/libguiEvents.la",0);
94 printf("Main : the address of gm : %d\n", gm
);
95 if(!g_module_symbol(gm
, "get_constructor", (gpointer
)&get_constructor
)){
96 g_error("can not get constructor\n");
98 if(!g_module_symbol(gm
, "call_Event_Selected_Hook", (gpointer
)&selected_hook
)){
99 g_error("can not get selected hook\n");
102 gConstructor
= get_constructor();
103 ToolMenuTitle_menu
= lookup_widget(mw
->MWindow
,"ToolMenuTitle_menu");
104 insert_view
= gtk_menu_item_new_with_mnemonic ("insert_view");
105 gtk_widget_show (insert_view
);
106 gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu
), insert_view
);
107 g_signal_connect ((gpointer
) insert_view
, "activate",
108 G_CALLBACK (insertViewTest
),
112 gSysView
->EventDB
= NULL
;
113 gSysView
->SystemInfo
= NULL
;
114 gSysView
->Options
= NULL
;
115 gSysView
->Window
= mw
;
116 gSysView
->Next
= NULL
;
118 g_object_set_data(G_OBJECT(window1
), "systemView", (gpointer
)gSysView
);
119 g_object_set_data(G_OBJECT(window1
), "mainWindow", (gpointer
)mw
);
129 G_MODULE_EXPORT
void init(LttvModule
*self
, int argc
, char *argv
[]) {
131 LttvAttributeValue value
;
132 WindowCreationData
*Window_Creation_Data
= g_new(WindowCreationData
, 1);
134 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
136 Window_Creation_Data
->argc
= argc
;
137 Window_Creation_Data
->argv
= argv
;
139 g_assert(lttv_iattribute_find_by_path(
141 "hooks/main/before", LTTV_POINTER
, &value
));
143 g_assert((main_hooks
= *(value
.v_pointer
)) != NULL
);
145 lttv_hooks_add(main_hooks
, Window_Creation_Hook
, Window_Creation_Data
);
149 void destroy_walk(gpointer data
, gpointer user_data
)
151 //GuiControlFlow_Destructor((ControlFlowData*)data);
157 * plugin's destroy function
159 * This function releases the memory reserved by the module and unregisters
160 * everything that has been registered in the gtkTraceSet API.
162 G_MODULE_EXPORT
void destroy() {
164 WindowCreationData
*Window_Creation_Data
;
165 LttvAttributeValue value
;
167 g_critical("GUI destroy()");
170 //ControlFlowData *Control_Flow_Data;
173 //g_slist_foreach(sControl_Flow_Data_List, destroy_walk, NULL );
175 lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
176 "/hooks/main/before", LTTV_POINTER
, &value
);
178 Window_Creation_Data
= lttv_hooks_remove(*(value
.v_pointer
),
179 Window_Creation_Hook
);
181 g_free(Window_Creation_Data
);