Do not expose the service names from Activity.
This create quite a bit of duplication, but I have to start somewhere cleaning this mess :/
This commit is contained in:
@@ -15,14 +15,18 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import time
|
||||
import gobject
|
||||
import logging
|
||||
|
||||
import gobject
|
||||
import dbus
|
||||
|
||||
from sugar.graphics.iconcolor import IconColor
|
||||
from sugar.presence import PresenceService
|
||||
from sugar.activity import Activity
|
||||
from sugar import profile
|
||||
|
||||
_ACTIVITY_SERVICE_NAME = "org.laptop.Activity"
|
||||
_ACTIVITY_SERVICE_PATH = "/org/laptop/Activity"
|
||||
|
||||
class HomeActivity(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
'launch-timeout': (gobject.SIGNAL_RUN_FIRST,
|
||||
@@ -69,7 +73,10 @@ class HomeActivity(gobject.GObject):
|
||||
|
||||
self._window = window
|
||||
self._xid = window.get_xid()
|
||||
self._service = Activity.get_service(window.get_xid())
|
||||
|
||||
bus = dbus.SessionBus()
|
||||
self._service = bus.get_object(_ACTIVITY_SERVICE_NAME + '%d' % self._xid,
|
||||
_ACTIVITY_SERVICE_PATH + "/%s" % self._xid)
|
||||
|
||||
# verify id and type details
|
||||
act_id = self._service.get_id()
|
||||
@@ -79,6 +86,9 @@ class HomeActivity(gobject.GObject):
|
||||
if act_type != self._type:
|
||||
raise RuntimeError("Activity's real type (%s) didn't match expected (%s)." % (act_type, self._type))
|
||||
|
||||
def get_service(self):
|
||||
return self._service
|
||||
|
||||
def get_title(self):
|
||||
if not self._launched:
|
||||
raise RuntimeError("Activity is still launching.")
|
||||
|
||||
@@ -18,10 +18,14 @@ import logging
|
||||
|
||||
import gobject
|
||||
import wnck
|
||||
import dbus
|
||||
|
||||
from model.homeactivity import HomeActivity
|
||||
from sugar.activity import Activity
|
||||
|
||||
_ACTIVITY_SERVICE_NAME = "org.laptop.Activity"
|
||||
_ACTIVITY_SERVICE_PATH = "/org/laptop/Activity"
|
||||
|
||||
class HomeModel(gobject.GObject):
|
||||
|
||||
__gsignals__ = {
|
||||
@@ -114,7 +118,10 @@ class HomeModel(gobject.GObject):
|
||||
self.emit('active-activity-changed', self._current_activity)
|
||||
|
||||
def _add_activity(self, window):
|
||||
act_service = Activity.get_service(window.get_xid())
|
||||
bus = dbus.SessionBus()
|
||||
xid = window.get_xid()
|
||||
act_service = bus.get_object(_ACTIVITY_SERVICE_NAME + '%d' % xid,
|
||||
_ACTIVITY_SERVICE_PATH + "/%s" % xid)
|
||||
act_id = act_service.get_id()
|
||||
|
||||
activity = None
|
||||
@@ -128,7 +135,7 @@ class HomeModel(gobject.GObject):
|
||||
if not bundle:
|
||||
raise RuntimeError("No bundle for activity type '%s'." % act_type)
|
||||
return
|
||||
activity = HomeActivity(bundle, act_id)
|
||||
activity = HomeActivity(act_service, bundle)
|
||||
self._activities[act_id] = activity
|
||||
|
||||
activity.set_window(window)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import gtk
|
||||
import dbus
|
||||
|
||||
from sugar.activity import Activity
|
||||
from sugar.p2p import Stream
|
||||
from sugar.p2p import network
|
||||
from sugar.chat import ActivityChat
|
||||
@@ -42,7 +41,7 @@ class ActivityHost:
|
||||
self._model = model
|
||||
self._id = model.get_id()
|
||||
self._window = model.get_window()
|
||||
self._activity = Activity.get_service(self.get_xid())
|
||||
self._activity = model.get_service()
|
||||
self._gdk_window = gtk.gdk.window_foreign_new(self.get_xid())
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user