[gnome-sudoku] Limit amount of puzzles printed on one page by 15
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Limit amount of puzzles printed on one page by 15
- Date: Sat, 22 Aug 2020 22:53:24 +0000 (UTC)
commit 8729d8e42c48df21061145317f45d50f8267f578
Author: Andrey Kutejko <andy128k gmail com>
Date: Sun Aug 23 00:33:45 2020 +0200
Limit amount of puzzles printed on one page by 15
src/print-dialog.vala | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/print-dialog.vala b/src/print-dialog.vala
index e5f97cb..1a696fe 100644
--- a/src/print-dialog.vala
+++ b/src/print-dialog.vala
@@ -42,6 +42,7 @@ public class PrintDialog : Dialog
private Cancellable cancellable;
private const string DIFFICULTY_KEY_NAME = "print-multiple-sudoku-difficulty";
+ private const int MAX_PUZZLES_PER_PAGE = 15;
public PrintDialog (SudokuSaver saver, Window window)
{
@@ -82,16 +83,18 @@ public class PrintDialog : Dialog
var per_page = n_sudokus_per_page_button.get_adjustment ();
total.set_value (initial_total_value);
- per_page.set_value (int.min (initial_total_value, initial_per_page_value));
- per_page.set_upper (initial_total_value);
+ var initial_max_per_page = int.min (MAX_PUZZLES_PER_PAGE, initial_total_value);
+ per_page.set_value (int.min (initial_max_per_page, initial_per_page_value));
+ per_page.set_upper (initial_max_per_page);
total.value_changed.connect (() => {
var total_value = (int) total.get_value ();
settings.set_int ("print-multiple-sudokus-to-print", total_value);
+ var max_per_page = int.min (MAX_PUZZLES_PER_PAGE, total_value);
var per_page_value = (int) per_page.get_value ();
- per_page_value = int.min (per_page_value, total_value);
- per_page.set_upper (total_value);
+ per_page_value = int.min (per_page_value, max_per_page);
+ per_page.set_upper (max_per_page);
per_page.set_value (per_page_value);
});
per_page.value_changed.connect (() => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]