[five-or-more/arnaudb/code-improvements: 10/10] Init theme action.



commit 4398c246c301343218acb91f87ee2fcd96fffc08
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat May 9 10:07:14 2020 +0200

    Init theme action.

 src/window.vala | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/window.vala b/src/window.vala
index 1e25dd9..62dd2f8 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -74,6 +74,15 @@ private class GameWindow : ApplicationWindow
     {
         add_action_entries (win_actions, this);
 
+        SimpleAction theme_action = (SimpleAction) lookup_action ("change-theme");
+        string theme_value = settings.get_string (FiveOrMoreApp.KEY_THEME);
+        if (theme_value != "balls.svg" && theme_value != "shapes.svg" && theme_value != "tango.svg") /* TODO 
use an enum in GSchema file? */
+        {
+            settings.set_string (FiveOrMoreApp.KEY_THEME, "balls.svg");
+            theme_value = "balls.svg";
+        }
+        theme_action.set_state (new Variant.@string (theme_value));
+
         var board_size_action = lookup_action ("change-size");
         string board_size_string;
         int board_size = settings.get_int (FiveOrMoreApp.KEY_SIZE);


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