completely removed tab list and current_tab concept
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / init_module.c
index 7faf99edfa0bc1b68912f4ca2f87946c92a13703..505cc86da3416398df06be904fe51c5c1d53b70d 100644 (file)
 #include "interface.h"
 #include "support.h"
 #include <lttvwindow/mainwindow.h>
+#include <lttvwindow/mainwindow-private.h>
 #include "callbacks.h"
 #include <ltt/trace.h>
 
 
+GQuark LTTV_TRACES;
+
 /** Array containing instanced objects. */
 GSList * g_main_window_list = NULL ;
 
@@ -56,13 +59,16 @@ LttvTrace *g_init_trace = NULL;
 
 static char *a_trace;
 
+
 void lttv_trace_option(void *hook_data)
 { 
   LttTrace *trace;
+  gchar *path;
 
   trace = ltt_trace_open(a_trace);
   if(trace == NULL) g_critical("cannot open trace %s", a_trace);
   g_init_trace = lttv_trace_new(trace);
+
 }
 
 /*****************************************************************************
@@ -104,8 +110,10 @@ static void init() {
   // Global attributes only used for interaction with main() here.
   LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
   
-  g_debug("GUI init()");
+  LTTV_TRACES = g_quark_from_string("traces/");
   
+  g_debug("GUI init()");
+
   lttv_option_add("trace", 't', 
       "add a trace to the trace set to analyse", 
       "pathname of the directory containing the trace", 
@@ -115,27 +123,18 @@ static void init() {
       LTTV_POINTER, &value));
   g_assert((main_hooks = *(value.v_pointer)) != NULL);
 
-  lttv_hooks_add(main_hooks, window_creation_hook, NULL);
+  lttv_hooks_add(main_hooks, window_creation_hook, NULL, LTTV_PRIO_DEFAULT);
 
 }
 
 void
 main_window_destructor(MainWindow * mw)
 {
-  if(GTK_IS_WIDGET(mw->mwindow)){
-    gtk_widget_destroy(mw->mwindow);
-    mw = NULL;
-  }
-}
-
-
-void main_window_destroy_walk(gpointer data, gpointer user_data)
-{
-  main_window_destructor((MainWindow*)data);
+  g_assert(GTK_IS_WIDGET(mw->mwindow));
+  gtk_widget_destroy(mw->mwindow);
 }
 
 
-
 /**
  * plugin's destroy function
  *
@@ -146,7 +145,8 @@ static void destroy() {
 
   LttvAttributeValue value;  
   LttvTrace *trace;
-
+  GSList *iter = NULL;
+  
   lttv_option_remove("trace");
 
   lttv_hooks_remove_data(main_hooks, window_creation_hook, NULL);
@@ -154,7 +154,9 @@ static void destroy() {
   g_debug("GUI destroy()");
 
   if(g_main_window_list){
-    g_slist_foreach(g_main_window_list, main_window_destroy_walk, NULL );
+    for(iter=g_main_window_list;iter!=NULL;iter=g_slist_next(iter)) {
+        main_window_destructor((MainWindow*)iter->data);
+    }
     g_slist_free(g_main_window_list);
   }
   
@@ -163,4 +165,4 @@ static void destroy() {
 
 LTTV_MODULE("lttvwindow", "Viewer main window", \
     "Viewer with multiple windows, tabs and panes for graphical modules", \
-           init, destroy, "stats")
+           init, destroy, "stats", "option")
This page took 0.025513 seconds and 4 git commands to generate.