[polari] mainWindow: Handle connecting accounts on startup



commit c4d9a141b015875713a2a12ef91b8040e6b7aabc
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 30 01:56:49 2013 +0200

    mainWindow: Handle connecting accounts on startup
    
    It's a corner case, but if an account is already in connecting
    state when we startup (someone messing with empathy-accounts?),
    we should pick it up ...

 src/mainWindow.js |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 1549d86..9e5d887 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -1,4 +1,5 @@
 const Gdk = imports.gi.Gdk;
+const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const Tp = imports.gi.TelepathyGLib;
 
@@ -35,7 +36,9 @@ const MainWindow = new Lang.Class({
 
         this._accountsMonitor = new AccountsMonitor.getDefault();
         this._accountsMonitor.connect('account-status-changed',
-                                      Lang.bind(this, this._accountStatusChanged));
+                                      Lang.bind(this, this._onAccountChanged));
+        this._accountsMonitor.connect('account-added',
+                                      Lang.bind(this, this._onAccountChanged));
 
         this._roomManager = new ChatroomManager.getDefault();
         this._roomManager.connect('room-added',
@@ -106,12 +109,22 @@ const MainWindow = new Lang.Class({
         this.window.show_all();
     },
 
-    _accountStatusChanged: function(am, account) {
+    _onAccountChanged: function(am, account) {
         if (account.connection_status != Tp.ConnectionStatus.CONNECTING)
             return;
 
+        if (account._connectingNotification)
+            return;
+
+        let app = Gio.Application.get_default();
         let notification = new AppNotifications.ConnectingNotification(account);
-        this._notifications.addNotification(notification);
+        app.notificationQueue.addNotification(notification);
+
+        account._connectingNotification = notification;
+        notification.widget.connect('destroy',
+            function() {
+               delete account._connectingNotification;
+            });
     },
 
 


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