1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2005 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,
28 #include <lttv/lttv.h>
29 #include <lttv/module.h>
30 #include <lttv/hook.h>
31 #include <lttv/filter.h>
33 #include <lttvwindow/lttvwindow.h>
34 #include <lttvwindow/lttvwindowtraces.h>
36 #include "hGuiFilterInsert.xpm"
39 GSList
*g_filter_list
= NULL
;
41 /*! \file lttv/modules/gui/filter/filter.c
42 * \brief Graphic filter interface.
44 * The gui filter facility gives the user an easy to use
45 * basic interface to construct and modify at will a filter
46 * expression. User may either decide to write it himself in
47 * expression text entry or add simple expressions using the
50 * \note The version of gtk-2.0 currently installed on
51 * my desktop misses some function of the newer
52 * gtk+ api. For the time being, I'll use the older api
53 * to keep compatibility with most systems.
56 typedef struct _FilterViewerData FilterViewerData
;
57 typedef struct _FilterViewerDataLine FilterViewerDataLine
;
62 GtkWidget
*guifilter_get_widget(FilterViewerData
*fvd
);
63 FilterViewerData
*gui_filter(Tab
*tab
);
64 void gui_filter_destructor(FilterViewerData
*fvd
);
65 FilterViewerDataLine
* gui_filter_add_line(FilterViewerData
*fvd
);
66 void gui_filter_line_set_visible(FilterViewerDataLine
*fvdl
, gboolean v
);
67 void gui_filter_line_reset(FilterViewerDataLine
*fvdl
);
68 GtkWidget
* h_guifilter(Tab
*tab
);
69 void filter_destroy_walk(gpointer data
, gpointer user_data
);
74 void callback_process_button(GtkWidget
*widget
, gpointer data
);
75 void callback_add_button(GtkWidget
*widget
, gpointer data
);
76 void callback_logical_op_box(GtkWidget
*widget
, gpointer data
);
77 void callback_expression_field(GtkWidget
*widget
, gpointer data
);
80 * @struct _FilterViewerDataLine
82 * @brief Defines a simple expression
83 * This structures defines a simple
84 * expression whithin the main filter
87 struct _FilterViewerDataLine
{
88 int row
; /**< row number */
89 gboolean visible
; /**< visible state */
90 GtkWidget
*f_not_op_box
; /**< '!' operator (GtkComboBox) */
91 GtkWidget
*f_logical_op_box
; /**< '&,|,^' operators (GtkComboBox) */
92 GtkWidget
*f_field_box
; /**< field types (GtkComboBox) */
93 GtkWidget
*f_math_op_box
; /**< '>,>=,<,<=,=,!=' operators (GtkComboBox) */
94 GtkWidget
*f_value_field
; /**< expression's value (GtkComboBox) */
98 * @struct _FilterViewerData
100 * @brief Main structure of gui filter
101 * Main struct for the filter gui module
103 struct _FilterViewerData
{
104 Tab
*tab
; /**< current tab of module */
106 GtkWidget
*f_main_box
; /**< main container */
108 GtkWidget
*f_expression_field
; /**< entire expression (GtkEntry) */
109 GtkWidget
*f_process_button
; /**< process expression button (GtkButton) */
111 GtkWidget
*f_logical_op_junction_box
; /**< linking operator box (GtkComboBox) */
113 int rows
; /**< number of rows */
114 GPtrArray
*f_lines
; /**< array of FilterViewerDataLine */
116 GPtrArray
*f_not_op_options
; /**< array of operators types for not_op box */
117 GPtrArray
*f_logical_op_options
; /**< array of operators types for logical_op box */
118 GPtrArray
*f_field_options
; /**< array of field types for field box */
119 GPtrArray
*f_math_op_options
; /**< array of operators types for math_op box */
121 GtkWidget
*f_add_button
; /**< add expression to current expression (GtkButton) */
126 * @fn GtkWidget* guifilter_get_widget(FilterViewerData*)
128 * This function returns the current main widget
129 * used by this module
130 * @param fvd the module struct
131 * @return The main widget
134 guifilter_get_widget(FilterViewerData
*fvd
)
136 return fvd
->f_main_box
;
140 * @fn FilterViewerData* gui_filter(Tab*)
142 * Constructor is used to create FilterViewerData data structure.
143 * @param tab The tab structure used by the widget
144 * @return The Filter viewer data created.
149 g_print("filter::gui_filter()");
152 GtkCellRenderer
*renderer
;
153 GtkTreeViewColumn
*column
;
155 FilterViewerData
* fvd
= g_new(FilterViewerData
,1);
159 // lttvwindow_register_traceset_notify(fvd->tab,
160 // filter_traceset_changed,
161 // filter_viewer_data);
162 // request_background_data(filter_viewer_data);
165 * Initiating items for
168 fvd
->f_not_op_options
= g_ptr_array_new();
169 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new(""));
170 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new("!"));
172 fvd
->f_logical_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,sizeof(gchar));
173 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new(""));
174 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("&"));
175 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("|"));
176 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("!"));
177 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("^"));
179 fvd
->f_field_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,16);
180 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new(""));
181 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.name"));
182 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.category"));
183 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.time"));
184 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.tsc"));
186 * TODO: Add core.xml fields here !
188 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("tracefile.name"));
189 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("trace.name"));
190 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.pid"));
191 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.ppid"));
192 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.creation_time"));
193 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.insertion_time"));
194 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_mode"));
195 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_submode"));
196 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.process_status"));
197 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.cpu"));
199 fvd
->f_math_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,7);
200 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(""));
201 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("="));
202 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("!="));
203 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<"));
204 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<="));
205 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">"));
206 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">="));
210 * Initiating GtkTable layout
211 * starts with 2 rows and 5 columns and
212 * expands when expressions added
214 fvd
->f_main_box
= gtk_table_new(3,7,FALSE
);
215 gtk_table_set_row_spacings(GTK_TABLE(fvd
->f_main_box
),5);
216 gtk_table_set_col_spacings(GTK_TABLE(fvd
->f_main_box
),5);
219 * First half of the filter window
220 * - textual entry of filter expression
221 * - processing button
223 fvd
->f_expression_field
= gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL);
224 // gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),"state.cpu>0");
225 gtk_widget_show (fvd
->f_expression_field
);
227 g_signal_connect (G_OBJECT (fvd
->f_expression_field
), "changed",
228 G_CALLBACK (callback_expression_field
), (gpointer
) fvd
);
230 fvd
->f_process_button
= gtk_button_new_with_label("Process");
231 gtk_widget_show (fvd
->f_process_button
);
233 g_signal_connect (G_OBJECT (fvd
->f_process_button
), "clicked",
234 G_CALLBACK (callback_process_button
), (gpointer
) fvd
);
236 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_expression_field
,0,6,0,1,GTK_FILL
,GTK_FILL
,0,0);
237 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_process_button
,6,7,0,1,GTK_FILL
,GTK_FILL
,0,0);
242 * Second half of the filter window
243 * - combo boxes featuring filtering options added to the expression
245 fvd
->f_add_button
= gtk_button_new_with_label("Add Expression");
246 gtk_widget_show (fvd
->f_add_button
);
248 g_signal_connect (G_OBJECT (fvd
->f_add_button
), "clicked",
249 G_CALLBACK (callback_add_button
), (gpointer
) fvd
);
251 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_add_button
,6,7,1,2,GTK_FILL
,GTK_FILL
,0,0);
253 fvd
->f_logical_op_junction_box
= gtk_combo_box_new_text();
254 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
255 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
256 gtk_combo_box_append_text(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
), s
->str
);
258 gtk_combo_box_set_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
),0);
260 //gtk_widget_show(fvd->f_logical_op_box);
262 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);
264 gtk_container_set_border_width(GTK_CONTAINER(fvd
->f_main_box
), 1);
266 /* initialize a new line */
267 fvd
->f_lines
= g_ptr_array_new();
269 FilterViewerDataLine
* fvdl
= gui_filter_add_line(fvd
);
270 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl
);
273 * show main container
275 gtk_widget_show(fvd
->f_main_box
);
278 g_object_set_data_full(
279 G_OBJECT(guifilter_get_widget(fvd
)),
280 "filter_viewer_data",
282 (GDestroyNotify
)gui_filter_destructor
);
284 g_filter_list
= g_slist_append(
292 * @fn FilterViewerDataLine* gui_filter_add_line(FilterViewerData*)
294 * Adds a filter option line on the module tab
295 * @param fvd The filter module structure
296 * @return The line structure
298 FilterViewerDataLine
*
299 gui_filter_add_line(FilterViewerData
* fvd
) {
301 FilterViewerDataLine
* fvdl
= g_new(FilterViewerDataLine
,1);
304 fvdl
->row
= fvd
->rows
;
305 fvdl
->visible
= TRUE
;
307 fvdl
->f_not_op_box
= gtk_combo_box_new_text();
308 for(i
=0;i
<fvd
->f_not_op_options
->len
;i
++) {
309 GString
* s
= g_ptr_array_index(fvd
->f_not_op_options
,i
);
310 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_not_op_box
), s
->str
);
313 fvdl
->f_field_box
= gtk_combo_box_new_text();
314 for(i
=0;i
<fvd
->f_field_options
->len
;i
++) {
315 GString
* s
= g_ptr_array_index(fvd
->f_field_options
,i
);
316 // g_print("String field: %s\n",s->str);
317 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_field_box
), s
->str
);
320 fvdl
->f_math_op_box
= gtk_combo_box_new_text();
321 for(i
=0;i
<fvd
->f_math_op_options
->len
;i
++) {
322 GString
* s
= g_ptr_array_index(fvd
->f_math_op_options
,i
);
323 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_math_op_box
), s
->str
);
326 fvdl
->f_value_field
= gtk_entry_new();
328 fvdl
->f_logical_op_box
= gtk_combo_box_new_text();
329 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
330 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
331 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_logical_op_box
), s
->str
);
333 gtk_widget_set_events(fvdl
->f_logical_op_box
,
334 GDK_ENTER_NOTIFY_MASK
|
335 GDK_LEAVE_NOTIFY_MASK
|
336 GDK_FOCUS_CHANGE_MASK
);
338 g_signal_connect (G_OBJECT (fvdl
->f_logical_op_box
), "changed",
339 G_CALLBACK (callback_logical_op_box
), (gpointer
) fvd
);
341 gui_filter_line_reset(fvdl
);
342 gui_filter_line_set_visible(fvdl
,TRUE
);
344 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);
345 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);
346 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);
347 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);
348 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);
354 * @fn void gui_filter_line_set_visible(FilterViewerDataLine*,gboolean)
356 * Change visible state of current FilterViewerDataLine
357 * @param fvdl pointer to the current FilterViewerDataLine
358 * @param v TRUE: sets visible, FALSE: sets invisible
361 gui_filter_line_set_visible(FilterViewerDataLine
*fvdl
, gboolean v
) {
365 gtk_widget_show(fvdl
->f_not_op_box
);
366 gtk_widget_show(fvdl
->f_field_box
);
367 gtk_widget_show(fvdl
->f_math_op_box
);
368 gtk_widget_show(fvdl
->f_value_field
);
369 gtk_widget_show(fvdl
->f_logical_op_box
);
371 gtk_widget_hide(fvdl
->f_not_op_box
);
372 gtk_widget_hide(fvdl
->f_field_box
);
373 gtk_widget_hide(fvdl
->f_math_op_box
);
374 gtk_widget_hide(fvdl
->f_value_field
);
375 gtk_widget_hide(fvdl
->f_logical_op_box
);
381 * @fn void gui_filter_line_reset(FilterViewerDataLine*)
383 * Sets selections of all boxes in current FilterViewerDataLine
384 * to default value (0)
385 * @param fvdl pointer to current FilterViewerDataLine
388 gui_filter_line_reset(FilterViewerDataLine
*fvdl
) {
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_ENTRY(fvdl
->f_value_field
),"");
394 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
),0);
398 * @fn void gui_filter_destructor(FilterViewerData*)
400 * Destructor for the filter gui module
401 * @param fvd The module structure
404 gui_filter_destructor(FilterViewerData
*fvd
)
408 /* May already been done by GTK window closing */
409 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
))){
410 g_info("widget still exists");
413 // lttvwindow_unregister_traceset_notify(fvd->tab,
414 // filter_traceset_changed,
415 // filter_viewer_data);
417 lttvwindowtraces_background_notify_remove(fvd
);
419 g_filter_list
= g_slist_remove(g_filter_list
, fvd
);
426 * @fn GtkWidget* h_guifilter(Tab*)
428 * Filter Module's constructor hook
430 * This constructor is given as a parameter to the menuitem and toolbar button
431 * registration. It creates the list.
432 * @param tab A pointer to the parent window.
433 * @return The widget created.
436 h_guifilter(Tab
*tab
)
438 FilterViewerData
* f
= gui_filter(tab
) ;
441 return guifilter_get_widget(f
);
447 * @fn static void init()
449 * This function initializes the Filter Viewer functionnality through the
454 lttvwindow_register_constructor("guifilter",
456 "Insert Filter Module",
457 hGuiFilterInsert_xpm
,
458 "Insert Filter Module",
463 * @fn void filter_destroy_walk(gpointer,gpointer)
465 * Initiate the destruction of the current gui module
466 * on the GTK Interface
469 filter_destroy_walk(gpointer data
, gpointer user_data
)
471 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
473 g_debug("CFV.c : filter_destroy_walk, %p", fvd
);
475 /* May already have been done by GTK window closing */
476 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
)))
477 gtk_widget_destroy(guifilter_get_widget(fvd
));
481 * @fn static void destroy()
482 * @brief plugin's destroy function
484 * This function releases the memory reserved by the module and unregisters
485 * everything that has been registered in the gtkTraceSet API.
487 static void destroy() {
489 g_slist_foreach(g_filter_list
, filter_destroy_walk
, NULL
);
491 lttvwindow_unregister_constructor(h_guifilter
);
496 * @fn void callback_process_button(GtkWidget*,gpointer)
498 * The Process Button callback function
499 * @param widget The Button widget passed to the callback function
500 * @param data Data sent along with the callback function
503 callback_process_button(GtkWidget
*widget
, gpointer data
) {
505 g_debug("callback_process_button(): Processing expression");
507 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
509 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
510 LttvFilter
* filter
= lttv_filter_new();
511 GString
* s
= g_string_new(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
512 lttv_filter_append_expression(filter
,s
->str
);
513 g_string_free(s
,TRUE
);
514 //SetFilter(fvd->tab,filter);
515 lttvwindow_report_filter(fvd
->tab
, filter
);
520 * @fn void callback_expression_field(GtkWidget*,gpointer)
522 * The Add Button callback function
523 * @param widget The Button widget passed to the callback function
524 * @param data Data sent along with the callback function
527 callback_expression_field(GtkWidget
*widget
, gpointer data
) {
529 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
531 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
532 gtk_widget_show(fvd
->f_logical_op_junction_box
);
534 gtk_widget_hide(fvd
->f_logical_op_junction_box
);
540 * @fn void callback_add_button(GtkWidget*,gpointer)
542 * The Add Button callback function
543 * @param widget The Button widget passed to the callback function
544 * @param data Data sent along with the callback function
547 callback_add_button(GtkWidget
*widget
, gpointer data
) {
549 g_debug("callback_add_button(): processing simple expressions");
553 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
554 FilterViewerDataLine
*fvdl
= NULL
;
555 GString
* a_filter_string
= g_string_new("");
558 * adding linking operator to
562 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
)));
563 g_string_append(a_filter_string
,s
->str
);
564 gtk_combo_box_set_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
),0);
566 /* begin expression */
567 g_string_append_c(a_filter_string
,'(');
570 * For each simple expression, add the resulting string
571 * to the filter string
573 * Each simple expression takes the following schema
574 * [not operator '!',' '] [field type] [math operator '<','<=','>','>=','=','!='] [value]
576 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
577 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
579 s
= g_ptr_array_index(fvd
->f_not_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_not_op_box
)));
580 g_string_append(a_filter_string
,s
->str
);
582 s
= g_ptr_array_index(fvd
->f_field_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_field_box
)));
583 g_string_append(a_filter_string
,s
->str
);
585 s
= g_ptr_array_index(fvd
->f_math_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_math_op_box
)));
586 g_string_append(a_filter_string
,s
->str
);
588 g_string_append(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvdl
->f_value_field
)));
590 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
)));
591 g_string_append(a_filter_string
,s
->str
);
594 * resetting simple expression lines
596 gui_filter_line_reset(fvdl
);
597 if(i
) gui_filter_line_set_visible(fvdl
,FALSE
); // Only keep the first line
601 g_string_append_c(a_filter_string
,')');
603 g_string_prepend(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
604 gtk_entry_set_text(GTK_ENTRY(fvd
->f_expression_field
),a_filter_string
->str
);
609 * @fn void callback_logical_op_box(GtkWidget*,gpointer)
611 * The logical op box callback function
612 * @param widget The Button widget passed to the callback function
613 * @param data Data sent along with the callback function
616 callback_logical_op_box(GtkWidget
*widget
, gpointer data
) {
618 g_debug("callback_logical_op_box(): adding new simple expression");
620 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
621 FilterViewerDataLine
*fvdl
= NULL
;
624 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
625 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
626 if(fvdl
->f_logical_op_box
== widget
) {
627 if(gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
)) == 0) return;
628 if(i
==fvd
->f_lines
->len
-1) { /* create a new line */
630 FilterViewerDataLine
* fvdl2
= gui_filter_add_line(fvd
);
631 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl2
);
633 FilterViewerDataLine
*fvdl2
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
+1);
634 if(!fvdl2
->visible
) gui_filter_line_set_visible(fvdl2
,TRUE
);
641 LTTV_MODULE("guifilter", "Filter window", \
642 "Graphical module that let user specify their filtering options", \
643 init
, destroy
, "lttvwindow")