[gnome-taquin] Add HAS_SOUND flag.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-taquin] Add HAS_SOUND flag.
- Date: Thu, 1 Aug 2019 15:16:07 +0000 (UTC)
commit 62074b1e2a6baf15e5fca270de4fd676e7941c4b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Aug 1 11:10:15 2019 +0200
Add HAS_SOUND flag.
src/game-headerbar.vala | 15 +++++++++------
src/game-window.vala | 1 +
src/taquin-main.vala | 1 +
3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/game-headerbar.vala b/src/game-headerbar.vala
index 8542ed9..cc6288b 100644
--- a/src/game-headerbar.vala
+++ b/src/game-headerbar.vala
@@ -30,6 +30,7 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
[CCode (notify = false)] public bool window_has_name { private get; protected construct; default =
false; }
[CCode (notify = false)] public string window_name { private get; internal construct; default = ""; }
+ [CCode (notify = false)] public bool has_sound { private get; protected construct; default = false; }
[CCode (notify = false)] public bool show_undo { private get; protected construct; default = false; }
[CCode (notify = false)] public bool show_redo { private get; protected construct; default = false; }
[CCode (notify = false)] public bool show_hint { private get; protected construct; default = false; }
// TODO something
@@ -53,6 +54,7 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
Object (about_action_label: _about_action_label,
night_light_monitor: _night_light_monitor,
has_keyboard_shortcuts: GameWindowFlags.SHORTCUTS in flags,
+ has_sound: GameWindowFlags.HAS_SOUND in flags,
has_help: GameWindowFlags.SHOW_HELP in flags, // TODO rename show_help
show_hint: GameWindowFlags.SHOW_HINT in flags,
show_redo: GameWindowFlags.SHOW_REDO in flags,
@@ -169,10 +171,10 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
public GLib.Menu? appearance_menu { private get; protected construct; default = null; }
protected override void populate_menu (ref GLib.Menu menu)
{
- append_options_section (ref menu, appearance_menu);
+ append_options_section (ref menu, appearance_menu, has_sound);
}
- private static inline void append_options_section (ref GLib.Menu menu, GLib.Menu? appearance_menu)
+ private static inline void append_options_section (ref GLib.Menu menu, GLib.Menu? appearance_menu, bool
has_sound)
{
GLib.Menu section = new GLib.Menu ();
@@ -180,10 +182,11 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
/* Translators: hamburger menu entry; "Appearance" submenu (with a mnemonic that appears
pressing Alt) */
// section.append_submenu (_("A_ppearance"), (!) appearance_menu);
-
-
- /* Translators: hamburger menu entry; sound togglebutton (with a mnemonic that appears pressing Alt)
*/
- section.append (_("_Sound"), "app.sound");
+ if (has_sound)
+ {
+ /* Translators: hamburger menu entry; sound togglebutton (with a mnemonic that appears pressing
Alt) */
+ section.append (_("_Sound"), "app.sound");
+ }
section.freeze ();
menu.append_section (null, section);
diff --git a/src/game-window.vala b/src/game-window.vala
index f287d65..b3ebf7d 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -22,6 +22,7 @@ using Gtk;
[Flags]
private enum GameWindowFlags {
+ HAS_SOUND,
SHORTCUTS,
SHOW_HELP,
SHOW_HINT,
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index d213ce1..9210670 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -153,6 +153,7 @@ private class Taquin : Gtk.Application, BaseApplication
_("About Taquin"),
/* start now */ true, // TODO add an option to go to new-game screen?
GameWindowFlags.SHOW_START_BUTTON
+ | GameWindowFlags.HAS_SOUND
| GameWindowFlags.SHORTCUTS
| GameWindowFlags.SHOW_HELP
| GameWindowFlags.SHOW_UNDO,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]