[gnome-nibbles/arnaudb/modernize-code: 26/58] Init sound at NibblesView construct.



commit 06cb38932f6e517d9b591a9fde5bd77777db67ef
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed May 27 15:50:21 2020 +0200

    Init sound at NibblesView construct.

 src/gnome-nibbles.vala | 3 +--
 src/nibbles-view.vala  | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index 3adc7f8..dd69df2 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -235,8 +235,7 @@ private class Nibbles : Gtk.Application
         });
 
         /* Create view */
-        view = new NibblesView (game);
-        view.is_muted = !settings.get_boolean ("sound");
+        view = new NibblesView (game, !settings.get_boolean ("sound"));
         view.show ();
 
         frame = new Games.GridFrame (NibblesGame.WIDTH, NibblesGame.HEIGHT);
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 83a71e0..355ab8d 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -146,9 +146,9 @@ private class NibblesView : GtkClutter.Embed
         }
     }
 
-    internal NibblesView (NibblesGame game)
+    internal NibblesView (NibblesGame game, bool is_muted)
     {
-        Object (game: game);
+        Object (game: game, is_muted: is_muted);
 
         stage = (Clutter.Stage) get_stage ();
         Clutter.Color stage_color = { 0x00, 0x00, 0x00, 0xff };
@@ -908,7 +908,7 @@ private class NibblesView : GtkClutter.Embed
     * * Sound
     \*/
 
-    internal bool is_muted { internal set; private get; default = true; }
+    public bool is_muted { private get; internal construct set; }
 
     private GSound.Context sound_context;
     private SoundContextState sound_context_state = SoundContextState.INITIAL;


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