Fixed proxy handling
[zeroinstall.git] / tests / my_dbus.py
blob547fc62b0250c8aea5d2e37aebe7e641c2026f4f
1 user_callback = None # Invoked in a callback when a question box is displayed
2 class mainloop:
3 class glib:
4 @classmethod
5 def DBusGMainLoop(a, set_as_default = False):
6 pass
8 system_services = {} # {service_name: {path: object}}
10 class SessionBus:
11 def get_object(self, service, path):
12 return None
14 class SystemBus:
15 def get_object(self, service, path, follow_name_owner_changes = False):
16 service = system_services.get(service, None)
17 if service:
18 return service[path]
19 return None
21 def Interface(obj, iface):
22 return obj
24 class NotifyCb:
25 def __init__(self):
26 self.callback = {}
27 self.boxes = []
29 def GetCapabilities(self):
30 pass
32 def Notify(self, *args):
33 self.boxes.append(args)
34 nid = len(self.boxes)
36 app, replaces_id, icon, title, message, actions, hints, timeout = args
38 if actions:
39 user_callback(self.callback['ActionInvoked'], nid, actions)
41 return nid
43 def connect_to_signal(self, signal, callback):
44 self.callback[signal] = callback
46 class Byte:
47 def __init__(self, value):
48 pass
50 PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties'
52 class exceptions:
53 class DBusException(Exception):
54 def __init__(self, name):
55 self.name = name
57 def get_dbus_name(self):
58 return self.name