summaryrefslogtreecommitdiff
path: root/src/nautilus-toolbar.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-10-06 18:51:57 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-10-06 18:53:34 +0200
commit9ee7c173b50f2866b2af9fe09b78b09132897ca8 (patch)
tree6f5054e5fed7b824ee093f27aaa5e1fa8c817c64 /src/nautilus-toolbar.c
parent5c9f68da01141b645d0612a8a4c6875b28dde11a (diff)
downloadnautilus-9ee7c173b50f2866b2af9fe09b78b09132897ca8.tar.gz
toolbar: remove operations button timeout correctly
We were resetting the id to 0 without actually removing it in the case a timeout was already there and we tried to set a new one. https://bugzilla.gnome.org/show_bug.cgi?id=755584
Diffstat (limited to 'src/nautilus-toolbar.c')
-rw-r--r--src/nautilus-toolbar.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index b3660d1ab..cab623672 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -428,7 +428,7 @@ schedule_remove_finished_operations (NautilusToolbar *self)
}
}
-static gboolean
+static void
remove_operations_button_attention_style (NautilusToolbar *self)
{
GtkStyleContext *style_context;
@@ -436,25 +436,40 @@ remove_operations_button_attention_style (NautilusToolbar *self)
style_context = gtk_widget_get_style_context (self->priv->operations_button);
gtk_style_context_remove_class (style_context,
"nautilus-operations-button-needs-attention");
+}
+
+static gboolean
+on_remove_operations_button_attention_style_timeout (NautilusToolbar *self)
+{
+ remove_operations_button_attention_style (self);
self->priv->operations_button_attention_timeout_id = 0;
return G_SOURCE_REMOVE;
}
static void
+unschedule_operations_button_attention_style (NautilusToolbar *self)
+{
+ if (self->priv->operations_button_attention_timeout_id!= 0) {
+ g_source_remove (self->priv->operations_button_attention_timeout_id);
+ self->priv->operations_button_attention_timeout_id = 0;
+ }
+}
+
+static void
add_operations_button_attention_style (NautilusToolbar *self)
{
GtkStyleContext *style_context;
style_context = gtk_widget_get_style_context (self->priv->operations_button);
- remove_operations_button_attention_style (self);
+ unschedule_operations_button_attention_style (self);
remove_operations_button_attention_style (self);
gtk_style_context_add_class (style_context,
"nautilus-operations-button-needs-attention");
self->priv->operations_button_attention_timeout_id = g_timeout_add (NEEDS_ATTENTION_ANIMATION_TIMEOUT,
- (GSourceFunc) remove_operations_button_attention_style,
+ (GSourceFunc) on_remove_operations_button_attention_style_timeout,
self);
}
@@ -799,11 +814,7 @@ nautilus_toolbar_dispose (GObject *obj)
unschedule_menu_popup_timeout (self);
unschedule_remove_finished_operations (self);
unschedule_operations_start (self);
-
- if (self->priv->operations_button_attention_timeout_id != 0) {
- g_source_remove (self->priv->operations_button_attention_timeout_id);
- self->priv->operations_button_attention_timeout_id = 0;
- }
+ unschedule_operations_button_attention_style (self);
g_signal_handlers_disconnect_by_data (self->priv->progress_manager, self);
g_clear_object (&self->priv->progress_manager);