From 8e3a7c75c825b64bb891233028057543577e3393 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 5 Jul 2006 21:32:05 +0000 Subject: [PATCH] gui multiple -t args git-svn-id: http://ltt.polymtl.ca/svn@1974 04897980-b3bd-0310-b5e0-8ef037075253 --- .../gui/lttvwindow/lttvwindow/callbacks.c | 61 ++++++++++--------- .../gui/lttvwindow/lttvwindow/callbacks.h | 2 +- .../gui/lttvwindow/lttvwindow/init_module.c | 17 +++--- 3 files changed, 41 insertions(+), 39 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index bb893237..3a1eac2c 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -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; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h index f38331aa..1bbd4fbf 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h @@ -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); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c index 8c3f9729..1e2da6a3 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c @@ -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); } -- 2.34.1