[Dextrose] [PATCH] Copy .xo to removable device hack

Martin Abente martin.abente.lahaye at gmail.com
Tue Mar 15 21:12:23 EDT 2011


Plan Ceibal folks reported that it wasn't possible
to copy .xo files from datastore to removable
devices. This bug affects all versions of dextrose
and other distros bases on sugar 0.88.1.

The problem was caused by a too generalist logic
at _model_created_cb in which the journal was trying
to install bundles also when copying files to
external devices.

This bug seems to be fixed in mainstream, but as side
effect of a big change to the journal code.

This patch checks for corner cases and avoid any attempt
of installation when copying to external remoable devices.

Signed-off-by: Martin Abente <martin.abente.lahaye at gmail.com>
---
 src/jarabe/journal/journalactivity.py |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index b96135c..456a027 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -253,16 +253,27 @@ class JournalActivity(JournalWindow):
         self._main_toolbox.search_toolbar.set_mount_point(mount_point)
         self._main_toolbox.set_current_toolbar(0)
 
+    def _is_datastore_object(self, object_id):
+        metadata = model.get(object_id)
+        return model.is_editable(metadata)
+
     def __model_created_cb(self, sender, **kwargs):
-        self._check_for_bundle(kwargs['object_id'])
+        object_id = kwargs['object_id']
+
+        if self._is_datastore_object(object_id):
+            self._check_for_bundle(object_id)
+
         self._main_toolbox.search_toolbar.refresh_filters()
         self._check_available_space()
 
     def __model_updated_cb(self, sender, **kwargs):
-        self._check_for_bundle(kwargs['object_id'])
+        object_id = kwargs['object_id']
+
+        if self._is_datastore_object(object_id):
+            self._check_for_bundle(object_id)
 
         if self.canvas == self._secondary_view and \
-                kwargs['object_id'] == self._detail_view.props.metadata['uid']:
+                object_id == self._detail_view.props.metadata['uid']:
             self._detail_view.refresh()
 
         self._check_available_space()
-- 
1.7.1



More information about the Dextrose mailing list