[gnome-builder] hook up next/previous search result



commit 63c832aa0d8165b191fca2f80a6135e1774422f4
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 19 19:48:08 2015 -0700

    hook up next/previous search result

 data/ui/gb-editor-frame.ui           |    6 ++++--
 src/editor/gb-editor-frame-actions.c |   30 +++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/gb-editor-frame.ui b/data/ui/gb-editor-frame.ui
index 4b356a6..4e3d53b 100644
--- a/data/ui/gb-editor-frame.ui
+++ b/data/ui/gb-editor-frame.ui
@@ -58,8 +58,9 @@
                     </child>
                     <child>
                       <object class="GtkButton">
-                        <property name="visible">true</property>
+                        <property name="action-name">frame.previous-search-result</property>
                         <property name="can-focus">false</property>
+                        <property name="visible">true</property>
                         <style>
                           <class name="image-button"/>
                         </style>
@@ -74,8 +75,9 @@
                     </child>
                     <child>
                       <object class="GtkButton">
-                        <property name="visible">true</property>
+                        <property name="action-name">frame.next-search-result</property>
                         <property name="can-focus">false</property>
+                        <property name="visible">true</property>
                         <style>
                           <class name="image-button"/>
                         </style>
diff --git a/src/editor/gb-editor-frame-actions.c b/src/editor/gb-editor-frame-actions.c
index 25cd256..5214f8f 100644
--- a/src/editor/gb-editor-frame-actions.c
+++ b/src/editor/gb-editor-frame-actions.c
@@ -34,8 +34,36 @@ gb_editor_frame_actions_find (GSimpleAction *action,
   gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
 }
 
+static void
+gb_editor_frame_actions_next_search_result (GSimpleAction *action,
+                                            GVariant      *variant,
+                                            gpointer       user_data)
+{
+  GbEditorFrame *self = user_data;
+
+  g_assert (GB_IS_EDITOR_FRAME (self));
+
+  g_signal_emit_by_name (self->source_view, "move-search",
+                         GTK_DIR_DOWN, FALSE, FALSE, TRUE);
+}
+
+static void
+gb_editor_frame_actions_previous_search_result (GSimpleAction *action,
+                                                GVariant      *variant,
+                                                gpointer       user_data)
+{
+  GbEditorFrame *self = user_data;
+
+  g_assert (GB_IS_EDITOR_FRAME (self));
+
+  g_signal_emit_by_name (self->source_view, "move-search",
+                         GTK_DIR_UP, FALSE, FALSE, TRUE);
+}
+
 static const GActionEntry GbEditorFrameActions[] = {
-  { "find",     gb_editor_frame_actions_find },
+  { "find", gb_editor_frame_actions_find },
+  { "next-search-result", gb_editor_frame_actions_next_search_result },
+  { "previous-search-result", gb_editor_frame_actions_previous_search_result },
 };
 
 void


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