diff options
Diffstat (limited to 'collaboration/neighborhood.py')
-rwxr-xr-x | collaboration/neighborhood.py | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/collaboration/neighborhood.py b/collaboration/neighborhood.py index 192b66f..5287b42 100755 --- a/collaboration/neighborhood.py +++ b/collaboration/neighborhood.py @@ -21,8 +21,7 @@ from functools import partial from hashlib import sha1 import traceback -import gobject -import gconf +from util.gtkcompat import GObject, GConf import dbus from dbus import PROPERTIES_IFACE from telepathy.interfaces import ACCOUNT, \ @@ -75,20 +74,20 @@ will be very slow in returning these queries, so just be patient. """ -class ActivityModel(gobject.GObject): +class ActivityModel(GObject.GObject): __gsignals__ = { - 'current-buddy-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'current-buddy-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'current-buddy-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'current-buddy-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), } def __init__(self, activity_id, room_handle): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self.activity_id = activity_id self.room_handle = room_handle @@ -105,7 +104,7 @@ class ActivityModel(gobject.GObject): def set_color(self, color): self._color = color - color = gobject.property(type=object, getter=get_color, setter=set_color) + color = GObject.property(type=object, getter=get_color, setter=set_color) def get_bundle(self): return self._bundle @@ -113,7 +112,7 @@ class ActivityModel(gobject.GObject): def set_bundle(self, bundle): self._bundle = bundle - bundle = gobject.property(type=object, getter=get_bundle, + bundle = GObject.property(type=object, getter=get_bundle, setter=set_bundle) def get_name(self): @@ -122,7 +121,7 @@ class ActivityModel(gobject.GObject): def set_name(self, name): self._name = name - name = gobject.property(type=object, getter=get_name, setter=set_name) + name = GObject.property(type=object, getter=get_name, setter=set_name) def is_private(self): return self._private @@ -130,7 +129,7 @@ class ActivityModel(gobject.GObject): def set_private(self, private): self._private = private - private = gobject.property(type=object, getter=is_private, + private = GObject.property(type=object, getter=is_private, setter=set_private) def get_buddies(self): @@ -146,7 +145,7 @@ class ActivityModel(gobject.GObject): self.notify('buddies') self.emit('buddy-removed', buddy) - buddies = gobject.property(type=object, getter=get_buddies) + buddies = GObject.property(type=object, getter=get_buddies) def get_current_buddies(self): return self._current_buddies @@ -161,35 +160,35 @@ class ActivityModel(gobject.GObject): self.notify('current-buddies') self.emit('current-buddy-removed', buddy) - current_buddies = gobject.property(type=object, getter=get_current_buddies) + current_buddies = GObject.property(type=object, getter=get_current_buddies) -class _Account(gobject.GObject): +class _Account(GObject.GObject): __gsignals__ = { - 'activity-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object])), - 'activity-updated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-updated': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object])), - 'activity-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object, object])), - 'buddy-updated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-updated': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object])), - 'buddy-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-joined-activity': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-joined-activity': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object])), - 'buddy-left-activity': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-left-activity': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object, object])), - 'current-activity-updated': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([object, object])), - 'connected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), - 'disconnected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), + 'current-activity-updated': (GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, ([object, object])), + 'connected': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([])), + 'disconnected': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([])), } def __init__(self, account_path): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self.object_path = account_path @@ -632,20 +631,20 @@ class _Account(gobject.GObject): -class Neighborhood(gobject.GObject): +class Neighborhood(GObject.GObject): __gsignals__ = { - 'activity-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'activity-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-added': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), - 'buddy-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'buddy-removed': (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ([object])), } def __init__(self, params = {}): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self._buddies = {None: get_owner_instance()} self._activities = {} @@ -729,7 +728,7 @@ class Neighborhood(gobject.GObject): #print('Still dont have a Salut account, creating one') - client = gconf.client_get_default() + client = GConf.Client.get_default() nick = client.get_string('/desktop/sugar/user/nick') params = { @@ -1042,7 +1041,7 @@ if __name__ == "__main__": params["password"] = "test" params["register"] = True - loop = gobject.MainLoop() + loop = GObject.MainLoop() dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) n = get_neighborhood(params) loop.run() |