[gedit/wip/redesign2] Handle merge of app menu into gear menu



commit 4d2b180f844ebd03ebb087872ed7eb9346637c9e
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Jan 6 22:22:44 2014 +0100

    Handle merge of app menu into gear menu

 gedit/gedit-window-private.h |    4 ++
 gedit/gedit-window.c         |   19 ++++++-
 gedit/gedit-window.ui        |  122 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 139 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index b462b2f..24515a8 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -65,6 +65,7 @@ struct _GeditWindowPrivate
 
        /* Widgets for fullscreen mode */
        GtkWidget      *fullscreen_controls;
+       GtkMenuButton  *fullscreen_gear_button;
        gboolean        fullscreen_controls_setup;
        guint           fullscreen_animation_timeout_id;
        gboolean        fullscreen_animation_enter;
@@ -88,7 +89,10 @@ struct _GeditWindowPrivate
        GtkWidget      *headerbar;
        GtkWidget      *open_button;
        GtkWidget      *open_menu;
+       GtkMenuButton  *gear_button;
        GMenuModel     *gear_menu;
+       GMenuModel     *gear_menu_win;
+       GMenuModel     *gear_menu_app;
 
        /* recent files */
 
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index c9061c1..e5309cf 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -425,7 +425,9 @@ gedit_window_class_init (GeditWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_headerbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, headerbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, open_menu);
-       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu_win);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu_app);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_panel);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, vpaned);
@@ -433,6 +435,7 @@ gedit_window_class_init (GeditWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, statusbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_controls);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_gear_button);
 }
 
 static void
@@ -2996,6 +2999,20 @@ gedit_window_init (GeditWindow *window)
 
        setup_headerbar_open_button (window);
 
+       if (_gedit_app_has_app_menu (GEDIT_APP (g_application_get_default ())))
+       {
+               window->priv->gear_menu = window->priv->gear_menu_win;
+       }
+       else
+       {
+               window->priv->gear_menu = window->priv->gear_menu_app;
+       }
+
+       gtk_menu_button_set_menu_model (window->priv->gear_button,
+                                       window->priv->gear_menu);
+       gtk_menu_button_set_menu_model (window->priv->fullscreen_gear_button,
+                                       window->priv->gear_menu);
+
        /* Setup status bar */
        setup_statusbar (window);
 
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index def2468..f7bc01c 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.8 -->
-  <menu id="gear_menu">
+  <menu id="gear_menu_win">
     <section>
       <attribute name="id">ext1</attribute>
     </section>
@@ -18,7 +18,6 @@
       <item>
         <attribute name="label" translatable="yes">Save _All</attribute>
         <attribute name="action">win.save_all</attribute>
-        <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;l</attribute>
       </item>
     </section>
     <section>
@@ -86,10 +85,12 @@
     </section>
     <section>
       <attribute name="id">ext12</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext13</attribute>
       <item>
         <attribute name="label" translatable="yes">_Close All</attribute>
         <attribute name="action">win.close_all</attribute>
-        <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;w</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">_Close</attribute>
@@ -97,6 +98,119 @@
       </item>
     </section>
   </menu>
+  <menu id="gear_menu_app">
+    <section>
+      <attribute name="id">ext1</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext2</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Reload</attribute>
+        <attribute name="action">win.revert</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Save As…</attribute>
+        <attribute name="action">win.save_as</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Save _All</attribute>
+        <attribute name="action">win.save_all</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext3</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext4</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Print…</attribute>
+        <attribute name="action">win.print</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext5</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext6</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Side _Panel</attribute>
+        <attribute name="action">win.side_panel</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
+        <attribute name="action">win.bottom_panel</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext7</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext8</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Find…</attribute>
+        <attribute name="action">win.find</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Find and Replace…</attribute>
+        <attribute name="action">win.replace</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Clear Highlight</attribute>
+        <attribute name="action">win.clear_highlight</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Go to Line…</attribute>
+        <attribute name="action">win.goto_line</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext9</attribute>
+    </section>
+    <section>
+      <attribute name="id">ext10</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Highlight Mode…</attribute>
+        <attribute name="action">win.highlight_mode</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext11</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext12</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Help</attribute>
+        <attribute name="action">app.help</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">ext13</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Close All</attribute>
+        <attribute name="action">win.close_all</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Close</attribute>
+        <attribute name="action">win.close</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Quit</attribute>
+        <attribute name="action">app.quit</attribute>
+      </item>
+    </section>
+  </menu>
   <template class="GeditWindow" parent="GtkWindow">
     <property name="can_focus">False</property>
     <property name="has_focus">False</property>
@@ -204,7 +318,6 @@
               <object class="GtkMenuButton" id="gear_button">
                 <property name="visible">True</property>
                 <property name="valign">center</property>
-                <property name="menu_model">gear_menu</property>
                 <style>
                   <class name="image-button"/>
                 </style>
@@ -386,7 +499,6 @@
           <object class="GtkMenuButton" id="fullscreen_gear_button">
             <property name="visible">True</property>
             <property name="valign">center</property>
-            <property name="menu_model">gear_menu</property>
             <style>
               <class name="image-button"/>
             </style>


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