From 67372f1ad852b29b7c8c638a7bae397b6be3098c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 13 Jul 2010 15:41:33 +0200 Subject: factor out select_account_once_ready --- libempathy-gtk/empathy-log-window.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index fcbc6e22a..7ea7bf187 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -186,6 +186,26 @@ account_chooser_ready_cb (EmpathyAccountChooser *chooser, window->selected_chat_id, window->selected_is_chatroom); } +static void +select_account_once_ready (EmpathyLogWindow *self, + TpAccount *account, + const gchar *chat_id, + gboolean is_chatroom) +{ + EmpathyAccountChooser *account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->account_chooser_chats); + + self->selected_account = account; + self->selected_chat_id = g_strdup (chat_id); + self->selected_is_chatroom = is_chatroom; + + if (empathy_account_chooser_is_ready (account_chooser)) + account_chooser_ready_cb (account_chooser, self); + else + /* Chat will be selected once the account chooser is ready */ + g_signal_connect (account_chooser, "ready", + G_CALLBACK (account_chooser_ready_cb), self); +} + GtkWidget * empathy_log_window_show (TpAccount *account, const gchar *chat_id, @@ -295,18 +315,8 @@ empathy_log_window_show (TpAccount *account, log_window_chats_setup (window); log_window_chats_populate (window); - if (account && chat_id) { - window->selected_account = account; - window->selected_chat_id = g_strdup (chat_id); - window->selected_is_chatroom = is_chatroom; - - if (empathy_account_chooser_is_ready (account_chooser)) - account_chooser_ready_cb (account_chooser, window); - else - /* Chat will be selected once the account chooser is ready */ - g_signal_connect (account_chooser, "ready", - G_CALLBACK (account_chooser_ready_cb), window); - } + if (account && chat_id) + select_account_once_ready (window, account, chat_id, is_chatroom); if (parent) { gtk_window_set_transient_for (GTK_WINDOW (window->window), -- cgit v1.2.3