2 * Initial main.c file generated by Glade. Edit as required.
3 * Glade will not overwrite this file.
12 #include <lttv/module.h>
13 #include <lttv/hook.h>
14 #include <lttv/lttv.h>
17 #include "interface.h"
19 #include "mainWindow.h"
20 #include "callbacks.h"
23 systemView
* gSysView
;
25 typedef view_constructor (* constructor
)();
26 constructor get_constructor
= NULL
;
27 typedef void (*call_Event_Selected_Hook
)(void * call_data
);
28 call_Event_Selected_Hook selected_hook
= NULL
;
30 view_constructor gConstructor
= NULL
;
32 int Window_Creation_Hook(void *hook_data
, void *call_data
);
34 /*****************************************************************************
35 * Functions for module loading/unloading *
36 *****************************************************************************/
38 * plugin's init function
40 * This function initializes the GUI.
43 typedef struct _WindowCreationData
{
48 G_MODULE_EXPORT
void init(LttvModule
*self
, int argc
, char *argv
[]) {
50 LttvAttributeValue value
;
51 WindowCreationData
*Window_Creation_Data
= g_new(WindowCreationData
, 1);
53 Window_Creation_Data
->argc
= argc
;
54 Window_Creation_Data
->argv
= argv
;
57 lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
58 "/hooks/main/before", LTTV_POINTER
, &value
);
60 lttv_hooks_add(*(value
.v_pointer
), Window_Creation_Hook
, Window_Creation_Data
);
64 int Window_Creation_Hook(void *hook_data
, void *call_data
)
67 GtkWidget
* ToolMenuTitle_menu
, *insert_view
;
69 mainWindow
* mw
= g_new(mainWindow
, 1);
70 gSysView
= g_new(systemView
, 1);
71 WindowCreationData
*Window_Creation_Data
= (WindowCreationData
*)call_data
;
73 g_critical("GUI init()");
75 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
76 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
77 textdomain (GETTEXT_PACKAGE
);
81 gtk_init (&(Window_Creation_Data
->argc
), &(Window_Creation_Data
->argv
));
83 add_pixmap_directory (PACKAGE_DATA_DIR
"/" PACKAGE
"/pixmaps");
84 add_pixmap_directory ("pixmaps");
87 * The following code was added by Glade to create one of each component
88 * (except popup menus), just so that you see something after building
89 * the project. Delete any components that you don't want shown initially.
91 window1
= create_MWindow ();
92 gtk_widget_show (window1
);
94 mw
->MWindow
= window1
;
95 mw
->SystemView
= gSysView
;
97 mw
->CurrentTab
= NULL
;
98 // mw->Attributes = lttv_attributes_new();
102 gm
= g_module_open("/home1/yangxx/poly/lttv/modules/libguiEvents.la",0);
103 printf("Main : the address of gm : %d\n", gm
);
104 if(!g_module_symbol(gm
, "get_constructor", (gpointer
)&get_constructor
)){
105 g_error("can not get constructor\n");
107 if(!g_module_symbol(gm
, "call_Event_Selected_Hook", (gpointer
)&selected_hook
)){
108 g_error("can not get selected hook\n");
111 gConstructor
= get_constructor();
112 ToolMenuTitle_menu
= lookup_widget(mw
->MWindow
,"ToolMenuTitle_menu");
113 insert_view
= gtk_menu_item_new_with_mnemonic ("insert_view");
114 gtk_widget_show (insert_view
);
115 gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu
), insert_view
);
116 g_signal_connect ((gpointer
) insert_view
, "activate",
117 G_CALLBACK (insertViewTest
),
121 gSysView
->EventDB
= NULL
;
122 gSysView
->SystemInfo
= NULL
;
123 gSysView
->Options
= NULL
;
124 gSysView
->Window
= mw
;
125 gSysView
->Next
= NULL
;
127 g_object_set_data(G_OBJECT(window1
), "systemView", (gpointer
)gSysView
);
128 g_object_set_data(G_OBJECT(window1
), "mainWindow", (gpointer
)mw
);
133 void destroy_walk(gpointer data
, gpointer user_data
)
135 //GuiControlFlow_Destructor((ControlFlowData*)data);
141 * plugin's destroy function
143 * This function releases the memory reserved by the module and unregisters
144 * everything that has been registered in the gtkTraceSet API.
146 G_MODULE_EXPORT
void destroy() {
148 WindowCreationData
*Window_Creation_Data
;
149 LttvAttributeValue value
;
151 g_critical("GUI destroy()");
154 //ControlFlowData *Control_Flow_Data;
157 //g_slist_foreach(sControl_Flow_Data_List, destroy_walk, NULL );
159 lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
160 "/hooks/main/before", LTTV_POINTER
, &value
);
162 Window_Creation_Data
= lttv_hooks_remove(*(value
.v_pointer
),
163 Window_Creation_Hook
);
165 g_free(Window_Creation_Data
);