remove all _api functions and calls
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / callbacks.c
index 3dfaad147be9cb2979153c29f849b26c23edfe33..8a228fbab8b9b465d9fc5c69c3c3897031f87f24 100644 (file)
@@ -29,7 +29,7 @@
 #include <lttvwindow/mainwindow.h>
 #include <lttvwindow/menu.h>
 #include <lttvwindow/toolbar.h>
-#include <lttvwindow/gtktraceset.h>
+#include <lttvwindow/viewer.h>
 #include <lttv/module.h>
 #include <lttvwindow/gtkdirsel.h>
 #include <lttv/iattribute.h>
@@ -378,7 +378,7 @@ unsigned get_max_event_number(MainWindow * mw_data)
 
 
 /* redraw_viewer parses the traceset first by calling 
- * process_traceset_api, then display all viewers of 
+ * process_traceset, then display all viewers of 
  * the current tab
  */
 
@@ -388,6 +388,9 @@ void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window)
   GdkWindow * win;
   GdkCursor * new;
   GtkWidget* widget;
+  LttvTracesetContext *tsc = 
+   LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+                            traceset_context);
 
   //set the cursor to be X shape, indicating that the computer is busy in doing its job
   new = gdk_cursor_new(GDK_X_CURSOR);
@@ -403,7 +406,8 @@ void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window)
   
   max_nb_events = get_max_event_number(mw_data);
 
-  process_traceset_api(mw_data, time_window->start_time, 
+  lttv_process_traceset_seek_time(tsc, time_window->start_time);
+  lttv_process_traceset(tsc,
                       ltt_time_add(time_window->start_time,time_window->time_width),
                       max_nb_events);
 
@@ -504,9 +508,13 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       trace_v = lttv_trace_new(trace);
       traceset = mw_data->current_tab->traceset_info->traceset;
       if(mw_data->current_tab->traceset_info->traceset_context != NULL){
-       lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
-                                               traceset_info->traceset_context));
-       g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
+      //remove state update hooks
+      lttv_state_remove_event_hooks(
+           (LttvTracesetState*)mw_data->current_tab->traceset_info->
+                                traceset_context);
+       lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
+                                               traceset_info->traceset_context));
+       g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
       }
       lttv_traceset_add(traceset, trace_v);
       mw_data->current_tab->traceset_info->traceset_context =
@@ -514,6 +522,11 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       lttv_context_init(
        LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->
                              traceset_context),traceset); 
+      //add state update hooks
+      lttv_state_add_event_hooks(
+      (LttvTracesetState*)mw_data->current_tab->traceset_info->traceset_context);
+  
       add_trace_into_traceset_selector(mw_data->current_tab->multi_vpaned, trace);
 
       gtk_widget_destroy((GtkWidget*)file_selector);
@@ -636,6 +649,10 @@ void remove_trace(GtkWidget * widget, gpointer user_data)
            ltt_trace_close(lttv_trace(trace_v));
 
          if(mw_data->current_tab->traceset_info->traceset_context != NULL){
+      //remove state update hooks
+      lttv_state_remove_event_hooks(
+           (LttvTracesetState*)mw_data->current_tab->traceset_info->
+                                traceset_context);
            lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
                                                    traceset_info->traceset_context));
            g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
@@ -645,9 +662,12 @@ void remove_trace(GtkWidget * widget, gpointer user_data)
             lttv_trace_destroy(trace_v);
          mw_data->current_tab->traceset_info->traceset_context =
            g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
-         lttv_context_init(
+           lttv_context_init(
                            LTTV_TRACESET_CONTEXT(mw_data->current_tab->
                                      traceset_info->traceset_context),traceset);      
+      //add state update hooks
+      lttv_state_add_event_hooks(
+      (LttvTracesetState*)mw_data->current_tab->traceset_info->traceset_context);
          //update current tab
          update_traceset(mw_data);
          if(nb_trace > 1){
@@ -1862,6 +1882,10 @@ void tab_destructor(Tab * tab_instance)
   }
 
   if(tab_instance->traceset_info->traceset_context != NULL){
+    //remove state update hooks
+    lttv_state_remove_event_hooks(
+         (LttvTracesetState*)tab_instance->traceset_info->
+                              traceset_context);
     lttv_context_fini(LTTV_TRACESET_CONTEXT(tab_instance->traceset_info->
                                            traceset_context));
     g_object_unref(tab_instance->traceset_info->traceset_context);
@@ -1929,7 +1953,11 @@ void * create_tab(MainWindow * parent, MainWindow* current_window,
   lttv_context_init(
            LTTV_TRACESET_CONTEXT(tmp_tab->traceset_info->traceset_context),
                                  tmp_tab->traceset_info->traceset);
-
+  //add state update hooks
+  lttv_state_add_event_hooks(
+       (LttvTracesetState*)tmp_tab->traceset_info->traceset_context);
+  
   //determine the current_time and time_window of the tab
   if(mw_data->current_tab){
     // Will have to read directly at the main window level, as we want
@@ -1972,11 +2000,7 @@ void * create_tab(MainWindow * parent, MainWindow* current_window,
           tmp_tab,
           (GDestroyNotify)tab_destructor);
 
-  //add state update hooks
-  lttv_state_add_event_hooks(
-       (LttvTracesetState*)tmp_tab->traceset_info->traceset_context);
-  
-  //insert tab into notebook
+ //insert tab into notebook
   gtk_notebook_append_page(notebook, (GtkWidget*)tmp_tab->multi_vpaned, tmp_tab->label);  
   list = gtk_container_get_children(GTK_CONTAINER(notebook));
   gtk_notebook_set_current_page(notebook,g_list_length(list)-1);
This page took 0.025479 seconds and 4 git commands to generate.