Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2007-09-24 16:00:36 (GMT)
committer Simon Schampijer <simon@schampijer.de>2007-09-24 16:00:36 (GMT)
commite3f97b042f2ffddcef8d10ae6d9bd3cb4f6c19c1 (patch)
tree57b3abd1356026e35d6aed6f02d54909ce394d2a /shell
parent0a53813064890877a52e2bf392eb4d1dbfbb0a3c (diff)
Save state of volume when shutdown and reboot fix for #3652
Diffstat (limited to 'shell')
-rw-r--r--shell/hardware/hardwaremanager.py13
-rwxr-xr-xshell/sugar-shell3
-rw-r--r--shell/view/home/HomeBox.py7
3 files changed, 23 insertions, 0 deletions
diff --git a/shell/hardware/hardwaremanager.py b/shell/hardware/hardwaremanager.py
index 5a85707..79b932f 100644
--- a/shell/hardware/hardwaremanager.py
+++ b/shell/hardware/hardwaremanager.py
@@ -21,6 +21,8 @@ import gst
import gst.interfaces
from hardware.nmclient import NMClient
+from sugar.profile import get_profile
+from sugar import env
_HARDWARE_MANAGER_INTERFACE = 'org.laptop.HardwareManager'
_HARDWARE_MANAGER_SERVICE = 'org.laptop.HardwareManager'
@@ -80,6 +82,17 @@ class HardwareManager(object):
logging.error('Cannot mute the audio channel')
self._mixer.set_mute(self._master, mute)
+ def startup(self):
+ if env.is_emulator() is False:
+ profile = get_profile()
+ self.set_volume(profile.sound_volume)
+
+ def shutdown(self):
+ if env.is_emulator() is False:
+ profile = get_profile()
+ profile.sound_volume = self.get_volume()
+ profile.save()
+
def set_dcon_freeze(self, frozen):
if not self._service:
return
diff --git a/shell/sugar-shell b/shell/sugar-shell
index 93f2faa..106a9d7 100755
--- a/shell/sugar-shell
+++ b/shell/sugar-shell
@@ -147,6 +147,9 @@ if __name__ == '__main__':
main()
+ hw_manager = hardwaremanager.get_manager()
+ hw_manager.startup()
+
try:
gtk.main()
except KeyboardInterrupt:
diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py
index 82fa083..7cdb2cb 100644
--- a/shell/view/home/HomeBox.py
+++ b/shell/view/home/HomeBox.py
@@ -24,6 +24,7 @@ import gtk
import hippo
import dbus
+from hardware import hardwaremanager
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
from sugar.graphics.palette import Palette, CanvasInvoker
@@ -169,6 +170,9 @@ class HomeMyIcon(MyIcon):
pm = self._get_power_manager()
+ hw_manager = hardwaremanager.get_manager()
+ hw_manager.shutdown()
+
if env.is_emulator():
self._close_emulator()
else:
@@ -180,6 +184,9 @@ class HomeMyIcon(MyIcon):
pm = self._get_power_manager()
+ hw_manager = hardwaremanager.get_manager()
+ hw_manager.shutdown()
+
if env.is_emulator():
self._close_emulator()
else: