git-svn-id: http://ltt.polymtl.ca/svn@489 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / module.c
CommitLineData
ce0214a6 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19
20
f0d936c0 21/*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */
22/*\@{*/
23
24/*! \file guiControlFlow.c
25 * \brief Graphical plugin for showing control flow of a trace.
26 *
27 * This plugin adds a Control Flow Viewer functionnality to Linux TraceToolkit
28 * GUI when this plugin is loaded. The init and destroy functions add the
29 * viewer's insertion menu item and toolbar icon by calling gtkTraceSet's
30 * API functions. Then, when a viewer's object is created, the constructor
31 * creates ans register through API functions what is needed to interact
32 * with the TraceSet window.
33 *
34 * This plugin uses the gdk library to draw the events and gtk to interact
35 * with the user.
36 *
37 * Author : Mathieu Desnoyers, June 2003
38 */
39
189a5d08 40#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
41#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
42
558aa013 43#include <glib.h>
f0d936c0 44#include <gmodule.h>
45#include <lttv/module.h>
cef97e7c 46#include <lttv/gtktraceset.h>
558aa013 47
d66666fe 48#include "cfv.h"
49#include "eventhooks.h"
558aa013 50
d66666fe 51#include "../icons/hGuiControlFlowInsert.xpm"
558aa013 52
ae4e77e0 53static LttvModule *Main_Win_Module;
558aa013 54
55
56/** Array containing instanced objects. Used when module is unloaded */
68997a22 57GSList *g_control_flow_data_list = NULL ;
558aa013 58
59
f0d936c0 60
f0d936c0 61
62/*****************************************************************************
63 * Functions for module loading/unloading *
64 *****************************************************************************/
65/**
66 * plugin's init function
67 *
68 * This function initializes the Control Flow Viewer functionnality through the
69 * gtkTraceSet API.
70 */
558aa013 71G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
72
a56a1ba4 73 Main_Win_Module = lttv_module_require(self, "mainwin", argc, argv);
74
75 if(Main_Win_Module == NULL)
76 {
77 g_critical("Can't load Control Flow Viewer : missing mainwin\n");
78 return;
79 }
80
81 g_info("GUI ControlFlow Viewer init()");
82
83 /* Register the toolbar insert button */
84 toolbar_item_reg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer",
85 h_guicontrolflow);
86
87 /* Register the menu item insert entry */
88 menu_item_reg("/", "Insert Control Flow Viewer", h_guicontrolflow);
89
f0d936c0 90}
91
92void destroy_walk(gpointer data, gpointer user_data)
93{
a56a1ba4 94 g_info("Walk destroy GUI Control Flow Viewer");
95 guicontrolflow_destructor_full((ControlFlowData*)data);
f0d936c0 96}
97
98
99
100/**
101 * plugin's destroy function
102 *
103 * This function releases the memory reserved by the module and unregisters
104 * everything that has been registered in the gtkTraceSet API.
105 */
106G_MODULE_EXPORT void destroy() {
a56a1ba4 107 g_info("GUI Control Flow Viewer destroy()");
108 int i;
f0d936c0 109
68997a22 110 g_slist_foreach(g_control_flow_data_list, destroy_walk, NULL );
a56a1ba4 111
68997a22 112 g_slist_free(g_control_flow_data_list);
f7afe191 113
a56a1ba4 114 /* Unregister the toolbar insert button */
115 toolbar_item_unreg(h_guicontrolflow);
f0d936c0 116
a56a1ba4 117 /* Unregister the menu item insert entry */
118 menu_item_unreg(h_guicontrolflow);
119
558aa013 120}
This page took 0.029484 seconds and 4 git commands to generate.