[gnome-sudoku] Fix spinner to start three seconds after Print button is pressed
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Fix spinner to start three seconds after Print button is pressed
- Date: Thu, 26 Feb 2015 22:53:41 +0000 (UTC)
commit 0fb636a03e0fbca35bd0e3036e26572f2f790247
Author: iulianR <iulian radu67 gmail com>
Date: Thu Feb 26 19:57:02 2015 +0200
Fix spinner to start three seconds after Print button is pressed
https://bugzilla.gnome.org/show_bug.cgi?id=736773
src/print-dialog.vala | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/print-dialog.vala b/src/print-dialog.vala
index 93704c4..a96278b 100644
--- a/src/print-dialog.vala
+++ b/src/print-dialog.vala
@@ -36,6 +36,7 @@ public class PrintDialog : Gtk.Dialog
[GtkChild]
private Gtk.RadioButton very_hard_radio_button;
+ private Gtk.Revealer revealer;
private Gtk.Spinner spinner;
private const string DIFFICULTY_KEY_NAME = "print-multiple-sudoku-difficulty";
@@ -54,9 +55,11 @@ public class PrintDialog : Gtk.Dialog
set_transient_for (window);
spinner = new Gtk.Spinner ();
- spinner.valign = Gtk.Align.CENTER;
+ revealer = new Gtk.Revealer ();
+ revealer.add (spinner);
+ revealer.valign = Gtk.Align.CENTER;
if (use_header_bar == 1)
- ((Gtk.HeaderBar) get_header_bar ()).pack_end (spinner);
+ ((Gtk.HeaderBar) get_header_bar ()).pack_end (revealer);
var saved_difficulty = (DifficultyCategory) settings.get_enum (DIFFICULTY_KEY_NAME);
if (saved_difficulty == DifficultyCategory.EASY)
@@ -75,9 +78,13 @@ public class PrintDialog : Gtk.Dialog
~PrintDialog ()
{
- // The spinner still has a floating reference if it wasn't added to the header bar.
+ /* Both the spinner and the revealer have a floating reference if
+ they weren't added to the header bar. */
if (use_header_bar != 1)
+ {
spinner.destroy ();
+ revealer.destroy ();
+ }
}
private void wrap_adjustment (string key_name, Gtk.Adjustment action)
@@ -86,6 +93,15 @@ public class PrintDialog : Gtk.Dialog
action.value_changed.connect (() => settings.set_int (key_name, (int) action.get_value ()));
}
+ public bool start_spinner_cb ()
+ {
+ revealer.set_transition_type (Gtk.RevealerTransitionType.SLIDE_LEFT);
+ revealer.show_all ();
+ spinner.start ();
+ revealer.set_reveal_child (true);
+ return Source.REMOVE;
+ }
+
public override void response (int response)
{
if (response != Gtk.ResponseType.OK)
@@ -110,8 +126,7 @@ public class PrintDialog : Gtk.Dialog
settings.set_enum (DIFFICULTY_KEY_NAME, level);
- spinner.show ();
- spinner.start ();
+ Timeout.add_seconds (3, (SourceFunc) start_spinner_cb);
sensitive = false;
@@ -121,7 +136,7 @@ public class PrintDialog : Gtk.Dialog
var boards = SudokuGenerator.generate_boards_async.end (res);
spinner.stop ();
- spinner.hide ();
+ revealer.hide ();
sensitive = true;
var printer = new SudokuPrinter (boards, this);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]