+/**
+ * @fn FilterViewerDataLine* gui_filter_add_line(FilterViewerData*)
+ *
+ * Adds a filter option line on the module tab
+ * @param fvd The filter module structure
+ * @return The line structure
+ */
+FilterViewerDataLine*
+gui_filter_add_line(FilterViewerData* fvd) {
+
+ FilterViewerDataLine* fvdl = g_new(FilterViewerDataLine,1);
+
+ unsigned i;
+ fvdl->row = fvd->rows;
+ fvdl->visible = TRUE;
+
+ fvdl->f_not_op_box = gtk_combo_box_new_text();
+ for(i=0;i<fvd->f_not_op_options->len;i++) {
+ GString* s = g_ptr_array_index(fvd->f_not_op_options,i);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl->f_not_op_box), s->str);
+ }
+
+ fvdl->f_field_box = gtk_combo_box_new_text();
+ for(i=0;i<fvd->f_field_options->len;i++) {
+ GString* s = g_ptr_array_index(fvd->f_field_options,i);
+// g_print("String field: %s\n",s->str);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl->f_field_box), s->str);
+ }
+
+ fvdl->f_math_op_box = gtk_combo_box_new_text();
+ for(i=0;i<fvd->f_math_op_options->len;i++) {
+ GString* s = g_ptr_array_index(fvd->f_math_op_options,i);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl->f_math_op_box), s->str);
+ }
+
+ fvdl->f_value_field = gtk_entry_new();
+
+ fvdl->f_logical_op_box = gtk_combo_box_new_text();
+ for(i=0;i<fvd->f_logical_op_options->len;i++) {
+ GString* s = g_ptr_array_index(fvd->f_logical_op_options,i);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fvdl->f_logical_op_box), s->str);
+ }
+ gtk_widget_set_events(fvdl->f_logical_op_box,
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK |
+ GDK_FOCUS_CHANGE_MASK);
+
+ g_signal_connect (G_OBJECT (fvdl->f_logical_op_box), "changed",
+ G_CALLBACK (callback_logical_op_box), (gpointer) fvd);
+
+ gui_filter_line_reset(fvdl);
+ gui_filter_line_set_visible(fvdl,TRUE);
+
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+
+ return fvdl;
+}
+
+/**
+ * @fn void gui_filter_line_set_visible(FilterViewerDataLine*,gboolean)
+ *
+ * Change visible state of current FilterViewerDataLine
+ * @param fvdl pointer to the current FilterViewerDataLine
+ * @param v TRUE: sets visible, FALSE: sets invisible
+ */
+void
+gui_filter_line_set_visible(FilterViewerDataLine *fvdl, gboolean v) {
+
+ fvdl->visible = v;
+ if(v) {
+ gtk_widget_show(fvdl->f_not_op_box);
+ gtk_widget_show(fvdl->f_field_box);
+ gtk_widget_show(fvdl->f_math_op_box);
+ gtk_widget_show(fvdl->f_value_field);
+ gtk_widget_show(fvdl->f_logical_op_box);
+ } else {
+ gtk_widget_hide(fvdl->f_not_op_box);
+ gtk_widget_hide(fvdl->f_field_box);
+ gtk_widget_hide(fvdl->f_math_op_box);
+ gtk_widget_hide(fvdl->f_value_field);
+ gtk_widget_hide(fvdl->f_logical_op_box);
+ }
+
+}
+
+/**
+ * @fn void gui_filter_line_reset(FilterViewerDataLine*)
+ *
+ * Sets selections of all boxes in current FilterViewerDataLine
+ * to default value (0)
+ * @param fvdl pointer to current FilterViewerDataLine
+ */
+void
+gui_filter_line_reset(FilterViewerDataLine *fvdl) {
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_not_op_box),0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_field_box),0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_math_op_box),0);
+ gtk_entry_set_text(GTK_ENTRY(fvdl->f_value_field),"");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_logical_op_box),0);
+}
+
+/**
+ * @fn void gui_filter_destructor(FilterViewerData*)
+ *
+ * Destructor for the filter gui module
+ * @param fvd The module structure
+ */