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_window
; /**< filter window */
108 GtkWidget
*f_main_box
; /**< main container */
110 GtkWidget
*f_expression_field
; /**< entire expression (GtkEntry) */
111 GtkWidget
*f_process_button
; /**< process expression button (GtkButton) */
113 GtkWidget
*f_logical_op_junction_box
; /**< linking operator box (GtkComboBox) */
115 int rows
; /**< number of rows */
116 GPtrArray
*f_lines
; /**< array of FilterViewerDataLine */
118 GPtrArray
*f_not_op_options
; /**< array of operators types for not_op box */
119 GPtrArray
*f_logical_op_options
; /**< array of operators types for logical_op box */
120 GPtrArray
*f_field_options
; /**< array of field types for field box */
121 GPtrArray
*f_math_op_options
; /**< array of operators types for math_op box */
123 GtkWidget
*f_add_button
; /**< add expression to current expression (GtkButton) */
125 gchar
*name
; /**< Name of the window in the main window */
129 * @fn GtkWidget* guifilter_get_widget(FilterViewerData*)
131 * This function returns the current main widget
132 * used by this module
133 * @param fvd the module struct
134 * @return The main widget
137 guifilter_get_widget(FilterViewerData
*fvd
)
139 return fvd
->f_window
;
143 * @fn FilterViewerData* gui_filter(Tab*)
145 * Constructor is used to create FilterViewerData data structure.
146 * @param tab The tab structure used by the widget
147 * @return The Filter viewer data created.
152 g_debug("filter::gui_filter()");
155 GtkCellRenderer
*renderer
;
156 GtkTreeViewColumn
*column
;
158 FilterViewerData
* fvd
= g_new(FilterViewerData
,1);
162 // lttvwindow_register_traceset_notify(fvd->tab,
163 // filter_traceset_changed,
164 // filter_viewer_data);
165 // request_background_data(filter_viewer_data);
168 * Initiating items for
171 fvd
->f_not_op_options
= g_ptr_array_new();
172 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new(""));
173 g_ptr_array_add(fvd
->f_not_op_options
,(gpointer
) g_string_new("!"));
175 fvd
->f_logical_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,sizeof(gchar));
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("&"));
178 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("|"));
179 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("!"));
180 g_ptr_array_add(fvd
->f_logical_op_options
,(gpointer
) g_string_new("^"));
182 fvd
->f_field_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,16);
183 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new(""));
184 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.name"));
185 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.facility"));
186 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.category"));
187 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.time"));
188 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("event.tsc"));
190 * TODO: Add core.xml fields here !
192 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("tracefile.name"));
193 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("trace.name"));
194 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.process_name"));
195 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.pid"));
196 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.ppid"));
197 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.creation_time"));
198 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.insertion_time"));
199 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_mode"));
200 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.execution_submode"));
201 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.process_status"));
202 g_ptr_array_add(fvd
->f_field_options
,(gpointer
) g_string_new("state.cpu"));
204 fvd
->f_math_op_options
= g_ptr_array_new(); //g_array_new(FALSE,FALSE,7);
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("="));
207 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("!="));
208 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<"));
209 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new("<="));
210 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">"));
211 g_ptr_array_add(fvd
->f_math_op_options
,(gpointer
) g_string_new(">="));
214 fvd
->f_window
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
217 * Initiating GtkTable layout
218 * starts with 2 rows and 5 columns and
219 * expands when expressions added
221 fvd
->f_main_box
= gtk_table_new(3,7,FALSE
);
222 gtk_table_set_row_spacings(GTK_TABLE(fvd
->f_main_box
),5);
223 gtk_table_set_col_spacings(GTK_TABLE(fvd
->f_main_box
),5);
225 gtk_container_add(GTK_CONTAINER(fvd
->f_window
), GTK_WIDGET(fvd
->f_main_box
));
228 * First half of the filter window
229 * - textual entry of filter expression
230 * - processing button
232 fvd
->f_expression_field
= gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL);
233 // gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),"state.cpu>0");
234 gtk_widget_show (fvd
->f_expression_field
);
236 g_signal_connect (G_OBJECT (fvd
->f_expression_field
), "changed",
237 G_CALLBACK (callback_expression_field
), (gpointer
) fvd
);
239 fvd
->f_process_button
= gtk_button_new_with_label("Process");
240 gtk_widget_show (fvd
->f_process_button
);
242 g_signal_connect (G_OBJECT (fvd
->f_process_button
), "clicked",
243 G_CALLBACK (callback_process_button
), (gpointer
) fvd
);
245 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_expression_field
,0,6,0,1,GTK_FILL
,GTK_FILL
,0,0);
246 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_process_button
,6,7,0,1,GTK_FILL
,GTK_FILL
,0,0);
251 * Second half of the filter window
252 * - combo boxes featuring filtering options added to the expression
254 fvd
->f_add_button
= gtk_button_new_with_label("Add Expression");
255 gtk_widget_show (fvd
->f_add_button
);
257 g_signal_connect (G_OBJECT (fvd
->f_add_button
), "clicked",
258 G_CALLBACK (callback_add_button
), (gpointer
) fvd
);
260 gtk_table_attach( GTK_TABLE(fvd
->f_main_box
),fvd
->f_add_button
,6,7,1,2,GTK_FILL
,GTK_FILL
,0,0);
262 fvd
->f_logical_op_junction_box
= gtk_combo_box_new_text();
263 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
264 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
265 gtk_combo_box_append_text(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
), s
->str
);
267 gtk_combo_box_set_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
),0);
269 //gtk_widget_show(fvd->f_logical_op_box);
271 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);
273 gtk_container_set_border_width(GTK_CONTAINER(fvd
->f_main_box
), 1);
275 /* initialize a new line */
276 fvd
->f_lines
= g_ptr_array_new();
278 FilterViewerDataLine
* fvdl
= gui_filter_add_line(fvd
);
279 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl
);
282 * show main container
284 gtk_widget_show(fvd
->f_main_box
);
285 gtk_widget_show(fvd
->f_window
);
288 g_object_set_data_full(
289 G_OBJECT(guifilter_get_widget(fvd
)),
290 "filter_viewer_data",
292 (GDestroyNotify
)gui_filter_destructor
);
294 g_filter_list
= g_slist_append(
302 * @fn FilterViewerDataLine* gui_filter_add_line(FilterViewerData*)
304 * Adds a filter option line on the module tab
305 * @param fvd The filter module structure
306 * @return The line structure
308 FilterViewerDataLine
*
309 gui_filter_add_line(FilterViewerData
* fvd
) {
311 FilterViewerDataLine
* fvdl
= g_new(FilterViewerDataLine
,1);
314 fvdl
->row
= fvd
->rows
;
315 fvdl
->visible
= TRUE
;
317 fvdl
->f_not_op_box
= gtk_combo_box_new_text();
318 for(i
=0;i
<fvd
->f_not_op_options
->len
;i
++) {
319 GString
* s
= g_ptr_array_index(fvd
->f_not_op_options
,i
);
320 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_not_op_box
), s
->str
);
323 fvdl
->f_field_box
= gtk_combo_box_new_text();
324 for(i
=0;i
<fvd
->f_field_options
->len
;i
++) {
325 GString
* s
= g_ptr_array_index(fvd
->f_field_options
,i
);
326 // g_print("String field: %s\n",s->str);
327 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_field_box
), s
->str
);
330 fvdl
->f_math_op_box
= gtk_combo_box_new_text();
331 for(i
=0;i
<fvd
->f_math_op_options
->len
;i
++) {
332 GString
* s
= g_ptr_array_index(fvd
->f_math_op_options
,i
);
333 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_math_op_box
), s
->str
);
336 fvdl
->f_value_field
= gtk_entry_new();
338 fvdl
->f_logical_op_box
= gtk_combo_box_new_text();
339 for(i
=0;i
<fvd
->f_logical_op_options
->len
;i
++) {
340 GString
* s
= g_ptr_array_index(fvd
->f_logical_op_options
,i
);
341 gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl
->f_logical_op_box
), s
->str
);
343 gtk_widget_set_events(fvdl
->f_logical_op_box
,
344 GDK_ENTER_NOTIFY_MASK
|
345 GDK_LEAVE_NOTIFY_MASK
|
346 GDK_FOCUS_CHANGE_MASK
);
348 g_signal_connect (G_OBJECT (fvdl
->f_logical_op_box
), "changed",
349 G_CALLBACK (callback_logical_op_box
), (gpointer
) fvd
);
351 gui_filter_line_reset(fvdl
);
352 gui_filter_line_set_visible(fvdl
,TRUE
);
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);
364 * @fn void gui_filter_line_set_visible(FilterViewerDataLine*,gboolean)
366 * Change visible state of current FilterViewerDataLine
367 * @param fvdl pointer to the current FilterViewerDataLine
368 * @param v TRUE: sets visible, FALSE: sets invisible
371 gui_filter_line_set_visible(FilterViewerDataLine
*fvdl
, gboolean v
) {
375 gtk_widget_show(fvdl
->f_not_op_box
);
376 gtk_widget_show(fvdl
->f_field_box
);
377 gtk_widget_show(fvdl
->f_math_op_box
);
378 gtk_widget_show(fvdl
->f_value_field
);
379 gtk_widget_show(fvdl
->f_logical_op_box
);
381 gtk_widget_hide(fvdl
->f_not_op_box
);
382 gtk_widget_hide(fvdl
->f_field_box
);
383 gtk_widget_hide(fvdl
->f_math_op_box
);
384 gtk_widget_hide(fvdl
->f_value_field
);
385 gtk_widget_hide(fvdl
->f_logical_op_box
);
391 * @fn void gui_filter_line_reset(FilterViewerDataLine*)
393 * Sets selections of all boxes in current FilterViewerDataLine
394 * to default value (0)
395 * @param fvdl pointer to current FilterViewerDataLine
398 gui_filter_line_reset(FilterViewerDataLine
*fvdl
) {
400 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_not_op_box
),0);
401 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_field_box
),0);
402 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_math_op_box
),0);
403 gtk_entry_set_text(GTK_ENTRY(fvdl
->f_value_field
),"");
404 gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
),0);
408 * @fn void gui_filter_destructor(FilterViewerData*)
410 * Destructor for the filter gui module
411 * @param fvd The module structure
414 gui_filter_destructor(FilterViewerData
*fvd
)
418 /* May already been done by GTK window closing */
419 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
))){
420 g_info("widget still exists");
423 // lttvwindow_unregister_traceset_notify(fvd->tab,
424 // filter_traceset_changed,
425 // filter_viewer_data);
427 lttvwindowtraces_background_notify_remove(fvd
);
429 g_filter_list
= g_slist_remove(g_filter_list
, fvd
);
431 main_window_remove_child_window(tab
, fvd
->name
);
440 * @fn GtkWidget* h_guifilter(Tab*)
442 * Filter Module's constructor hook
444 * This constructor is given as a parameter to the menuitem and toolbar button
445 * registration. It creates the list.
446 * @param tab A pointer to the parent window.
447 * @return The widget created.
450 h_guifilter(Tab
*tab
)
452 FilterViewerData
* f
= gui_filter(tab
) ;
453 f
->name
= g_new(gchar
, 256);
455 snprintf(f
->name
, 256, "guifilter %p", f
);
458 main_window_add_child_window(tab
, f
,
459 f
->name
, (GDestroyNotify
)gui_filter_destructor
);
465 * @fn static void init()
467 * This function initializes the Filter Viewer functionnality through the
472 lttvwindow_register_constructor("guifilter",
474 "Insert Filter Module",
475 hGuiFilterInsert_xpm
,
476 "Insert Filter Module",
481 * @fn void filter_destroy_walk(gpointer,gpointer)
483 * Initiate the destruction of the current gui module
484 * on the GTK Interface
487 filter_destroy_walk(gpointer data
, gpointer user_data
)
489 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
491 g_debug("CFV.c : filter_destroy_walk, %p", fvd
);
493 /* May already have been done by GTK window closing */
494 if(GTK_IS_WIDGET(guifilter_get_widget(fvd
)))
495 gtk_widget_destroy(guifilter_get_widget(fvd
));
499 * @fn static void destroy()
500 * @brief plugin's destroy function
502 * This function releases the memory reserved by the module and unregisters
503 * everything that has been registered in the gtkTraceSet API.
505 static void destroy() {
507 g_slist_foreach(g_filter_list
, filter_destroy_walk
, NULL
);
509 lttvwindow_unregister_constructor(h_guifilter
);
514 * @fn void callback_process_button(GtkWidget*,gpointer)
516 * The Process Button callback function
517 * @param widget The Button widget passed to the callback function
518 * @param data Data sent along with the callback function
521 callback_process_button(GtkWidget
*widget
, gpointer data
) {
523 g_debug("callback_process_button(): Processing expression");
525 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
528 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
529 filter
= lttv_filter_new();
530 GString
* s
= g_string_new(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
531 lttv_filter_append_expression(filter
,s
->str
);
532 g_string_free(s
,TRUE
);
533 //SetFilter(fvd->tab,filter);
537 lttvwindow_report_filter(fvd
->tab
, filter
);
541 * @fn void callback_expression_field(GtkWidget*,gpointer)
543 * The Add Button callback function
544 * @param widget The Button widget passed to the callback function
545 * @param data Data sent along with the callback function
548 callback_expression_field(GtkWidget
*widget
, gpointer data
) {
550 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
552 if(strlen(gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
))) !=0) {
553 gtk_widget_show(fvd
->f_logical_op_junction_box
);
555 gtk_widget_hide(fvd
->f_logical_op_junction_box
);
561 * @fn void callback_add_button(GtkWidget*,gpointer)
563 * The Add Button callback function
564 * @param widget The Button widget passed to the callback function
565 * @param data Data sent along with the callback function
568 callback_add_button(GtkWidget
*widget
, gpointer data
) {
570 g_debug("callback_add_button(): processing simple expressions");
574 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
575 FilterViewerDataLine
*fvdl
= NULL
;
576 GString
* a_filter_string
= g_string_new("");
579 * adding linking operator to
583 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
)));
584 g_string_append(a_filter_string
,s
->str
);
585 gtk_combo_box_set_active(GTK_COMBO_BOX(fvd
->f_logical_op_junction_box
),0);
587 /* begin expression */
588 g_string_append_c(a_filter_string
,'(');
591 * For each simple expression, add the resulting string
592 * to the filter string
594 * Each simple expression takes the following schema
595 * [not operator '!',' '] [field type] [math operator '<','<=','>','>=','=','!='] [value]
597 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
598 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
600 s
= g_ptr_array_index(fvd
->f_not_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_not_op_box
)));
601 g_string_append(a_filter_string
,s
->str
);
603 s
= g_ptr_array_index(fvd
->f_field_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_field_box
)));
604 g_string_append(a_filter_string
,s
->str
);
606 s
= g_ptr_array_index(fvd
->f_math_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_math_op_box
)));
607 g_string_append(a_filter_string
,s
->str
);
609 g_string_append(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvdl
->f_value_field
)));
611 s
= g_ptr_array_index(fvd
->f_logical_op_options
,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
)));
612 g_string_append(a_filter_string
,s
->str
);
615 * resetting simple expression lines
617 gui_filter_line_reset(fvdl
);
618 if(i
) gui_filter_line_set_visible(fvdl
,FALSE
); // Only keep the first line
622 g_string_append_c(a_filter_string
,')');
624 g_string_prepend(a_filter_string
,gtk_entry_get_text(GTK_ENTRY(fvd
->f_expression_field
)));
625 gtk_entry_set_text(GTK_ENTRY(fvd
->f_expression_field
),a_filter_string
->str
);
630 * @fn void callback_logical_op_box(GtkWidget*,gpointer)
632 * The logical op box callback function
633 * @param widget The Button widget passed to the callback function
634 * @param data Data sent along with the callback function
637 callback_logical_op_box(GtkWidget
*widget
, gpointer data
) {
639 g_debug("callback_logical_op_box(): adding new simple expression");
641 FilterViewerData
*fvd
= (FilterViewerData
*)data
;
642 FilterViewerDataLine
*fvdl
= NULL
;
645 for(i
=0;i
<fvd
->f_lines
->len
;i
++) {
646 fvdl
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
);
647 if(fvdl
->f_logical_op_box
== widget
) {
648 if(gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl
->f_logical_op_box
)) == 0) return;
649 if(i
==fvd
->f_lines
->len
-1) { /* create a new line */
651 FilterViewerDataLine
* fvdl2
= gui_filter_add_line(fvd
);
652 g_ptr_array_add(fvd
->f_lines
,(gpointer
) fvdl2
);
654 FilterViewerDataLine
*fvdl2
= (FilterViewerDataLine
*)g_ptr_array_index(fvd
->f_lines
,i
+1);
655 if(!fvdl2
->visible
) gui_filter_line_set_visible(fvdl2
,TRUE
);
662 LTTV_MODULE("guifilter", "Filter window", \
663 "Graphical module that let user specify their filtering options", \
664 init
, destroy
, "lttvwindow")