[gnome-builder/editor-layout] add split window command



commit 4af431c19ef29de01a96899037e57ad92c72266e
Author: Christian Hergert <christian hergert me>
Date:   Sun Nov 30 16:12:04 2014 -0800

    add split window command

 src/editor/gb-editor-tab.c       |   11 +++++++++++
 src/editor/gb-editor-tab.h       |   17 +++++++++--------
 src/editor/gb-editor-workspace.c |   14 ++++++++++++++
 3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index 01a1687..5dd68d3 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -253,6 +253,17 @@ gb_editor_tab_open_file (GbEditorTab *tab,
   EXIT;
 }
 
+void
+gb_editor_tab_toggle_split (GbEditorTab *tab)
+{
+  gboolean active;
+
+  g_return_if_fail (GB_IS_EDITOR_TAB (tab));
+
+  active = gtk_toggle_button_get_active (tab->priv->split_button);
+  gtk_toggle_button_set_active (tab->priv->split_button, !active);
+}
+
 static void
 gb_editor_tab_on_frame_focused (GbEditorTab   *tab,
                                 GbEditorFrame *frame)
diff --git a/src/editor/gb-editor-tab.h b/src/editor/gb-editor-tab.h
index e526fdc..70d49ce 100644
--- a/src/editor/gb-editor-tab.h
+++ b/src/editor/gb-editor-tab.h
@@ -51,14 +51,15 @@ struct _GbEditorTabClass
   GbTabClass parent_class;
 };
 
-GbEditorTab *gb_editor_tab_new         (void);
-GType        gb_editor_tab_get_type    (void) G_GNUC_CONST;
-void         gb_editor_tab_save        (GbEditorTab *tab);
-void         gb_editor_tab_save_as     (GbEditorTab *tab);
-void         gb_editor_tab_open_file   (GbEditorTab *tab,
-                                        GFile       *file);
-void         gb_editor_tab_scroll_up   (GbEditorTab *tab);
-void         gb_editor_tab_scroll_down (GbEditorTab *tab);
+GbEditorTab *gb_editor_tab_new          (void);
+GType        gb_editor_tab_get_type     (void) G_GNUC_CONST;
+void         gb_editor_tab_save         (GbEditorTab *tab);
+void         gb_editor_tab_save_as      (GbEditorTab *tab);
+void         gb_editor_tab_open_file    (GbEditorTab *tab,
+                                         GFile       *file);
+void         gb_editor_tab_scroll_up    (GbEditorTab *tab);
+void         gb_editor_tab_scroll_down  (GbEditorTab *tab);
+void         gb_editor_tab_toggle_split (GbEditorTab *tab);
 
 G_END_DECLS
 
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index cc59ed6..16f906e 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -102,6 +102,19 @@ scroll_down_tab (GSimpleAction *action,
 }
 
 static void
+toggle_split_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_toggle_split (GB_EDITOR_TAB (tab));
+}
+
+static void
 close_tab (GSimpleAction *action,
            GVariant      *parameter,
            gpointer       user_data)
@@ -256,6 +269,7 @@ gb_editor_workspace_init (GbEditorWorkspace *workspace)
       { "save-as", save_as_tab },
       { "scroll-up", scroll_up_tab },
       { "scroll-down", scroll_down_tab },
+      { "toggle-split", toggle_split_tab },
     };
 
   workspace->priv = gb_editor_workspace_get_instance_private (workspace);


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