state update hooks are added by the main window
[lttv.git] / ltt / branches / poly / lttv / modules / gui / mainWin / src / init_module.c
index a4a2be31bf9ae34bff93817845e4a9bb4a621c8f..2201eadc1f6d5167055fab578fdebcb5a2d4783b 100644 (file)
 #include "support.h"
 #include <lttv/mainWindow.h>
 #include "callbacks.h"
+#include <ltt/trace.h>
+
 
 /* global variable */
-//LttvTracesetStats * gTracesetContext = NULL;
-//static LttvTraceset * traceset;
 static WindowCreationData  win_creation_data;
 
 /** Array containing instanced objects. */
@@ -77,7 +77,7 @@ static gboolean window_creation_hook(void *hook_data, void *call_data)
   add_pixmap_directory ("pixmaps");
   add_pixmap_directory ("modules/gui/mainWin/pixmaps");
 
-  construct_main_window(NULL, window_creation_data, TRUE);
+  construct_main_window(NULL, window_creation_data);
 
   gtk_main ();
 
@@ -110,47 +110,15 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
 }
 
 void
-main_window_free(mainWindow * mw)
+main_window_free(MainWindow * mw)
 { 
-  guint i, nb, ref_count;
-  LttvTrace * trace;
-
   if(mw){
-
-g_critical("begin remove");
-    lttv_hooks_destroy(mw->Traceset_Info->before_traceset);
-    lttv_hooks_destroy(mw->Traceset_Info->after_traceset);
-    lttv_hooks_destroy(mw->Traceset_Info->before_trace);
-    lttv_hooks_destroy(mw->Traceset_Info->after_trace);
-    lttv_hooks_destroy(mw->Traceset_Info->before_tracefile);
-    lttv_hooks_destroy(mw->Traceset_Info->after_tracefile);
-    lttv_hooks_destroy(mw->Traceset_Info->before_event);
-    lttv_hooks_destroy(mw->Traceset_Info->after_event);
-g_critical("end remove");
-    
-    if(mw->Traceset_Info->path != NULL)
-      g_free(mw->Traceset_Info->path);
-    if(mw->Traceset_Info->TracesetContext != NULL){
-      lttv_context_fini(LTTV_TRACESET_CONTEXT(mw->Traceset_Info->TracesetContext));
-      g_object_unref(mw->Traceset_Info->TracesetContext);
+    while(mw->tab){
+      lttv_state_remove_event_hooks(
+           (LttvTracesetState*)mw->tab->traceset_info->traceset_context);
+      mw->tab = mw->tab->next;
     }
-    if(mw->Traceset_Info->traceset != NULL) {
-      nb = lttv_traceset_number(mw->Traceset_Info->traceset);
-      for(i = 0 ; i < nb ; i++) {
-       trace = lttv_traceset_get(mw->Traceset_Info->traceset, i);
-       ref_count = lttv_trace_get_ref_number(trace);
-       if(ref_count <= 1)
-         ltt_trace_close(lttv_trace(trace));
-      }
-    }
-
-    lttv_traceset_destroy(mw->Traceset_Info->traceset); 
-
-    g_object_unref(mw->Attributes);
-
-    g_free(mw->Traceset_Info);
-    mw->Traceset_Info = NULL;
-      
+    g_object_unref(mw->attributes);
     g_main_window_list = g_slist_remove(g_main_window_list, mw);
 
     g_hash_table_destroy(mw->hash_menu_item);
@@ -162,10 +130,10 @@ g_critical("end remove");
 }
 
 void
-main_window_destructor(mainWindow * mw)
+main_window_destructor(MainWindow * mw)
 {
-  if(GTK_IS_WIDGET(mw->MWindow)){
-    gtk_widget_destroy(mw->MWindow);
+  if(GTK_IS_WIDGET(mw->mwindow)){
+    gtk_widget_destroy(mw->mwindow);
     //    gtk_widget_destroy(mw->HelpContents);
     //    gtk_widget_destroy(mw->AboutBox);    
     mw = NULL;
@@ -177,7 +145,7 @@ main_window_destructor(mainWindow * mw)
 
 void main_window_destroy_walk(gpointer data, gpointer user_data)
 {
-  main_window_destructor((mainWindow*)data);
+  main_window_destructor((MainWindow*)data);
 }
 
 
This page took 0.023115 seconds and 4 git commands to generate.