[gnome-builder/wip/libide-merge: 20/35] hook up save/close to view stack



commit 82c70ad3d2162bcc4d7a10b67df2b54aa99d8e48
Author: Christian Hergert <christian hergert me>
Date:   Wed Mar 18 20:54:54 2015 -0700

    hook up save/close to view stack

 data/keybindings/default.css        |    2 +-
 data/keybindings/emacs.css          |    2 +-
 data/keybindings/vim.css            |   12 ++++++------
 data/ui/gb-view-stack.ui            |   14 +++++++-------
 src/editor/gb-editor-tweak-widget.c |    2 +-
 src/editor/gb-editor-view-actions.c |    5 ++---
 src/views/gb-view-stack-actions.c   |    2 +-
 src/views/gb-view-stack.c           |    4 ++++
 8 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index ad33511..01a3e5c 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -4,7 +4,7 @@
   bind "<ctrl>comma" { "action" ("app", "preferences", "") };
   bind "<ctrl>f" { "action" ("frame", "find", "") };
   bind "<ctrl>period" { "action" ("workbench", "global-search", "") };
-  bind "<ctrl>s" { "action" ("editor-view", "save", "") };
+  bind "<ctrl>s" { "action" ("view", "save", "") };
 }
 
 IdeSourceViewMode.default {
diff --git a/data/keybindings/emacs.css b/data/keybindings/emacs.css
index 6c8b0e4..6706649 100644
--- a/data/keybindings/emacs.css
+++ b/data/keybindings/emacs.css
@@ -77,7 +77,7 @@
   bind "0" { "action" ("stack", "close", "") };
   bind "k" { "action" ("stack", "close", "") };
   bind "<ctrl>f" { "action" ("workspace", "open", "") };
-  bind "<ctrl>s" { "action" ("editor-view", "save", "") };
+  bind "<ctrl>s" { "action" ("view", "save", "") };
   bind "s" { "action" ("win", "save-all", "") };
   bind "b" { "action" ("workspace", "new-document", "") };
   bind "<ctrl>w" { "action" ("stack", "save-as", "") };
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index 3a2c0cc..36b94eb 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -91,7 +91,7 @@
 
   bind "<ctrl>comma" { "action" ("app", "preferences", "") };
   bind "<ctrl>period" { "action" ("workbench", "global-search", "") };
-  bind "<ctrl>s" { "action" ("editor-view", "save", "") };
+  bind "<ctrl>s" { "action" ("view", "save", "") };
 }
 
 @binding-set builder-vim-source-view-normal-with-count
@@ -896,13 +896,13 @@
 
 @binding-set builder-vim-source-view-normal-ctrl-w
 {
-  bind "v" { "action" ("view", "split-left", "") "grab_focus" () };
-  bind "<ctrl>v" { "action" ("view", "split-left", "") "grab_focus" () };
+  bind "v" { "action" ("view-stack", "split-left", "") "grab_focus" () };
+  bind "<ctrl>v" { "action" ("view-stack", "split-left", "") "grab_focus" () };
 
-  bind "c" { "action" ("view", "close", "") };
-  bind "<ctrl>c" { "action" ("view", "close", "") };
+  bind "c" { "action" ("view-stack", "close", "") };
+  bind "<ctrl>c" { "action" ("view-stack", "close", "") };
 
-  bind "s" { "action" ("view", "split-down", "true") };
+  bind "s" { "action" ("view-stack", "split-down", "true") };
 }
 
 @binding-set builder-vim-source-view-visual-line-g
diff --git a/data/ui/gb-view-stack.ui b/data/ui/gb-view-stack.ui
index 4c013e7..606ad70 100644
--- a/data/ui/gb-view-stack.ui
+++ b/data/ui/gb-view-stack.ui
@@ -83,7 +83,7 @@
                 </child>
                 <child>
                   <object class="GtkButton">
-                    <property name="action-name">view.close</property>
+                    <property name="action-name">view-stack.close</property>
                     <property name="visible">true</property>
                     <style>
                       <class name="dim-label"/>
@@ -155,7 +155,7 @@
                 <child>
                   <object class="GtkButton">
                     <property name="visible">true</property>
-                    <property name="action-name">view.split-left</property>
+                    <property name="action-name">view-stack.split-left</property>
                     <style>
                       <class name="image-button"/>
                     </style>
@@ -170,7 +170,7 @@
                 <child>
                   <object class="GtkButton">
                     <property name="visible">true</property>
-                    <property name="action-name">view.split-right</property>
+                    <property name="action-name">view-stack.split-right</property>
                     <style>
                       <class name="image-button"/>
                     </style>
@@ -187,7 +187,7 @@
             <child>
               <object class="GtkToggleButton">
                 <property name="visible">true</property>
-                <property name="action-name">view.split-down</property>
+                <property name="action-name">view-stack.split-down</property>
                 <style>
                   <class name="image-button"/>
                 </style>
@@ -223,7 +223,7 @@
                 </style>
                 <child>
                   <object class="GtkButton">
-                    <property name="action-name">view.move-left</property>
+                    <property name="action-name">view-stack.move-left</property>
                     <property name="hexpand">true</property>
                     <property name="visible">true</property>
                     <style>
@@ -239,7 +239,7 @@
                 </child>
                 <child>
                   <object class="GtkButton">
-                    <property name="action-name">view.move-right</property>
+                    <property name="action-name">view-stack.move-right</property>
                     <property name="hexpand">true</property>
                     <property name="visible">true</property>
                     <style>
@@ -285,7 +285,7 @@
           <object class="GtkModelButton">
             <property name="halign">fill</property>
             <property name="hexpand">true</property>
-            <property name="action-name">view.close</property>
+            <property name="action-name">view-stack.close</property>
             <property name="text" translatable="yes">Close</property>
             <property name="visible">true</property>
           </object>
diff --git a/src/editor/gb-editor-tweak-widget.c b/src/editor/gb-editor-tweak-widget.c
index b94a87d..f498808 100644
--- a/src/editor/gb-editor-tweak-widget.c
+++ b/src/editor/gb-editor-tweak-widget.c
@@ -108,7 +108,7 @@ gb_editor_tweak_widget_row_activated (GbEditorTweakWidget *self,
     {
       lang_id = gtk_source_language_get_id (lang);
       param = g_variant_new_string (lang_id);
-      gb_widget_activate_action (GTK_WIDGET (self), "editor-view", "language", param);
+      gb_widget_activate_action (GTK_WIDGET (self), "view", "language", param);
     }
 }
 
diff --git a/src/editor/gb-editor-view-actions.c b/src/editor/gb-editor-view-actions.c
index a271898..cee477b 100644
--- a/src/editor/gb-editor-view-actions.c
+++ b/src/editor/gb-editor-view-actions.c
@@ -246,9 +246,8 @@ gb_editor_view_actions_init (GbEditorView *self)
   group = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (group), GbEditorViewActions,
                                    G_N_ELEMENTS (GbEditorViewActions), self);
-  gtk_widget_insert_action_group (GTK_WIDGET (self), "editor-view", G_ACTION_GROUP (group));
-  gtk_widget_insert_action_group (GTK_WIDGET (self->tweak_widget), "editor-view",
-                                  G_ACTION_GROUP (group));
+  gtk_widget_insert_action_group (GTK_WIDGET (self), "view", G_ACTION_GROUP (group));
+  gtk_widget_insert_action_group (GTK_WIDGET (self->tweak_widget), "view", G_ACTION_GROUP (group));
 
 #define WATCH_PROPERTY(name) \
   G_STMT_START { \
diff --git a/src/views/gb-view-stack-actions.c b/src/views/gb-view-stack-actions.c
index 1661544..7f1cafe 100644
--- a/src/views/gb-view-stack-actions.c
+++ b/src/views/gb-view-stack-actions.c
@@ -193,5 +193,5 @@ gb_view_stack_actions_init (GbViewStack *self)
   actions = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (actions), gGbViewStackActions,
                                    G_N_ELEMENTS (gGbViewStackActions), self);
-  gtk_widget_insert_action_group (GTK_WIDGET (self), "view", G_ACTION_GROUP (actions));
+  gtk_widget_insert_action_group (GTK_WIDGET (self), "view-stack", G_ACTION_GROUP (actions));
 }
diff --git a/src/views/gb-view-stack.c b/src/views/gb-view-stack.c
index ff3e25b..8508ad7 100644
--- a/src/views/gb-view-stack.c
+++ b/src/views/gb-view-stack.c
@@ -339,6 +339,7 @@ gb_view_stack_set_active_view (GbViewStack *self,
         {
           GtkWidget *controls;
           GBinding *binding;
+          GActionGroup *group;
 
           self->focus_history = g_list_prepend (self->focus_history, active_view);
           if (active_view != gtk_stack_get_visible_child (self->stack))
@@ -354,6 +355,9 @@ gb_view_stack_set_active_view (GbViewStack *self,
               gtk_stack_set_visible_child (self->controls_stack, controls);
               gtk_widget_show (GTK_WIDGET (self->controls_stack));
             }
+          group = gtk_widget_get_action_group (active_view, "view");
+          if (group)
+            gtk_widget_insert_action_group (GTK_WIDGET (self), "view", group);
         }
 
       g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_ACTIVE_VIEW]);


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