Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-06-23 02:42:29 (GMT)
committer Dan Williams <dcbw@redhat.com>2006-06-23 02:42:29 (GMT)
commitf2ef2a68477819f8337eb2c421127f2c719596d1 (patch)
tree3ed3152c73b2481c40a41cd4a6af4727740cd859 /sugar
parentbe992586b1e0d849a732b44eed7047dd8be62501 (diff)
Make activities emit an ActivityShared dbus signal; and have the shell & presence window detect that and disable the 'share' button
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/Activity.py17
-rw-r--r--sugar/presence/PresenceService.py4
2 files changed, 21 insertions, 0 deletions
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)