[gnome-builder/document-manager] GbEditorFrame: add reformat GAction



commit 9197fdf68df7d58494b16f00049749f729a64d41
Author: Christian Hergert <christian hergert me>
Date:   Mon Dec 8 18:21:59 2014 -0800

    GbEditorFrame: add reformat GAction

 src/editor/gb-editor-frame.c          |   13 +++++++++++++
 src/editor/gb-editor-workspace.c      |   16 ----------------
 src/resources/keybindings/default.ini |    6 +++---
 3 files changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 14ce46d..526bedd 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -942,6 +942,18 @@ gb_editor_frame_grab_focus (GtkWidget *widget)
 }
 
 static void
+gb_editor_frame_reformat_activate (GSimpleAction *action,
+                                   GVariant      *parameter,
+                                   gpointer       user_data)
+{
+  GbEditorFrame *frame = user_data;
+
+  g_return_if_fail (GB_IS_EDITOR_FRAME (frame));
+
+  gb_editor_frame_reformat (frame);
+}
+
+static void
 gb_editor_frame_scroll (GbEditorFrame    *frame,
                         GtkDirectionType  dir)
 {
@@ -1228,6 +1240,7 @@ gb_editor_frame_init (GbEditorFrame *self)
 {
   const GActionEntry entries[] = {
     { "find", gb_editor_frame_find_activate },
+    { "reformat", gb_editor_frame_reformat_activate },
     { "scroll-up", gb_editor_frame_scroll_up },
     { "scroll-down", gb_editor_frame_scroll_down },
   };
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index 729ef74..bfcfb6e 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -88,21 +88,6 @@ save_as_tab (GSimpleAction *action,
 }
 
 static void
-reformat_tab (GSimpleAction *action,
-              GVariant      *parameter,
-              gpointer       user_data)
-{
-#if 0
-  GbEditorWorkspace *workspace = user_data;
-  GbTab *tab;
-
-  tab = gb_tab_grid_get_active (workspace->priv->tab_grid);
-  if (GB_IS_EDITOR_TAB (tab))
-    gb_editor_tab_reformat (GB_EDITOR_TAB (tab));
-#endif
-}
-
-static void
 preview_tab (GSimpleAction *action,
              GVariant      *parameter,
              gpointer       user_data)
@@ -372,7 +357,6 @@ gb_editor_workspace_init (GbEditorWorkspace *workspace)
       { "open", open_tab },
       { "save", save_tab },
       { "save-as", save_as_tab },
-      { "reformat", reformat_tab },
       { "preview", preview_tab },
       { "jump-to-doc", jump_to_doc_tab, "s" },
     };
diff --git a/src/resources/keybindings/default.ini b/src/resources/keybindings/default.ini
index 3684926..e1fd59d 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -20,15 +20,15 @@ new-tab = <Control><Shift>T
 # I'd like open to not have an accelerator by default eventually. We will move
 # the majority of that feature to the global search making it unnecessary.
 open = <Control><Shift>O
-reformat = <Control><Shift>R
 save = <Control>S
 save-as = <Control><Shift>S
 preview = <Control><Alt>P
 
 [editor-frame]
-scroll-up = <Control>Y
-scroll-down = <Control>E
 find = <Control><Shift>F
+reformat = <Control><Shift>R
+scroll-down = <Control>E
+scroll-up = <Control>Y
 
 [editor-view]
 toggle-split = <Control><Shift>J


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