X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fmodule.c;h=14311efed2a552661b6eb7dd1cee0e5afeb1d8a7;hb=6cec4cd266bde25f87dad0a059fd98c7381eb8c2;hp=67bf7ccad8c7d7e885d0f0d69320dd2252ee65a3;hpb=cef97e7c926bfe509b0b58d9c38bab60d30c81f8;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c index 67bf7cca..14311efe 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c @@ -26,7 +26,7 @@ * * This plugin adds a Control Flow 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. @@ -37,27 +37,27 @@ * Author : Mathieu Desnoyers, June 2003 */ -#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) -#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) +#ifdef HAVE_CONFIG_H +#include +#endif #include -#include +#include #include -#include +#include #include "cfv.h" #include "eventhooks.h" -#include "../icons/hGuiControlFlowInsert.xpm" - -static LttvModule *Main_Win_Module; +#include "hGuiControlFlowInsert.xpm" +#include "hLegendInsert.xpm" +GQuark LTT_NAME_CPU; /** Array containing instanced objects. Used when module is unloaded */ GSList *g_control_flow_data_list = NULL ; - - +GSList *g_legend_list = NULL ; /***************************************************************************** * Functions for module loading/unloading * @@ -68,25 +68,27 @@ GSList *g_control_flow_data_list = NULL ; * This function initializes the Control Flow Viewer functionnality through the * gtkTraceSet API. */ -G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { +static void init() { - 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; - } - g_info("GUI ControlFlow Viewer init()"); - /* Register the toolbar insert button */ - toolbar_item_reg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer", - h_guicontrolflow); - - /* Register the menu item insert entry */ - menu_item_reg("/", "Insert Control Flow Viewer", h_guicontrolflow); + /* Register the toolbar insert button and menu entry*/ + lttvwindow_register_constructor("guicontrolflow", + "/", + "Insert Control Flow Viewer", + hGuiControlFlowInsert_xpm, + "Insert Control Flow Viewer", + h_guicontrolflow); + lttvwindow_register_constructor("guicontrolflowlegend", + "/", + "Popup Control Flow Viewer Legend", + hLegendInsert_xpm, + "Popup Control Flow Viewer Legend", + h_legend); + + + LTT_NAME_CPU = g_quark_from_string("/cpu"); } void destroy_walk(gpointer data, gpointer user_data) @@ -95,6 +97,12 @@ void destroy_walk(gpointer data, gpointer user_data) guicontrolflow_destructor_full((ControlFlowData*)data); } +void destroy_legend_walk(gpointer data, gpointer user_data) +{ + g_info("Walk destroy GUI Control Flow Viewer"); + legend_destructor((GtkWindow*)data); +} + /** @@ -103,18 +111,23 @@ void destroy_walk(gpointer data, gpointer user_data) * 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() { +static void destroy() { g_info("GUI Control Flow Viewer destroy()"); - int i; g_slist_foreach(g_control_flow_data_list, destroy_walk, NULL ); g_slist_free(g_control_flow_data_list); - /* Unregister the toolbar insert button */ - toolbar_item_unreg(h_guicontrolflow); - - /* Unregister the menu item insert entry */ - menu_item_unreg(h_guicontrolflow); + g_slist_foreach(g_legend_list, destroy_legend_walk, NULL ); + g_slist_free(g_control_flow_data_list); + + /* Unregister the toolbar insert button and menu entry */ + lttvwindow_unregister_constructor(h_guicontrolflow); + lttvwindow_unregister_constructor(h_legend); } + + +LTTV_MODULE("guicontrolflow", "Control flow viewer", \ + "Graphical module to view processes state and control flow", \ + init, destroy, "lttvwindow")