no more after_request on remove_all
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / callbacks.c
index c7d1cc17a5e907d9cb7a1c865c176c4b79e082fc..128b420229c0f345ef741168f7d4c28b15f215ab 100644 (file)
@@ -740,10 +740,13 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 
   
   /* Events processing algorithm implementation */
+  /* Warning : the gtk_events_pending takes a LOT of cpu time. So what we do
+   * instead is to leave the control to GTK and take it back.
+   */
   /* A. Servicing loop */
-  while( (g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
-     /*    && !gtk_events_pending() )  */
-
+  //while( (g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
+  if((g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
+    /* Servicing */
     /* 1. If list_in is empty (need a seek) */
     if( g_slist_length(list_in) ==  0 ) {
 
@@ -1011,7 +1014,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                              events_request->event,
                                              events_request->event_by_id);
           }
+
           /* Go to next */
           if(remove)
           {
@@ -1113,8 +1116,11 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
       count = lttv_process_traceset_middle(tsc, end_time, end_nb_events, end_position);
 
       tfc = lttv_traceset_context_get_current_tfc(tsc);
-      g_debug("Context time after middle : %lu, %lu", tfc->timestamp.tv_sec,
+      if(tfc != NULL)
+        g_debug("Context time after middle : %lu, %lu", tfc->timestamp.tv_sec,
                                                         tfc->timestamp.tv_nsec);
+      else
+        g_debug("End of trace reached after middle.");
 
     }
     {
@@ -1231,9 +1237,10 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
         }
       }
     }
-
-    if(gtk_events_pending()) break;
   }
+  /* End of removed servicing loop : leave control to GTK instead. */
+  //  if(gtk_events_pending()) break;
+  //}
 
   /* B. When interrupted between chunks */
 
@@ -1384,9 +1391,10 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
 {
   LttvTraceset *traceset = tab->traceset_info->traceset;
   guint i;
+  guint num_traces = lttv_traceset_number(traceset);
 
  //Verify if trace is already present.
-  for(i=0; i<lttv_traceset_number(traceset); i++)
+  for(i=0; i<num_traces; i++)
   {
     LttvTrace * trace = lttv_traceset_get(traceset, i);
     if(trace == trace_v)
@@ -2720,9 +2728,9 @@ on_unload_module_activate              (GtkMenuItem     *menuitem,
     GPtrArray *name;
     guint nb,i;
     gchar *module_name;
+    nb = lttv_library_module_number(library);
     LttvModuleInfo *module_info = g_new(LttvModuleInfo,nb);
     name = g_ptr_array_new();
-    nb = lttv_library_module_number(library);
     /* ask for the module name */
 
     for(i=0;i<nb;i++){
@@ -2749,10 +2757,11 @@ on_unload_module_activate              (GtkMenuItem     *menuitem,
     if(module_name == NULL) return;
   }
   
-  lttv_module_release(module);
   LttvModuleInfo module_info;
   lttv_module_info(module, &module_info);
   g_printf("Release module: %s\n", module_info.name);
+  lttv_module_release(module);
 }
 
 
@@ -3094,7 +3103,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar,
   lower = adjust->lower;
   upper = adjust->upper;
   ratio = (value - lower) / (upper - lower);
-  g_critical("lower %lu, upper %lu, value %lu, ratio %lu", lower, upper, value, ratio);
+  g_info("lower %lu, upper %lu, value %lu, ratio %lu", lower, upper, value, ratio);
   
   //time = ltt_time_sub(time_span->end_time, time_span->start_time);
   //time = ltt_time_mul(time, (float)ratio);
@@ -3624,9 +3633,13 @@ void 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);
+
+      LttvTraceset *traceset = new_tab->traceset_info->traceset;
+      SetTraceset(new_tab, traceset);
     }
   }
 
@@ -3702,12 +3715,13 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
     tab->traceset_info->traceset = lttv_traceset_new();
   }
 
-//FIXME : this is g_debug level
+#ifdef DEBUG
   lttv_attribute_write_xml(
       lttv_traceset_attribute(tab->traceset_info->traceset),
       stdout,
       0, 4);
   fflush(stdout);
+#endif //DEBUG
 
 
   //FIXME copy not implemented in lower level
@@ -3749,8 +3763,8 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
   tab->attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
   tab->interrupted_state = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
  
-  tab->vbox = gtk_vbox_new(FALSE, 0);
-  tab->viewer_container = gtk_vbox_new(TRUE, 0);
+  tab->vbox = gtk_vbox_new(FALSE, 2);
+  tab->viewer_container = gtk_vbox_new(TRUE, 2);
   tab->scrollbar = gtk_hscrollbar_new(NULL);
   //tab->multivpaned = gtk_multi_vpaned_new();
   
This page took 0.025437 seconds and 4 git commands to generate.