From be57ef773c5d24c921c586eba75cdd73db23223f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 19 Sep 2011 13:50:59 +0200 Subject: 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 --- src/empathy.c | 21 +++++++-------------- 1 file 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); } -- cgit v1.2.3