Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@laptop.org>2013-03-21 10:58:11 (GMT)
committer Simon Schampijer <simon@laptop.org>2013-03-21 11:53:59 (GMT)
commit5b2c88b621d684d8631655fb5fab03fc70fbd2bf (patch)
treeec02802bd646518613e9aaba0f2fce97a0b08af8
parent2577166a9ec64ee2a16abf61397bd75bc279984d (diff)
documents dir: handle cases where get_documents_path returns None, SL #4380
I came across this when the Palettes in the Journal where not able to be displayed because the code to add the copy to documents option was failing hard because get_documents_path returned None. The root cause on my system is that I have wiped the Documents folder and xdg-user-dir returns $HOME as a consequence which we ommit in get_documents_path. This patch does gracefully handle those cases in a few places, including the Palettes. In the volumes toolbar we were already doing so. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r--src/jarabe/journal/journaltoolbox.py3
-rw-r--r--src/jarabe/journal/listview.py5
-rw-r--r--src/jarabe/journal/palettes.py3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index 69ff777..b9c5e68 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -468,7 +468,8 @@ class DetailToolbox(ToolbarBox):
journal_menu.show()
documents_path = model.get_documents_path()
- if not self._metadata['uid'].startswith(documents_path):
+ if documents_path is not None and not \
+ self._metadata['uid'].startswith(documents_path):
documents_menu = VolumeMenu(self._metadata, _('Documents'),
documents_path)
documents_menu.set_image(Icon(icon_name='user-documents',
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 3005d2f..3356d6f 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -332,11 +332,12 @@ class BaseListView(Gtk.Bin):
self.tree_view.get_bin_window().show()
if len(tree_model) == 0:
+ documents_path = model.get_documents_path()
if self._is_query_empty():
if self._query['mountpoints'] == ['/']:
self._show_message(_('Your Journal is empty'))
- elif self._query['mountpoints'] == \
- [model.get_documents_path()]:
+ elif documents_path and self._query['mountpoints'] == \
+ [documents_path]:
self._show_message(_('Your documents folder is empty'))
else:
self._show_message(_('The device is empty'))
diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py
index 200240f..c675c6a 100644
--- a/src/jarabe/journal/palettes.py
+++ b/src/jarabe/journal/palettes.py
@@ -225,7 +225,8 @@ class CopyMenu(Gtk.Menu):
journal_menu.show()
documents_path = model.get_documents_path()
- if not self._metadata['uid'].startswith(documents_path):
+ if documents_path is not None and not \
+ self._metadata['uid'].startswith(documents_path):
documents_menu = VolumeMenu(self._metadata, _('Documents'),
documents_path)
documents_menu.set_image(Icon(icon_name='user-documents',