[gnome-sudoku/multithread_printing] Add code for spinner



commit 7fb6638c3417ead98002a9f537fd31df68793dda
Author: Parin Porecha <parinporecha gmail com>
Date:   Wed Aug 13 21:51:47 2014 +0200

    Add code for spinner

 data/print-games.ui     |    6 ++++++
 src/sudoku-printer.vala |    9 +++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/data/print-games.ui b/data/print-games.ui
index 62a5ef1..44f9533 100644
--- a/data/print-games.ui
+++ b/data/print-games.ui
@@ -24,6 +24,12 @@
         <property name="can_focus">False</property>
         <property name="show-close-button">False</property>
         <child>
+            <object class="GtkSpinner" id="spinner">
+                <property name="halign">center</property>
+                <property name="visible">False</property>
+            </object>
+        </child>
+        <child>
           <object class="GtkButton" id="okbutton1">
             <property name="label" translatable="yes">_Print</property>
             <property name="visible">True</property>
diff --git a/src/sudoku-printer.vala b/src/sudoku-printer.vala
index b80dea9..85c6251 100644
--- a/src/sudoku-printer.vala
+++ b/src/sudoku-printer.vala
@@ -232,6 +232,8 @@ public class GamePrinter: GLib.Object
     private RadioButton intermediate_button;
     private RadioButton expert_button;
 
+    private Spinner spinner;
+
     private const string DIFFICULTY_KEY_NAME = "print-multiple-sudoku-difficulty";
 
     public GamePrinter (SudokuSaver saver, ref ApplicationWindow window)
@@ -282,6 +284,8 @@ public class GamePrinter: GLib.Object
 
         nsudokus_button = builder.get_object ("sudokusToPrintSpinButton") as SpinButton;
         wrap_adjustment ("print-multiple-sudokus-to-print", nsudokus_button.get_adjustment ());
+
+        spinner = builder.get_object ("spinner") as Spinner;
     }
 
     private void wrap_adjustment (string key_name, Adjustment action)
@@ -298,6 +302,9 @@ public class GamePrinter: GLib.Object
             return;
         }
 
+        spinner.visible = true;
+        spinner.start ();
+
         boards_list = new ArrayList<SudokuBoard> ();
         var nsudokus = (int) nsudokus_button.get_adjustment ().get_value ();
         DifficultyCategory level;
@@ -345,6 +352,8 @@ public class GamePrinter: GLib.Object
                 boards[i] = boards_list[i];
         }
 
+        spinner.stop ();
+
         SudokuPrinter printer = new SudokuPrinter (boards, ref window);
 
         PrintOperationResult result = printer.print_sudoku ();


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