[kupfer: 38/51] Fix copy to clipboard to use current Display



commit c9da8d8f1dff4eb51714243862bb164094e4198e
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 28 16:51:48 2011 +0200

    Fix copy to clipboard to use current Display

 kupfer/plugin/core/__init__.py |    7 +++++--
 kupfer/ui/browser.py           |    3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/plugin/core/__init__.py b/kupfer/plugin/core/__init__.py
index ba879f2..39f3514 100644
--- a/kupfer/plugin/core/__init__.py
+++ b/kupfer/plugin/core/__init__.py
@@ -91,8 +91,11 @@ class CopyToClipboard (Action):
 	rank_adjust = -2
 	def __init__(self):
 		Action.__init__(self, _("Copy"))
-	def activate(self, leaf):
-		clip = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
+	def wants_context(self):
+		return True
+	def activate(self, leaf, ctx):
+		clip = gtk.Clipboard(selection=gtk.gdk.SELECTION_CLIPBOARD,
+		                     display=ctx.environment.get_screen().get_display())
 		interface.copy_to_clipboard(leaf, clip)
 	def item_types(self):
 		yield Leaf
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 52dcad3..ef5b604 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1140,7 +1140,8 @@ class Interface (gobject.GObject):
 		selection = self.current.get_current()
 		if selection is None:
 			return False
-		clip = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
+		clip = gtk.Clipboard(selection=gtk.gdk.SELECTION_CLIPBOARD,
+		                     display=entry.get_display())
 		return interface.copy_to_clipboard(selection, clip)
 
 	def _entry_cut_clipboard(self, entry):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]