Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/frame/clipboardicon.py13
-rw-r--r--src/jarabe/frame/clipboardmenu.py6
-rw-r--r--src/jarabe/frame/clipboardobject.py4
-rw-r--r--src/jarabe/frame/clipboardpanelwindow.py2
-rw-r--r--src/jarabe/frame/clipboardtray.py38
-rw-r--r--src/jarabe/journal/listmodel.py11
-rw-r--r--src/jarabe/journal/volumestoolbar.py2
7 files changed, 43 insertions, 33 deletions
diff --git a/src/jarabe/frame/clipboardicon.py b/src/jarabe/frame/clipboardicon.py
index 26af595..63ed2e3 100644
--- a/src/jarabe/frame/clipboardicon.py
+++ b/src/jarabe/frame/clipboardicon.py
@@ -75,10 +75,11 @@ class ClipboardIcon(RadioToolButton):
def _drag_data_get_cb(self, widget, context, selection, target_type,
event_time):
- logging.debug('_drag_data_get_cb: requested target %s',
- selection.target)
- data = self._cb_object.get_formats()[selection.target].get_data()
- selection.set(selection.target, 8, data)
+ target_atom = selection.get_target()
+ target_name = target_atom.name()
+ logging.debug('_drag_data_get_cb: requested target %s', target_name)
+ data = self._cb_object.get_formats()[target_name].get_data()
+ selection.set(target_atom, 8, data)
def _put_in_clipboard(self):
logging.debug('ClipboardIcon._put_in_clipboard')
@@ -161,8 +162,8 @@ class ClipboardIcon(RadioToolButton):
icon_theme = Gtk.IconTheme.get_default()
pixbuf = icon_theme.load_icon(self._icon.props.icon_name,
style.STANDARD_ICON_SIZE, 0)
- context.set_icon_pixbuf(pixbuf, hot_x=pixbuf.props.width / 2,
- hot_y=pixbuf.props.height / 2)
+ Gtk.drag_set_icon_pixbuf(context, pixbuf, hot_x=pixbuf.props.width / 2,
+ hot_y=pixbuf.props.height / 2)
def _notify_active_cb(self, widget, pspec):
if self.props.active:
diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py
index e6766fb..ddba1c6 100644
--- a/src/jarabe/frame/clipboardmenu.py
+++ b/src/jarabe/frame/clipboardmenu.py
@@ -195,9 +195,9 @@ class ClipboardMenu(Palette):
transfer_ownership = False
if most_significant_mime_type == 'text/uri-list':
- uris = mime.split_uri_list(format_.get_data())
- if len(uris) == 1 and uris[0].startswith('file://'):
- parsed_url = urlparse.urlparse(uris[0])
+ uri = format_.get_data()
+ if uri.startswith('file://'):
+ parsed_url = urlparse.urlparse(uri)
file_path = parsed_url.path # pylint: disable=E1101
transfer_ownership = False
mime_type = mime.get_for_file(file_path)
diff --git a/src/jarabe/frame/clipboardobject.py b/src/jarabe/frame/clipboardobject.py
index e79fa46..dc412df 100644
--- a/src/jarabe/frame/clipboardobject.py
+++ b/src/jarabe/frame/clipboardobject.py
@@ -103,8 +103,8 @@ class ClipboardObject(object):
format_ = mime.choose_most_significant(self._formats.keys())
if format_ == 'text/uri-list':
- data = self._formats['text/uri-list'].get_data()
- uri = urlparse.urlparse(mime.split_uri_list(data)[0], 'file')
+ uri_data = self._formats[format_].get_data()
+ uri = urlparse.urlparse(uri_data, 'file')
scheme = uri.scheme # pylint: disable=E1101
if scheme == 'file':
path = uri.path # pylint: disable=E1101
diff --git a/src/jarabe/frame/clipboardpanelwindow.py b/src/jarabe/frame/clipboardpanelwindow.py
index cfbc5f7..d67f27f 100644
--- a/src/jarabe/frame/clipboardpanelwindow.py
+++ b/src/jarabe/frame/clipboardpanelwindow.py
@@ -79,7 +79,7 @@ class ClipboardPanelWindow(FrameWindow):
cb_selections.append(selection)
if target_is_uri:
- uri = selection.get_data()
+ uri = selection.get_uris()[0]
filename = uri[len('file://'):].strip()
md5 = self._md5_for_file(filename)
data_hash = hash(md5)
diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index abc885e..c2735c5 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -76,26 +76,31 @@ class ClipboardTray(tray.VTray):
return False
def _add_selection(self, object_id, selection):
- if not selection.data:
+ if not selection.get_data():
return
- logging.debug('ClipboardTray: adding type %r', selection.type)
+ selection_data = selection.get_data()
+
+ selection_type_atom = selection.get_data_type()
+ selection_type = selection_type_atom.name()
+
+ logging.debug('ClipboardTray: adding type %r', selection_type)
cb_service = clipboard.get_instance()
- if selection.type == 'text/uri-list':
- uris = selection.data.split('\n')
+ if selection_type == 'text/uri-list':
+ uris = selection.get_uris()
if len(uris) > 1:
raise NotImplementedError('Multiple uris in text/uri-list' \
' still not supported.')
cb_service.add_object_format(object_id,
- selection.type,
+ selection_type,
uris[0],
on_disk=True)
else:
cb_service.add_object_format(object_id,
- selection.type,
- selection.data,
+ selection_type,
+ selection_data,
on_disk=False)
def _object_added_cb(self, cb_service, cb_object):
@@ -132,9 +137,9 @@ class ClipboardTray(tray.VTray):
logging.debug('ClipboardTray._drag_motion_cb')
if self._internal_drag(context):
- context.drag_status(Gdk.DragAction.MOVE, time)
+ Gdk.drag_status(context, Gdk.DragAction.MOVE, time)
else:
- context.drag_status(Gdk.DragAction.COPY, time)
+ Gdk.drag_status(context, Gdk.DragAction.COPY, time)
self.props.drag_active = True
return True
@@ -148,15 +153,16 @@ class ClipboardTray(tray.VTray):
if self._internal_drag(context):
# TODO: We should move the object within the clipboard here
if not self._context_map.has_context(context):
- context.drop_finish(False, Gtk.get_current_event_time())
+ Gdk.drop_finish(context, False, Gtk.get_current_event_time())
return False
cb_service = clipboard.get_instance()
object_id = cb_service.add_object(name="")
- self._context_map.add_context(context, object_id, len(context.targets))
+ context_targets = context.list_targets()
+ self._context_map.add_context(context, object_id, len(context_targets))
- for target in context.targets:
+ for target in context_targets:
if str(target) not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE'):
widget.drag_get_data(context, target, time)
@@ -167,13 +173,13 @@ class ClipboardTray(tray.VTray):
def drag_data_received_cb(self, widget, context, x, y, selection,
targetType, time):
logging.debug('ClipboardTray: got data for target %r',
- selection.target)
+ selection.get_target())
object_id = self._context_map.get_object_id(context)
try:
if selection is None:
logging.warn('ClipboardTray: empty selection for target %s',
- selection.target)
+ selection.get_target())
else:
self._add_selection(object_id, selection)
@@ -181,10 +187,10 @@ class ClipboardTray(tray.VTray):
# If it's the last target to be processed, finish
# the dnd transaction
if not self._context_map.has_context(context):
- context.drop_finish(True, Gtk.get_current_event_time())
+ Gdk.drop_finish(context, True, Gtk.get_current_event_time())
def _internal_drag(self, context):
- source_widget = context.get_source_widget()
+ source_widget = Gtk.drag_get_source_widget(context)
if source_widget is None:
return False
view_ancestor = source_widget.get_ancestor(Gtk.Viewport)
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index a5bb7b0..a135de5 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -241,14 +241,17 @@ class ListModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeDragSource):
def do_drag_data_get(self, path, selection):
uid = self[path][ListModel.COLUMN_UID]
- if selection.target == 'text/uri-list':
+ target_atom = selection.get_target()
+ target_name = target_atom.name()
+ if target_name == 'text/uri-list':
# Get hold of a reference so the temp file doesn't get deleted
self._temp_drag_file_path = model.get_file(uid)
logging.debug('putting %r in selection', self._temp_drag_file_path)
- selection.set(selection.target, 8, self._temp_drag_file_path)
+ selection.set(target_atom, 8, self._temp_drag_file_path)
return True
- elif selection.target == 'journal-object-id':
- selection.set(selection.target, 8, uid)
+ elif target_name == 'journal-object-id':
+ # uid is unicode but Gtk.SelectionData.set() needs str
+ selection.set(target_atom, 8, str(uid))
return True
return False
diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py
index 4b382b8..189bd05 100644
--- a/src/jarabe/journal/volumestoolbar.py
+++ b/src/jarabe/journal/volumestoolbar.py
@@ -397,7 +397,7 @@ class BaseButton(RadioToolButton):
journal._show_alert(_('Entries cannot be copied to Peer-Shares.'), _('Error'))
return
- object_id = selection_data.data
+ object_id = selection_data.get_data()
metadata = model.get(object_id)
from jarabe.journal.palettes import CopyMenu, get_copy_menu_helper