From 711272a739ab7add8972c5df146c24b62c0fdcf7 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 3 May 2011 13:28:56 +0100 Subject: Show an spinner while logs are being retrieved --- libempathy-gtk/empathy-log-window.c | 51 ++++++++++++++++++++++++++++++++ libempathy-gtk/empathy-log-window.ui | 56 +++++++++++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 4 deletions(-) diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 21300cdd1..6482a5eed 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -69,6 +69,9 @@ typedef struct GtkWidget *search_entry; + GtkWidget *notebook; + GtkWidget *spinner; + GtkWidget *treeview_who; GtkWidget *treeview_what; GtkWidget *treeview_when; @@ -127,6 +130,13 @@ empathy_account_chooser_filter_has_logs (TpAccount *account, gpointer callback_data, gpointer user_data); +enum +{ + PAGE_EVENTS, + PAGE_SPINNER, + PAGE_EMPTY +}; + enum { COL_TYPE_ANY, @@ -455,6 +465,8 @@ empathy_log_window_show (TpAccount *account, "treeview_what", &window->treeview_what, "treeview_when", &window->treeview_when, "treeview_events", &window->treeview_events, + "notebook", &window->notebook, + "spinner", &window->spinner, NULL); g_free (filename); @@ -2286,6 +2298,42 @@ log_window_what_setup (EmpathyLogWindow *window) g_object_unref (store); } +static void +start_spinner (void) +{ + gtk_spinner_start (GTK_SPINNER (log_window->spinner)); + gtk_notebook_set_current_page (GTK_NOTEBOOK (log_window->notebook), + PAGE_EMPTY); +} + +static gboolean +show_spinner (gpointer data) +{ + gboolean active; + + if (log_window == NULL) + return FALSE; + + g_object_get (log_window->spinner, "active", &active, NULL); + + if (active) + gtk_notebook_set_current_page (GTK_NOTEBOOK (log_window->notebook), + PAGE_SPINNER); + + return FALSE; +} + +static void +show_events (TplActionChain *chain, + gpointer user_data) +{ + gtk_spinner_stop (GTK_SPINNER (log_window->spinner)); + gtk_notebook_set_current_page (GTK_NOTEBOOK (log_window->notebook), + PAGE_EVENTS); + + _tpl_action_chain_continue (chain); +} + static void log_window_got_messages_for_date_cb (GObject *manager, GAsyncResult *result, @@ -2467,6 +2515,9 @@ log_window_get_messages_for_dates (EmpathyLogWindow *window, } } + start_spinner (); + g_timeout_add (1000, show_spinner, NULL); + _tpl_action_chain_append (window->chain, show_events, NULL); _tpl_action_chain_start (window->chain); g_list_free_full (accounts, g_object_unref); diff --git a/libempathy-gtk/empathy-log-window.ui b/libempathy-gtk/empathy-log-window.ui index 9b5ab9551..9c2303829 100644 --- a/libempathy-gtk/empathy-log-window.ui +++ b/libempathy-gtk/empathy-log-window.ui @@ -225,15 +225,63 @@ - + True True - automatic - automatic + False + False - + True True + automatic + automatic + + + True + True + + + + + + + True + page 2 + + + False + + + + + True + + + 1 + + + + + True + page 2 + + + False + + + + + True + True + automatic + automatic + + + True + True + + -- cgit v1.2.3