From cfe99bbb2c30580e9347fd103a6dece59e228494 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 31 Dec 2016 01:16:10 +0100
Subject: Updated the progress bar only when needed.

---
 ChangeLog                   | 5 +++++
 src/gtkext/gtkstatusstack.c | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8a4be68..d2d3044 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 16-12-31  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/gtkext/gtkstatusstack.c:
+	Update the progress bar only when needed.
+
+16-12-31  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/analysis/binary.c:
 	* src/analysis/binary.h:
 	Load binaires without blocking the GUI during the process.
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);
 
-- 
cgit v0.11.2-87-g4458