[gnome-builder/document-manager] editor: use ctrl+j to switch between vertical splits



commit 50db28d5ac218ef1507c2972b73cd73da735c09a
Author: Christian Hergert <christian hergert me>
Date:   Mon Dec 8 18:19:08 2014 -0800

    editor: use ctrl+j to switch between vertical splits

 src/editor/gb-editor-view.c           |   24 +++++++++++++++++++++++-
 src/editor/gb-editor-workspace.c      |   16 ----------------
 src/resources/keybindings/default.ini |    2 +-
 3 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index af2d64b..4af5586 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -21,6 +21,7 @@
 #include <glib/gi18n.h>
 
 #include "gb-editor-frame.h"
+#include "gb-editor-frame-private.h"
 #include "gb-editor-view.h"
 
 struct _GbEditorViewPrivate
@@ -153,7 +154,6 @@ gb_editor_view_split_button_toggled (GbEditorView    *view,
   gb_editor_view_toggle_split (view);
 }
 
-
 static void
 gb_editor_view_toggle_split_activate (GSimpleAction *action,
                                       GVariant      *parameter,
@@ -169,6 +169,27 @@ gb_editor_view_toggle_split_activate (GSimpleAction *action,
 }
 
 static void
+gb_editor_view_switch_pane (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       user_data)
+{
+  GbEditorView *view = user_data;
+
+  g_return_if_fail (GB_IS_EDITOR_VIEW (view));
+
+  if (!gtk_widget_has_focus (GTK_WIDGET (view->priv->frame->priv->source_view)))
+    gtk_widget_grab_focus (GTK_WIDGET (view->priv->frame));
+  else
+    {
+      GtkWidget *child2;
+
+      child2 = gtk_paned_get_child2 (view->priv->paned);
+      if (child2)
+        gtk_widget_grab_focus (child2);
+    }
+}
+
+static void
 gb_editor_view_grab_focus (GtkWidget *widget)
 {
   GbEditorView *view = (GbEditorView *)widget;
@@ -262,6 +283,7 @@ gb_editor_view_init (GbEditorView *self)
 {
   const GActionEntry entries[] = {
     { "toggle-split", gb_editor_view_toggle_split_activate },
+    { "switch-pane", gb_editor_view_switch_pane },
   };
   GSimpleActionGroup *actions;
 
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index beb054e..729ef74 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -300,21 +300,6 @@ open_tab (GSimpleAction *action,
   gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
-static void
-switch_pane_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_switch_pane (GB_EDITOR_TAB (tab));
-#endif
-}
-
 static GActionGroup *
 gb_editor_workspace_get_actions (GbWorkspace *workspace)
 {
@@ -390,7 +375,6 @@ gb_editor_workspace_init (GbEditorWorkspace *workspace)
       { "reformat", reformat_tab },
       { "preview", preview_tab },
       { "jump-to-doc", jump_to_doc_tab, "s" },
-      { "switch-pane", switch_pane_tab },
     };
 
   workspace->priv = gb_editor_workspace_get_instance_private (workspace);
diff --git a/src/resources/keybindings/default.ini b/src/resources/keybindings/default.ini
index bcb7e54..3684926 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -24,7 +24,6 @@ reformat = <Control><Shift>R
 save = <Control>S
 save-as = <Control><Shift>S
 preview = <Control><Alt>P
-switch-pane = <Control><Shift>K
 
 [editor-frame]
 scroll-up = <Control>Y
@@ -33,6 +32,7 @@ find = <Control><Shift>F
 
 [editor-view]
 toggle-split = <Control><Shift>J
+switch-pane = <Control>J
 
 [stack]
 close = <Control>W


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