From 6dd2f7109c2e955ef5649eddf60fefb6bc1f63bd Mon Sep 17 00:00:00 2001 From: Bert Freudenberg Date: Thu, 17 May 2007 13:18:56 +0200 Subject: [PATCH 01/11] Find executable in bundle (approved by marcopg, fix for #1362) --- sugar/activity/bundle.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index 98b9e9ae..d3c490f5 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -78,10 +78,14 @@ class Bundle: if cp.has_option(section, 'class'): self._class = cp.get(section, 'class') self._exec = '%s --bundle-path="%s"' % ( - env.get_bin_path(_PYTHON_FACTORY), self.get_path()) + env.get_bin_path(_PYTHON_FACTORY), self._path) elif cp.has_option(section, 'exec'): self._class = None - self._exec = cp.get(section, 'exec') + cmdline = cp.get(section, 'exec') + cmdline = os.path.join(self._path, cmdline) + cmdline = cmdline.replace('$SUGAR_BUNDLE_PATH', self._path) + cmdline = os.path.expandvars(cmdline) + self._exec = cmdline else: self._exec = None self._valid = False From d72ff8c6fb2c0a097da7ca2ad8ba8a490f10dc5e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 17 May 2007 09:32:34 -0400 Subject: [PATCH 02/11] Don't try to shove None through dbus --- services/presence/buddy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/presence/buddy.py b/services/presence/buddy.py index 200401bd..6db9b79e 100644 --- a/services/presence/buddy.py +++ b/services/presence/buddy.py @@ -386,7 +386,14 @@ class Buddy(ExportedGObject): # to avoid leaking a PropertyChanged signal before the buddy is # actually valid the first time after creation if self._valid: - self.PropertyChanged(changed_props) + dbus_changed = {} + for key, value in changed_props.items(): + if value: + dbus_changed[key] = value + else: + dbus_changed[key] = "" + self.PropertyChanged(dbus_changed) + self.emit('property-changed', changed_props) self._update_validity() From 4af212d2141ad218407fbe1ebe653076879f3123 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 17 May 2007 16:06:04 +0200 Subject: [PATCH 03/11] Disable clicks handling for now, can't figure out what's broken. --- browser/sugar-browser.cpp | 3 ++- build-snapshot.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/sugar-browser.cpp b/browser/sugar-browser.cpp index 2cee6d26..46501831 100644 --- a/browser/sugar-browser.cpp +++ b/browser/sugar-browser.cpp @@ -690,8 +690,9 @@ sugar_browser_init(SugarBrowser *browser) G_CALLBACK(title_cb), NULL); g_signal_connect(G_OBJECT(browser), "location", G_CALLBACK(location_cb), NULL); - g_signal_connect(G_OBJECT(browser), "dom-mouse-click", +/* g_signal_connect(G_OBJECT(browser), "dom-mouse-click", G_CALLBACK(dom_mouse_click_cb), NULL); +*/ } int diff --git a/build-snapshot.sh b/build-snapshot.sh index 7376c781..812d8ace 100755 --- a/build-snapshot.sh +++ b/build-snapshot.sh @@ -1,6 +1,6 @@ VERSION=0.63 DATE=`date +%Y%m%d` -RELEASE=2.82 +RELEASE=2.86 TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2 rm sugar-$VERSION.tar.bz2 From 7b9c59fb9c673128a298d06ab675113f438f402b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 17 May 2007 13:54:26 -0400 Subject: [PATCH 04/11] Correctly send IPv4 address when NM already has a connection --- services/presence/buddy.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/presence/buddy.py b/services/presence/buddy.py index 6db9b79e..2b404e09 100644 --- a/services/presence/buddy.py +++ b/services/presence/buddy.py @@ -457,6 +457,11 @@ class GenericOwner(Buddy): self._registered = kwargs["registered"] del kwargs["registered"] + self._ip4_addr_monitor = psutils.IP4AddressMonitor.get_instance() + self._ip4_addr_monitor.connect("address-changed", self._ip4_address_changed_cb) + if self._ip4_addr_monitor.props.address: + kwargs["ip4-address"] = self._ip4_addr_monitor.props.address + Buddy.__init__(self, bus_name, object_id, **kwargs) self._owner = True @@ -465,9 +470,6 @@ class GenericOwner(Buddy): signal_name="NameOwnerChanged", dbus_interface="org.freedesktop.DBus") - self._ip4_addr_monitor = psutils.IP4AddressMonitor.get_instance() - self._ip4_addr_monitor.connect("address-changed", self._ip4_address_changed_cb) - def _ip4_address_changed_cb(self, monitor, address): """Handle IPv4 address change, set property to generate event""" props = {_PROP_IP4_ADDRESS: address} From b958a515d546af130da793ff311d7b99b43fab8f Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 18 May 2007 13:32:50 +0200 Subject: [PATCH 05/11] Draw the background of the toolbox hbox --- build-snapshot.sh | 2 +- sugar/graphics/toolbox.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build-snapshot.sh b/build-snapshot.sh index 812d8ace..9606dc00 100755 --- a/build-snapshot.sh +++ b/build-snapshot.sh @@ -1,6 +1,6 @@ VERSION=0.63 DATE=`date +%Y%m%d` -RELEASE=2.86 +RELEASE=2.87 TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2 rm sugar-$VERSION.tar.bz2 diff --git a/sugar/graphics/toolbox.py b/sugar/graphics/toolbox.py index 17b1b5fd..0bfc037b 100644 --- a/sugar/graphics/toolbox.py +++ b/sugar/graphics/toolbox.py @@ -34,6 +34,16 @@ class Toolbox(gtk.VBox): self._notebook.set_show_tabs(False) self.pack_start(self._notebook) self._notebook.show() + + def _toolbar_box_expose_cb(self, widget, event): + widget.style.paint_flat_box(widget.window, + gtk.STATE_NORMAL, gtk.SHADOW_NONE, + event.area, widget, 'toolbox', + widget.allocation.x, + widget.allocation.y, + widget.allocation.width, + widget.allocation.height) + return False def add_toolbar(self, name, toolbar): label = gtk.Label(name) @@ -42,7 +52,8 @@ class Toolbox(gtk.VBox): toolbar_box = gtk.HBox() toolbar_box.pack_start(toolbar, True, True, units.grid_to_pixels(1)) - + toolbar_box.connect('expose-event', self._toolbar_box_expose_cb) + self._notebook.append_page(toolbar_box, label) toolbar_box.show() From 6c671fb7fe11c7b146ed8496f8fd2505dce7bcae Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 18 May 2007 14:00:29 +0200 Subject: [PATCH 06/11] Size the toolbox to 1 grid cell --- sugar/graphics/toolbox.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sugar/graphics/toolbox.py b/sugar/graphics/toolbox.py index 0bfc037b..1b7121a1 100644 --- a/sugar/graphics/toolbox.py +++ b/sugar/graphics/toolbox.py @@ -52,6 +52,7 @@ class Toolbox(gtk.VBox): toolbar_box = gtk.HBox() toolbar_box.pack_start(toolbar, True, True, units.grid_to_pixels(1)) + toolbar_box.set_size_request(-1, units.grid_to_pixels(1)) toolbar_box.connect('expose-event', self._toolbar_box_expose_cb) self._notebook.append_page(toolbar_box, label) From 3ac4cb5432c30bc2744c4139dad825d0a3671792 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sat, 19 May 2007 10:01:07 +0200 Subject: [PATCH 07/11] Stop depending on NSPR. --- configure.ac | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/configure.ac b/configure.ac index 6f4f2a33..ecfb7b1c 100644 --- a/configure.ac +++ b/configure.ac @@ -57,22 +57,6 @@ AC_SUBST(MOZILLA_INCLUDE_DIR) AC_SUBST(XPIDL) AC_SUBST(MOZILLA_IDL_DIR) -PKG_CHECK_MODULES(NSPR, [nspr], - [have_nspr=true], - [ -PKG_CHECK_MODULES(NSPR, [mozilla-nspr], - [have_nspr=true], - [ -PKG_CHECK_MODULES(NSPR, [xulrunner-nspr], - [have_nspr=true], - have_nspr=false) - ]) - ]) - -if test "x$have_nspr" = xfalse; then - AC_MSG_ERROR([Could not find nspr]) -fi - else AC_MSG_ERROR([Must specify the xulrunner sdk dir (--with-libxul-sdk)]) From abec4df66ec2433249185ce8a046e33a60c20acb Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sat, 19 May 2007 11:19:56 +0200 Subject: [PATCH 08/11] Don't try to display an icon without file name. --- sugar/graphics/canvasicon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 14f83519..ec141d0c 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -123,7 +123,7 @@ class _IconCache: del self._icons[evict_key] def get_handle(self, name, fill_color, stroke_color): - if name == None: + if not name: return None if name[0:6] == "theme:": From 5d4b9b1dfa6a10e25062f439b1af30cdfa06e3d2 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sat, 19 May 2007 20:06:36 +0200 Subject: [PATCH 09/11] Set the activity icon on new journal entries. --- sugar/activity/activity.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 421d7ba2..05d02a4c 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -28,6 +28,7 @@ import gtk, gobject from sugar.presence import presenceservice from sugar.activity.activityservice import ActivityService +from sugar.activity import bundleregistry from sugar.graphics.window import Window from sugar.graphics.toolbox import Toolbox from sugar.graphics.toolbutton import ToolButton @@ -206,7 +207,7 @@ class Activity(Window, gtk.Container): self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity') self.jobject['activity'] = self.get_service_name() self.jobject['date'] = str(time.time()) - self.jobject['icon'] = '' + self.jobject['icon'] = self._get_icon() self.jobject['keep'] = '0' self.jobject['buddies'] = '' self.jobject['preview'] = '' @@ -329,6 +330,10 @@ class Activity(Window, gtk.Container): raise self.destroy() + def _get_icon(self): + registry = bundleregistry.get_registry() + return registry.get_bundle(self.get_service_name()).get_icon() + def get_bundle_name(): """Return the bundle name for the current process' bundle """ From 04fc7047c2a640f731090839137f26cacc16094c Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sun, 20 May 2007 12:36:55 +0200 Subject: [PATCH 10/11] Don't autolaunch downloaded docs, this will be done from the Web activity. --- shell/view/clipboardicon.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/shell/view/clipboardicon.py b/shell/view/clipboardicon.py index fb370fb9..fc609f6b 100644 --- a/shell/view/clipboardicon.py +++ b/shell/view/clipboardicon.py @@ -106,16 +106,6 @@ class ClipboardIcon(CanvasIcon): else: self.props.xo_color = XoColor("#000000,#FFFFFF") - if activity and percent == 100: - # FIXME: restrict based on file type rather than activity once - # we have a better type registry - # restrict auto-open to a specific set of activities - allowed = ["org.laptop.AbiWordActivity", - "org.laptop.sugar.Xbook", - "org.vpri.EtoysActivity"] - if activity in allowed: - self._open_file() - def _open_file(self): if self._percent < 100: return From 11c89d86c91d91de42a815f7715076494c33fa25 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sun, 20 May 2007 12:38:08 +0200 Subject: [PATCH 11/11] Put dates to work correctly on the journal, create a new journal entry when resuming a past entry. --- sugar/activity/activity.py | 4 +++- sugar/datastore/datastore.py | 3 +++ sugar/datastore/dbus_helpers.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 05d02a4c..3dba4c71 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -201,12 +201,14 @@ class Activity(Window, gtk.Container): if handle.object_id: self.jobject = datastore.get(handle.object_id) + self.jobject.object_id = '' + del self.jobject['ctime'] + del self.jobject['mtime'] elif create_jobject: logging.debug('Creating a jobject.') self.jobject = datastore.create() self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity') self.jobject['activity'] = self.get_service_name() - self.jobject['date'] = str(time.time()) self.jobject['icon'] = self._get_icon() self.jobject['keep'] = '0' self.jobject['buddies'] = '' diff --git a/sugar/datastore/datastore.py b/sugar/datastore/datastore.py index 99fd230d..9d656707 100644 --- a/sugar/datastore/datastore.py +++ b/sugar/datastore/datastore.py @@ -39,6 +39,9 @@ class DSObject(gobject.GObject): self.metadata[key] = value self.emit('updated') + def __delitem__(self, key): + del self.metadata[key] + def get_metadata(self): return self._metadata diff --git a/sugar/datastore/dbus_helpers.py b/sugar/datastore/dbus_helpers.py index 33aa9a6e..fa054915 100644 --- a/sugar/datastore/dbus_helpers.py +++ b/sugar/datastore/dbus_helpers.py @@ -40,7 +40,7 @@ def create(properties, filename): return object_id def update(uid, properties, filename, reply_handler=None, error_handler=None): - logging.debug('dbus_helpers.update') + logging.debug('dbus_helpers.update: %s, %s' % (uid, filename)) if reply_handler and error_handler: _data_store.update(uid, dbus.Dictionary(properties), filename, reply_handler=reply_handler,