summaryrefslogtreecommitdiff
blob: 8a623a53b7906d93e6966460fc278017ed2dee0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
This should fix the bug with Openoffice clipboard items

Index: glipper/Clipboards.py
===================================================================
RCS file: /cvsroot/glipper/glipper-ng/glipper/Clipboards.py,v
retrieving revision 1.16
retrieving revision 1.17
diff --unified -r1.16 -r1.17
--- glipper/Clipboards.py	30 Sep 2007 19:10:14 -0000	1.16
+++ glipper/Clipboards.py	28 Dec 2007 17:03:31 -0000	1.17
@@ -61,23 +61,39 @@
    
    def on_default_clipboard_owner_change(self, clipboard, event):
       if self.use_default_clipboard:
-         item = clipboard.wait_for_text()
-         
-         if item != None:
-            self.default_clipboard_text = item
-            self.emit('new-item', item)
-         elif self.default_clipboard_text != None:
-            clipboard.set_text(self.default_clipboard_text)
+         text = clipboard.wait_for_text()
+
+         if text != None:
+            self.default_clipboard_text = text
+            self.default_clipboard_image = None
+            self.emit('new-item', text)
+            return
+
+         targets = clipboard.wait_for_targets()
+
+         if targets == None:
+            if self.default_clipboard_text != None:
+               clipboard.set_text(self.default_clipboard_text)
+            elif self.default_clipboard_image != None:
+               clipboard.set_image(self.default_clipboard_image)
    
    def on_primary_clipboard_owner_change(self, clipboard, event):
       if self.use_primary_clipboard:
-         item = clipboard.wait_for_text()
-         
-         if item != None:
-            self.primary_clipboard_text = item
-            self.emit('new-item', item)
-         elif self.primary_clipboard_text != None:
-            clipboard.set_text(self.primary_clipboard_text)
+         text = clipboard.wait_for_text()
+
+         if text != None:
+            self.primary_clipboard_text = text
+            self.primary_clipboard_image = None
+            self.emit('new-item', text)
+            return
+
+         targets = clipboard.wait_for_targets()
+
+         if targets == None:
+            if self.primary_clipboard_text != None:
+               clipboard.set_text(self.primary_clipboard_text)
+            elif self.default_clipboard_image != None:
+               clipboard.set_image(self.primary_clipboard_image)
       
    def on_use_default_clipboard_changed (self, value):
       if value is None or value.type != gconf.VALUE_BOOL: