Respect profile settings (silent profile, disabled vibrations)
authorPali Rohár <pali.rohar@gmail.com>
Fri, 22 Jun 2012 13:49:58 +0000 (15:49 +0200)
committerPali Rohár <pali.rohar@gmail.com>
Fri, 22 Jun 2012 13:49:58 +0000 (15:49 +0200)
src/usr/lib/hildon-desktop/CallNotify.py

index 6f81c18..b121c31 100644 (file)
@@ -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):