Use shared values for timeouts on background process progress

This commit is contained in:
Chris Heywood 2019-12-07 09:45:44 +01:00
parent 8299f9c17a
commit 554a8d9e1a
3 changed files with 10 additions and 9 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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.)