Patch by Simon to make sugar start when not connected to wireless.

This commit is contained in:
Marco Pesenti Gritti 2007-08-16 17:32:29 +02:00
parent d0a564e035
commit f056056691
2 changed files with 15 additions and 4 deletions

View File

@ -52,6 +52,8 @@ class ActivityToolbar(gtk.Toolbar):
self._activity = activity self._activity = activity
activity.connect('shared', self._activity_shared_cb) activity.connect('shared', self._activity_shared_cb)
activity.connect('joined', self._activity_shared_cb) activity.connect('joined', self._activity_shared_cb)
activity.connect('notify::max_participants',
self._max_participants_changed_cb)
if activity.metadata: if activity.metadata:
self.title = gtk.Entry() self.title = gtk.Entry()
@ -94,10 +96,11 @@ class ActivityToolbar(gtk.Toolbar):
self._update_title_sid = None self._update_title_sid = None
def _update_share(self): def _update_share(self):
max_participants = self._activity.props.max_participants
if self._activity.get_shared(): if self._activity.get_shared():
self.share.set_sensitive(False) self.share.set_sensitive(False)
self.share.combo.set_active(self.SHARE_NEIGHBORHOOD) self.share.combo.set_active(self.SHARE_NEIGHBORHOOD)
else: elif max_participants == -1 or max_participants > 0:
self.share.set_sensitive(True) self.share.set_sensitive(True)
self.share.combo.set_active(self.SHARE_PRIVATE) self.share.combo.set_active(self.SHARE_PRIVATE)
@ -139,6 +142,9 @@ class ActivityToolbar(gtk.Toolbar):
def _activity_shared_cb(self, activity): def _activity_shared_cb(self, activity):
self._update_share() self._update_share()
def _max_participants_changed_cb(self, activity, pspec):
self._update_share()
class EditToolbar(gtk.Toolbar): class EditToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
gtk.Toolbar.__init__(self) gtk.Toolbar.__init__(self)
@ -185,7 +191,8 @@ class Activity(Window, gtk.Container):
} }
__gproperties__ = { __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): def __init__(self, handle, create_jobject=True):
@ -235,6 +242,7 @@ class Activity(Window, gtk.Container):
self._preview = None self._preview = None
self._updating_jobject = False self._updating_jobject = False
self._closing = False self._closing = False
self._max_participants = -1
shared_activity = handle.get_shared_activity() shared_activity = handle.get_shared_activity()
if shared_activity: if shared_activity:
@ -284,6 +292,8 @@ class Activity(Window, gtk.Container):
def do_get_property(self, pspec): def do_get_property(self, pspec):
if pspec.name == 'active': if pspec.name == 'active':
return self._active return self._active
elif pspec.name == 'max-participants':
return self._max_participants
def get_id(self): def get_id(self):
return self._activity_id return self._activity_id

View File

@ -175,6 +175,7 @@ class Palette(gtk.Window):
return gtk.gdk.Rectangle(x, y, width, height) return gtk.gdk.Rectangle(x, y, width, height)
def set_primary_text(self, label, accel_path=None): def set_primary_text(self, label, accel_path=None):
if label is not None:
self._label.set_text(label) self._label.set_text(label)
self._label.show() self._label.show()