From f2ef2a68477819f8337eb2c421127f2c719596d1 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 23 Jun 2006 02:42:29 +0000 Subject: Make activities emit an ActivityShared dbus signal; and have the shell & presence window detect that and disable the 'share' button --- (limited to 'sugar') diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py index 2af336a..1cf9f94 100644 --- a/sugar/activity/Activity.py +++ b/sugar/activity/Activity.py @@ -141,6 +141,11 @@ class ActivityDbusService(dbus.service.Object): """Called by the shell to request the activity to publish itself on the network.""" self._call_callback(ON_PUBLISH_CB) + @dbus.service.signal(ACTIVITY_SERVICE_NAME) + def ActivityShared(self): + print "sent signal" + pass + class Activity(object): """Base Activity class that all other Activities derive from.""" @@ -157,6 +162,7 @@ class Activity(object): self._plug = None self._initial_service = None self._activity_object = None + self._shared = False if type(default_type) != type("") or not len(default_type): raise ValueError("Default type must be a valid string.") self._default_type = default_type @@ -180,6 +186,15 @@ class Activity(object): def default_type(self): return self._default_type + def set_shared(self): + """Mark the activity as 'shared'.""" + if not self._shared: + self._shared = True + self._dbus_service.ActivityShared() + + def shared(self): + return self._shared + def has_focus(self): """Return whether or not this Activity is visible to the user.""" return self._has_focus @@ -197,6 +212,8 @@ class Activity(object): print "Activity: XEMBED window ID is %s" % self._window_id self._plug = gtk.Plug(self._window_id) self._initial_service = service + if service: + self.set_shared(True) self.on_connected_to_shell() def _internal_on_disconnected_from_shell_cb(self): diff --git a/sugar/presence/PresenceService.py b/sugar/presence/PresenceService.py index c379b85..9599025 100644 --- a/sugar/presence/PresenceService.py +++ b/sugar/presence/PresenceService.py @@ -492,6 +492,10 @@ class PresenceService(gobject.GObject): # random port # port = random.randint(5000, 65535) + # Mark the activity as shared + if stype == activity.default_type(): + activity.set_shared() + logging.debug('Share activity %s, type %s, address %s, port %d, properties %s' % (actid, stype, address, port, properties)) service = Service.Service(name=real_name, stype=stype, domain="local", address=address, port=port, properties=properties) -- cgit v0.9.1