[geary: 3/6] Use shared values for timeouts on background process progress



commit 554a8d9e1aecb3eef29386d283b75c636fed13b2
Author: Chris Heywood <15127-creywood users noreply gitlab gnome org>
Date:   Sat Dec 7 09:45:44 2019 +0100

    Use shared values for timeouts on background process progress

 src/client/composer/composer-widget.vala                 |  4 ++--
 src/client/conversation-viewer/conversation-message.vala | 10 +++-------
 src/client/util/util-gtk.vala                            |  5 +++++
 3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 14f98643..887677b7 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -607,10 +607,10 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
         this.editor.selection_changed.connect(on_selection_changed);
 
         this.show_background_work_timeout = new Geary.TimeoutManager.milliseconds(
-            SHOW_BACKGROUND_WORK_TIMEOUT_MSEC, this.on_background_work_timeout
+            Util.Gtk.SHOW_PROGRESS_TIMEOUT_MSEC, this.on_background_work_timeout
         );
         this.background_work_pulse = new Geary.TimeoutManager.milliseconds(
-            PULSE_TIMEOUT_MSEC, this.background_progress.pulse
+            Util.Gtk.PROGRESS_PULSE_TIMEOUT_MSEC, this.background_progress.pulse
         );
         this.background_work_pulse.repetition = FOREVER;
 
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 3d98d991..64f78bfa 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -30,10 +30,6 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
 
     private const int MAX_PREVIEW_BYTES = Geary.Email.MAX_PREVIEW_BYTES;
 
-    private const int SHOW_PROGRESS_TIMEOUT_MSEC = 1000;
-    private const int HIDE_PROGRESS_TIMEOUT_MSEC = 1000;
-    private const int PULSE_TIMEOUT_MSEC = 250;
-
     private const int MAX_INLINE_IMAGE_MAJOR_DIM = 1024;
 
     private const string ACTION_CONVERSATION_NEW = "conversation-new";
@@ -494,14 +490,14 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
 
         this.body_container.set_has_tooltip(true); // Used to show link URLs
         this.show_progress_timeout = new Geary.TimeoutManager.milliseconds(
-            SHOW_PROGRESS_TIMEOUT_MSEC, this.on_show_progress_timeout
+            Util.Gtk.SHOW_PROGRESS_TIMEOUT_MSEC, this.on_show_progress_timeout
         );
         this.hide_progress_timeout = new Geary.TimeoutManager.milliseconds(
-            HIDE_PROGRESS_TIMEOUT_MSEC, this.on_hide_progress_timeout
+            Util.Gtk.HIDE_PROGRESS_TIMEOUT_MSEC, this.on_hide_progress_timeout
         );
 
         this.progress_pulse = new Geary.TimeoutManager.milliseconds(
-            PULSE_TIMEOUT_MSEC, this.body_progress.pulse
+            Util.Gtk.PROGRESS_PULSE_TIMEOUT_MSEC, this.body_progress.pulse
         );
         this.progress_pulse.repetition = FOREVER;
     }
diff --git a/src/client/util/util-gtk.vala b/src/client/util/util-gtk.vala
index 798ad0ed..14661b07 100644
--- a/src/client/util/util-gtk.vala
+++ b/src/client/util/util-gtk.vala
@@ -8,6 +8,11 @@
 
 namespace Util.Gtk {
 
+    /** Shared timeouts for showing background operation progress. */
+    public const int SHOW_PROGRESS_TIMEOUT_MSEC = 1000;
+    public const int HIDE_PROGRESS_TIMEOUT_MSEC = 1000;
+    public const int PROGRESS_PULSE_TIMEOUT_MSEC = 250;
+
     /**
      * Given an HTML-style color spec, parses the color and sets it to
      * the source RGB of the Cairo context. (Borrowed from Shotwell.)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]