diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index abc885e..6e5127b 100644
a
|
b
|
class ClipboardTray(tray.VTray): |
76 | 76 | return False |
77 | 77 | |
78 | 78 | def _add_selection(self, object_id, selection): |
79 | | if not selection.data: |
| 79 | if not selection.get_data(): |
80 | 80 | return |
81 | 81 | |
82 | | logging.debug('ClipboardTray: adding type %r', selection.type) |
| 82 | selection_data = selection.get_data() |
| 83 | selection_type = selection.get_data_type() |
| 84 | |
| 85 | logging.debug('ClipboardTray: adding type %r', selection_type) |
83 | 86 | |
84 | 87 | cb_service = clipboard.get_instance() |
85 | | if selection.type == 'text/uri-list': |
86 | | uris = selection.data.split('\n') |
| 88 | if selection_type == 'text/uri-list': |
| 89 | uris = selection_data.split('\n') |
87 | 90 | if len(uris) > 1: |
88 | 91 | raise NotImplementedError('Multiple uris in text/uri-list' \ |
89 | 92 | ' still not supported.') |
90 | 93 | |
91 | 94 | cb_service.add_object_format(object_id, |
92 | | selection.type, |
| 95 | selection_type, |
93 | 96 | uris[0], |
94 | 97 | on_disk=True) |
95 | 98 | else: |
96 | 99 | cb_service.add_object_format(object_id, |
97 | | selection.type, |
98 | | selection.data, |
| 100 | selection_type, |
| 101 | selection_data, |
99 | 102 | on_disk=False) |
100 | 103 | |
101 | 104 | def _object_added_cb(self, cb_service, cb_object): |
… |
… |
class ClipboardTray(tray.VTray): |
132 | 135 | logging.debug('ClipboardTray._drag_motion_cb') |
133 | 136 | |
134 | 137 | if self._internal_drag(context): |
135 | | context.drag_status(Gdk.DragAction.MOVE, time) |
| 138 | Gdk.drag_status(context, Gdk.DragAction.MOVE, time) |
136 | 139 | else: |
137 | | context.drag_status(Gdk.DragAction.COPY, time) |
| 140 | Gdk.drag_status(context, Gdk.DragAction.COPY, time) |
138 | 141 | self.props.drag_active = True |
139 | 142 | |
140 | 143 | return True |
… |
… |
class ClipboardTray(tray.VTray): |
154 | 157 | cb_service = clipboard.get_instance() |
155 | 158 | object_id = cb_service.add_object(name="") |
156 | 159 | |
157 | | self._context_map.add_context(context, object_id, len(context.targets)) |
| 160 | context_targets = context.list_targets() |
| 161 | self._context_map.add_context(context, object_id, len(context_targets)) |
158 | 162 | |
159 | | for target in context.targets: |
| 163 | for target in context_targets: |
160 | 164 | if str(target) not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE'): |
161 | 165 | widget.drag_get_data(context, target, time) |
162 | 166 | |
… |
… |
class ClipboardTray(tray.VTray): |
167 | 171 | def drag_data_received_cb(self, widget, context, x, y, selection, |
168 | 172 | targetType, time): |
169 | 173 | logging.debug('ClipboardTray: got data for target %r', |
170 | | selection.target) |
| 174 | selection.get_target()) |
171 | 175 | |
172 | 176 | object_id = self._context_map.get_object_id(context) |
173 | 177 | try: |
174 | 178 | if selection is None: |
175 | 179 | logging.warn('ClipboardTray: empty selection for target %s', |
176 | | selection.target) |
| 180 | selection.get_target()) |
177 | 181 | else: |
178 | 182 | self._add_selection(object_id, selection) |
179 | 183 | |
… |
… |
class ClipboardTray(tray.VTray): |
184 | 188 | context.drop_finish(True, Gtk.get_current_event_time()) |
185 | 189 | |
186 | 190 | def _internal_drag(self, context): |
187 | | source_widget = context.get_source_widget() |
| 191 | source_widget = Gtk.drag_get_source_widget(context) |
188 | 192 | if source_widget is None: |
189 | 193 | return False |
190 | 194 | view_ancestor = source_widget.get_ancestor(Gtk.Viewport) |