stats ok with functions
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / callbacks.c
index 8571eb25d03076414f69a34b8b380b89d0ab8278..e07f7f168ebba9934c839798520c4fb4742ed75a 100644 (file)
@@ -1090,6 +1090,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 
         } else {
           LttTime pos_time;
+                                       LttvTracefileContext *tfc =
+                                               lttv_traceset_context_get_current_tfc(tsc);
           /* Else, the first request in list_in is a position request */
           /* If first req in list_in pos != current pos */
           g_assert(events_request->start_position != NULL);
@@ -1098,10 +1100,16 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                       events_request->start_position).tv_sec,
                  lttv_traceset_context_position_get_time(
                       events_request->start_position).tv_nsec);
-
-          g_debug("SEEK POS context time : %lu, %lu", 
-               lttv_traceset_context_get_current_tfc(tsc)->timestamp.tv_sec,
-               lttv_traceset_context_get_current_tfc(tsc)->timestamp.tv_nsec);
+                                       
+                                       if(tfc) {
+                                               g_debug("SEEK POS context time : %lu, %lu", 
+                                                        tfc->timestamp.tv_sec,
+                                                        tfc->timestamp.tv_nsec);
+                                       } else {
+                                               g_debug("SEEK POS context time : %lu, %lu", 
+                                                        ltt_time_infinite.tv_sec,
+                                                        ltt_time_infinite.tv_nsec);
+                                       }
           g_assert(events_request->start_position != NULL);
           if(lttv_traceset_context_ctx_pos_compare(tsc,
                      events_request->start_position) != 0) {
@@ -1730,6 +1738,18 @@ void add_trace(GtkWidget * widget, gpointer user_data)
         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 trace "
+              "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);
@@ -4025,57 +4045,48 @@ MainWindow *construct_main_window(MainWindow * parent)
     new_tab = create_tab(new_m_window, parent_tab, notebook, "Traceset");
   } else {
     new_tab = create_tab(new_m_window, NULL, notebook, "Traceset");
-    /* First window, use command line trace */
-    if(g_init_trace != NULL){
-      lttvwindow_add_trace(new_tab,
-                           g_init_trace);
+  }
 
+  /* Insert default viewers */
+  {
+    LttvAttributeType type;
+    LttvAttributeName name;
+    LttvAttributeValue value;
+    LttvAttribute *attribute;
+    
+    LttvIAttribute *attributes_global = 
+       LTTV_IATTRIBUTE(lttv_global_attributes());
+
+    g_assert(attribute = 
+      LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+                                LTTV_IATTRIBUTE(attributes_global),
+                                LTTV_VIEWER_CONSTRUCTORS)));
+
+    name = g_quark_from_string("guievents");
+    type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+                                       name, &value);
+    if(type == LTTV_POINTER) {
+      lttvwindow_viewer_constructor viewer_constructor = 
+                (lttvwindow_viewer_constructor)*value.v_pointer;
+      insert_viewer(new_window, viewer_constructor);
     }
-    LttvTraceset *traceset = new_tab->traceset_info->traceset;
-    SetTraceset(new_tab, traceset);
-
-    /* Insert default viewers */
-    {
-      LttvAttributeType type;
-      LttvAttributeName name;
-      LttvAttributeValue value;
-      LttvAttribute *attribute;
-      
-      LttvIAttribute *attributes_global = 
-         LTTV_IATTRIBUTE(lttv_global_attributes());
-
-      g_assert(attribute = 
-        LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
-                                  LTTV_IATTRIBUTE(attributes_global),
-                                  LTTV_VIEWER_CONSTRUCTORS)));
-
-      name = g_quark_from_string("guievents");
-      type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
-                                         name, &value);
-      if(type == LTTV_POINTER) {
-        lttvwindow_viewer_constructor viewer_constructor = 
-                  (lttvwindow_viewer_constructor)*value.v_pointer;
-        insert_viewer(new_window, viewer_constructor);
-      }
-
-      name = g_quark_from_string("guicontrolflow");
-      type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
-                                         name, &value);
-      if(type == LTTV_POINTER) {
-        lttvwindow_viewer_constructor viewer_constructor = 
-                  (lttvwindow_viewer_constructor)*value.v_pointer;
-        insert_viewer(new_window, viewer_constructor);
-      }
 
-      name = g_quark_from_string("guistatistics");
-      type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
-                                         name, &value);
-      if(type == LTTV_POINTER) {
-        lttvwindow_viewer_constructor viewer_constructor = 
-                  (lttvwindow_viewer_constructor)*value.v_pointer;
-        insert_viewer(new_window, viewer_constructor);
-      }
+    name = g_quark_from_string("guicontrolflow");
+    type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+                                       name, &value);
+    if(type == LTTV_POINTER) {
+      lttvwindow_viewer_constructor viewer_constructor = 
+                (lttvwindow_viewer_constructor)*value.v_pointer;
+      insert_viewer(new_window, viewer_constructor);
+    }
 
+    name = g_quark_from_string("guistatistics");
+    type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+                                       name, &value);
+    if(type == LTTV_POINTER) {
+      lttvwindow_viewer_constructor viewer_constructor = 
+                (lttvwindow_viewer_constructor)*value.v_pointer;
+      insert_viewer(new_window, viewer_constructor);
     }
   }
 
@@ -4535,6 +4546,17 @@ void create_main_window_with_trace(gchar *path)
     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);
This page took 0.025465 seconds and 4 git commands to generate.