diff options
author | Simon Schampijer <simon@schampijer.de> | 2010-08-31 14:44:53 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2010-08-31 14:44:53 (GMT) |
commit | 46f194c0e9d8a053d41869e18d3d237423c6832c (patch) | |
tree | 04c8924434051026250d778e2912d89a303520e7 /src/jarabe/journal/journaltoolbox.py | |
parent | c5ac2887e7cb121645747d339f7b34dc8d673992 (diff) |
Journal: Alert if an error occures when copying to devices in the detail view #1842
Includes better error messages for both cases
(detail view and dragging in main view).
Diffstat (limited to 'src/jarabe/journal/journaltoolbox.py')
-rw-r--r-- | src/jarabe/journal/journaltoolbox.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py index 75c6de5..6b109a8 100644 --- a/src/jarabe/journal/journaltoolbox.py +++ b/src/jarabe/journal/journaltoolbox.py @@ -363,6 +363,11 @@ class DetailToolbox(Toolbox): self.entry_toolbar.show() class EntryToolbar(gtk.Toolbar): + __gsignals__ = { + 'volume-error': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, + ([str, str])) + } def __init__(self): gtk.Toolbar.__init__(self) @@ -432,7 +437,22 @@ class EntryToolbar(gtk.Toolbar): misc.resume(self._metadata, service_name) def _copy_menu_item_activate_cb(self, menu_item, mount_point): - model.copy(self._metadata, mount_point) + file_path = model.get_file(self._metadata['uid']) + + if not file_path or not os.path.exists(file_path): + logging.warn('Entries without a file cannot be copied.') + self.emit('volume-error', + _('Entries without a file cannot be copied.'), + _('Warning')) + return + + try: + model.copy(self._metadata, mount_point) + except IOError, e: + logging.exception('Error while copying the entry. %s', e.strerror) + self.emit('volume-error', + _('Error while copying the entry. %s') % e.strerror, + _('Error')) def _refresh_copy_palette(self): palette = self._copy.get_palette() |