[nautilus] window-slot: let the "Loading" floating bar appear only after a timeout
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window-slot: let the "Loading" floating bar appear only after a timeout
- Date: Tue, 15 Mar 2011 14:15:05 +0000 (UTC)
commit ad8dd8389670d85e8afacb58dc7971cc2b81b9eb
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Mar 15 10:14:03 2011 -0400
window-slot: let the "Loading" floating bar appear only after a timeout
It will appear only if loading takes more than 500ms.
src/nautilus-window-manage-views.c | 42 ++++++++++++++++++++++++++++++------
src/nautilus-window-slot.c | 5 ++++
src/nautilus-window-slot.h | 1 +
3 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 3b2c2f0..519bac6 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -1163,14 +1163,8 @@ nautilus_window_report_location_change (NautilusWindow *window)
}
static void
-setup_loading_floating_bar (NautilusWindowSlot *slot)
+real_setup_loading_floating_bar (NautilusWindowSlot *slot)
{
- /* setup loading overlay */
- if (slot->set_status_timeout_id != 0) {
- g_source_remove (slot->set_status_timeout_id);
- slot->set_status_timeout_id = 0;
- }
-
nautilus_floating_bar_set_label (NAUTILUS_FLOATING_BAR (slot->floating_bar),
NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->content_view)) ?
_("Searching...") : _("Loading..."));
@@ -1182,6 +1176,35 @@ setup_loading_floating_bar (NautilusWindowSlot *slot)
gtk_widget_show (slot->floating_bar);
}
+static gboolean
+setup_loading_floating_bar_timeout_cb (gpointer user_data)
+{
+ NautilusWindowSlot *slot = user_data;
+
+ slot->loading_timeout_id = 0;
+ real_setup_loading_floating_bar (slot);
+
+ return FALSE;
+}
+
+static void
+setup_loading_floating_bar (NautilusWindowSlot *slot)
+{
+ /* setup loading overlay */
+ if (slot->set_status_timeout_id != 0) {
+ g_source_remove (slot->set_status_timeout_id);
+ slot->set_status_timeout_id = 0;
+ }
+
+ if (slot->loading_timeout_id != 0) {
+ g_source_remove (slot->loading_timeout_id);
+ slot->loading_timeout_id = 0;
+ }
+
+ slot->loading_timeout_id =
+ g_timeout_add (500, setup_loading_floating_bar_timeout_cb, slot);
+}
+
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
location_has_really_changed (NautilusWindowSlot *slot)
@@ -1489,6 +1512,11 @@ nautilus_window_report_load_complete (NautilusWindow *window,
static void
remove_loading_floating_bar (NautilusWindowSlot *slot)
{
+ if (slot->loading_timeout_id != 0) {
+ g_source_remove (slot->loading_timeout_id);
+ slot->loading_timeout_id = 0;
+ }
+
gtk_widget_hide (slot->floating_bar);
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (slot->floating_bar));
}
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 7428e18..d012406 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -242,6 +242,11 @@ nautilus_window_slot_dispose (GObject *object)
slot->set_status_timeout_id = 0;
}
+ if (slot->loading_timeout_id != 0) {
+ g_source_remove (slot->loading_timeout_id);
+ slot->loading_timeout_id = 0;
+ }
+
nautilus_window_slot_set_viewed_file (slot, NULL);
/* TODO? why do we unref here? the file is NULL.
* It was already here before the slot move, though */
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index ef23c8f..1e97324 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -79,6 +79,7 @@ struct NautilusWindowSlot {
GtkWidget *floating_bar;
guint set_status_timeout_id;
+ guint loading_timeout_id;
NautilusView *content_view;
NautilusView *new_content_view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]