[empathy: 62/80] Show an spinner while logs are being retrieved
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 62/80] Show an spinner while logs are being retrieved
- Date: Fri, 10 Jun 2011 08:44:22 +0000 (UTC)
commit 711272a739ab7add8972c5df146c24b62c0fdcf7
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date: Tue May 3 13:28:56 2011 +0100
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 21300cd..6482a5e 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 9b5ab95..9c23038 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]