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_guifilter(Tab
*tab
);
42 void statistic_destroy_walk(gpointer data
, gpointer user_data
);
44 struct _FilterViewerData
{
47 // temp widget -- still thinking about a formal structure
50 GtkWidget
*f_selectwnd
;
56 *guifilter_get_widget(FilterViewerData
*fvd
)
62 * Statistic Viewer's constructor
64 * This constructor is used to create StatisticViewerData data structure.
65 * @return The Statistic viewer data created.
70 GtkCellRenderer
*renderer
;
71 GtkTreeViewColumn
*column
;
73 FilterViewerData
* fvd
= g_new(FilterViewerData
,1);
77 lttvwindow_register_traceset_notify(fvd
->tab
,
78 filter_traceset_changed
,
80 // request_background_data(filter_viewer_data);
82 fvd
->f_textwnd
= gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL);
83 gtk_entry_set_text(fvd
->f_textwnd
,"this is a test");
84 gtk_widget_show (fvd
->f_textwnd
);
86 fvd
->hbox
= gtk_hbox_new(0, 0);
87 gtk_box_pack_start(GTK_BOX(fvd
->hbox
), fvd
->f_textwnd
, TRUE
, TRUE
, 0);
89 gtk_widget_show(fvd
->hbox
);
91 g_object_set_data_full(
92 G_OBJECT(guifilter_get_widget(fvd
)),
95 (GDestroyNotify
)gui_filter_destructor
);
101 gui_filter_destructor(FilterViewerData
*fvd
)
105 /* May already been done by GTK window closing */
106 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
))){
107 g_info("widget still exists");
110 lttvwindow_unregister_traceset_notify(fvd
->tab
,
111 filter_traceset_changed
,
114 lttvwindowtraces_background_notify_remove(fvd
);
120 filter_traceset_changed(void * hook_data
, void * call_data
) {
126 filter_viewer_data(void * hook_data
, void * call_data
) {
132 * Filter Module's constructor hook
134 * This constructor is given as a parameter to the menuitem and toolbar button
135 * registration. It creates the list.
136 * @param parent_window A pointer to the parent window.
137 * @return The widget created.
140 h_guifilter(Tab
*tab
)
142 FilterViewerData
* f
= gui_filter(tab
) ;
144 g_print("FilterViewerData:%p\n",f
);
146 return guifilter_get_widget(f
);
154 * plugin's init function
156 * This function initializes the Statistic Viewer functionnality through the
161 lttvwindow_register_constructor("guifilter",
163 "Insert Filter Module",
164 hGuiFilterInsert_xpm
,
165 "Insert Filter Module",
169 void filter_destroy_walk(gpointer data
, gpointer user_data
)
171 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
173 g_debug("CFV.c : statistic_destroy_walk, %p", fvd
);
174 /* May already have been done by GTK window closing */
175 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
)))
176 gtk_widget_destroy(guifilter_get_widget(fvd
));
180 * plugin's destroy function
182 * This function releases the memory reserved by the module and unregisters
183 * everything that has been registered in the gtkTraceSet API.
185 static void destroy() {
187 lttvwindow_unregister_constructor(h_guifilter
);
192 LTTV_MODULE("guifilter", "Filter window", \
193 "Graphical module that let user specify their filtering options", \
194 init
, destroy
, "lttvwindow")