Fix Buddy object's get_service_of_type() method
This call would always fail for activity services because the dbus bindings for it did not pass in the activity at all. Fix that.
This commit is contained in:
parent
fe448938b1
commit
1226b0b6b9
@ -88,9 +88,18 @@ class BuddyDBusHelper(dbus.service.Object):
|
|||||||
return icon
|
return icon
|
||||||
|
|
||||||
@dbus.service.method(BUDDY_DBUS_INTERFACE,
|
@dbus.service.method(BUDDY_DBUS_INTERFACE,
|
||||||
in_signature="s", out_signature="o")
|
in_signature="so", out_signature="o")
|
||||||
def getServiceOfType(self, stype):
|
def getServiceOfType(self, stype, activity_op):
|
||||||
service = self._parent.get_service_of_type(stype)
|
activity = None
|
||||||
|
# "/" is the placeholder for None
|
||||||
|
if activity_op != "/":
|
||||||
|
for act in self._parent.get_joined_activities():
|
||||||
|
if act.object_path() == activity_op:
|
||||||
|
activity = act
|
||||||
|
if not activity:
|
||||||
|
raise NotFoundError("Not found")
|
||||||
|
|
||||||
|
service = self._parent.get_service_of_type(stype, activity)
|
||||||
if not service:
|
if not service:
|
||||||
raise NotFoundError("Not found")
|
raise NotFoundError("Not found")
|
||||||
return service.object_path()
|
return service.object_path()
|
||||||
@ -357,7 +366,7 @@ class Buddy(object):
|
|||||||
acts.append(act)
|
acts.append(act)
|
||||||
return acts
|
return acts
|
||||||
|
|
||||||
def get_service_of_type(self, stype=None, activity=None):
|
def get_service_of_type(self, stype, activity=None):
|
||||||
"""Return a service of a certain type, or None if the buddy
|
"""Return a service of a certain type, or None if the buddy
|
||||||
doesn't provide that service."""
|
doesn't provide that service."""
|
||||||
if not stype:
|
if not stype:
|
||||||
|
@ -172,9 +172,12 @@ class Buddy(gobject.GObject):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_service_of_type(self, stype):
|
def get_service_of_type(self, stype, activity=None):
|
||||||
try:
|
try:
|
||||||
object_path = self._buddy.getServiceOfType(stype)
|
act_op = "/"
|
||||||
|
if activity:
|
||||||
|
act_op = activity.object_path()
|
||||||
|
object_path = self._buddy.getServiceOfType(stype, act_op)
|
||||||
except dbus.exceptions.DBusException:
|
except dbus.exceptions.DBusException:
|
||||||
return None
|
return None
|
||||||
return self._ps_new_object(object_path)
|
return self._ps_new_object(object_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user