[gnome-tetravex] Use GResource for loading the app-menu.



commit 4b677badab7f7ea36685e7e47ba04f3e090e8bbe
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Sep 9 06:06:23 2014 +0200

    Use GResource for loading the app-menu.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736305

 src/app-menu.ui                  |    2 +-
 src/gnome-tetravex.gresource.xml |    4 +++-
 src/gnome-tetravex.vala          |   13 +------------
 3 files changed, 5 insertions(+), 14 deletions(-)
---
diff --git a/src/app-menu.ui b/src/app-menu.ui
index 9315dd0..8089164 100644
--- a/src/app-menu.ui
+++ b/src/app-menu.ui
@@ -1,5 +1,5 @@
 <interface>
-  <menu id="gnome-tetravex-menu">
+  <menu id="app-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes">_New Game</attribute>
diff --git a/src/gnome-tetravex.gresource.xml b/src/gnome-tetravex.gresource.xml
index caca0a0..5c9aebf 100644
--- a/src/gnome-tetravex.gresource.xml
+++ b/src/gnome-tetravex.gresource.xml
@@ -2,6 +2,8 @@
 <gresources>
   <gresource prefix="/org/gnome/tetravex">
     <file preprocess="xml-stripblanks">gnome-tetravex.ui</file>
-    <file preprocess="xml-stripblanks">app-menu.ui</file>
+  </gresource>
+  <gresource prefix="/org/gnome/tetravex/gtk">
+    <file alias="menus.ui" preprocess="xml-stripblanks">app-menu.ui</file>
   </gresource>
 </gresources>
diff --git a/src/gnome-tetravex.vala b/src/gnome-tetravex.vala
index 76d3add..4b68686 100644
--- a/src/gnome-tetravex.vala
+++ b/src/gnome-tetravex.vala
@@ -80,18 +80,7 @@ public class Tetravex : Gtk.Application
         set_accels_for_action ("app.move-left", {"<Primary>Left"});
         set_accels_for_action ("app.move-right", {"<Primary>Right"});
 
-        var builder = new Gtk.Builder ();
-        try
-        {
-            builder.add_from_resource ("/org/gnome/tetravex/gnome-tetravex.ui");
-            builder.add_from_resource ("/org/gnome/tetravex/app-menu.ui");
-        }
-        catch (Error e)
-        {
-            error ("Unable to build menus: %s", e.message);
-        }
-
-        set_app_menu (builder.get_object ("gnome-tetravex-menu") as MenuModel);
+        var builder = new Gtk.Builder.from_resource ("/org/gnome/tetravex/gnome-tetravex.ui");
 
         settings = new Settings ("org.gnome.tetravex");
 


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