fix for first draw, but problematic with duplicate event
[lttv.git] / ltt / branches / poly / lttv / modules / gui / main / src / callbacks.c
index 76cd18c208d98ad53479cdf36365ca42349e893e..75a9b0a861453cbcdc86858383f6e81f53246d8b 100644 (file)
@@ -421,6 +421,10 @@ void add_trace(GtkWidget * widget, gpointer user_data)
     case GTK_RESPONSE_ACCEPT:
     case GTK_RESPONSE_OK:
       dir = gtk_dir_selection_get_dir (file_selector);
+      if(!dir || strlen(dir) ==0){
+       gtk_widget_destroy((GtkWidget*)file_selector);
+       break;
+      }
       trace = ltt_trace_open(dir);
       if(trace == NULL) g_critical("cannot open trace %s", dir);
       trace_v = lttv_trace_new(trace);
@@ -442,6 +446,18 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       
       //update current tab
       update_traceset(mw_data);
+
+      get_traceset_time_span(mw_data,LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->traceset_context)->Time_Span);
+      if(lttv_traceset_number(mw_data->current_tab->traceset_info->traceset) == 1 ||
+        ltt_time_compare(mw_data->current_tab->current_time,
+             LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->traceset_context)->Time_Span->startTime)<0){
+       mw_data->current_tab->current_time = 
+           LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->traceset_context)->Time_Span->startTime;
+       mw_data->current_tab->time_window.start_time = mw_data->current_tab->current_time;
+       mw_data->current_tab->time_window.time_width.tv_sec = DEFAULT_TIME_WIDTH_S;
+       mw_data->current_tab->time_window.time_width.tv_nsec = 0;
+      } 
+
       redraw_viewer(mw_data, &(mw_data->current_tab->time_window));
       set_current_time(mw_data,&(mw_data->current_tab->current_time));
       break;
This page took 0.023076 seconds and 4 git commands to generate.