1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Simon Bouvier-Zappa
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;
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.
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,
24 #include <lttv/lttv.h>
25 #include <lttv/module.h>
26 #include <lttv/hook.h>
27 #include <lttv/filter.h>
29 #include <lttvwindow/lttvwindow.h>
30 #include <lttvwindow/lttvwindowtraces.h>
32 #include "hGuiFilterInsert.xpm"
34 typedef struct _FilterViewerData FilterViewerData
;
36 GtkWidget
*guifilter_get_widget(FilterViewerData
*fvd
);
37 FilterViewerData
*gui_filter(Tab
*tab
);
38 void gui_filter_destructor(FilterViewerData
*fvd
);
39 gboolean
filter_traceset_changed(void * hook_data
, void * call_data
);
40 gboolean
filter_viewer_data(void * hook_data
, void * call_data
);
41 GtkWidget
* h_gui_filter(Tab
*tab
);
42 void statistic_destroy_walk(gpointer data
, gpointer user_data
);
44 struct _FilterViewerData
{
47 // temp widget -- still thinking about a formal structure
48 GtkWidget
*vcontainer
;
53 *guifilter_get_widget(FilterViewerData
*fvd
)
59 * Statistic Viewer's constructor
61 * This constructor is used to create StatisticViewerData data structure.
62 * @return The Statistic viewer data created.
67 GtkCellRenderer
*renderer
;
68 GtkTreeViewColumn
*column
;
70 FilterViewerData
* fvd
= g_new(FilterViewerData
,1);
74 lttvwindow_register_traceset_notify(fvd
->tab
,
75 filter_traceset_changed
,
77 // request_background_data(filter_viewer_data);
79 /* Initialize the vertical container */
81 fvd
->window
= gtk_drawing_area_new();
83 gtk_widget_set_size_request(fvd
->window
,200,200);
85 fvd
->vcontainer
= gtk_vbox_new (FALSE
, 1);
86 gtk_container_set_border_width (GTK_CONTAINER (fvd
->vcontainer
), 1);
87 gtk_container_add (GTK_CONTAINER (fvd
->window
), fvd
->vcontainer
);
89 gtk_box_pack_start (GTK_BOX (fvd
->vcontainer
), fvd
->window
, TRUE
, TRUE
, 0);
91 // gtk_widget_show(fvd->window);
93 g_object_set_data_full(
94 G_OBJECT(guifilter_get_widget(fvd
)),
97 (GDestroyNotify
)gui_filter_destructor
);
103 gui_filter_destructor(FilterViewerData
*fvd
)
107 /* May already been done by GTK window closing */
108 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
))){
109 g_info("widget still exists");
112 lttvwindow_unregister_traceset_notify(fvd
->tab
,
113 filter_traceset_changed
,
116 lttvwindowtraces_background_notify_remove(fvd
);
122 filter_traceset_changed(void * hook_data
, void * call_data
) {
128 filter_viewer_data(void * hook_data
, void * call_data
) {
134 * Filter Module's constructor hook
136 * This constructor is given as a parameter to the menuitem and toolbar button
137 * registration. It creates the list.
138 * @param parent_window A pointer to the parent window.
139 * @return The widget created.
142 h_gui_filter(Tab
*tab
)
144 FilterViewerData
* f
= gui_filter(tab
) ;
147 return guifilter_get_widget(f
);
155 * plugin's init function
157 * This function initializes the Statistic Viewer functionnality through the
162 lttvwindow_register_constructor("guifilter",
164 "Insert Filter Module",
165 hGuiFilterInsert_xpm
,
166 "Insert Filter Module",
170 void filter_destroy_walk(gpointer data
, gpointer user_data
)
172 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
174 g_debug("CFV.c : statistic_destroy_walk, %p", fvd
);
175 /* May already have been done by GTK window closing */
176 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
)))
177 gtk_widget_destroy(guifilter_get_widget(fvd
));
181 * plugin's destroy function
183 * This function releases the memory reserved by the module and unregisters
184 * everything that has been registered in the gtkTraceSet API.
186 static void destroy() {
188 lttvwindow_unregister_constructor(h_gui_filter
);
193 LTTV_MODULE("guifilter", "Filter window", \
194 "Graphical module that let user specify their filtering options", \
195 init
, destroy
, "lttvwindow")