[polari] application: Use GTK+'s automated menu loading



commit f039270bf87ca63376c2e98c94b8a2b638c95b49
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jul 9 19:15:12 2014 +0200

    application: Use GTK+'s automated menu loading
    
    It doesn't safe us a lot of code for now, but hopefully we'll get
    support for other automatic resources like actions soon ...

 configure.ac                             |    2 +-
 data/polari.gresource.xml                |    2 +-
 data/resources/{app-menu.ui => menus.ui} |    0
 src/application.js                       |   10 +++-------
 4 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a007ad0..865ad47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ GLIB_GSETTINGS
 PKG_CHECK_MODULES(POLARI,
                   gio-2.0 >= 2.41.0
                   gobject-introspection-1.0
-                  gtk+-3.0 >= 3.11.5
+                  gtk+-3.0 >= 3.13.4
                   telepathy-glib);
 
 AC_PATH_PROG([GJS_CONSOLE],[gjs-console],[no])
diff --git a/data/polari.gresource.xml b/data/polari.gresource.xml
index 8b0c5b9..4dca49b 100644
--- a/data/polari.gresource.xml
+++ b/data/polari.gresource.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/Polari">
-    <file alias="app-menu.ui" preprocess="xml-stripblanks">resources/app-menu.ui</file>
+    <file alias="gtk/menus.ui" preprocess="xml-stripblanks">resources/menus.ui</file>
     <file alias="connection-details-dialog.ui" 
preprocess="xml-stripblanks">resources/connection-details-dialog.ui</file>
     <file alias="connection-list-dialog.ui" 
preprocess="xml-stripblanks">resources/connection-list-dialog.ui</file>
     <file alias="join-room-dialog.ui" preprocess="xml-stripblanks">resources/join-room-dialog.ui</file>
diff --git a/data/resources/app-menu.ui b/data/resources/menus.ui
similarity index 100%
rename from data/resources/app-menu.ui
rename to data/resources/menus.ui
diff --git a/src/application.js b/src/application.js
index 1736dfa..223d8d6 100644
--- a/src/application.js
+++ b/src/application.js
@@ -43,6 +43,9 @@ const Application = new Lang.Class({
     },
 
     vfunc_startup: function() {
+        let resource = Gio.Resource.load(Config.RESOURCE_DIR + '/polari.gresource');
+        resource._register();
+
         this.parent();
         String.prototype.format = Format.format;
 
@@ -55,9 +58,6 @@ const Application = new Lang.Class({
         let w = new Polari.FixedSizeFrame(); // register gtype
         w.destroy();
 
-        let resource = Gio.Resource.load(Config.RESOURCE_DIR + '/polari.gresource');
-        resource._register();
-
         this._chatroomManager = ChatroomManager.getDefault();
         this._accountsMonitor = AccountsMonitor.getDefault();
 
@@ -72,10 +72,6 @@ const Application = new Lang.Class({
         this.notificationQueue = new AppNotifications.NotificationQueue();
         this.commandOutputQueue = new AppNotifications.CommandOutputQueue();
 
-        let builder = new Gtk.Builder();
-        builder.add_from_resource('/org/gnome/Polari/app-menu.ui');
-        this.set_app_menu(builder.get_object('app-menu'));
-
         let actionEntries = [
           { name: 'room-menu',
             activate: Lang.bind(this, this._onToggleAction),


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