From f0560566919e1d93caaa4dc86e9233493d2005be Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 16 Aug 2007 15:32:29 +0000 Subject: Patch by Simon to make sugar start when not connected to wireless. --- diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 262d89b..3f272a2 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -52,6 +52,8 @@ class ActivityToolbar(gtk.Toolbar): self._activity = activity activity.connect('shared', self._activity_shared_cb) activity.connect('joined', self._activity_shared_cb) + activity.connect('notify::max_participants', + self._max_participants_changed_cb) if activity.metadata: self.title = gtk.Entry() @@ -94,10 +96,11 @@ class ActivityToolbar(gtk.Toolbar): self._update_title_sid = None def _update_share(self): + max_participants = self._activity.props.max_participants if self._activity.get_shared(): self.share.set_sensitive(False) self.share.combo.set_active(self.SHARE_NEIGHBORHOOD) - else: + elif max_participants == -1 or max_participants > 0: self.share.set_sensitive(True) self.share.combo.set_active(self.SHARE_PRIVATE) @@ -139,6 +142,9 @@ class ActivityToolbar(gtk.Toolbar): def _activity_shared_cb(self, activity): self._update_share() + def _max_participants_changed_cb(self, activity, pspec): + self._update_share() + class EditToolbar(gtk.Toolbar): def __init__(self): gtk.Toolbar.__init__(self) @@ -185,7 +191,8 @@ class Activity(Window, gtk.Container): } __gproperties__ = { - 'active': (bool, None, None, False, gobject.PARAM_READWRITE) + 'active': : (bool, None, None, False, gobject.PARAM_READWRITE) + 'max-participants': (int, -1, 1000, 0, gobject.PARAM_READWRITE) } def __init__(self, handle, create_jobject=True): @@ -235,6 +242,7 @@ class Activity(Window, gtk.Container): self._preview = None self._updating_jobject = False self._closing = False + self._max_participants = -1 shared_activity = handle.get_shared_activity() if shared_activity: @@ -284,6 +292,8 @@ class Activity(Window, gtk.Container): def do_get_property(self, pspec): if pspec.name == 'active': return self._active + elif pspec.name == 'max-participants': + return self._max_participants def get_id(self): return self._activity_id diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index 3573e96..9b27163 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -175,8 +175,9 @@ class Palette(gtk.Window): return gtk.gdk.Rectangle(x, y, width, height) def set_primary_text(self, label, accel_path=None): - self._label.set_text(label) - self._label.show() + if label is not None: + self._label.set_text(label) + self._label.show() def set_content(self, widget): if len(self._content.get_children()) > 0: -- cgit v0.9.1