Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2010-08-31 14:44:53 (GMT)
committer Simon Schampijer <simon@schampijer.de>2010-08-31 14:44:53 (GMT)
commit46f194c0e9d8a053d41869e18d3d237423c6832c (patch)
tree04c8924434051026250d778e2912d89a303520e7
parentc5ac2887e7cb121645747d339f7b34dc8d673992 (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).
-rw-r--r--src/jarabe/journal/journalactivity.py9
-rw-r--r--src/jarabe/journal/journaltoolbox.py22
-rw-r--r--src/jarabe/journal/volumestoolbar.py16
3 files changed, 35 insertions, 12 deletions
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index e278420..44cc018 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -140,8 +140,8 @@ class JournalActivity(Window):
self._critical_space_alert = None
self._check_available_space()
- def __alert_notify_cb(self, gobject, strerror, severity):
- alert = ErrorAlert(title=severity, msg=strerror)
+ def __volume_error_cb(self, gobject, message, severity):
+ alert = ErrorAlert(title=severity, msg=message)
alert.connect('response', self.__alert_response_cb)
self.add_alert(alert)
alert.show()
@@ -172,7 +172,7 @@ class JournalActivity(Window):
self._volumes_toolbar = VolumesToolbar()
self._volumes_toolbar.connect('volume-changed',
self.__volume_changed_cb)
- self._volumes_toolbar.connect('volume-error', self.__alert_notify_cb)
+ self._volumes_toolbar.connect('volume-error', self.__volume_error_cb)
self._main_view.pack_start(self._volumes_toolbar, expand=False)
search_toolbar = self._main_toolbox.search_toolbar
@@ -183,7 +183,8 @@ class JournalActivity(Window):
self._secondary_view = gtk.VBox()
self._detail_toolbox = DetailToolbox()
- entry_toolbar = self._detail_toolbox.entry_toolbar
+ self._detail_toolbox.entry_toolbar.connect('volume-error',
+ self.__volume_error_cb)
self._detail_view = DetailView()
self._detail_view.connect('go-back-clicked', self.__go_back_clicked_cb)
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()
diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py
index 8b7786f..4208c17 100644
--- a/src/jarabe/journal/volumestoolbar.py
+++ b/src/jarabe/journal/volumestoolbar.py
@@ -153,17 +153,19 @@ class BaseButton(RadioToolButton):
metadata = model.get(object_id)
file_path = model.get_file(metadata['uid'])
if not file_path or not os.path.exists(file_path):
- logging.warn('File does not exist')
- self.emit('volume-error', _('Entries without a file cannot'
- ' be copied'), _('Warning'))
+ 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(metadata, self.mount_point)
- except IOError:
- logging.exception('BaseButton._drag_data_received_cb: Error'
- 'while copying')
- self.emit('volume-error', _('Input/Output error'), _('Error'))
+ 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'))
class VolumeButton(BaseButton):
def __init__(self, mount):