[gedit/wip/menus] Use menubar only for OSX and Unity



commit 740cf4a51206145f955412e9386fde7f16e29760
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Mar 30 23:31:38 2016 +0200

    Use menubar only for OSX and Unity
    
    They are the only 2 cases where a menubar might work but on
    the other cases a menubar will be shown between the sidebar and
    the normal window behaving really weird.

 gedit/gedit-app.c                        |   16 +++-
 gedit/resources/gtk/menus-traditional.ui |  136 ++++++++++++++++++++++++++++++
 2 files changed, 150 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index c3a0a47..e21b3bd 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -765,6 +765,9 @@ gedit_app_startup (GApplication *application)
        const gchar *cache_dir;
        gchar *metadata_filename;
 #endif
+#ifndef OS_OSX
+       const gchar *current_desktop;
+#endif
 
        priv = gedit_app_get_instance_private (GEDIT_APP (application));
 
@@ -797,7 +800,16 @@ gedit_app_startup (GApplication *application)
                                         application);
 
        /* menus */
-       priv->hamburger_menu = get_menu_model (GEDIT_APP (application), "hamburger-menu");
+#ifndef OS_OSX
+       /* We will use a menubar with osx or unity */
+       current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
+       if (current_desktop == NULL ||
+           g_ascii_strcasecmp (current_desktop, "Unity") != 0)
+       {
+               priv->hamburger_menu = get_menu_model (GEDIT_APP (application),
+                                                      "hamburger-menu");
+       }
+#endif
        priv->notebook_menu = get_menu_model (GEDIT_APP (application), "notebook-menu");
        priv->tab_width_menu = get_menu_model (GEDIT_APP (application), "tab-width-menu");
        priv->line_col_menu = get_menu_model (GEDIT_APP (application), "line-col-menu");
@@ -1920,7 +1932,7 @@ _gedit_app_get_line_col_menu (GeditApp *app)
 
 GeditMenuExtension *
 _gedit_app_extend_menu (GeditApp    *app,
-                       const gchar *extension_point)
+                        const gchar *extension_point)
 {
        GeditAppPrivate *priv;
        GMenuModel *model;
diff --git a/gedit/resources/gtk/menus-traditional.ui b/gedit/resources/gtk/menus-traditional.ui
index 6c8ef99..e7a9c77 100644
--- a/gedit/resources/gtk/menus-traditional.ui
+++ b/gedit/resources/gtk/menus-traditional.ui
@@ -1,6 +1,142 @@
 <?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <menu id="hamburger-menu">
+    <section>
+      <attribute name="id">juntion-section</attribute>
+      <attribute name="display-hint">horizontal-buttons</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Reload</attribute>
+        <attribute name="action">win.revert</attribute>
+        <attribute name="verb-icon">view-refresh-symbolic</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Print…</attribute>
+        <attribute name="action">win.print</attribute>
+        <attribute name="verb-icon">printer-symbolic</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+        <attribute name="verb-icon">view-fullscreen-symbolic</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">file-section</attribute>
+    </section>
+    <section>
+      <attribute name="id">file-section-1</attribute>
+      <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">edit-section</attribute>
+    </section>
+    <section>
+      <attribute name="id">edit-section-1</attribute>
+    </section>
+    <section>
+      <attribute name="id">search-section</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>
+      <submenu>
+        <attribute name="label" translatable="yes">View</attribute>
+        <section>
+          <attribute name="id">view-section</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>
+            <attribute name="hidden-when">action-disabled</attribute>
+          </item>
+        </section>
+        <section>
+          <attribute name="id">view-section-1</attribute>
+        </section>
+        <section>
+          <attribute name="id">view-section-2</attribute>
+          <item>
+            <attribute name="label" translatable="yes">_Highlight Mode…</attribute>
+            <attribute name="action">win.highlight-mode</attribute>
+          </item>
+        </section>
+      </submenu>
+      <submenu>
+        <attribute name="label" translatable="yes">Tools</attribute>
+        <section>
+          <attribute name="id">spell-section</attribute>
+        </section>
+        <section>
+          <attribute name="id">tools-section</attribute>
+        </section>
+        <section>
+          <attribute name="id">tools-section-1</attribute>
+        </section>
+      </submenu>
+    </section>
+    <section>
+      <attribute name="id">preferences-section</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">help-section</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        <attribute name="action">app.shortcuts</attribute>
+      </item>
+      <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">close-section</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>
   <menu id="menubar">
     <section>
       <submenu>


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