diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-05-03 20:28:56 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-06-09 19:34:57 +0800 |
commit | 711272a739ab7add8972c5df146c24b62c0fdcf7 (patch) | |
tree | 2878839600e6432761cde88d9f041f3cb378f7d3 | |
parent | ee8c16e7d70527760ebb2c5894dd85c545daa2e4 (diff) | |
download | gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar.gz gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar.bz2 gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar.lz gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar.xz gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.tar.zst gsoc2013-empathy-711272a739ab7add8972c5df146c24b62c0fdcf7.zip |
Show an spinner while logs are being retrieved
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 51 | ||||
-rw-r--r-- | 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; @@ -129,6 +132,13 @@ empathy_account_chooser_filter_has_logs (TpAccount *account, enum { + PAGE_EVENTS, + PAGE_SPINNER, + PAGE_EMPTY +}; + +enum +{ COL_TYPE_ANY, COL_TYPE_SEPARATOR, COL_TYPE_NORMAL @@ -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); @@ -2287,6 +2299,42 @@ log_window_what_setup (EmpathyLogWindow *window) } 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, gpointer user_data) @@ -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 @@ </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow_events"> + <object class="GtkNotebook" id="notebook"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> + <property name="show_border">False</property> + <property name="show_tabs">False</property> <child> - <object class="GtkTreeView" id="treeview_events"> + <object class="GtkScrolledWindow" id="scrolledwindow_events"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkTreeView" id="treeview_events"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">page 2</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkSpinner" id="spinner"> + <property name="visible">True</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes">page 2</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow_empty"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkTreeView" id="treeview_empty"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> </object> </child> </object> |