[recipes] Set all app menus explicitly
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Set all app menus explicitly
- Date: Wed, 8 Mar 2017 11:01:11 +0000 (UTC)
commit b7aecccfeeb40a404edde0afc7ddedbaba192d9a
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Mar 7 18:16:43 2017 -0500
Set all app menus explicitly
It is a bit weird to rely on the heuristics in one case,
but not the other, so just explicitly set either a menubar
or an app menu.
src/gr-app.c | 23 ++++------
src/menus-appmenu.ui | 40 -----------------
src/menus-traditional.ui | 60 --------------------------
src/menus.ui | 96 ++++++++++++++++++++++++++++++++++++++++++
src/recipes-ui.gresource.xml | 5 +--
5 files changed, 107 insertions(+), 117 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index b45040b..587dd5f 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -35,9 +35,6 @@
#include "gr-utils.h"
#include "gr-recipe-exporter.h"
-#ifdef GDK_WINDOWING_QUARTZ
-#include <gdk/gdkquartz.h>
-#endif
struct _GrApp
{
@@ -365,21 +362,21 @@ gr_app_startup (GApplication *app)
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
accels[i].detailed_action,
accels[i].accelerators);
- }
-
-#ifdef GDK_WINDOWING_QUARTZ
- if (GDK_IS_QUARTZ_DISPLAY (gdk_display_get_default ())) {
- g_debug ("Not setting an app menu on OS X");
}
- else
-#endif
+
{
g_autoptr(GtkBuilder) builder = NULL;
GObject *menu;
- builder = gtk_builder_new_from_resource ("/org/gnome/Recipes/gtk/menus-appmenu.ui");
- menu = gtk_builder_get_object (builder, "app-menu");
- gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));
+ builder = gtk_builder_new_from_resource ("/org/gnome/Recipes/menus.ui");
+ if (strcmp (G_OBJECT_TYPE_NAME (gdk_display_get_default ()), "GdkQuartzDisplay") == 0) {
+ menu = gtk_builder_get_object (builder, "menubar");
+ gtk_application_set_menubar (GTK_APPLICATION (app), G_MENU_MODEL (menu));
+ }
+ else {
+ menu = gtk_builder_get_object (builder, "app-menu");
+ gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));
+ }
}
load_application_css (GR_APP (app));
diff --git a/src/menus.ui b/src/menus.ui
new file mode 100644
index 0000000..db79068
--- /dev/null
+++ b/src/menus.ui
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<interface domain="gnome-recipes">
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="app-menu">
+ <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>
+ <item>
+ <attribute name="label" translatable="yes">_Chef Information</attribute>
+ <attribute name="action">app.chef-information</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ <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>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ </item>
+ </section>
+ </menu>
+ <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 b32e762..1578e81 100644
--- a/src/recipes-ui.gresource.xml
+++ b/src/recipes-ui.gresource.xml
@@ -30,9 +30,6 @@
<file preprocess="xml-stripblanks">recipe-conflict-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-export-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-whats-new-dialog.ui</file>
- </gresource>
- <gresource prefix="/org/gnome/Recipes/gtk">
- <file preprocess="xml-stripblanks">menus-appmenu.ui</file>
- <file preprocess="xml-stripblanks">menus-traditional.ui</file>
+ <file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]