1
0
Fork 0

ofono: Remove the SmsWatcher.. but add an easy way to register

This commit is contained in:
Holger Hans Peter Freyther 2012-11-09 19:48:17 +01:00
parent 62004b3e26
commit 4c7e84f080
1 changed files with 6 additions and 21 deletions

View File

@ -15,27 +15,6 @@
import dbus
sms = []
class SmsWatcher:
def __init__(self, sms):
self.sms = sms
self.watched = {}
self.sms.connect_to_signal("MessageAdded", self._msg_added)
self.sms.connect_to_signal("MessageRemoved", self._msg_removed)
def _msg_added(self, property, value):
self.watched[property] = 1
print "PROP: ", property
print "VA:: ", value
def _msg_removed(self, property):
try:
del self.watched[property]
except KeyError:
pass
print "PROP: ", property
class Sms(object):
def __init__(self, bus, name):
self.bus = bus
@ -71,6 +50,12 @@ class SmsManager(object):
def get_message(self, path):
return Sms(self.bus, path)
def registerOnMsgAdded(self, cb):
self.sms.connect_to_signal('MessageAdded', cb)
def registerOnMsgRemoved(self, cb):
self.sms.connect_to_signal('MessageRemoved', cb)
def __repr__(self):
return "<SmsManager for Modem('%s')>" % self.name