[polari/wip/fmuellner/nickserv: 5/20] application: Initialize actions as early as possible



commit 6333eadf64f59d03599f40018175773ba27d0025
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 6a80286..dd671fa 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),
@@ -132,6 +117,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]