aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-19 19:50:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-19 20:01:35 +0800
commitbe57ef773c5d24c921c586eba75cdd73db23223f (patch)
tree7e594ea05e554a1902e0a46c362a806496733d57 /src
parent5ca677e8864ed07d51b243beb9f5fd6a111d305e (diff)
downloadgsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar.gz
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar.bz2
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar.lz
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar.xz
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.tar.zst
gsoc2013-empathy-be57ef773c5d24c921c586eba75cdd73db23223f.zip
Don't assume a connected TpAccount always have a TpConnection
The connection object may not be there yet if tp-glib is still preparing its features. https://bugzilla.gnome.org/show_bug.cgi?id=659439
Diffstat (limited to 'src')
-rw-r--r--src/empathy.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 32aa25a86..e95ad1d20 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -672,13 +672,10 @@ account_join_chatrooms (TpAccount *account,
TpConnection *conn;
GList *chatrooms, *p;
- if (tp_account_get_connection_status (account, NULL) !=
- TP_CONNECTION_STATUS_CONNECTED)
- return;
-
- /* If we're connected we should have a connection */
+ /* Wait if we are not connected or the TpConnection is not prepared yet */
conn = tp_account_get_connection (account);
- g_return_if_fail (conn != NULL);
+ if (conn == NULL)
+ return;
chatrooms = empathy_chatroom_manager_get_chatrooms (
chatroom_manager, account);
@@ -697,12 +694,8 @@ account_join_chatrooms (TpAccount *account,
}
static void
-account_status_changed_cb (TpAccount *account,
- guint old_status,
- guint new_status,
- guint reason,
- gchar *dbus_error_name,
- GHashTable *details,
+account_connection_changed_cb (TpAccount *account,
+ GParamSpec *spec,
EmpathyChatroomManager *manager)
{
account_join_chatrooms (account, manager);
@@ -735,8 +728,8 @@ account_manager_chatroom_ready_cb (GObject *source_object,
account_join_chatrooms (account, chatroom_manager);
/* And/or join them on (re)connection */
- tp_g_signal_connect_object (account, "status-changed",
- G_CALLBACK (account_status_changed_cb), chatroom_manager, 0);
+ tp_g_signal_connect_object (account, "notify::connection",
+ G_CALLBACK (account_connection_changed_cb), chatroom_manager, 0);
}
g_list_free (accounts);
}