[empathy] log_manager_got_chats_cb: don't rely on the selected account any more



commit d21720ea54edc73128bcdcdcc4faee834d7c1c4f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Jul 14 15:10:22 2010 +0200

    log_manager_got_chats_cb: don't rely on the selected account any more
    
    Getting the chats is now an async operation, so the selected account could
    have changed while we were fetching the chats. So instead of using the
    currently selected account we use the account we receive from the hit.
    
    Note that this depends on this fix in the logger:
    https://bugs.freedesktop.org/show_bug.cgi?id=29058

 libempathy-gtk/empathy-log-window.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 5dac0e1..a7799a6 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -773,8 +773,6 @@ log_manager_got_chats_cb (GObject *manager,
 	EmpathyLogWindow      *window = user_data;
 	GList                 *chats;
 	GList                 *l;
-	EmpathyAccountChooser *account_chooser;
-	TpAccount             *account;
 	GtkTreeView           *view;
 	GtkTreeModel          *model;
 	GtkTreeSelection      *selection;
@@ -792,9 +790,6 @@ log_manager_got_chats_cb (GObject *manager,
 			return;
 	}
 
-	account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);
-	account = empathy_account_chooser_dup_account (account_chooser);
-
 	view = GTK_TREE_VIEW (window->treeview_chats);
 	model = gtk_tree_view_get_model (view);
 	selection = gtk_tree_view_get_selection (view);
@@ -805,11 +800,14 @@ log_manager_got_chats_cb (GObject *manager,
 
 			hit = l->data;
 
+			if (hit->account == NULL)
+				continue;
+
 			gtk_list_store_append (store, &iter);
 			gtk_list_store_set (store, &iter,
 					COL_CHAT_ICON, "empathy-available", /* FIXME */
 					COL_CHAT_NAME, hit->chat_id,
-					COL_CHAT_ACCOUNT, account,
+					COL_CHAT_ACCOUNT, hit->account,
 					COL_CHAT_ID, hit->chat_id,
 					COL_CHAT_IS_CHATROOM, hit->is_chatroom,
 					-1);
@@ -825,8 +823,6 @@ log_manager_got_chats_cb (GObject *manager,
 	g_signal_handlers_unblock_by_func (selection,
 			log_window_chats_changed_cb,
 			window);
-
-	g_object_unref (account);
 }
 
 static void



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