[geary] Use GtkApplication built-in for loading app menu.



commit a3e0e474e770cb79f0e5e65b8a79bb161a5c635b
Author: Michael James Gratton <mike vee net>
Date:   Sun Sep 25 01:05:29 2016 +1000

    Use GtkApplication built-in for loading app menu.
    
    * src/client/application/geary-application.vala (GearyApplication): Set
      the resource_base_path to comply with the expected modern app id, so
      the app menu will be automatically loaded.
    
    * ui/CMakeLists.txt: Replace app_menu.interface with gtk/menus.ui. Don't
      try ot copy interface files now that there aren't any.
    
    * gtk/menus.ui: Replaces app_menu.interface.

 src/client/application/geary-application.vala |    6 ++-
 ui/CMakeLists.txt                             |    4 +-
 ui/app_menu.interface                         |   30 -------------------
 ui/gtk/menus.ui                               |   38 +++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 34 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index da5ff3e..0bc1408 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -88,8 +88,10 @@ public class GearyApplication : Gtk.Application {
     private bool is_destroyed = false;
 
     public GearyApplication() {
-        Object(application_id: APP_ID);
-
+        Object(
+            application_id: APP_ID,
+            resource_base_path: "/org/gnome/Geary" // XXX remove this when Bug 766196 is fixed 
+        );
         _instance = this;
     }
 
diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt
index e16c285..8171ed1 100644
--- a/ui/CMakeLists.txt
+++ b/ui/CMakeLists.txt
@@ -4,7 +4,6 @@ set(RESOURCE_LIST
   STRIPBLANKS "account_cannot_remove.glade"
   STRIPBLANKS "account_list.glade"
   STRIPBLANKS "account_spinner.glade"
-  STRIPBLANKS "app_menu.interface"
   STRIPBLANKS "certificate_warning_dialog.glade"
   STRIPBLANKS "composer-headerbar.ui"
   STRIPBLANKS "composer-menus.ui"
@@ -12,6 +11,7 @@ set(RESOURCE_LIST
   STRIPBLANKS "edit_alternate_emails.glade"
   STRIPBLANKS "find_bar.glade"
   STRIPBLANKS "folder-popover.ui"
+  STRIPBLANKS "gtk/menus.ui"
   STRIPBLANKS "login.glade"
   STRIPBLANKS "password-dialog.glade"
   STRIPBLANKS "preferences.glade"
@@ -50,7 +50,7 @@ add_custom_target(resource_copy ALL
   COMMAND
     cp ${RESOURCES_XML} ${CMAKE_BINARY_DIR}/ui
   COMMAND
-    cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.interface ${CMAKE_SOURCE_DIR}/ui/*.ui 
${CMAKE_BINARY_DIR}/ui
+    cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.ui ${CMAKE_BINARY_DIR}/ui
   COMMAND
     cp ${CMAKE_SOURCE_DIR}/ui/*.css ${CMAKE_BINARY_DIR}/ui
 )
diff --git a/ui/gtk/menus.ui b/ui/gtk/menus.ui
new file mode 100644
index 0000000..b1770de
--- /dev/null
+++ b/ui/gtk/menus.ui
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<interface>
+  <menu id='app-menu'>
+    <section>
+      <item>
+        <attribute name='label' translatable='yes'>Compose Message</attribute>
+        <attribute name='action'>app.compose</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name='label' translatable='yes'>A_ccounts</attribute>
+        <attribute name='action'>app.accounts</attribute>
+      </item>
+      <item>
+        <attribute name='label' translatable='yes'>_Preferences</attribute>
+        <attribute name='action'>app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name='label' translatable='yes'>_Help</attribute>
+        <attribute name='action'>app.help</attribute>
+        <attribute name='accel'>F1</attribute>
+      </item>
+      <item>
+        <attribute name='label' translatable='yes'>_About</attribute>
+        <attribute name='action'>app.about</attribute>
+      </item>
+      <item>
+        <attribute name='label' translatable='yes'>_Quit</attribute>
+        <attribute name='action'>app.quit</attribute>
+        <attribute name='accel'>&lt;Primary&gt;Q</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>


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