[gnome-builder] editor: add action to focus goto-line popover



commit 3bb4ed063f8b2fb74b51aa54acd0e178302c28ff
Author: Christian Hergert <christian hergert me>
Date:   Fri Sep 18 16:28:43 2015 -0700

    editor: add action to focus goto-line popover

 data/ui/gb-editor-view.ui           |    2 +-
 src/editor/gb-editor-view-actions.c |   13 +++++++++++++
 src/editor/gb-editor-view-private.h |    1 +
 src/editor/gb-editor-view.c         |    1 +
 4 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/gb-editor-view.ui b/data/ui/gb-editor-view.ui
index 23e608a..3d77c8f 100644
--- a/data/ui/gb-editor-view.ui
+++ b/data/ui/gb-editor-view.ui
@@ -98,7 +98,7 @@
               </object>
             </child>
             <child>
-              <object class="GtkMenuButton">
+              <object class="GtkMenuButton" id="goto_line_button">
                 <property name="popover">goto_line_popover</property>
                 <property name="focus-on-click">false</property>
                 <property name="visible">true</property>
diff --git a/src/editor/gb-editor-view-actions.c b/src/editor/gb-editor-view-actions.c
index 3cfd11a..7b2ba8e 100644
--- a/src/editor/gb-editor-view-actions.c
+++ b/src/editor/gb-editor-view-actions.c
@@ -735,10 +735,23 @@ gb_editor_view_actions_print (GSimpleAction *action,
   handle_print_result (self, GTK_PRINT_OPERATION (operation), result);
 }
 
+static void
+gb_editor_view_actions_goto_line (GSimpleAction *action,
+                                  GVariant      *param,
+                                  gpointer      user_data)
+{
+  GbEditorView *self = user_data;
+
+  g_assert (GB_IS_EDITOR_VIEW (self));
+
+  gtk_widget_activate (GTK_WIDGET (self->goto_line_button));
+}
+
 static GActionEntry GbEditorViewActions[] = {
   { "auto-indent", NULL, NULL, "false", gb_editor_view_actions_auto_indent },
   { "close", gb_editor_view_actions_close },
   { "find-other-file", gb_editor_view_actions_find_other_file },
+  { "goto-line", gb_editor_view_actions_goto_line },
   { "highlight-current-line", NULL, NULL, "false", gb_editor_view_actions_highlight_current_line },
   { "language", NULL, "s", "''", gb_editor_view_actions_language },
   { "preview", gb_editor_view_actions_preview },
diff --git a/src/editor/gb-editor-view-private.h b/src/editor/gb-editor-view-private.h
index 2229acf..596bdb2 100644
--- a/src/editor/gb-editor-view-private.h
+++ b/src/editor/gb-editor-view-private.h
@@ -48,6 +48,7 @@ struct _GbEditorView
   GtkProgressBar      *progress_bar;
   GtkMenuButton       *tweak_button;
   GbEditorTweakWidget *tweak_widget;
+  GtkMenuButton       *goto_line_button;
   GbSimplePopover     *goto_line_popover;
 };
 
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index 65ac03b..a32d811 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -753,6 +753,7 @@ gb_editor_view_class_init (GbEditorViewClass *klass)
   GB_WIDGET_CLASS_BIND (klass, GbEditorView, progress_bar);
   GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_button);
   GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_widget);
+  GB_WIDGET_CLASS_BIND (klass, GbEditorView, goto_line_button);
   GB_WIDGET_CLASS_BIND (klass, GbEditorView, goto_line_popover);
 
   g_type_ensure (GB_TYPE_EDITOR_FRAME);


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