[gnome-builder] editor: implement shortcuts for up/down arrow



commit 8cab5caaa274cc8703531d220a69670d0d156125
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 25 18:39:55 2017 -0700

    editor: implement shortcuts for up/down arrow

 libide/editor/ide-editor-private.h              |    1 +
 libide/editor/ide-editor-search-bar-shortcuts.c |   42 +++++++++++++++++++++++
 libide/editor/ide-editor-search-bar.c           |    1 +
 libide/meson.build                              |    1 +
 4 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/libide/editor/ide-editor-private.h b/libide/editor/ide-editor-private.h
index b595eef..5198162 100644
--- a/libide/editor/ide-editor-private.h
+++ b/libide/editor/ide-editor-private.h
@@ -111,6 +111,7 @@ void _ide_editor_view_init_settings          (IdeEditorView        *self);
 void _ide_editor_view_init_shortcuts         (IdeEditorView        *self);
 void _ide_editor_view_update_actions         (IdeEditorView        *self);
 void _ide_editor_search_bar_init_actions     (IdeEditorSearchBar   *self);
+void _ide_editor_search_bar_init_shortcuts   (IdeEditorSearchBar   *self);
 void _ide_editor_sidebar_set_open_pages      (IdeEditorSidebar     *self,
                                               GListModel           *open_pages);
 void _ide_editor_perspective_show_properties (IdeEditorPerspective *self,
diff --git a/libide/editor/ide-editor-search-bar-shortcuts.c b/libide/editor/ide-editor-search-bar-shortcuts.c
new file mode 100644
index 0000000..6dcfd4a
--- /dev/null
+++ b/libide/editor/ide-editor-search-bar-shortcuts.c
@@ -0,0 +1,42 @@
+/* ide-editor-search-bar-shortcuts.c
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-editor-search-bar-shortcuts"
+
+#include "editor/ide-editor-private.h"
+#include "editor/ide-editor-search-bar.h"
+
+void
+_ide_editor_search_bar_init_shortcuts (IdeEditorSearchBar *self)
+{
+  DzlShortcutController *controller;
+
+  controller = dzl_shortcut_controller_find (GTK_WIDGET (self));
+
+  dzl_shortcut_controller_add_command_action (controller,
+                                              "org.gnome.builder.editor.search-bar.move-next",
+                                              "Down",
+                                              DZL_SHORTCUT_PHASE_BUBBLE,
+                                              "editor-view.move-next-search-result");
+
+  dzl_shortcut_controller_add_command_action (controller,
+                                              "org.gnome.builder.editor.search-bar.move-previous",
+                                              "Up",
+                                              DZL_SHORTCUT_PHASE_BUBBLE,
+                                              "editor-view.move-previous-search-result");
+}
diff --git a/libide/editor/ide-editor-search-bar.c b/libide/editor/ide-editor-search-bar.c
index 2009528..78fbcaa 100644
--- a/libide/editor/ide-editor-search-bar.c
+++ b/libide/editor/ide-editor-search-bar.c
@@ -630,6 +630,7 @@ ide_editor_search_bar_init (IdeEditorSearchBar *self)
                             self);
 
   _ide_editor_search_bar_init_actions (self);
+  _ide_editor_search_bar_init_shortcuts (self);
 }
 
 GtkWidget *
diff --git a/libide/meson.build b/libide/meson.build
index 5afabf0..f697bf2 100644
--- a/libide/meson.build
+++ b/libide/meson.build
@@ -485,6 +485,7 @@ libide_sources = libide_generated_headers + libide_public_sources + [
   'editor/ide-editor-properties.h',
   'editor/ide-editor-search-bar.c',
   'editor/ide-editor-search-bar-actions.c',
+  'editor/ide-editor-search-bar-shortcuts.c',
   'editor/ide-editor-search-bar.h',
   'editor/ide-editor-view-actions.c',
   'editor/ide-editor-view-settings.c',


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