/** Array containing instanced objects. */
extern GSList * Main_Window_List;
+static int gWinCount = 0;
+
mainWindow * get_window_data_struct(GtkWidget * widget);
char * get_unload_module(char ** loaded_module_name, int nb_module);
void * create_tab(GtkWidget* parent, GtkNotebook * notebook, char * label);
on_quit_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- on_MWindow_destroy(GTK_OBJECT(menuitem), user_data);
+ mainWindow * mwData = get_window_data_struct((GtkWidget*)menuitem);
+ mainWindow_Destructor(mwData);
}
gpointer user_data)
{
g_printf("There are : %d windows\n",g_slist_length(Main_Window_List));
-
- gtk_main_quit ();
+ gWinCount--;
+ if(gWinCount == 0)
+ gtk_main_quit ();
}
void constructMainWin(mainWindow * parent, WindowCreationData * win_creation_data)
{
- systemView * sv = NULL; /* System view */
+ // systemView * sv = NULL; /* System view */
systemView * newSv; /* New system view displayed in the new window */
GtkWidget * newWindow; /* New generated main window */
mainWindow * newMWindow;/* New main window structure */
GtkNotebook * notebook;
- if(parent) sv = parent->SystemView;
+ // if(parent) sv = parent->SystemView;
newMWindow = g_new(mainWindow, 1);
gtk_widget_show (newWindow);
newSv = g_new(systemView, 1);
- if(sv){
- while(sv->Next) sv = sv->Next;
- sv->Next = newSv;
- }
+ // if(sv){
+ // while(sv->Next) sv = sv->Next;
+ // sv->Next = newSv;
+ // }
newSv->EventDB = NULL;
newSv->SystemInfo = NULL;
//Use "Traceset" as the label for the default tab
create_tab(newMWindow->MWindow, notebook,"Traceset");
+ g_object_set_data_full(
+ G_OBJECT(newMWindow->MWindow),
+ "Main_Window_Data",
+ newMWindow,
+ (GDestroyNotify)mainWindow_free);
+
+ gWinCount++;
}
void * create_tab(GtkWidget* parent, GtkNotebook * notebook, char * label)