From 17abcce324e1dc3d093fb3b70227ca7357ec8eb9 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 4 Jun 2003 20:33:07 +0000 Subject: [PATCH] init/destroy (begin) git-svn-id: http://ltt.polymtl.ca/svn@87 04897980-b3bd-0310-b5e0-8ef037075253 --- .../poly/lttv/plugins/guiControlFlow.c | 85 +++++++++++++++++++ ltt/branches/poly/lttv/plugins/guiEvents.c | 22 +---- 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/ltt/branches/poly/lttv/plugins/guiControlFlow.c b/ltt/branches/poly/lttv/plugins/guiControlFlow.c index e69de29b..5f28e98c 100644 --- a/ltt/branches/poly/lttv/plugins/guiControlFlow.c +++ b/ltt/branches/poly/lttv/plugins/guiControlFlow.c @@ -0,0 +1,85 @@ +/*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */ +/*\@{*/ + +/*! \file guiControlFlow.c + * \brief Graphical plugin for showing control flow of a trace. + * + * 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 + * 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. + * + * This plugin uses the gdk library to draw the events and gtk to interact + * with the user. + * + * Author : Mathieu Desnoyers, June 2003 + */ + +#include +#include +#include +#include + +#include + +#include "guiControlFlow.h" +#include "icons/guiControlFlowInsert.xpm" + +//! Event Viewer's constructor +GtkWidget *guiControlFlow(GtkWidget *ParentWindow); + +/** + * plugin's init function + * + * This function initializes the Control Flow Viewer functionnality through the + * gtkTraceSet API. + */ +G_MODULE_EXPORT void init() { + g_critical("GUI ControlFlow Viewer init()"); + + /* Register the toolbar insert button */ + ToolbarItemReg(guiEventsInsert_xpm, "Insert Control Flow Viewer", guiEvent); + + /* Register the menu item insert entry */ + MenuItemReg("/", "Insert Control Flow Viewer", guiEvent); + +} + +/** + * 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() { + g_critical("GUI Control Flow Viewer destroy()"); + + /* Unregister the toolbar insert button */ + ToolbarItemUnreg(guiEvent); + + /* Unregister the menu item insert entry */ + MenuItemUnreg(guiEvents); +} + +/** + * Control Flow Viewer's constructor + * + * This constructor is given as a parameter to the menuitem and toolbar button + * registration. It creates the drawing widget. + * @param ParentWindow A pointer to the parent window. + * @return The widget created. + */ +static GtkWidget * +guiEvents(GtkWidget *ParentWindow) +{ + GtkWidget *drawing_area = gtk_drawing_area_new (); + + g_signal_connect (G_OBJECT (drawing_area), "expose_event", + G_CALLBACK (expose_event_callback), NULL); +} + + + +/*\@}*/ diff --git a/ltt/branches/poly/lttv/plugins/guiEvents.c b/ltt/branches/poly/lttv/plugins/guiEvents.c index bc26092b..5efe8a95 100644 --- a/ltt/branches/poly/lttv/plugins/guiEvents.c +++ b/ltt/branches/poly/lttv/plugins/guiEvents.c @@ -4,6 +4,9 @@ /*! \file guiEvents.c * \brief Graphical plugin for showing events. * + * This plugin lists all the events contained in the current time interval + * in a list. + * * 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 @@ -11,9 +14,6 @@ * creates ans register through API functions what is needed to interact * with the TraceSet window. * - * This plugin uses the gdk library to draw the events and gtk to interact - * with the user. - * * Author : Mathieu Desnoyers, June 2003 */ @@ -24,16 +24,11 @@ #include -#include "guiEvents.h" #include "icons/guiEventsInsert.xpm" //! Event Viewer's constructor GtkWidget *guiEvents(GtkWidget *ParentWindow); -//! Callback functions -gboolean -expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data); - /** * plugin's init function * @@ -77,20 +72,11 @@ G_MODULE_EXPORT void destroy() { */ static GtkWidget * guiEvents(GtkWidget *ParentWindow) -{ - GtkWidget *drawing_area = gtk_drawing_area_new (); - - g_signal_connect (G_OBJECT (drawing_area), "expose_event", - G_CALLBACK (expose_event_callback), NULL); -} - - -gboolean -expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data) { } + /*\@}*/ -- 2.34.1