From 77c525bf5dc27475a4ae0ccbf66dee3dac365394 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Fri, 22 Jun 2012 15:49:58 +0200 Subject: [PATCH] Respect profile settings (silent profile, disabled vibrations) --- src/usr/lib/hildon-desktop/CallNotify.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/usr/lib/hildon-desktop/CallNotify.py b/src/usr/lib/hildon-desktop/CallNotify.py index 6f81c18..b121c31 100644 --- a/src/usr/lib/hildon-desktop/CallNotify.py +++ b/src/usr/lib/hildon-desktop/CallNotify.py @@ -148,12 +148,14 @@ class CallNotify(hildondesktop.StatusMenuItem): def playSound(self): self.dbg('playSound started') - if self.sound: + profiled = dbus.Interface(dbus.SessionBus().get_object("com.nokia.profiled", "/com/nokia/profiled"), "com.nokia.profiled") + mce = dbus.Interface(dbus.SystemBus().get_object("com.nokia.mce", "/com/nokia/mce/request"), "com.nokia.mce.request") + if self.sound and profiled.get_value("", "ringing.alert.type") != "silent": # Create the player_name sink - if self.msgType == "Call": + if self.msgType == "Call" and profiled.get_value("", "ringing.alert.volume") != "0": self.dbg('play soundCall:' + self.soundCall) Playbin2().play(self.soundCall, self.volume) - elif self.msgType == "SMS": + elif self.msgType == "SMS" and profiled.get_value("", "sms.alert.volume") != "0": self.dbg('play soundSMS:' + self.soundSMS) Playbin2().play(self.soundSMS, self.volume) elif self.msgType == "Both": @@ -162,14 +164,9 @@ class CallNotify(hildondesktop.StatusMenuItem): else: Playbin2().play(self.soundFile, self.volume) - if self.vibration: - bb = 'run-standalone.sh dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_activate string:' + "\'PatternIncomingCall\'" - bb = str(bb) - b = os.popen(bb) - b.close() - bb = 'run-standalone.sh dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_deactivate string:' + "\'PatternIncomingCall\'" - b = os.popen(bb) - b.close() + if self.vibration and profiled.get_value("", "vibrating.alert.enabled") == "On": + mce.req_vibrator_pattern_activate("PatternIncomingCall") + mce.req_vibrator_pattern_deactivate("PatternIncomingCall") return True def loadImages(self): -- 1.7.9.5