Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10117 from samjoch/bug-877813-SoundsControlToTurn…
Browse files Browse the repository at this point in the history
…OffBootAndShutdownSoundsIsNeededInSettings

Bug 877813 - [Sounds] Control to Turn off Boot and Shutdown Sounds is needed in Settings r=alive
  • Loading branch information
samjoch committed May 31, 2013
2 parents b81ceb3 + 792c599 commit d5d898b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
7 changes: 7 additions & 0 deletions apps/settings/index.html
Expand Up @@ -1235,6 +1235,13 @@ <h2 data-l10n-id="other-sounds">Other Sounds</h2>
</label>
<a data-l10n-id="unlock-screen">Unlock Screen</a>
</li>
<li>
<label>
<input type="checkbox" name="bootshutdown.sound.enabled" checked />
<span></span>
</label>
<a data-l10n-id="boot-and-shutdown">Boot and Shutdown</a>
</li>
</ul>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/settings/locales/settings.en-US.properties
Expand Up @@ -256,6 +256,7 @@ alert-tones=Alert tones
volume-and-tones=Volume & Tones
other-sounds=Other sounds
alerts=Alerts
boot-and-shutdown=Boot and Shutdown
unlock-screen=Unlock screen
camera-shutter=Camera shutter
sent-mail=Sent Mail
Expand Down
11 changes: 11 additions & 0 deletions apps/system/js/boot_sound.js
@@ -1,6 +1,17 @@
var BootSound = (function() {

var key = 'bootshutdown.sound.enabled';

var shouldPlayBootSound = false;

SettingsListener.observe(key, true, function(value) {
shouldPlayBootSound = value;
});

function playBootupSound(delay) {
if (!shouldPlayBootSound) {
return;
}
var bootupSound = new Audio('./resources/sounds/bootup.ogg');
if (delay === 0) {
bootupSound.play();
Expand Down
14 changes: 12 additions & 2 deletions apps/system/js/sleep_menu.js
Expand Up @@ -10,6 +10,9 @@ var SleepMenu = {
// Indicate setting status of volume
isSilentModeEnabled: false,

// Indicate setting status of bootshutdown.sound.enabled
shouldPlayShutdownSound: false,

elements: {},

get visible() {
Expand Down Expand Up @@ -41,6 +44,11 @@ var SleepMenu = {
SettingsListener.observe('audio.volume.notification', 7, function(value) {
self.isSilentModeEnabled = (value == 0);
});

SettingsListener.observe('bootshutdown.sound.enabled', true,
function(value) {
self.shouldPlayShutdownSound = value;
});
},

// Generate items
Expand Down Expand Up @@ -282,8 +290,10 @@ var SleepMenu = {
// Switch to next class
if (e.target == div) {
div.className = 'step2';
var shutdownSound = new Audio('./resources/sounds/shutdown.ogg');
shutdownSound.play();
if (self.shouldPlayShutdownSound) {
var shutdownSound = new Audio('./resources/sounds/shutdown.ogg');
shutdownSound.play();
}
}

if (e.target != inner)
Expand Down
1 change: 1 addition & 0 deletions build/settings.py
Expand Up @@ -24,6 +24,7 @@
"audio.volume.cemaxvol": 11,
"bluetooth.enabled": False,
"bluetooth.debugging.enabled": False,
"bootshutdown.sound.enabled": True,
"camera.shutter.enabled": True,
"clear.remote-windows.data": False,
"debug.grid.enabled": False,
Expand Down

0 comments on commit d5d898b

Please sign in to comment.