[gnome-builder] menus: move app-menu to gear-menu



commit 20ba72d401e4d430683faab7c0da87956ff84ba2
Author: Christian Hergert <chergert redhat com>
Date:   Sat Sep 15 16:01:43 2018 -0700

    menus: move app-menu to gear-menu
    
    This is part of our work for 3.32. It's not done, but it moves a number
    of items to the window menu and starts dropping support for the app-menu.

 src/libide/greeter/ide-greeter-perspective.ui    | 20 ++++++++--
 src/libide/gtk/menus.ui                          | 50 ++++++++++++------------
 src/libide/workbench/ide-workbench-actions.c     | 14 +++++++
 src/libide/workbench/ide-workbench-header-bar.ui | 20 ++++++----
 src/plugins/support/gtk/menus.ui                 |  4 +-
 5 files changed, 71 insertions(+), 37 deletions(-)
---
diff --git a/src/libide/greeter/ide-greeter-perspective.ui b/src/libide/greeter/ide-greeter-perspective.ui
index 16f90abed..3cf112e1d 100644
--- a/src/libide/greeter/ide-greeter-perspective.ui
+++ b/src/libide/greeter/ide-greeter-perspective.ui
@@ -243,7 +243,7 @@
         </child>
       </object>
       <packing>
-        <property name="position">1</property>
+        <property name="position">2</property>
         <property name="pack-type">end</property>
       </packing>
     </child>
@@ -257,7 +257,7 @@
         </style>
       </object>
       <packing>
-        <property name="position">0</property>
+        <property name="position">1</property>
         <property name="pack-type">end</property>
       </packing>
     </child>
@@ -270,8 +270,22 @@
         </style>
       </object>
       <packing>
-        <property name="position">0</property>
+        <property name="position">1</property>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
+    <child>
+      <object class="DzlMenuButton" id="gear_button">
+        <property name="icon-name">open-menu-symbolic</property>
+        <property name="visible">true</property>
+        <property name="menu-id">gear-menu</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+      </object>
+      <packing>
         <property name="pack-type">end</property>
+        <property name="position">0</property>
       </packing>
     </child>
   </object>
diff --git a/src/libide/gtk/menus.ui b/src/libide/gtk/menus.ui
index 7dbcefdf7..8ce4b746e 100644
--- a/src/libide/gtk/menus.ui
+++ b/src/libide/gtk/menus.ui
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <menu id="app-menu">
-    <section id="app-menu-project-section">
+  <menu id="gear-menu">
+    <section id="gear-menu-project-section">
       <item>
         <attribute name="label" translatable="yes">_New Project</attribute>
         <attribute name="action">app.new-project</attribute>
@@ -16,15 +16,33 @@
         <attribute name="action">app.clone</attribute>
       </item>
     </section>
-    <section id="app-menu-placeholder-1"/>
-    <section id="app-menu-preferences-section">
+    <section id="gear-menu-save-section">
+      <item>
+        <attribute name="label" translatable="yes">Save _All</attribute>
+        <attribute name="action">win.save-all</attribute>
+        <attribute name="accel">&lt;primary&gt;&lt;alt&gt;s</attribute>
+      </item>
+    </section>
+    <section id="gear-menu-close-section">
+      <item>
+        <attribute name="label" translatable="yes">Close _All</attribute>
+        <attribute name="action">editor.close-all</attribute>
+        <attribute name="accel">&lt;primary&gt;&lt;shift&gt;w</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Close Project</attribute>
+        <attribute name="action">win.close-project</attribute>
+      </item>
+    </section>
+    <section id="gear-menu-placeholder-1"/>
+    <section id="gear-menu-preferences-section">
       <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
     </section>
-    <section id="app-menu-placeholder-2"/>
-    <section id="app-menu-help-section">
+    <section id="gear-menu-placeholder-2"/>
+    <section id="gear-menu-help-section">
       <attribute name="id">help-section</attribute>
       <item>
         <attribute name="label" translatable="yes">Keyboard _Shortcuts</attribute>
@@ -38,6 +56,8 @@
         <attribute name="label" translatable="yes">_About</attribute>
         <attribute name="action">app.about</attribute>
       </item>
+    </section>
+    <section id="gear-menu-quit-section">
       <item>
         <attribute name="label" translatable="yes">_Quit</attribute>
         <attribute name="action">app.quit</attribute>
@@ -67,24 +87,6 @@
       </item>
     </section>
   </menu>
-  <menu id="pages-menu">
-    <section id="pages-menu-save-section">
-      <item>
-        <attribute name="label" translatable="yes">Save _All</attribute>
-        <attribute name="action">win.save-all</attribute>
-        <attribute name="accel">&lt;primary&gt;&lt;alt&gt;s</attribute>
-      </item>
-    </section>
-    <section id="pages-menu-close-section">
-      <item>
-        <attribute name="label" translatable="yes">Close _All</attribute>
-        <attribute name="action">editor.close-all</attribute>
-        <attribute name="accel">&lt;primary&gt;&lt;shift&gt;w</attribute>
-      </item>
-    </section>
-  </menu>
-  <menu id="gear-menu">
-  </menu>
   <menu id="ide-source-view-popup-menu">
     <section id="ide-source-view-popup-menu-jump-section">
       <item>
diff --git a/src/libide/workbench/ide-workbench-actions.c b/src/libide/workbench/ide-workbench-actions.c
index a76514a79..f46ad7b67 100644
--- a/src/libide/workbench/ide-workbench-actions.c
+++ b/src/libide/workbench/ide-workbench-actions.c
@@ -302,6 +302,19 @@ ide_workbench_actions_update_dependencies (GSimpleAction *action,
                               self);
 }
 
+static void
+ide_workbench_actions_close_project (GSimpleAction *action,
+                                     GVariant      *variant,
+                                     gpointer       user_data)
+{
+  IdeWorkbench *self = user_data;
+
+  g_assert (G_IS_SIMPLE_ACTION (action));
+  g_assert (IDE_IS_WORKBENCH (self));
+
+  gtk_window_close (GTK_WINDOW (self));
+}
+
 void
 ide_workbench_actions_init (IdeWorkbench *self)
 {
@@ -315,6 +328,7 @@ ide_workbench_actions_init (IdeWorkbench *self)
     { "counters", ide_workbench_actions_counters },
     { "inspector", ide_workbench_actions_inspector },
     { "update-dependencies", ide_workbench_actions_update_dependencies },
+    { "close-project", ide_workbench_actions_close_project },
   };
 
   g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), self);
diff --git a/src/libide/workbench/ide-workbench-header-bar.ui 
b/src/libide/workbench/ide-workbench-header-bar.ui
index 8f5966612..66cdbc308 100644
--- a/src/libide/workbench/ide-workbench-header-bar.ui
+++ b/src/libide/workbench/ide-workbench-header-bar.ui
@@ -53,36 +53,40 @@
               </object>
             </child>
             <child>
-              <object class="GtkMenuButton" id="menu_button">
-                <property name="tooltip-text" translatable="yes">Show workbench menu</property>
+              <object class="GtkToggleButton" id="fullscreen_button">
+                <property name="action-name">win.fullscreen</property>
                 <property name="focus-on-click">false</property>
                 <property name="visible">true</property>
                 <style>
                   <class name="image-button"/>
                 </style>
                 <child>
-                  <object class="GtkImage">
-                    <property name="icon-name">open-menu-symbolic</property>
+                  <object class="GtkImage" id="fullscreen_image">
+                    <property name="icon-name">view-fullscreen-symbolic</property>
                     <property name="visible">true</property>
                   </object>
                 </child>
               </object>
             </child>
             <child>
-              <object class="GtkToggleButton" id="fullscreen_button">
-                <property name="action-name">win.fullscreen</property>
+              <object class="GtkMenuButton" id="menu_button">
+                <property name="tooltip-text" translatable="yes">Show workbench menu</property>
                 <property name="focus-on-click">false</property>
                 <property name="visible">true</property>
                 <style>
                   <class name="image-button"/>
                 </style>
                 <child>
-                  <object class="GtkImage" id="fullscreen_image">
-                    <property name="icon-name">view-fullscreen-symbolic</property>
+                  <object class="GtkImage">
+                    <property name="icon-name">open-menu-symbolic</property>
                     <property name="visible">true</property>
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="priority">-100001</property>
+                <property name="pack-type">end</property>
+              </packing>
             </child>
           </object>
           <packing>
diff --git a/src/plugins/support/gtk/menus.ui b/src/plugins/support/gtk/menus.ui
index c222d4107..35d19c2ef 100644
--- a/src/plugins/support/gtk/menus.ui
+++ b/src/plugins/support/gtk/menus.ui
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <menu id="app-menu">
-    <section id="app-menu-placeholder-2">
+  <menu id="gear-menu">
+    <section id="gear-menu-placeholder-2">
       <item>
         <attribute name="label" translatable="yes">Generate Support Log</attribute>
         <attribute name="action">app.generate-support</attribute>


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