gui multiple -t args
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 5 Jul 2006 21:32:05 +0000 (21:32 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 5 Jul 2006 21:32:05 +0000 (21:32 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1974 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c

index bb8932373df05c6c500563c3011a38cabcd3b0e6..3a1eac2c7cff6f4c237fb5c923fe72902949c707 100644 (file)
@@ -4847,9 +4847,9 @@ gboolean execute_events_requests(Tab *tab)
 }
 
 
-void create_main_window_with_trace(const gchar *path)
+void create_main_window_with_trace_list(GSList *traces)
 {
-  if(path == NULL) return;
+  GSList *iter = NULL;
 
   /* Create window */
   MainWindow *mw = construct_main_window(NULL);
@@ -4869,37 +4869,40 @@ void create_main_window_with_trace(const gchar *path)
     tab = ptab->tab;
   }
 
-  /* Add trace */
-  gchar abs_path[PATH_MAX];
-  LttvTrace *trace_v;
-  LttTrace *trace;
-
-  get_absolute_pathname(path, abs_path);
-  trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
-  if(trace_v == NULL) {
-    trace = ltt_trace_open(abs_path);
-    if(trace == NULL) {
-      g_warning("cannot open trace %s", abs_path);
-
-      GtkWidget *dialogue = 
-        gtk_message_dialog_new(
-          GTK_WINDOW(gtk_widget_get_toplevel(widget)),
-          GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
-          GTK_MESSAGE_ERROR,
-          GTK_BUTTONS_OK,
-          "Cannot open trace : maybe you should enter in the directory"
-          "to select it ?");
-      gtk_dialog_run(GTK_DIALOG(dialogue));
-      gtk_widget_destroy(dialogue);
+  for(iter=traces; iter!=NULL; iter=g_slist_next(iter)) {
+    gchar *path = (gchar*)iter->data;
+    /* Add trace */
+    gchar abs_path[PATH_MAX];
+    LttvTrace *trace_v;
+    LttTrace *trace;
+
+    get_absolute_pathname(path, abs_path);
+    trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
+    if(trace_v == NULL) {
+      trace = ltt_trace_open(abs_path);
+      if(trace == NULL) {
+        g_warning("cannot open trace %s", abs_path);
+
+        GtkWidget *dialogue = 
+          gtk_message_dialog_new(
+            GTK_WINDOW(gtk_widget_get_toplevel(widget)),
+            GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+            GTK_MESSAGE_ERROR,
+            GTK_BUTTONS_OK,
+            "Cannot open trace : maybe you should enter in the directory"
+            "to select it ?");
+        gtk_dialog_run(GTK_DIALOG(dialogue));
+        gtk_widget_destroy(dialogue);
+      } else {
+        trace_v = lttv_trace_new(trace);
+        lttvwindowtraces_add_trace(trace_v);
+        lttvwindow_add_trace(tab, trace_v);
+      }
     } else {
-      trace_v = lttv_trace_new(trace);
-      lttvwindowtraces_add_trace(trace_v);
       lttvwindow_add_trace(tab, trace_v);
     }
-  } else {
-    lttvwindow_add_trace(tab, trace_v);
   }
-
+  
   LttvTraceset *traceset;
 
   traceset = tab->traceset_info->traceset;
index f38331aabafc201fd4e37c73f33dbaacac0d63fc..1bbd4fbf05a5c13a0e8673f23a8b01884d238b67 100644 (file)
@@ -27,7 +27,7 @@ MainWindow *construct_main_window(MainWindow * parent);
 void main_window_free(MainWindow * mw);
 void main_window_destructor(MainWindow * mw);
 
-void create_main_window_with_trace(const gchar *path);
+void create_main_window_with_trace_list(GSList *traces);
 
 void insert_viewer_wrap(GtkWidget *menuitem, gpointer user_data);
 gboolean execute_events_requests(Tab *tab);
index 8c3f97296167e33bb44db14f47f24e4b02744c82..1e2da6a348a3020c3a45f8fa262dfb36a033e04a 100644 (file)
@@ -83,17 +83,18 @@ LttvHooks
   *main_hooks;
 
 /* Initial trace from command line */
-//LttvTrace *g_init_trace = NULL;
+static GSList *g_init_trace = NULL;
 
 static char *a_trace;
-static char g_init_trace[PATH_MAX] = "";
+//static char g_init_trace[PATH_MAX] = "";
 
 
 void lttv_trace_option(void *hook_data)
 { 
-  LttTrace *trace;
+  //LttTrace *trace;
 
-  get_absolute_pathname(a_trace, g_init_trace);
+  //get_absolute_pathname(a_trace, g_init_trace);
+  g_init_trace = g_slist_append(g_init_trace, a_trace);
 }
 
 /*****************************************************************************
@@ -122,11 +123,7 @@ static gboolean window_creation_hook(void *hook_data, void *call_data)
   add_pixmap_directory ("../modules/gui/main/pixmaps");
 
   /* First window, use command line trace */
-  if(strcmp(g_init_trace, "") != 0){
-    create_main_window_with_trace(g_init_trace);
-  } else {
-    construct_main_window(NULL);
-  }
+  create_main_window_with_trace_list(g_init_trace);
 
   gtk_main ();
 
@@ -255,6 +252,8 @@ static void destroy() {
   g_slist_foreach(g_main_window_list, destroy_walk, NULL);
   
   g_slist_free(g_main_window_list);
+
+  g_slist_free(g_init_trace);
   
 }
 
This page took 0.027178 seconds and 4 git commands to generate.