[gnome-builder] keybindings: add <Control><Shift>K to switch between split panes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] keybindings: add <Control><Shift>K to switch between split panes
- Date: Tue, 2 Dec 2014 21:43:17 +0000 (UTC)
commit e6a448b35490c3c04a01dd0f74ef81963172f9fe
Author: Christian Hergert <christian hergert me>
Date: Tue Dec 2 03:22:05 2014 -0800
keybindings: add <Control><Shift>K to switch between split panes
src/editor/gb-editor-tab.c | 27 +++++++++++++++++++++++++++
src/editor/gb-editor-tab.h | 1 +
src/editor/gb-editor-workspace.c | 14 ++++++++++++++
src/resources/keybindings/default.ini | 1 +
4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index 70f7e55..8d57362 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -572,6 +572,33 @@ gb_editor_tab_reformat (GbEditorTab *tab)
gb_editor_frame_reformat (frame);
}
+void
+gb_editor_tab_switch_pane (GbEditorTab *tab)
+{
+ GbEditorFrame *last_frame;
+ GtkWidget *frame1;
+ GtkWidget *frame2;
+
+ ENTRY;
+
+ g_return_if_fail (GB_IS_EDITOR_TAB (tab));
+
+ frame1 = GTK_WIDGET (tab->priv->frame);
+ frame2 = gtk_paned_get_child2 (tab->priv->paned);
+
+ if (!frame2)
+ return;
+
+ last_frame = gb_editor_tab_get_last_frame (tab);
+
+ if (last_frame == (GbEditorFrame *)frame1)
+ gtk_widget_grab_focus (frame2);
+ else
+ gtk_widget_grab_focus (frame1);
+
+ EXIT;
+}
+
static gboolean
markdown_preview_title (GBinding *binding,
const GValue *from_value,
diff --git a/src/editor/gb-editor-tab.h b/src/editor/gb-editor-tab.h
index 6013923..48c5848 100644
--- a/src/editor/gb-editor-tab.h
+++ b/src/editor/gb-editor-tab.h
@@ -60,6 +60,7 @@ void gb_editor_tab_open_file (GbEditorTab *tab,
void gb_editor_tab_scroll_up (GbEditorTab *tab);
void gb_editor_tab_scroll_down (GbEditorTab *tab);
void gb_editor_tab_toggle_split (GbEditorTab *tab);
+void gb_editor_tab_switch_pane (GbEditorTab *tab);
void gb_editor_tab_find (GbEditorTab *tab);
void gb_editor_tab_reformat (GbEditorTab *tab);
void gb_editor_tab_scroll_to_line (GbEditorTab *tab,
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index 45015a7..6858aa0 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -314,6 +314,19 @@ open_tab (GSimpleAction *action,
gtk_widget_destroy (GTK_WIDGET (dialog));
}
+static void
+switch_pane_tab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ 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));
+}
+
static GActionGroup *
gb_editor_workspace_get_actions (GbWorkspace *workspace)
{
@@ -380,6 +393,7 @@ 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 280b778..d27c623 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -29,6 +29,7 @@ preview = <Control><Alt>P
scroll-up = <Control>Y
scroll-down = <Control>E
toggle-split = <Control><Shift>J
+switch-pane = <Control><Shift>K
[tabs]
next = <Control>J
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]