[iagno] Move the sound switch to the app-menu.



commit 1b3ca4482ade1661dba0e99988a35097dff5822a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Sep 25 17:24:40 2014 +0200

    Move the sound switch to the app-menu.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664976

 data/iagno-menus.ui       |    4 ++++
 data/iagno-preferences.ui |   14 --------------
 src/iagno.vala            |   14 +-------------
 3 files changed, 5 insertions(+), 27 deletions(-)
---
diff --git a/data/iagno-menus.ui b/data/iagno-menus.ui
index bfcfb8c..c50ba38 100644
--- a/data/iagno-menus.ui
+++ b/data/iagno-menus.ui
@@ -7,6 +7,10 @@
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
+      <item>
+        <attribute name="label" translatable="yes">_Sound</attribute>
+        <attribute name="action">app.sound</attribute>
+      </item>
     </section>
     <section>
       <item>
diff --git a/data/iagno-preferences.ui b/data/iagno-preferences.ui
index 799be9e..3fa3cb8 100644
--- a/data/iagno-preferences.ui
+++ b/data/iagno-preferences.ui
@@ -41,20 +41,6 @@
         <property name="top-attach">2</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkCheckButton" id="sound-button">
-        <property name="visible">True</property>
-        <property name="label" translatable="yes">E_nable sounds</property>
-        <property name="use-underline">True</property>
-        <property name="sensitive">True</property>
-      </object>
-      <packing>
-        <property name="width">2</property>
-        <property name="height">1</property>
-        <property name="left-attach">0</property>
-        <property name="top-attach">3</property>
-      </packing>
-    </child>
   </object>
   <object class="GtkListStore" id="liststore-theme">
     <columns>
diff --git a/src/iagno.vala b/src/iagno.vala
index bd252a8..7e44df3 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -164,6 +164,7 @@ public class Iagno : Gtk.Application
         add_action_entries (app_actions, this);
         set_accels_for_action ("app.new-game", {"<Primary>n"});
         set_accels_for_action ("app.undo-move", {"<Primary>z"});
+        add_action (settings.create_action ("sound"));
         /* TODO bugs when changing manually the gsettings key (not for sound);
          * solving this bug may remove the need of the hack in three parts */
         add_action (settings.create_action ("play-as"));
@@ -510,12 +511,6 @@ public class Iagno : Gtk.Application
         }
     }
 
-    private void sound_select (Gtk.ToggleButton widget)
-    {
-        var play_sounds = widget.get_active ();
-        settings.set_boolean ("sound", play_sounds);
-    }
-
     private bool propbox_close_cb (Gtk.Widget widget, Gdk.EventAny event)
     {
         widget.hide ();
@@ -590,12 +585,5 @@ public class Iagno : Gtk.Application
                 theme_combo.set_active_iter (iter);
         }
         theme_combo.changed.connect (theme_changed_cb);
-
-        var enable_sounds_button = builder.get_object ("sound-button") as Gtk.CheckButton;
-        settings.changed["sound"].connect (() => {
-            enable_sounds_button.set_active (settings.get_boolean ("sound"));
-        });
-        enable_sounds_button.set_active (settings.get_boolean ("sound"));
-        enable_sounds_button.toggled.connect (sound_select);
     }
 }


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