aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-13 23:37:03 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-16 18:13:36 +0800
commitdc392002e18aad2efd7806f84ac94a94fa28cd61 (patch)
tree89536c29fd9d60d741e00d2b391089c3961ed1d2
parent2b60435f91564f1d3848cb054599ecfe62a004b4 (diff)
downloadgsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar.gz
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar.bz2
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar.lz
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar.xz
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.tar.zst
gsoc2013-empathy-dc392002e18aad2efd7806f84ac94a94fa28cd61.zip
log-window: wait that the accounts chooser is ready before selecting the chat
If we don't wait, the combobox is empty and so log_window_chats_set_selected can't find the chat (#601807).
-rw-r--r--libempathy-gtk/empathy-log-window.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 247a99806..f6f6ef17f 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -72,6 +72,11 @@ typedef struct {
gchar *last_find;
EmpathyLogManager *log_manager;
+
+ /* Those are only used while waiting for the account chooser to be ready */
+ TpAccount *selected_account;
+ gchar *selected_chat_id;
+ gboolean selected_is_chatroom;
} EmpathyLogWindow;
static void log_window_destroy_cb (GtkWidget *widget,
@@ -165,6 +170,15 @@ account_manager_prepared_cb (GObject *source_object,
}
}
+static void
+account_chooser_ready_cb (EmpathyAccountChooser *chooser,
+ EmpathyLogWindow *window)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1);
+ log_window_chats_set_selected (window, window->selected_account,
+ window->selected_chat_id, window->selected_is_chatroom);
+}
+
GtkWidget *
empathy_log_window_show (TpAccount *account,
const gchar *chat_id,
@@ -271,11 +285,13 @@ empathy_log_window_show (TpAccount *account,
log_window_chats_setup (window);
log_window_chats_populate (window);
- /* Select chat */
+ /* Chat will be selected once the account chooser is ready */
if (account && chat_id) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1);
- log_window_chats_set_selected (window, account,
- chat_id, is_chatroom);
+ g_signal_connect (account_chooser, "ready",
+ G_CALLBACK (account_chooser_ready_cb), window);
+ window->selected_account = account;
+ window->selected_chat_id = g_strdup (chat_id);
+ window->selected_is_chatroom = is_chatroom;
}
if (parent) {
@@ -294,6 +310,7 @@ log_window_destroy_cb (GtkWidget *widget,
{
g_free (window->last_find);
g_object_unref (window->log_manager);
+ g_free (window->selected_chat_id);
g_free (window);
}