diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-07-14 21:36:04 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-12 16:50:48 +0800 |
commit | 4f9a1a249f0447b45f8c96d3228013280e94e082 (patch) | |
tree | c16bb9351d99183c8d37e65cfa813fe79b144271 | |
parent | d21720ea54edc73128bcdcdcc4faee834d7c1c4f (diff) | |
download | gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar.gz gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar.bz2 gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar.lz gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar.xz gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.tar.zst gsoc2013-empathy-4f9a1a249f0447b45f8c96d3228013280e94e082.zip |
select the account once we have populated the model with its chats (#622714)
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index a7799a616..df41225cb 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -179,7 +179,11 @@ account_chooser_ready_cb (EmpathyAccountChooser *chooser, EmpathyLogWindow *window) { gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1); - log_window_chats_set_selected (window); + + /* We'll display the account once the model has been populate with the chats + * of this account. */ + empathy_account_chooser_set_account (EMPATHY_ACCOUNT_CHOOSER ( + window->account_chooser_chats), window->selected_account); } static void @@ -779,6 +783,7 @@ log_manager_got_chats_cb (GObject *manager, GtkListStore *store; GtkTreeIter iter; GError *error = NULL; + gboolean select_account = FALSE; if (log_window == NULL) return; @@ -812,6 +817,8 @@ log_manager_got_chats_cb (GObject *manager, COL_CHAT_IS_CHATROOM, hit->is_chatroom, -1); + select_account = (hit->account == window->selected_account); + /* FIXME: Update COL_CHAT_ICON/NAME */ if (hit->is_chatroom) { } else { @@ -823,6 +830,11 @@ log_manager_got_chats_cb (GObject *manager, g_signal_handlers_unblock_by_func (selection, log_window_chats_changed_cb, window); + + /* We display the selected account if we populate the model with chats from + * this account. */ + if (select_account) + log_window_chats_set_selected (window); } static void @@ -932,7 +944,6 @@ log_window_chats_accounts_changed_cb (GtkWidget *combobox, static void log_window_chats_set_selected (EmpathyLogWindow *window) { - EmpathyAccountChooser *account_chooser; GtkTreeView *view; GtkTreeModel *model; GtkTreeSelection *selection; @@ -940,10 +951,6 @@ log_window_chats_set_selected (EmpathyLogWindow *window) GtkTreePath *path; gboolean ok; - account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats); - empathy_account_chooser_set_account (account_chooser, - window->selected_account); - view = GTK_TREE_VIEW (window->treeview_chats); model = gtk_tree_view_get_model (view); selection = gtk_tree_view_get_selection (view); @@ -978,6 +985,9 @@ log_window_chats_set_selected (EmpathyLogWindow *window) g_object_unref (this_account); g_free (this_chat_id); } + + tp_clear_object (&window->selected_account); + tp_clear_pointer (&window->selected_chat_id, g_free); } static gboolean |