viewer.h API functions name change, second commit : breaks compilation
[lttv.git] / ltt / branches / poly / lttv / modules / gui / detailedevents / events.c
index 17cc9321c5255f45f969668d3e270801245fc1cc..1b6c422530b230739476c8b9f4171d218c911075 100644 (file)
@@ -28,7 +28,7 @@
  * 
  * This plugin adds a Events Viewer functionnality to Linux TraceToolkit
  * GUI when this plugin is loaded. The init and destroy functions add the
- * viewer's insertion menu item and toolbar icon by calling gtkTraceSet's
+ * viewer's insertion menu item and toolbar icon by calling viewer.h's
  * API functions. Then, when a viewer's object is created, the constructor
  * creates ans register through API functions what is needed to interact
  * with the TraceSet window.
 #include <math.h>
 
 #include <glib.h>
-#include <gmodule.h>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
 #include <lttv/module.h>
 #include <lttv/hook.h>
-#include <lttv/gtktraceset.h>
-#include <lttv/processTrace.h>
+#include <lttvwindow/viewer.h>
+#include <lttv/tracecontext.h>
 #include <lttv/state.h>
 #include <ltt/ltt.h>
 #include <ltt/event.h>
 #include <ltt/facility.h>
 #include <string.h>
 
-//#include "mw_api.h"
 #include "gtktreeprivate.h"
 
-#include "../icons/hGuiEventsInsert.xpm"
+#include "hGuiEventsInsert.xpm"
 
 
 static LttvHooks  *before_event;
@@ -187,57 +185,6 @@ static gboolean parse_event(void *hook_data, void *call_data);
 
 static LttvModule *main_win_module;
 
-/**
- * plugin's init function
- *
- * This function initializes the Event Viewer functionnality through the
- * gtkTraceSet API.
- */
-G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
-
-  main_win_module = lttv_module_require(self, "mainwin", argc, argv);
-  
-  if(main_win_module == NULL){
-    g_critical("Can't load Control Flow Viewer : missing mainwin\n");
-    return;
-  }
-  
-  /* Register the toolbar insert button */
-  toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
-  
-  /* Register the menu item insert entry */
-  menu_item_reg("/", "Insert Event Viewer", h_gui_events);
-  
-}
-
-void event_destroy_walk(gpointer data, gpointer user_data)
-{
-  gui_events_destructor((EventViewerData*)data);
-}
-
-/**
- * plugin's destroy function
- *
- * This function releases the memory reserved by the module and unregisters
- * everything that has been registered in the gtkTraceSet API.
- */
-G_MODULE_EXPORT void destroy() {
-  int i;
-  
-  EventViewerData *event_viewer_data;
-  
-  if(g_event_viewer_data_list){
-    g_slist_foreach(g_event_viewer_data_list, event_destroy_walk, NULL );
-    g_slist_free(g_event_viewer_data_list);
-  }
-
-  /* Unregister the toolbar insert button */
-  toolbar_item_unreg(h_gui_events);
-  
-  /* Unregister the menu item insert entry */
-  menu_item_unreg(h_gui_events);
-}
-
 /* Enumeration of the columns */
 enum
 {
@@ -1335,7 +1282,7 @@ void add_context_hooks(EventViewerData * event_viewer_data,
   }
   
   //add hooks for process_traceset
-  //    context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //    lttv_traceset_context_add_hooks(tsc, NULL, NULL, NULL, NULL, NULL, NULL,
   //        NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);  
 }
 
@@ -1402,7 +1349,7 @@ void remove_context_hooks(EventViewerData * event_viewer_data,
     }
   }
   //remove hooks from context
-  //    context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //    lttv_traceset_context_remove_hooks(tsc, NULL, NULL, NULL, NULL, NULL, NULL,
   //           NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
 }
 
@@ -1671,15 +1618,12 @@ void get_events(EventViewerData* event_viewer_data, LttTime start,
   int size;
   LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
 
-  //  context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-  //      NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
   add_context_hooks(event_viewer_data,tsc);
 
-  process_traceset_api(event_viewer_data->mw, start, end, max_num_events);
+  lttv_process_traceset_seek_time(tsc, start);
+  lttv_process_traceset(tsc, end, max_num_events);
 
   remove_context_hooks(event_viewer_data,tsc);
-  //  context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-  //         NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
 
   size = event_viewer_data->raw_trace_data_queue_tmp->length;
   *real_num_events = size;
@@ -1888,3 +1832,51 @@ void remove_all_items_from_queue(GQueue *q)
 }
 
 
+/**
+ * plugin's init function
+ *
+ * This function initializes the Event Viewer functionnality through the
+ * gtkTraceSet API.
+ */
+static void init() {
+
+  /* Register the toolbar insert button */
+  toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
+  
+  /* Register the menu item insert entry */
+  menu_item_reg("/", "Insert Event Viewer", h_gui_events);
+  
+}
+
+void event_destroy_walk(gpointer data, gpointer user_data)
+{
+  gui_events_destructor((EventViewerData*)data);
+}
+
+/**
+ * plugin's destroy function
+ *
+ * This function releases the memory reserved by the module and unregisters
+ * everything that has been registered in the gtkTraceSet API.
+ */
+static void destroy() {
+  int i;
+  
+  EventViewerData *event_viewer_data;
+  
+  if(g_event_viewer_data_list){
+    g_slist_foreach(g_event_viewer_data_list, event_destroy_walk, NULL );
+    g_slist_free(g_event_viewer_data_list);
+  }
+
+  /* Unregister the toolbar insert button */
+  toolbar_item_unreg(h_gui_events);
+  
+  /* Unregister the menu item insert entry */
+  menu_item_unreg(h_gui_events);
+}
+
+
+LTTV_MODULE("guievents", "Detailed events view", \
+    "Graphical module to display a detailed event list", \
+           init, destroy, "lttvwindow")
This page took 0.041889 seconds and 4 git commands to generate.