[recipes] Add a more traditional menubar on OS X



commit 9c0aa4de7eb2ef3bd376e1eb44599e92b45bae04
Author: Matthias Clasen <mclasen Matthiass-MBP home>
Date:   Mon Mar 6 18:13:57 2017 -0500

    Add a more traditional menubar on OS X
    
    GtkApplication has relatively good support for setting
    this up in a way that does not interfere with the app
    menu in GNOME, so lets try this.

 src/gr-app.c                       |    8 ++--
 src/{menus.ui => menus-appmenu.ui} |    0
 src/menus-traditional.ui           |   60 ++++++++++++++++++++++++++++++++++++
 src/recipes-ui.gresource.xml       |    3 +-
 4 files changed, 66 insertions(+), 5 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 25392a1..6d04b3c 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -332,7 +332,8 @@ load_application_css (GrApp *app)
 static void
 gr_app_startup (GApplication *app)
 {
-        const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
+        const gchar *quit_accels[2] = { "<Primary>Q", NULL };
+        const gchar *search_accels[2] = { "<Primary>F", NULL };
 
         G_APPLICATION_CLASS (gr_app_parent_class)->startup (app);
 
@@ -349,9 +350,8 @@ gr_app_startup (GApplication *app)
         }
 #endif
 
-        gtk_application_set_accels_for_action (GTK_APPLICATION (app),
-                                               "app.quit",
-                                               quit_accels);
+        gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
+        gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.search('')", search_accels);
 
         load_application_css (GR_APP (app));
 }
diff --git a/src/menus.ui b/src/menus-appmenu.ui
similarity index 100%
rename from src/menus.ui
rename to src/menus-appmenu.ui
diff --git a/src/menus-traditional.ui b/src/menus-traditional.ui
new file mode 100644
index 0000000..b87c986
--- /dev/null
+++ b/src/menus-traditional.ui
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<interface domain="gnome-recipes">
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="menubar">
+    <submenu>
+      <attribute name="label" translatable="yes">File</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Import</attribute>
+          <attribute name="action">app.import</attribute>
+          <attribute name="hidden-when">action-disabled</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Export All</attribute>
+          <attribute name="action">app.export</attribute>
+          <attribute name="hidden-when">action-disabled</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Chef Information…</attribute>
+          <attribute name="action">app.chef-information</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">Edit</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Copy</attribute>
+          <attribute name="action">app.copy</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Paste</attribute>
+          <attribute name="action">app.paste</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Find…</attribute>
+          <attribute name="action">app.search</attribute>
+          <attribute name="target"></attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">Help</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_What’s New</attribute>
+          <attribute name="action">app.news</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Report Issue</attribute>
+          <attribute name="action">app.report-issue</attribute>
+        </item>
+      </section>
+    </submenu>
+  </menu>
+</interface>
diff --git a/src/recipes-ui.gresource.xml b/src/recipes-ui.gresource.xml
index d63687c..b32e762 100644
--- a/src/recipes-ui.gresource.xml
+++ b/src/recipes-ui.gresource.xml
@@ -32,6 +32,7 @@
     <file preprocess="xml-stripblanks">recipe-whats-new-dialog.ui</file>
   </gresource>
   <gresource prefix="/org/gnome/Recipes/gtk">
-    <file preprocess="xml-stripblanks">menus.ui</file>
+    <file preprocess="xml-stripblanks">menus-appmenu.ui</file>
+    <file preprocess="xml-stripblanks">menus-traditional.ui</file>
   </gresource>
 </gresources>


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