summaryrefslogtreecommitdiff
path: root/src/nautilus-toolbar.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-08-20 00:25:21 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-08-20 00:50:40 +0200
commit6594207b305f4afb5842dd9732fc8e4dae5355b9 (patch)
tree6621188e559dbc9fa0dfb1fe866a5712554fb0fb /src/nautilus-toolbar.c
parent3cd90961cb88ca281098341ac89500a7c23be63d (diff)
downloadnautilus-6594207b305f4afb5842dd9732fc8e4dae5355b9.tar.gz
toolbar: dont update operations when no necesary
We were looping with a timeout to make sure we don't miss any operation that it's time remaning was not well calculated. But we were not stoping this loop when all the operations were took into account. So remove the timeout if all the operations are being show, cancelled, or finished. https://bugzilla.gnome.org/show_bug.cgi?id=753728
Diffstat (limited to 'src/nautilus-toolbar.c')
-rw-r--r--src/nautilus-toolbar.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 645efd95f..40cd7e9a1 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -69,6 +69,8 @@ struct _NautilusToolbarPrivate {
GtkWidget *view_button;
GtkWidget *action_button;
+ guint n_progress_infos_showing;
+
GtkWidget *operations_popover;
GtkWidget *operations_container;
GtkWidget *operations_revealer;
@@ -465,6 +467,9 @@ on_progress_info_cancelled (NautilusToolbar *self)
{
/* Update the pie chart progress */
gtk_widget_queue_draw (self->priv->operations_icon);
+
+ self->priv->n_progress_infos_showing--;
+
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->operations_button))) {
schedule_remove_finished_operations (self);
}
@@ -487,6 +492,8 @@ on_progress_info_finished (NautilusToolbar *self,
/* Update the pie chart progress */
gtk_widget_queue_draw (self->priv->operations_icon);
+ self->priv->n_progress_infos_showing--;
+
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->operations_button))) {
schedule_remove_finished_operations (self);
}
@@ -535,10 +542,12 @@ update_operations (NautilusToolbar *self)
disconnect_progress_infos (self);
progress_infos = nautilus_progress_info_manager_get_all_infos (self->priv->progress_manager);
+ self->priv->n_progress_infos_showing = 0;
for (l = progress_infos; l != NULL; l = l->next) {
if (nautilus_progress_info_get_elapsed_time (l->data) +
nautilus_progress_info_get_remaining_time (l->data) > OPERATION_MINIMUM_TIME) {
total_remaining_time = nautilus_progress_info_get_remaining_time (l->data);
+ self->priv->n_progress_infos_showing++;
g_signal_connect_swapped (l->data, "finished",
G_CALLBACK (on_progress_info_finished), self);
@@ -574,12 +583,16 @@ update_operations (NautilusToolbar *self)
static gboolean
on_progress_info_started_timeout (NautilusToolbar *self)
{
+ GList *progress_infos;
+
update_operations (self);
/* In case we didn't show the operations button because the operation total
* time stimation is not good enough, update again to make sure we don't miss
* a long time operation because of that */
- if (!nautilus_progress_manager_are_all_infos_finished_or_cancelled (self->priv->progress_manager)) {
+ progress_infos = nautilus_progress_info_manager_get_all_infos (self->priv->progress_manager);
+ if (!nautilus_progress_manager_are_all_infos_finished_or_cancelled (self->priv->progress_manager) &&
+ g_list_length (progress_infos) != self->priv->n_progress_infos_showing) {
return G_SOURCE_CONTINUE;
} else {
self->priv->start_operations_timeout_id = 0;