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"
36 * - connect the gui filter to the core filter
41 * The version of gtk-2.0 currently installed on
42 * my desktop misses some function of the newer
45 * For the time being, I'll use the older api
46 * to keep compatibility with most systems.
49 typedef struct _FilterViewerData FilterViewerData
;
50 typedef struct _FilterViewerDataLine FilterViewerDataLine
;
55 GtkWidget
*guifilter_get_widget(FilterViewerData
*fvd
);
56 FilterViewerData
*gui_filter(Tab
*tab
);
57 void gui_filter_destructor(FilterViewerData
*fvd
);
58 FilterViewerDataLine
* gui_filter_add_line(FilterViewerData
*fvd
);
59 void gui_filter_line_set_visible(FilterViewerDataLine
*fvdl
, gboolean v
);
60 void gui_filter_line_reset(FilterViewerDataLine
*fvdl
);
61 gboolean
filter_traceset_changed(void * hook_data
, void * call_data
);
62 gboolean
filter_viewer_data(void * hook_data
, void * call_data
);
63 GtkWidget
* h_guifilter(Tab
*tab
);
64 void filter_destroy_walk(gpointer data
, gpointer user_data
);
69 void callback_process_button(GtkWidget
*widget
, gpointer data
);
70 void callback_add_button(GtkWidget
*widget
, gpointer data
);
71 void callback_logical_op_box(GtkWidget
*widget
, gpointer data
);
72 void callback_expression_field(GtkWidget
*widget
, gpointer data
);
74 struct _FilterViewerDataLine
{
77 GtkWidget
*f_not_op_box
;
78 GtkWidget
*f_logical_op_box
;
79 GtkWidget
*f_field_box
;
80 GtkWidget
*f_math_op_box
;
81 GtkWidget
*f_value_field
;
85 * @struct _FilterViewerData
86 * Main struct for the filter gui module
88 struct _FilterViewerData
{
91 GtkWidget
*f_main_box
;
96 GtkWidget
*f_expression_field
;
97 GtkWidget
*f_process_button
;
99 GtkWidget
*f_logical_op_junction_box
;
104 GPtrArray
*f_not_op_options
;
105 GPtrArray
*f_logical_op_options
;
106 GPtrArray
*f_field_options
;
107 GPtrArray
*f_math_op_options
;
109 GtkWidget
*f_add_button
;
111 GtkWidget
*f_textwnd
;
112 GtkWidget
*f_selectwnd
;
113 GtkWidget
*f_treewnd
;
118 * This function returns the current main widget
119 * used by this module
120 * @param fvd the module struct
121 * @return The main widget
124 *guifilter_get_widget(FilterViewerData
*fvd
)
126 return fvd
->f_main_box
;
130 * Constructor is used to create FilterViewerData data structure.
131 * @param the tab structure used by the widget
132 * @return The Filter viewer data created.
137 g_print("filter::gui_filter()");
140 GtkCellRenderer
*renderer
;
141 GtkTreeViewColumn
*column
;
143 FilterViewerData
* fvd
= g_new(FilterViewerData
,1);
147 lttvwindow_register_traceset_notify(fvd
->tab
,
148 filter_traceset_changed
,
150 // request_background_data(filter_viewer_data);
153 * Initiating items for
156 fvd
->f_not_op_options
= g_ptr_array_new();
157 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new(""));
158 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new("!"));
160 fvd
->f_logical_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,sizeof(gchar));
161 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new(""));
162 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("&"));
163 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("|"));
164 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("!"));
165 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("^"));
167 fvd
->f_field_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,16);
168 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new(""));
169 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.name"));
170 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.category"));
171 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.time"));
172 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.tsc"));
174 * TODO: Add core.xml fields here !
176 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("tracefile.name"));
177 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("trace.name"));
178 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.pid"));
179 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.ppid"));
180 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.creation_time"));
181 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.insertion_time"));
182 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_mode"));
183 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_submode"));
184 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.process_status"));
185 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.cpu"));
187 fvd
->f_math_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,7);
188 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(""));
189 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("="));
190 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("!="));
191 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<"));
192 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<="));
193 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">"));
194 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">="));
198 * Initiating GtkTable layout
199 * starts with 2 rows and 5 columns and
200 * expands when expressions added
202 fvd
->f_main_box
= gtk_table_new(3,7,FALSE
);
203 gtk_table_set_row_spacings(GTK_TABLE(fvd
->f_main_box
),5);
204 gtk_table_set_col_spacings(GTK_TABLE(fvd
->f_main_box
),5);
207 * First half of the filter window
208 * - textual entry of filter expression
209 * - processing button
211 fvd
->f_expression_field
= gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL);
212 // gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),"state.cpu>0");
213 gtk_widget_show (fvd
->f_expression_field
);
215 g_signal_connect (G_OBJECT (fvd
->f_expression_field
), "changed",
216 G_CALLBACK (callback_expression_field
), (gpointer
) fvd
);
218 fvd
->f_process_button
= gtk_button_new_with_label("Process");
219 gtk_widget_show (fvd
->f_process_button
);
221 g_signal_connect (G_OBJECT (fvd
->f_process_button
), "clicked",
222 G_CALLBACK (callback_process_button
), (gpointer
) fvd
);
224 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_expression_field
,0,6,0,1,GTK_FILL
,GTK_FILL
,0,0);
225 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_process_button
,6,7,0,1,GTK_FILL
,GTK_FILL
,0,0);
230 * Second half of the filter window
231 * - combo boxes featuring filtering options added to the expression
233 fvd
->f_add_button
= gtk_button_new_with_label("Add Expression");
234 gtk_widget_show (fvd
->f_add_button
);
236 g_signal_connect (G_OBJECT (fvd
->f_add_button
), "clicked",
237 G_CALLBACK (callback_add_button
), (gpointer
) fvd
);
239 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_add_button
,6,7,1,2,GTK_FILL
,GTK_FILL
,0,0);
241 fvd
->f_logical_op_junction_box
= gtk_combo_box_new_text();
242 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
243 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
244 gtk_combo_box_append_text(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
), s
->str
);
246 gtk_combo_box_set_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
),0);
248 //gtk_widget_show(fvd->f_logical_op_box);
250 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_logical_op_junction_box
,0,1,1,2,GTK_SHRINK
,GTK_FILL
,0,0);
252 /* initialize a new line */
253 fvd
->f_lines
= g_ptr_array_new();
255 FilterViewerDataLine
* fvdl
= gui_filter_add_line(fvd
);
256 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl
);
259 * show main container
261 gtk_widget_show(fvd
->f_main_box
);
264 g_object_set_data_full(
265 G_OBJECT(guifilter_get_widget(fvd
)),
266 "filter_viewer_data",
268 (GDestroyNotify
)gui_filter_destructor
);
275 * Adds a filter option line on the module tab
276 * @param fvd The filter module structure
277 * @return The line structure
279 FilterViewerDataLine
*
280 gui_filter_add_line(FilterViewerData
* fvd
) {
282 FilterViewerDataLine
* fvdl
= g_new(FilterViewerDataLine
,1);
285 fvdl
->row
= fvd
->rows
;
286 fvdl
->visible
= TRUE
;
289 fvdl->f_struct_box = gtk_combo_box_new_text();
290 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_struct_box), "");
291 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_struct_box), "event");
292 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_struct_box), "tracefile");
293 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_struct_box), "trace");
294 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_struct_box), "state");
295 gtk_widget_show(fvdl->f_struct_box);
297 fvdl->f_subfield_box = gtk_combo_box_new_text();
298 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "");
299 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "name");
300 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "category");
301 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "time");
302 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "tsc");
303 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "pid");
304 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "ppid");
305 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "creation time");
306 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "insertion time");
307 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "process name");
308 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "execution mode");
309 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "execution submode");
310 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "process status");
311 gtk_combo_box_append_text (GTK_COMBO_BOX (fvdl->f_subfield_box), "cpu");
312 gtk_widget_show(fvdl->f_subfield_box);
315 fvdl
->f_not_op_box
= gtk_combo_box_new_text();
316 for(i
=0;i
<fvd
->f_not_op_options
->len
;i
++) {
317 GString
* s
= g_ptr_array_index(fvd
->f_not_op_options
,i
);
318 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_not_op_box
), s
->str
);
321 fvdl
->f_field_box
= gtk_combo_box_new_text();
322 for(i
=0;i
<fvd
->f_field_options
->len
;i
++) {
323 GString
* s
= g_ptr_array_index(fvd
->f_field_options
,i
);
324 // g_print("String field: %s\n",s->str);
325 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_field_box
), s
->str
);
328 fvdl
->f_math_op_box
= gtk_combo_box_new_text();
329 for(i
=0;i
<fvd
->f_math_op_options
->len
;i
++) {
330 GString
* s
= g_ptr_array_index(fvd
->f_math_op_options
,i
);
331 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_math_op_box
), s
->str
);
334 fvdl
->f_value_field
= gtk_entry_new();
336 fvdl
->f_logical_op_box
= gtk_combo_box_new_text();
337 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
338 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
339 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_logical_op_box
), s
->str
);
341 gtk_widget_set_events(fvdl
->f_logical_op_box
,
342 GDK_ENTER_NOTIFY_MASK
|
343 GDK_LEAVE_NOTIFY_MASK
|
344 GDK_FOCUS_CHANGE_MASK
);
346 g_signal_connect (G_OBJECT (fvdl
->f_logical_op_box
), "changed",
347 G_CALLBACK (callback_logical_op_box
), (gpointer
) fvd
);
349 gui_filter_line_reset(fvdl
);
350 gui_filter_line_set_visible(fvdl
,TRUE
);
352 // gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvdl->f_struct_box,0,1,fvd->rows+1,fvd->rows+2,GTK_SHRINK,GTK_FILL,0,0);
353 // gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvdl->f_subfield_box,1,2,fvd->rows+1,fvd->rows+2,GTK_SHRINK,GTK_FILL,0,0);
354 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvdl
->f_not_op_box
,0,1,fvd
->rows
+1,fvd
->rows
+2,GTK_SHRINK
,GTK_FILL
,0,0);
355 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvdl
->f_field_box
,1,3,fvd
->rows
+1,fvd
->rows
+2,GTK_SHRINK
,GTK_FILL
,0,0);
356 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvdl
->f_math_op_box
,3,4,fvd
->rows
+1,fvd
->rows
+2,GTK_SHRINK
,GTK_FILL
,0,0);
357 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvdl
->f_value_field
,4,5,fvd
->rows
+1,fvd
->rows
+2,GTK_SHRINK
,GTK_FILL
,0,0);
358 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvdl
->f_logical_op_box
,5,6,fvd
->rows
+1,fvd
->rows
+2,GTK_SHRINK
,GTK_FILL
,0,0);
363 void gui_filter_line_set_visible(FilterViewerDataLine
*fvdl
, gboolean v
) {
367 // gtk_widget_show(fvdl->f_struct_box);
368 // gtk_widget_show(fvdl->f_subfield_box);
369 gtk_widget_show(fvdl
->f_not_op_box
);
370 gtk_widget_show(fvdl
->f_field_box
);
371 gtk_widget_show(fvdl
->f_math_op_box
);
372 gtk_widget_show(fvdl
->f_value_field
);
373 gtk_widget_show(fvdl
->f_logical_op_box
);
375 // gtk_widget_hide(fvdl->f_struct_box);
376 // gtk_widget_hide(fvdl->f_subfield_box);
377 gtk_widget_hide(fvdl
->f_not_op_box
);
378 gtk_widget_hide(fvdl
->f_field_box
);
379 gtk_widget_hide(fvdl
->f_math_op_box
);
380 gtk_widget_hide(fvdl
->f_value_field
);
381 gtk_widget_hide(fvdl
->f_logical_op_box
);
386 void gui_filter_line_reset(FilterViewerDataLine
*fvdl
) {
388 // gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_struct_box),0);
389 // gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_subfield_box),0);
390 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_not_op_box
),0);
391 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_field_box
),0);
392 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_math_op_box
),0);
393 gtk_entry_set_text(GTK_COMBO_BOX(fvdl
->f_value_field
),"");
394 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
),0);
398 * Destructor for the filter gui module
399 * @param fvd The module structure
402 gui_filter_destructor(FilterViewerData
*fvd
)
406 /* May already been done by GTK window closing */
407 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
))){
408 g_info("widget still exists");
411 lttvwindow_unregister_traceset_notify(fvd
->tab
,
412 filter_traceset_changed
,
415 lttvwindowtraces_background_notify_remove(fvd
);
422 * @param hook_data The hook data
423 * @param call_data The call data
424 * @return Success/Failure of operation
427 filter_traceset_changed(void * hook_data
, void * call_data
) {
434 * @param hook_data The hook data
435 * @param call_data The call data
436 * @return Success/Failure of operation
439 filter_viewer_data(void * hook_data
, void * call_data
) {
445 * Filter Module's constructor hook
447 * This constructor is given as a parameter to the menuitem and toolbar button
448 * registration. It creates the list.
449 * @param tab A pointer to the parent window.
450 * @return The widget created.
453 h_guifilter(Tab
*tab
)
455 FilterViewerData
* f
= gui_filter(tab
) ;
457 g_print("FilterViewerData:%p\n",f
);
459 return guifilter_get_widget(f
);
465 * This function initializes the Filter Viewer functionnality through the
470 lttvwindow_register_constructor("guifilter",
472 "Insert Filter Module",
473 hGuiFilterInsert_xpm
,
474 "Insert Filter Module",
479 * Initiate the destruction of the current gui module
480 * on the GTK Interface
482 void filter_destroy_walk(gpointer data
, gpointer user_data
)
484 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
486 g_debug("CFV.c : filter_destroy_walk, %p", fvd
);
487 /* May already have been done by GTK window closing */
488 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
)))
489 gtk_widget_destroy(guifilter_get_widget(fvd
));
493 * plugin's destroy function
495 * This function releases the memory reserved by the module and unregisters
496 * everything that has been registered in the gtkTraceSet API.
498 static void destroy() {
500 lttvwindow_unregister_constructor(h_guifilter
);
505 * The Process Button callback function
506 * @param widget The Button widget passed to the callback function
507 * @param data Data sent along with the callback function
509 void callback_process_button(GtkWidget
*widget
, gpointer data
) {
511 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
513 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
514 LttvFilter
* filter
= lttv_filter_new();
515 lttv_filter_append_expression(filter
,gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
520 * The Add Button callback function
521 * @param widget The Button widget passed to the callback function
522 * @param data Data sent along with the callback function
524 void callback_expression_field(GtkWidget
*widget
, gpointer data
) {
526 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
528 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
529 gtk_widget_show(fvd
->f_logical_op_junction_box
);
531 gtk_widget_hide(fvd
->f_logical_op_junction_box
);
537 * The Add Button callback function
538 * @param widget The Button widget passed to the callback function
539 * @param data Data sent along with the callback function
541 void callback_add_button(GtkWidget
*widget
, gpointer data
) {
543 g_print("filter::callback_add_button()\n");
545 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
546 FilterViewerDataLine
*fvdl
= NULL
;
547 GString
* a_filter_string
= g_string_new("");
550 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
)));
552 g_print("string:%s\n",s
);
553 g_string_append(a_filter_string
,s
->str
);
554 gtk_combo_box_set_active(fvd
->f_logical_op_junction_box
,0);
556 g_print("passe junction\n");
558 g_string_append_c(a_filter_string
,'(');
561 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
562 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
564 s
= g_ptr_array_index(fvd
->f_not_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_not_op_box
)));
565 g_string_append(a_filter_string
,s
->str
);
567 s
= g_ptr_array_index(fvd
->f_field_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_field_box
)));
568 g_string_append(a_filter_string
,s
->str
);
570 s
= g_ptr_array_index(fvd
->f_math_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_math_op_box
)));
571 g_string_append(a_filter_string
,s
->str
);
573 g_string_append(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvdl
->f_value_field
)));
575 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
)));
576 g_string_append(a_filter_string
,s
->str
);
578 gui_filter_line_reset(fvdl
);
579 if(i
) gui_filter_line_set_visible(fvdl
,FALSE
); // Only keep the first line
582 g_string_append_c(a_filter_string
,')');
584 g_string_prepend(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
585 gtk_entry_set_text(GTK_ENTRY(fvd
->f_expression_field
),a_filter_string
->str
);
590 * The logical op box callback function
591 * @param widget The Button widget passed to the callback function
592 * @param data Data sent along with the callback function
594 void callback_logical_op_box(GtkWidget
*widget
, gpointer data
) {
596 g_print("filter::callback_logical_op_box()\n");
598 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
599 FilterViewerDataLine
*fvdl
= NULL
;
602 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
603 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
604 if(fvdl
->f_logical_op_box
== widget
) {
605 if(gtk_combo_box_get_active(fvdl
->f_logical_op_box
) == 0) return;
606 if(i
==fvd
->f_lines
->len
-1) { /* create a new line */
608 FilterViewerDataLine
* fvdl2
= gui_filter_add_line(fvd
);
609 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl2
);
611 FilterViewerDataLine
*fvdl2
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
+1);
612 if(!fvdl2
->visible
) gui_filter_line_set_visible(fvdl2
,TRUE
);
619 LTTV_MODULE("guifilter", "Filter window", \
620 "Graphical module that let user specify their filtering options", \
621 init
, destroy
, "lttvwindow")