[gnome-clocks] Use the new autometic menu support in gtk



commit 871e2070d5ed354da99b3b8993f194d7fedf01cf
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jul 26 17:10:33 2014 +0200

    Use the new autometic menu support in gtk

 data/gnome-clocks.gresource.xml   |    2 +-
 data/{ui/menu.ui => gtk/menus.ui} |    2 +-
 src/application.vala              |    4 ----
 src/widgets.vala                  |    5 ++---
 4 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 711a735..7a76fc1 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -2,7 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/clocks">
     <file>css/gnome-clocks.css</file>
-    <file preprocess="xml-stripblanks">ui/menu.ui</file>
+    <file preprocess="xml-stripblanks">gtk/menus.ui</file>
     <file preprocess="xml-stripblanks">ui/window.ui</file>
     <file preprocess="xml-stripblanks">ui/worldlocationdialog.ui</file>
     <file preprocess="xml-stripblanks">ui/world.ui</file>
diff --git a/data/ui/menu.ui b/data/gtk/menus.ui
similarity index 98%
rename from data/ui/menu.ui
rename to data/gtk/menus.ui
index c713b85..10ac040 100644
--- a/data/ui/menu.ui
+++ b/data/gtk/menus.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <menu id="appmenu">
+  <menu id="app-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes">_Help</attribute>
diff --git a/src/application.vala b/src/application.vala
index cf0d08b..bb18533 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -55,10 +55,6 @@ public class Application : Gtk.Application {
                                                   css_provider,
                                                   Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 
-        var builder = Utils.load_ui ("menu.ui");
-        var app_menu = builder.get_object ("appmenu") as MenuModel;
-        set_app_menu (app_menu);
-
         add_accelerator ("<Primary>n", "win.new", null);
         add_accelerator ("<Primary>a", "win.select-all", null);
     }
diff --git a/src/widgets.vala b/src/widgets.vala
index 44b6034..da30e78 100644
--- a/src/widgets.vala
+++ b/src/widgets.vala
@@ -464,9 +464,8 @@ public class ContentView : Gtk.Bin {
         });
         header_bar.pack_end (cancel_button);
 
-        var builder = Utils.load_ui ("menu.ui");
-        selection_menu = builder.get_object ("selection-menu") as GLib.MenuModel;
-
+        var app = (Gtk.Application) GLib.Application.get_default ();
+        selection_menu = app.get_menu_by_id ("selection-menu");
         selection_menubutton = new Gtk.MenuButton ();
         selection_menubutton_label = new Gtk.Label (_("Click on items to select them"));
         Gtk.Arrow selection_menubutton_arrow = new Gtk.Arrow (Gtk.ArrowType.DOWN, Gtk.ShadowType.NONE);


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