From 6e6fd02322e8e3554cfc241fadb3b74d3a38f34d Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 20 Jul 2007 20:45:22 +0200 Subject: [PATCH] #2268 Allow removing downloads from the clipboard while in progress. --- NEWS | 1 + services/clipboard/clipboardobject.py | 3 ++- services/clipboard/clipboardservice.py | 6 +++++- shell/view/clipboardmenu.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 07859a3b..73a95395 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ +* #2268 Allow removing downloads from the clipboard while in progress. (tomeu) * #2240 Ensure activity uniquness in the shell. (marco) Snapshot f6f3f2b520 diff --git a/services/clipboard/clipboardobject.py b/services/clipboard/clipboardobject.py index 7de4730d..d7512747 100644 --- a/services/clipboard/clipboardobject.py +++ b/services/clipboard/clipboardobject.py @@ -134,7 +134,8 @@ class Format: def destroy(self): if self._on_disk: uri = urlparse.urlparse(self._data) - os.remove(uri.path) + if os.path.isfile(uri.path): + os.remove(uri.path) def get_type(self): return self._type diff --git a/services/clipboard/clipboardservice.py b/services/clipboard/clipboardservice.py index 569ed6b4..639f29c6 100644 --- a/services/clipboard/clipboardservice.py +++ b/services/clipboard/clipboardservice.py @@ -127,9 +127,13 @@ class ClipboardService(dbus.service.Object): in_signature="o", out_signature="a{sv}") def get_object(self, object_path): logging.debug('ClipboardService.get_object') + + if not self._objects.has_key(str(object_path)): + return dbus.Dictionary({}, signature='sv') + cb_object = self._objects[str(object_path)] formats = cb_object.get_formats() - format_types = dbus.Array([], 's') + format_types = dbus.Array([], signature='s') for type, format in formats.iteritems(): format_types.append(type) diff --git a/shell/view/clipboardmenu.py b/shell/view/clipboardmenu.py index 0bc3b9ec..95e61920 100644 --- a/shell/view/clipboardmenu.py +++ b/shell/view/clipboardmenu.py @@ -94,7 +94,7 @@ class ClipboardMenu(Palette): #self._stop_item.props.sensitive = False self._journal_item.props.sensitive = True else: - self._remove_item.props.sensitive = False + self._remove_item.props.sensitive = True self._open_item.props.sensitive = False # TODO: reenable the stop item when we implement stoping downloads. #self._stop_item.props.sensitive = True