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/menu.h>
18 #include <lttv/toolbar.h>
20 #include "interface.h"
22 #include <lttv/mainWindow.h>
23 #include "callbacks.h"
26 systemView
* gSysView
;
32 /*****************************************************************************
33 * Functions for module loading/unloading *
34 *****************************************************************************/
36 * plugin's init function
38 * This function initializes the GUI.
41 typedef struct _WindowCreationData
{
47 static gboolean
Window_Creation_Hook(void *hook_data
, void *call_data
)
51 view_constructor constructor
;
53 LttvToolbars
* toolbar
;
54 lttv_menu_closure
*menuItem
;
55 lttv_toolbar_closure
*toolbarItem
;
56 LttvAttributeValue value
;
57 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
59 GtkWidget
* ToolMenuTitle_menu
, *insert_view
, *pixmap
;
61 mainWindow
* mw
= g_new(mainWindow
, 1);
62 gSysView
= g_new(systemView
, 1);
63 WindowCreationData
*Window_Creation_Data
= (WindowCreationData
*)call_data
;
65 g_critical("GUI init()");
67 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
68 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
69 textdomain (GETTEXT_PACKAGE
);
73 gtk_init (&(Window_Creation_Data
->argc
), &(Window_Creation_Data
->argv
));
75 add_pixmap_directory (PACKAGE_DATA_DIR
"/" PACKAGE
"/pixmaps");
76 add_pixmap_directory ("pixmaps");
77 add_pixmap_directory ("modules/gui/mainWin/pixmaps");
80 * The following code was added by Glade to create one of each component
81 * (except popup menus), just so that you see something after building
82 * the project. Delete any components that you don't want shown initially.
84 window1
= create_MWindow ();
85 gtk_widget_show (window1
);
87 mw
->MWindow
= window1
;
88 mw
->SystemView
= gSysView
;
90 mw
->CurrentTab
= NULL
;
91 // mw->Attributes = lttv_attributes_new();
94 g_assert(lttv_iattribute_find_by_path(attributes
,
95 "viewers/menu", LTTV_POINTER
, &value
));
96 menu
= (LttvMenus
*)*(value
.v_pointer
);
99 for(i
=0;i
<menu
->len
;i
++){
100 menuItem
= &g_array_index(menu
, lttv_menu_closure
, i
);
101 constructor
= menuItem
->con
;
102 ToolMenuTitle_menu
= lookup_widget(mw
->MWindow
,"ToolMenuTitle_menu");
103 insert_view
= gtk_menu_item_new_with_mnemonic (menuItem
->menuText
);
104 gtk_widget_show (insert_view
);
105 gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu
), insert_view
);
106 g_signal_connect ((gpointer
) insert_view
, "activate",
107 G_CALLBACK (insertViewTest
),
112 g_assert(lttv_iattribute_find_by_path(attributes
,
113 "viewers/toolbar", LTTV_POINTER
, &value
));
114 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
117 for(i
=0;i
<toolbar
->len
;i
++){
118 toolbarItem
= &g_array_index(toolbar
, lttv_toolbar_closure
, i
);
119 constructor
= toolbarItem
->con
;
120 ToolMenuTitle_menu
= lookup_widget(mw
->MWindow
,"MToolbar2");
121 pixbuf
= gdk_pixbuf_new_from_xpm_data ((const char**)toolbarItem
->pixmap
);
122 pixmap
= gtk_image_new_from_pixbuf(pixbuf
);
123 insert_view
= gtk_toolbar_append_element (GTK_TOOLBAR (ToolMenuTitle_menu
),
124 GTK_TOOLBAR_CHILD_BUTTON
,
127 toolbarItem
->tooltip
, NULL
,
129 gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild
*) (g_list_last (GTK_TOOLBAR (ToolMenuTitle_menu
)->children
)->data
))->label
), TRUE
);
130 gtk_widget_show (insert_view
);
131 gtk_container_set_border_width (GTK_CONTAINER (insert_view
), 1);
132 g_signal_connect ((gpointer
) insert_view
, "clicked",G_CALLBACK (insertViewTest
),constructor
);
138 gSysView
->EventDB
= NULL
;
139 gSysView
->SystemInfo
= NULL
;
140 gSysView
->Options
= NULL
;
141 gSysView
->Window
= mw
;
142 gSysView
->Next
= NULL
;
144 g_object_set_data(G_OBJECT(window1
), "systemView", (gpointer
)gSysView
);
145 g_object_set_data(G_OBJECT(window1
), "mainWindow", (gpointer
)mw
);
155 G_MODULE_EXPORT
void init(LttvModule
*self
, int argc
, char *argv
[]) {
157 LttvAttributeValue value
;
158 WindowCreationData
*Window_Creation_Data
= g_new(WindowCreationData
, 1);
160 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
162 Window_Creation_Data
->argc
= argc
;
163 Window_Creation_Data
->argv
= argv
;
165 g_assert(lttv_iattribute_find_by_path(
167 "hooks/main/before", LTTV_POINTER
, &value
));
169 g_assert((main_hooks
= *(value
.v_pointer
)) != NULL
);
171 lttv_hooks_add(main_hooks
, Window_Creation_Hook
, Window_Creation_Data
);
175 void destroy_walk(gpointer data
, gpointer user_data
)
177 //GuiControlFlow_Destructor((ControlFlowData*)data);
183 * plugin's destroy function
185 * This function releases the memory reserved by the module and unregisters
186 * everything that has been registered in the gtkTraceSet API.
188 G_MODULE_EXPORT
void destroy() {
190 WindowCreationData
*Window_Creation_Data
;
191 LttvAttributeValue value
;
193 g_critical("GUI destroy()");
196 //ControlFlowData *Control_Flow_Data;
199 //g_slist_foreach(sControl_Flow_Data_List, destroy_walk, NULL );
201 lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
202 "/hooks/main/before", LTTV_POINTER
, &value
);
204 // Window_Creation_Data = lttv_hooks_remove(*(value.v_pointer), Window_Creation_Hook);
206 g_free(Window_Creation_Data
);