aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-12 19:25:21 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-12 20:14:52 +0800
commitddb4928052ff303f024ea9b69e10064fade790a3 (patch)
tree0fcb2b197356f992000456efcd310474ab15abe5
parent4fcf2a8de21bc613d9cbaafd59fc93c854905a90 (diff)
downloadgsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar.gz
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar.bz2
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar.lz
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar.xz
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.tar.zst
gsoc2013-empathy-ddb4928052ff303f024ea9b69e10064fade790a3.zip
roster-window: watch for TpAccount:connection changes
The account being connected isn't longer enough to ensure that its TpConnection is defined. https://bugzilla.gnome.org/show_bug.cgi?id=667743
-rw-r--r--src/empathy-roster-window.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index 7fc7f9a6b..f45474cf2 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -1294,9 +1294,6 @@ roster_window_connection_changed_cb (TpAccount *account,
{
empathy_sound_manager_play (self->priv->sound_mgr, GTK_WIDGET (self),
EMPATHY_SOUND_ACCOUNT_DISCONNECTED);
-
- /* remove balance action if required */
- roster_window_remove_balance_action (self, account);
}
if (current == TP_CONNECTION_STATUS_CONNECTED)
@@ -1306,7 +1303,6 @@ roster_window_connection_changed_cb (TpAccount *account,
/* Account connected without error, remove error message if any */
roster_window_remove_error (self, account);
- roster_window_setup_balance (self, account);
}
}
@@ -2053,6 +2049,26 @@ roster_window_account_removed_cb (TpAccountManager *manager,
}
static void
+account_connection_notify_cb (TpAccount *account,
+ GParamSpec *spec,
+ EmpathyRosterWindow *self)
+{
+ TpConnection *conn;
+
+ conn = tp_account_get_connection (account);
+
+ if (conn != NULL)
+ {
+ roster_window_setup_balance (self, account);
+ }
+ else
+ {
+ /* remove balance action if required */
+ roster_window_remove_balance_action (self, account);
+ }
+}
+
+static void
add_account (EmpathyRosterWindow *self,
TpAccount *account)
{
@@ -2071,6 +2087,11 @@ add_account (EmpathyRosterWindow *self,
g_hash_table_insert (self->priv->status_changed_handlers,
account, GUINT_TO_POINTER (handler_id));
+ /* roster_window_setup_balance() relies on the TpConnection to be ready on
+ * the TpAccount so we connect this signal as well. */
+ tp_g_signal_connect_object (account, "notify::connection",
+ G_CALLBACK (account_connection_notify_cb), self, 0);
+
roster_window_setup_balance (self, account);
}