- //remove state and stats hooks
- //state_remove_event_hooks_api(statistic_viewer_data->mw); //it will be done in the main window
- stats_remove_event_hooks_api(statistic_viewer_data->mw);
+ lttv_stats_remove_event_hooks(LTTV_TRACESET_STATS(tsc));
+}
+#endif //0
+
+/**
+ * plugin's init function
+ *
+ * This function initializes the Statistic Viewer functionnality through the
+ * gtkTraceSet API.
+ */
+static void init() {
+
+ lttvwindow_register_constructor("guistatistics",
+ "/",
+ "Insert Statistic Viewer",
+ hGuiStatisticInsert_xpm,
+ "Insert Statistic Viewer",
+ h_gui_statistic);
+}
+
+void statistic_destroy_walk(gpointer data, gpointer user_data)
+{
+ StatisticViewerData *svd = (StatisticViewerData*)data;
+
+ g_debug("CFV.c : statistic_destroy_walk, %p", svd);
+ /* May already have been done by GTK window closing */
+ if(GTK_IS_WIDGET(guistatistic_get_widget(svd)))
+ gtk_widget_destroy(guistatistic_get_widget(svd));
+}
+
+/**
+ * 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() {
+
+ g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL );
+ g_slist_free(g_statistic_viewer_data_list);
+
+ lttvwindow_unregister_constructor(h_gui_statistic);
+