[iagno] Add --mute and --unmute command-line options.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Add --mute and --unmute command-line options.
- Date: Thu, 17 Jul 2014 13:46:41 +0000 (UTC)
commit 72808859125a92da183fb323af39078c8dd5b43f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Jul 15 20:32:57 2014 +0200
Add --mute and --unmute command-line options.
https://bugzilla.gnome.org/show_bug.cgi?id=733224
data/iagno.6 | 8 ++++++++
src/iagno.vala | 22 ++++++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/data/iagno.6 b/data/iagno.6
index 49bb1d8..43d6133 100644
--- a/data/iagno.6
+++ b/data/iagno.6
@@ -36,6 +36,14 @@ Prints the command line options and exits.
.TP
.B \-v, \-\-version
Prints the program version and exits.
+.PP
+.B \-\-mute
+.br
+.B \-\-unmute
+.RS 7
+Turn off/on the sound, when launched or during a play.
+If the two options are given, the game is muted.
+.RE
.P
This program also accepts the standard GTK+ options.
.SH AUTHORS
diff --git a/src/iagno.vala b/src/iagno.vala
index 1e35fa2..5415c86 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -44,12 +44,10 @@ public class Iagno : Gtk.Application
private static const OptionEntry[] option_entries =
{
- { "fast-mode", 'f', 0, OptionArg.NONE, ref fast_mode,
- /* Help string for command line --fast-mode flag */
- N_("Reduce delay before AI moves"), null},
- { "version", 'v', 0, OptionArg.NONE, null,
- /* Help string for command line --version flag */
- N_("Print release version and exit"), null},
+ { "fast-mode", 'f', 0, OptionArg.NONE, ref fast_mode, N_("Reduce delay before AI moves"), null},
+ { "mute", 0, 0, OptionArg.NONE, null, N_("Turn off the sound"), null},
+ { "unmute", 0, 0, OptionArg.NONE, null, N_("Turn on the sound"), null},
+ { "version", 'v', 0, OptionArg.NONE, null, N_("Print release version and exit"), null},
{ null }
};
@@ -84,8 +82,6 @@ public class Iagno : Gtk.Application
return;
}
- settings = new Settings ("org.gnome.iagno");
-
var builder = new Gtk.Builder ();
try
{
@@ -189,6 +185,16 @@ public class Iagno : Gtk.Application
return Posix.EXIT_SUCCESS;
}
+ /* WARNING: Don't forget that changing at this moment settings
+ could interfere badly with a running instance of the game. */
+ settings = new Settings ("org.gnome.iagno");
+
+ /* Sound can be turned on/off via command-line while playing. */
+ if (options.contains ("unmute"))
+ settings.set_boolean ("sound", true);
+ if (options.contains ("mute"))
+ settings.set_boolean ("sound", false);
+
/* Activate */
return -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]