summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-12-31 00:16:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-12-31 00:16:10 (GMT)
commitcfe99bbb2c30580e9347fd103a6dece59e228494 (patch)
tree8dd5fe978900221a7cce1a21d410534cbb7d7293 /src
parentdeadb8b2432e08ce7a7d3ad02cb7bd4f269115cf (diff)
Updated the progress bar only when needed.
Diffstat (limited to 'src')
-rw-r--r--src/gtkext/gtkstatusstack.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index dba5145..586e722 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -158,6 +158,9 @@ struct _progress_info
};
+#define PROGRESS_SIZE 200
+
+
/* Supprime l'empreinte mémoire d'informations d'activité. */
static void reset_progress_info(progress_info *);
@@ -809,7 +812,7 @@ static GtkWidget *build_progress_status_stack(GtkStatusStack *stack)
progress = gtk_progress_bar_new();
g_object_set_data(ref, "progress", progress);
- gtk_widget_set_size_request(progress, 200, -1);
+ gtk_widget_set_size_request(progress, PROGRESS_SIZE, -1);
gtk_widget_set_valign(progress, GTK_ALIGN_CENTER);
gtk_widget_show(progress);
gtk_box_pack_start(GTK_BOX(result), progress, FALSE, TRUE, 8);
@@ -1025,8 +1028,10 @@ void gtk_status_stack_update_activity_value(GtkStatusStack *stack, activity_id_t
/* On n'actualise que le sommet de la pile */
- if ((i + 1) == info->count && (new - status->last_updated) > 0.1)
+ if ((i + 1) == info->count && (new - status->last_updated) > (1.0 / PROGRESS_SIZE))
{
+ status->last_updated = new;
+
if (info->tag != 0)
g_source_remove(info->tag);