mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
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
This commit is contained in:
parent
5c9f68da01
commit
9ee7c173b5
1 changed files with 19 additions and 8 deletions
|
@ -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,11 +436,26 @@ 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)
|
||||
{
|
||||
|
@ -448,13 +463,13 @@ add_operations_button_attention_style (NautilusToolbar *self)
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue