From e01837f8be8bd7ce51c665598df458e3b804541c Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Wed, 4 Sep 2013 13:09:40 -0600 Subject: [PATCH] Drop use of deprecated dbus.glib When writing Python apps that will use asynchronous DBus calls and signals, python-dbus must be initialised with the appropriate main loop. sugar currently does this by importing the datastore module from sugar-toolkit-gtk3, and the datastore module uses the deprecated and confusing dbus.glib module (which automatically and non-obviously sets the default GLib main context as the DBus mainloop). Eliminate the dbus.glib usage from sugar-toolkit-gtk3 as part of the effort to make sugar initialised the DBus mainloop in a more explicit and non-deprecated fashion. --- bin/sugar-activity | 3 ++- src/sugar3/datastore/datastore.py | 1 - src/sugar3/presence/presenceservice.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/sugar-activity b/bin/sugar-activity index 7cec4c41..b5c796bf 100644 --- a/bin/sugar-activity +++ b/bin/sugar-activity @@ -29,7 +29,8 @@ from optparse import OptionParser import dbus import dbus.service -import dbus.glib +from dbus.mainloop.glib import DBusGMainLoop +DBusGMainLoop(set_as_default=True) from sugar3.activity import activityhandle from sugar3.activity import i18n diff --git a/src/sugar3/datastore/datastore.py b/src/sugar3/datastore/datastore.py index fe990ae3..fcea5b53 100644 --- a/src/sugar3/datastore/datastore.py +++ b/src/sugar3/datastore/datastore.py @@ -29,7 +29,6 @@ from gi.repository import GObject from gi.repository import GConf from gi.repository import Gio import dbus -import dbus.glib from sugar3 import env from sugar3 import mime diff --git a/src/sugar3/presence/presenceservice.py b/src/sugar3/presence/presenceservice.py index 0f6f6dab..85b1628a 100644 --- a/src/sugar3/presence/presenceservice.py +++ b/src/sugar3/presence/presenceservice.py @@ -25,7 +25,6 @@ import logging from gi.repository import GObject import dbus import dbus.exceptions -import dbus.glib from dbus import PROPERTIES_IFACE from sugar3.presence.buddy import Buddy, Owner