[gedit] Split menus-traditional to get a different gear menu on win and osx



commit 4a1732ea6fd948f981b6dbb93b7e514e83aba159
Author: Paolo Borelli <pborelli gnome org>
Date:   Tue Jul 29 17:16:12 2014 +0200

    Split menus-traditional to get a different gear menu on win and osx

 gedit/gedit-app.c                        |   16 +--
 gedit/resources/gedit.gresource.xml      |    1 +
 gedit/resources/gtk/menus-traditional.ui |  215 ++++++++++++++++++++++++++++++
 gedit/resources/gtk/menus.ui             |  140 +-------------------
 4 files changed, 224 insertions(+), 148 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 6edb091..a5bb53b 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -520,18 +520,10 @@ gedit_app_startup (GApplication *application)
                                         app);
 
        /* menus */
-       if (gtk_application_prefers_app_menu (GTK_APPLICATION (app)))
-       {
-               app->priv->window_menu = get_menu_model (app, "gear_menu_withappmenu");
-       }
-       else
-       {
-               app->priv->window_menu = get_menu_model (app, "gear_menu_noappmenu");
-       }
-
-       app->priv->notebook_menu = get_menu_model (app, "notebook_menu");
-       app->priv->tab_width_menu = get_menu_model (app, "tab_width_menu");
-       app->priv->line_col_menu = get_menu_model (app, "line_col_menu");
+       app->priv->window_menu = get_menu_model (app, "gear-menu");
+       app->priv->notebook_menu = get_menu_model (app, "notebook-menu");
+       app->priv->tab_width_menu = get_menu_model (app, "tab-width-menu");
+       app->priv->line_col_menu = get_menu_model (app, "line-col-menu");
 
        /* Accelerators */
        gtk_application_add_accelerator (GTK_APPLICATION (application),
diff --git a/gedit/resources/gedit.gresource.xml b/gedit/resources/gedit.gresource.xml
index 74432d0..9daccd5 100644
--- a/gedit/resources/gedit.gresource.xml
+++ b/gedit/resources/gedit.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/gedit">
     <file preprocess="xml-stripblanks">gtk/menus.ui</file>
+    <file preprocess="xml-stripblanks">gtk/menus-traditional.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-encodings-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-preferences-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-replace-dialog.ui</file>
diff --git a/gedit/resources/gtk/menus-traditional.ui b/gedit/resources/gtk/menus-traditional.ui
new file mode 100644
index 0000000..7a40a93
--- /dev/null
+++ b/gedit/resources/gtk/menus-traditional.ui
@@ -0,0 +1,215 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="gear-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">_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="notebook-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Move _Left</attribute>
+        <attribute name="action">move-left</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Move _Right</attribute>
+        <attribute name="action">move-right</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Move to New _Window</attribute>
+        <attribute name="action">move-to-new-window</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Move to New Tab _Group</attribute>
+        <attribute name="action">move-to-new-tab-group</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Close</attribute>
+        <attribute name="action">close</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="tab-width-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Automatic Indentation</attribute>
+        <attribute name="action">win.auto-indent</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label">2</attribute>
+        <attribute name="action">win.tab-width</attribute>
+        <attribute name="target" type="u">2</attribute>
+      </item>
+      <item>
+        <attribute name="label">4</attribute>
+        <attribute name="action">win.tab-width</attribute>
+        <attribute name="target" type="u">4</attribute>
+      </item>
+      <item>
+        <attribute name="label">8</attribute>
+        <attribute name="action">win.tab-width</attribute>
+        <attribute name="target" type="u">8</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Use Spaces</attribute>
+        <attribute name="action">win.use-spaces</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="line-col-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Display line numbers</attribute>
+        <attribute name="action">win.show-line-numbers</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Display right margin</attribute>
+        <attribute name="action">win.display-right-margin</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Highlight current line</attribute>
+        <attribute name="action">win.highlight-current-line</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Text wrapping</attribute>
+        <attribute name="action">win.wrap-mode</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
diff --git a/gedit/resources/gtk/menus.ui b/gedit/resources/gtk/menus.ui
index a9ac272..501ac42 100644
--- a/gedit/resources/gtk/menus.ui
+++ b/gedit/resources/gtk/menus.ui
@@ -32,7 +32,7 @@
       </item>
     </section>
   </menu>
-  <menu id="gear_menu_withappmenu">
+  <menu id="gear-menu">
     <section>
       <attribute name="id">juntion-section</attribute>
       <attribute name="display-hint">horizontal-buttons</attribute>
@@ -142,139 +142,7 @@
       </item>
     </section>
   </menu>
-  <menu id="gear_menu_noappmenu">
-    <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">_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="notebook_menu">
+  <menu id="notebook-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes">Move _Left</attribute>
@@ -302,7 +170,7 @@
       </item>
     </section>
   </menu>
-  <menu id="tab_width_menu">
+  <menu id="tab-width-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes">Automatic Indentation</attribute>
@@ -333,7 +201,7 @@
       </item>
     </section>
   </menu>
-  <menu id="line_col_menu">
+  <menu id="line-col-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes">Display line numbers</attribute>


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