detailed event list partially works
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / callbacks.c
index 5ded4686fff86ea56aedec51c7b3d73439f823fa..060fcbc7dd64bd633a151699ba7cc152bf0292b6 100644 (file)
@@ -331,6 +331,18 @@ static void connect_focus_recursive(GtkWidget *widget,
                     (gpointer)viewer);
 }
 
+/* Stop all the processings and call gtk_main_quit() */
+static void mainwindow_quit()
+{
+  lttvwindowtraces_unregister_requests(g_quark_from_string("stats"));
+  lttvwindowtraces_unregister_requests(g_quark_from_string("state"));
+  lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("stats"));
+  lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("state"));
+
+  gtk_main_quit();
+}
+
+
 /* insert_viewer function constructs an instance of a viewer first,
  * then inserts the widget of the instance into the container of the
  * main window
@@ -424,7 +436,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
   current_time_change_manager(tab, new_current_time);
 
   //FIXME : we delete the filter tree, when it should be updated.
-  lttv_filter_tree_destroy(tab->filter);
+  lttv_filter_destroy(tab->filter);
   tab->filter = NULL;
   
 #if 0
@@ -809,42 +821,6 @@ void open_traceset(GtkWidget * widget, gpointer user_data)
 
 }
 
-static void events_request_free(EventsRequest *events_request)
-{
-  if(events_request == NULL) return;
-
-  if(events_request->start_position != NULL)
-       lttv_traceset_context_position_destroy(events_request->start_position);
-  if(events_request->end_position != NULL)
-       lttv_traceset_context_position_destroy(events_request->end_position);
-  if(events_request->hooks != NULL)
-    g_array_free(events_request->hooks, TRUE);
-  if(events_request->before_chunk_traceset != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_traceset);
-  if(events_request->before_chunk_trace != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_trace);
-  if(events_request->before_chunk_tracefile != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_tracefile);
-  if(events_request->event != NULL)
-       lttv_hooks_destroy(events_request->event);
-  if(events_request->event_by_id != NULL)
-       lttv_hooks_by_id_destroy(events_request->event_by_id);
-  if(events_request->after_chunk_tracefile != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_tracefile);
-  if(events_request->after_chunk_trace != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_trace);
-  if(events_request->after_chunk_traceset != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_traceset);
-  if(events_request->before_request != NULL)
-       lttv_hooks_destroy(events_request->before_request);
-  if(events_request->after_request != NULL)
-       lttv_hooks_destroy(events_request->after_request);
-
-  g_free(events_request);
-}
-
-
-
 /* lttvwindow_process_pending_requests
  * 
  * This internal function gets called by g_idle, taking care of the pending
@@ -957,8 +933,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
   }
 
   /* 0.2 Seek tracefiles positions to context position */
+  //g_assert(lttv_process_traceset_seek_position(tsc, sync_position) == 0);
   lttv_process_traceset_synchronize_tracefiles(tsc);
-
+  
   
   /* Events processing algorithm implementation */
   /* Warning : the gtk_events_pending takes a LOT of cpu time. So what we do
@@ -1100,6 +1077,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                lttv_process_traceset_middle(tsc,
                                             events_request->start_time,
                                             G_MAXUINT, NULL);
+#ifdef DEBUG
+            g_assert(seek_count < LTTV_STATE_SAVE_INTERVAL);
+#endif //DEBUG
 
 
         } else {
@@ -1564,7 +1544,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
       /* 1.1. Use current postition as start position */
       if(events_request->start_position != NULL)
         lttv_traceset_context_position_destroy(events_request->start_position);
-      events_request->start_position = lttv_traceset_context_position_new();
+      events_request->start_position = lttv_traceset_context_position_new(tsc);
       lttv_traceset_context_position_save(tsc, events_request->start_position);
 
       /* 1.2. Remove start time */
@@ -1590,10 +1570,10 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 
 
   }
-  
   /* C Unlock Traces */
   {
-    //lttv_process_traceset_get_sync_data(tsc);
+    lttv_process_traceset_get_sync_data(tsc);
+    //lttv_traceset_context_position_save(tsc, sync_position);
     
     guint iter_trace;
     
@@ -1605,7 +1585,6 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
       lttvwindowtraces_unlock(trace_v);
     }
   }
-
 #if 0
   //set the cursor back to normal
   gdk_window_set_cursor(win, NULL);  
@@ -2259,6 +2238,8 @@ Tab *create_new_tab(GtkWidget* widget, gpointer user_data){
   strcpy(label,"Page");
   if(get_label(mw_data, label,"Get the name of the tab","Please input tab's name"))    
     return (create_tab (mw_data, copy_tab, notebook, label));
+  else
+    return NULL;
 }
 
 void
@@ -2362,7 +2343,7 @@ void
 on_quit_activate                       (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-  gtk_main_quit ();
+  mainwindow_quit();
 }
 
 
@@ -3199,7 +3180,7 @@ on_MWindow_destroy                     (GtkWidget       *widget,
 
   g_info("There are now : %d windows\n",g_slist_length(g_main_window_list));
   if(g_slist_length(g_main_window_list) == 0)
-    gtk_main_quit ();
+    mainwindow_quit();
 }
 
 gboolean    
@@ -3607,6 +3588,22 @@ void current_time_change_manager       (Tab *tab,
   tab->current_time_manager_lock = FALSE;
 }
 
+void current_position_change_manager(Tab *tab,
+                                     LttvTracesetContextPosition *pos)
+{
+  LttvTracesetContext *tsc =
+    LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+  TimeInterval time_span = tsc->time_span;
+
+  g_assert(lttv_process_traceset_seek_position(tsc, pos) == 0);
+  LttTime new_time = lttv_traceset_context_position_get_time(pos);
+  
+  current_time_change_manager(tab, new_time);
+  
+  set_current_position(tab, pos);
+}
+
+
 void
 on_MEntry5_value_changed               (GtkSpinButton *spinbutton,
                                         gpointer user_data)
@@ -3809,7 +3806,7 @@ char * get_selection(char ** loaded_module_name, int nb_module,
   }
 
   id = gtk_dialog_run(GTK_DIALOG(dialogue));
-  GtkTreeModel **store_model = (GtkTreeModel**)&store;  /* for strict aliasing */
+  GtkTreeModel **store_model = (GtkTreeModel**)&store;
   switch(id){
     case GTK_RESPONSE_ACCEPT:
     case GTK_RESPONSE_OK:
@@ -4185,6 +4182,10 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
   tab->viewer_container = gtk_vbox_new(TRUE, 2);
   tab->scrollbar = gtk_hscrollbar_new(NULL);
   //tab->multivpaned = gtk_multi_vpaned_new();
+  tab->time_window.start_time = ltt_time_zero;
+  tab->time_window.end_time = ltt_time_zero;
+  tab->time_window.time_width = ltt_time_zero;
+  tab->current_time = ltt_time_zero;
   
   gtk_box_pack_start(GTK_BOX(tab->vbox),
                      tab->viewer_container,
This page took 0.025787 seconds and 4 git commands to generate.