aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-05-03 20:28:56 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-05-03 21:59:38 +0800
commitc3498f8ee1962f733f0000f4258853aa82fb8a4c (patch)
tree7dbc2aa4defb6135e82b6654e1213d7774517b80
parentf9ea13c0202f21d93f466ab345bf9a85c07c1a2f (diff)
downloadgsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar.gz
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar.bz2
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar.lz
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar.xz
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.tar.zst
gsoc2013-empathy-c3498f8ee1962f733f0000f4258853aa82fb8a4c.zip
Show an spinner while logs are being retrieved
-rw-r--r--libempathy-gtk/empathy-log-window.c51
-rw-r--r--libempathy-gtk/empathy-log-window.ui56
2 files changed, 103 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index c69ac2a7a..22c1923a7 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -68,6 +68,9 @@ typedef struct
GtkWidget *search_entry;
+ GtkWidget *notebook;
+ GtkWidget *spinner;
+
GtkWidget *treeview_who;
GtkWidget *treeview_what;
GtkWidget *treeview_when;
@@ -128,6 +131,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
@@ -454,6 +464,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)
}
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)
@@ -2466,6 +2514,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>