[polari/wip/fmuellner/nickserv: 12/28] application: Initialize actions as early as possible



commit 418521ce8b59e61ba7642672dab0661d78d6e906
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 30 21:45:25 2016 +0200

    application: Initialize actions as early as possible
    
    Until recently, some of the action create hooks were using some of the
    singletons that are initialized on startup, so we had to create those
    first before adding the actions. Now that this is no longer the case,
    we can reorder the code so that all application actions are always
    available, including to the singletons created on startup.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769655

 src/application.js |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index bf7606f..6d5db22 100644
--- a/src/application.js
+++ b/src/application.js
@@ -35,23 +35,8 @@ const Application = new Lang.Class({
     vfunc_startup: function() {
         this.parent();
 
-        this._chatroomManager = ChatroomManager.getDefault();
-        this._accountsMonitor = AccountsMonitor.getDefault();
-        this._networksManager = NetworksManager.getDefault();
-
-        this._accountsMonitor.connect('account-removed', Lang.bind(this,
-            function(am, account) {
-                this._removeSavedChannelsForAccount(account.object_path);
-            }));
-        this._accountsMonitor.connect('account-status-changed',
-                                      Lang.bind(this, this._onAccountStatusChanged));
-
         this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
 
-        this.pasteManager = new PasteManager.PasteManager();
-        this.notificationQueue = new AppNotifications.NotificationQueue();
-        this.commandOutputQueue = new AppNotifications.CommandOutputQueue();
-
         let actionEntries = [
           { name: 'show-join-dialog',
             activate: Lang.bind(this, this._onShowJoinDialog),
@@ -134,6 +119,21 @@ const Application = new Lang.Class({
 
         for (let i = 1; i < 10; i++)
             this.set_accels_for_action('app.nth-room(%d)'.format(i), ['<Alt>' + i]);
+
+        this._chatroomManager = ChatroomManager.getDefault();
+        this._accountsMonitor = AccountsMonitor.getDefault();
+        this._networksManager = NetworksManager.getDefault();
+
+        this._accountsMonitor.connect('account-removed', Lang.bind(this,
+            function(am, account) {
+                this._removeSavedChannelsForAccount(account.object_path);
+            }));
+        this._accountsMonitor.connect('account-status-changed',
+                                      Lang.bind(this, this._onAccountStatusChanged));
+
+        this.pasteManager = new PasteManager.PasteManager();
+        this.notificationQueue = new AppNotifications.NotificationQueue();
+        this.commandOutputQueue = new AppNotifications.CommandOutputQueue();
     },
 
     vfunc_activate: function() {


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