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:55:13 (GMT)
commit98049a18c32d7a8184c5a8d1ac641de715662b98 (patch)
tree86148e6ba6b8325d51c833647dabc8ccdeaeac0e
parentfac83b0c892eb522d824a8f5fcf3f59b77aedf1c (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 f20b6ed..ca45218 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -467,7 +467,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',