diff options
author | Dan Williams <dcbw@redhat.com> | 2007-03-14 04:50:06 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-03-14 04:50:06 (GMT) |
commit | 8b4ccf3eb10d0563344e123f7f2c773bba120a2f (patch) | |
tree | 7941f4122ecbda4ace3299b147b898b41aafd758 /shell/view/frame/clipboardbox.py | |
parent | bfe04c2073f696fd6dd7c6edb12f34d17433dfbe (diff) |
Cleanup clipboard D-Bus API
- The clipboard now determines each objects unique id and
returns it from add_object()
- The ID is opaque to the client and should not be used/accessed
other than with the clipboard service
- Add object type hints for dbus-python
- Sugar clipboard bindings for get_object() now return a dict rather
than a tuple
- ClipboardIcon now retrieves the real file path and uses that
to open the file
- Adapt sugar bits to clipboard changes
Diffstat (limited to 'shell/view/frame/clipboardbox.py')
-rw-r--r-- | shell/view/frame/clipboardbox.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py index d5e435e..031854a 100644 --- a/shell/view/frame/clipboardbox.py +++ b/shell/view/frame/clipboardbox.py @@ -64,14 +64,16 @@ class ClipboardBox(hippo.CanvasBox): return None def _add_selection(self, object_id, selection): - if selection.data: - logging.debug('ClipboardBox: adding type ' + selection.type + '.') - - cb_service = clipboardservice.get_instance() - cb_service.add_object_format(object_id, - selection.type, - selection.data, - on_disk = False) + if not selection.data: + return + + logging.debug('ClipboardBox: adding type ' + selection.type + '.') + + cb_service = clipboardservice.get_instance() + cb_service.add_object_format(object_id, + selection.type, + selection.data, + on_disk = False) def _object_added_cb(self, cb_service, object_id, name): icon = ClipboardIcon(self._popup_context, object_id, name) @@ -90,7 +92,6 @@ class ClipboardBox(hippo.CanvasBox): icon_name, preview, activity): icon = self._icons[object_id] icon.set_state(name, percent, icon_name, preview, activity) - logging.debug('ClipboardBox: ' + object_id + ' state was changed.') def drag_motion_cb(self, widget, context, x, y, time): logging.debug('ClipboardBox._drag_motion_cb') @@ -99,12 +100,11 @@ class ClipboardBox(hippo.CanvasBox): def drag_drop_cb(self, widget, context, x, y, time): logging.debug('ClipboardBox._drag_drop_cb') - object_id = util.unique_id() - self._context_map.add_context(context, object_id, len(context.targets)) - cb_service = clipboardservice.get_instance() - cb_service.add_object(object_id, name="") + object_id = cb_service.add_object(name="") + self._context_map.add_context(context, object_id, len(context.targets)) + for target in context.targets: if str(target) not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE'): widget.drag_get_data(context, target, time) @@ -186,8 +186,8 @@ class ClipboardBox(hippo.CanvasBox): def _get_targets_for_dnd(self, object_id): cb_service = clipboardservice.get_instance() - (name, percent, icon, preview, activity, format_types) = \ - cb_service.get_object(object_id) + attrs = cb_service.get_object(object_id) + format_types = attrs[clipboardservice.FORMATS_KEY] targets = [] for format_type in format_types: |