[Dextrose] [sugar mainline PATCH] sl#3605: Do not rely on 'mountpoint' property being present in the metadata per entry. Instead use the global API.
ajay at activitycentral.com
ajay at activitycentral.com
Tue Jun 5 09:00:24 EDT 2012
From: Ajay Garg <ajay at activitycentral.com>
Following are the steps to reproduce the issue ::
a)
Ensure that the "Journal" and "Documents" are empty.
b)
Copy a file (I tried with a mp3) to a USB drive, from a non-XO machine.
c)
Insert the USB drive in the XO.
d)
Copy the file (of step b) ) to "Documents" folder.
e)
View Details of the copied entry (in "Documents").
f)
There should be the exception in the logs. Moreover, the "Description" field should be empty in the "Details View" (this field ought to be "/media/<name of USB drive>").
src/jarabe/journal/journalactivity.py | 12 ++++++++++++
src/jarabe/journal/model.py | 8 +++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index bb1c7f6..485e7b4 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -53,6 +53,7 @@ _SPACE_TRESHOLD = 52428800
_BUNDLE_ID = 'org.laptop.JournalActivity'
_journal = None
+_mount_point = None
class JournalActivityDBusService(dbus.service.Object):
@@ -122,6 +123,8 @@ class JournalActivity(JournalWindow):
self._detail_toolbox = None
self._volumes_toolbar = None
+ set_mount_point('/')
+
self._setup_main_view()
self._setup_secondary_view()
@@ -184,6 +187,7 @@ class JournalActivity(JournalWindow):
search_toolbar = self._main_toolbox.search_toolbar
search_toolbar.connect('query-changed', self._query_changed_cb)
search_toolbar.set_mount_point('/')
+ set_mount_point('/')
def _setup_secondary_view(self):
self._secondary_view = gtk.VBox()
@@ -253,6 +257,7 @@ class JournalActivity(JournalWindow):
def __volume_changed_cb(self, volume_toolbar, mount_point):
logging.debug('Selected volume: %r.', mount_point)
self._main_toolbox.search_toolbar.set_mount_point(mount_point)
+ set_mount_point(mount_point)
self._main_toolbox.set_current_toolbar(0)
def __model_created_cb(self, sender, **kwargs):
@@ -373,3 +378,10 @@ def get_journal():
def start():
get_journal()
+
+def set_mount_point(mount_point):
+ global _mount_point
+ _mount_point = mount_point
+
+def get_mount_point():
+ return _mount_point
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 5285a7c..98b8e52 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -793,7 +793,13 @@ def is_editable(metadata):
if metadata.get('mountpoint', '/') == '/':
return True
else:
- return os.access(metadata['mountpoint'], os.W_OK)
+ # sl#3605: Instead of relying on mountpoint property being
+ # present in the metadata, use journalactivity api.
+ # This would work seamlessly, as "Details View' is
+ # called, upon an entry in the context of a singular
+ # mount-point.
+ from jarabe.journal.journalactivity import get_mount_point
+ return os.access(get_mount_point(), os.W_OK)
def get_documents_path():
--
1.7.10.1
More information about the Dextrose
mailing list