[gnome-builder/wip/chergert/grep] grep: add recursive toggle



commit 983bd45bbf5a9de488184029faa914f5490b8078
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 30 13:44:13 2018 -0700

    grep: add recursive toggle

 src/plugins/grep/gbp-grep-popover.c  |  8 +++++---
 src/plugins/grep/gbp-grep-popover.ui | 10 +++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/grep/gbp-grep-popover.c b/src/plugins/grep/gbp-grep-popover.c
index a601d5538..a7837198f 100644
--- a/src/plugins/grep/gbp-grep-popover.c
+++ b/src/plugins/grep/gbp-grep-popover.c
@@ -39,6 +39,7 @@ struct _GbpGrepPopover
   GtkCheckButton *regex_button;
   GtkCheckButton *whole_button;
   GtkCheckButton *case_button;
+  GtkCheckButton *recursive_button;
 };
 
 enum {
@@ -85,6 +86,7 @@ gbp_grep_popover_button_clicked_cb (GbpGrepPopover *self,
   gboolean use_regex;
   gboolean at_word_boundaries;
   gboolean case_sensitive;
+  gboolean recursive;
 
   g_assert (GBP_IS_GREP_POPOVER (self));
   g_assert (GTK_IS_BUTTON (button));
@@ -97,6 +99,7 @@ gbp_grep_popover_button_clicked_cb (GbpGrepPopover *self,
   use_regex = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->regex_button));
   at_word_boundaries = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->whole_button));
   case_sensitive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->case_button));
+  recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->recursive_button));
 
   model = gbp_grep_model_new (context);
   gbp_grep_model_set_directory (model, self->file);
@@ -104,9 +107,7 @@ gbp_grep_popover_button_clicked_cb (GbpGrepPopover *self,
   gbp_grep_model_set_at_word_boundaries (model, at_word_boundaries);
   gbp_grep_model_set_case_sensitive (model, case_sensitive);
   gbp_grep_model_set_query (model, gtk_entry_get_text (self->entry));
-
-  /* TODO: Add recursive toggle */
-  gbp_grep_model_set_recursive (model, TRUE);
+  gbp_grep_model_set_recursive (model, recursive);
 
   panel = gbp_grep_panel_new ();
   gtk_container_add (GTK_CONTAINER (utils), panel);
@@ -201,6 +202,7 @@ gbp_grep_popover_class_init (GbpGrepPopoverClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GbpGrepPopover, regex_button);
   gtk_widget_class_bind_template_child (widget_class, GbpGrepPopover, whole_button);
   gtk_widget_class_bind_template_child (widget_class, GbpGrepPopover, case_button);
+  gtk_widget_class_bind_template_child (widget_class, GbpGrepPopover, recursive_button);
 }
 
 static void
diff --git a/src/plugins/grep/gbp-grep-popover.ui b/src/plugins/grep/gbp-grep-popover.ui
index 1027f4630..1e1cab7e3 100644
--- a/src/plugins/grep/gbp-grep-popover.ui
+++ b/src/plugins/grep/gbp-grep-popover.ui
@@ -47,6 +47,14 @@
             <property name="margin-top">6</property>
             <property name="orientation">vertical</property>
             <property name="visible">true</property>
+            <child>
+              <object class="GtkCheckButton" id="recursive_button">
+                <property name="active">true</property>
+                <property name="label" translatable="yes">Search _recursively through folders</property>
+                <property name="use-underline">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
             <child>
               <object class="GtkCheckButton" id="case_button">
                 <property name="label" translatable="yes">Match _case when searching</property>
@@ -64,7 +72,7 @@
             </child>
             <child>
               <object class="GtkCheckButton" id="regex_button">
-                <property name="label" translatable="yes">Allow _regular expressions</property>
+                <property name="label" translatable="yes">Allow regular _expressions</property>
                 <property name="use-underline">true</property>
                 <property name="visible">true</property>
               </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]