summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkclipboard.xml
blob: fbafb1a775e2243b1f33548565ba0020619cee69 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gtkclipboard">
 <refnamediv>
    <refname>gtk.Clipboard</refname> <refpurpose>an object to store data to
    and retrieve data from (new in PyGTK 2.2)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Clipboard</classname></ooclass>
      <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link linkend="constructor-gtkclipboard">gtk.Clipboard</link></methodname>
	<methodparam><parameter role="keyword">display</parameter><initializer>gtk.gdk.display_get_default()</initializer></methodparam>
	<methodparam><parameter role="keyword">selection</parameter><initializer>"CLIPBOARD"</initializer></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--get-display">get_display</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--get-owner">get_owner</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--store">store</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--clear">clear</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--set-can-store">set_can_store</link></methodname>
	<methodparam><parameter role="keyword">targets</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--set-with-data">set_with_data</link></methodname>
	<methodparam><parameter role="keyword">targets</parameter></methodparam>
	<methodparam><parameter role="keyword">get_func</parameter></methodparam>
	<methodparam><parameter role="keyword">clear_func</parameter></methodparam>
	<methodparam><parameter role="keyword">user_data</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--set-text">set_text</link></methodname>
	<methodparam><parameter role="keyword">text</parameter></methodparam>
	<methodparam><parameter role="keyword">len</parameter><initializer>-1</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--set-image">set_image</link></methodname>
	<methodparam><parameter role="keyword">pixbuf</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-for-contents">wait_for_contents</link></methodname>
	<methodparam><parameter role="keyword">target</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-for-targets">wait_for_targets</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-for-text">wait_for_text</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-gtkclipboard--wait-for-rich-text">wait_for_rich_text</link></methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-for-image">wait_for_image</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-is-target-available">wait_is_target_available</link></methodname>
	<methodparam><parameter role="keyword">target</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-gtkclipboard--wait-is-uris-available">wait_is_uris_available</link></methodname>
        <methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-is-text-available">wait_is_text_available</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-gtkclipboard--wait-is-rich-text-available">wait_is_rich_text_available</link></methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--wait-is-image-available">wait_is_image_available</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--request-contents">request_contents</link></methodname>
	<methodparam><parameter role="keyword">target</parameter></methodparam>
	<methodparam><parameter role="keyword">callback</parameter></methodparam>
	<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--request-targets">request_targets</link></methodname>
	<methodparam><parameter role="keyword">callback</parameter></methodparam>
	<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--request-text">request_text</link></methodname>
	<methodparam><parameter role="keyword">callback</parameter></methodparam>
	<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-gtkclipboard--request-rich-text">request_rich_text</link></methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
        <methodparam><parameter role="keyword">callback</parameter></methodparam>
        <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkclipboard--request-image">request_image</link></methodname>
	<methodparam><parameter role="keyword">callback</parameter></methodparam>
	<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
    </classsynopsis>

    <programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
        <methodname><link linkend="function-gtk--clipboard-get">gtk.clipboard_get</link></methodname>
        <methodparam><parameter role="keyword">selection</parameter><initializer>"CLIPBOARD"</initializer></methodparam>
      </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkclipboard">gtk.Clipboard</link>
</synopsis>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkclipboard">
    <title>gtk.Clipboard Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>

    <variablelist>
      <varlistentry>
        <term>"<link linkend="signal-gtkclipboard--owner-change">owner-change</link></term>
        <listitem>
          <methodsynopsis language="python"><methodname>callback</methodname>
          <methodparam><parameter>clipboard</parameter></methodparam>
          <methodparam><parameter>event</parameter></methodparam>
          <methodparam><parameter>user_param1</parameter></methodparam>
          <methodparam><parameter>...</parameter></methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para>This object is available in PyGTK 2.2 and above.</para>
    </note>

    <para> The <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
object represents a clipboard of data shared between different processes or
between different widgets in the same process. Each clipboard is identified
by a name encoded as a <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link>. The
<link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link> is
basically a higher-level interface to the lower-level <link
linkend="class-gtkselectiondata"><classname>gtk.SelectionData</classname></link>
and selection interface. The built-in atoms are:</para>

    <itemizedlist>
      <listitem>
	<simpara>"PRIMARY"</simpara>
      </listitem>
      <listitem>
	<simpara>"SECONDARY"</simpara>
      </listitem>
      <listitem>
	<simpara>"CLIPBOARD"</simpara>
      </listitem>
      <listitem>
	<simpara>"BITMAP"</simpara>
      </listitem>
      <listitem>
	<simpara>"COLORMAP"</simpara>
      </listitem>
      <listitem>
	<simpara>"DRAWABLE"</simpara>
      </listitem>
      <listitem>
	<simpara>"PIXMAP"</simpara>
      </listitem>
      <listitem>
	<simpara>"STRING"</simpara>
      </listitem>
      <listitem>
	<simpara>"WINDOW"</simpara>
      </listitem>
   </itemizedlist>

    <para>Creating a <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link> from
strings can be done with the <link
linkend="constructor-gdkatom-intern">gtk.gdk.atom_intern</link>()
constructor function though <literal>PyGTK</literal> will usually do the
conversion under the covers as needed. The name of a <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link> can be
retrieved using the Python <function>str</function>() function:</para>

    <programlisting>
  name = str(atom)
</programlisting>

    <para>The default clipboard corresponds to the "CLIPBOARD" atom; another
commonly used clipboard is the "PRIMARY" clipboard, which, in X,
traditionally contains the currently selected text.</para>

<para>To simultaneously support different formats on the clipboard, the
clipboard mechanism allows you to provide callbacks instead of the actual
data. When you set the contents of the clipboard, you can either supply the
data directly (via a method like <link
linkend="method-gtkclipboard--set-text"><methodname>set_text</methodname>()</link>),
or you can supply a callback to be called when the data is needed (via the
<link
linkend="method-gtkclipboard--set-with-data"><methodname>set_with_data</methodname>()</link>
method.) Providing a callback also avoids making unnecessary copies of the
data.</para>

<para>Along with the methods to get the clipboard contents as an arbitrary
data chunk, there is a method to retrieve it as text, the <link
linkend="method-gtkclipboard--wait-for-text"><methodname>wait_for_text</methodname>()</link>
method. This method takes care of determining which formats are advertised
by the clipboard provider, asking for the clipboard in the best available
format and converting the results into the UTF-8 encoding. (The standard
form for representing strings in <literal>GTK</literal>+.) </para>

  </refsect1>

  <refsect1 id="constructor-gtkclipboard">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Clipboard</methodname>
	<methodparam><parameter role="keyword">display</parameter><initializer>gtk.gdk.display_get_default()</initializer></methodparam>
	<methodparam><parameter role="keyword">selection</parameter><initializer>"CLIPBOARD"</initializer></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter role="keyword">display</parameter>&nbsp;:</term>
	<listitem><simpara>the <link
linkend="class-gdkdisplay"><classname>gtk.gdk.Display</classname></link>
for which the clipboard is to be retrieved or created.</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">selection</parameter>&nbsp;:</term>
	<listitem><simpara>a string that identifies the clipboard
to use.</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>the appropriate clipboard object or if no
	clipboard already exists, a new one will be created. Once a
	clipboard object has been created, it is persistent for all time and
	cannot be freed.</simpara></listitem>
      </varlistentry>
    </variablelist>

    <note>
      <para>This constructor is available in PyGTK 2.2 and above.</para>
    </note>

    <para>Returns the clipboard object for the <link
linkend="class-gdkdisplay"><classname>gtk.gdk.Display</classname></link>
specified by <parameter>display</parameter> and the selection specified by
the string in <parameter>selection</parameter>. Cut/copy/paste menu items
and keyboard shortcuts should use the default clipboard, returned by passing
<literal>"CLIPBOARD"</literal> for <parameter>selection</parameter>. The
currently-selected object or text should be provided on the clipboard
identified by <literal>"PRIMARY"</literal>. Cut/copy/paste menu items
conceptually copy the contents of the <literal>"PRIMARY"</literal> clipboard
to the default clipboard, i.e. they copy the selection to what the user sees
as the clipboard.</para>

    <para>See <ulink
url="http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt">
http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt</ulink>
for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY" selections under
the X window system. On Win32 the <literal>"PRIMARY"</literal> clipboard is
essentially ignored.</para>

    <para>It's possible to have arbitrarily named clipboards. If you do
invent new clipboards, you should prefix the selection name with an
underscore (because the ICCCM requires that nonstandard atoms are
underscore-prefixed), and namespace it as well. For example, if your
application called "Foo" has a special-purpose clipboard, you might call it
"_FOO_SPECIAL_CLIPBOARD".</para>

    <para>In PyGTK 2.4 and above, the <parameter>display</parameter>
argument is optional and defaults to the default display returned from the
<link
linkend="function-gdk--display-get-default"><function>gtk.gdk.display_get_default</function>()</link>
function.</para>

    <para>In PyGTK 2.4 and above, the <parameter>selection</parameter>
argument is optional and defaults to "CLIPBOARD".</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkclipboard--get-display">
      <title>gtk.Clipboard.get_display</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_display</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-gdkdisplay"><classname>gtk.gdk.Display</classname></link>
associated with the clipboard</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>get_display</methodname>() method returns the
<link
linkend="class-gdkdisplay"><classname>gtk.gdk.Display</classname></link>
associated with the clipboard.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--get-owner">
      <title>gtk.Clipboard.get_owner</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_owner</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the owner of the clipboard, if any; otherwise
<literal>None</literal>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>get_owner</methodname>() method returns the
owner set by the <methodname>set_with_owner</methodname>() method if neither
the <link
linkend="method-gtkclipboard--set-with-data"><methodname>set_with_data()</methodname></link>
method nor the <link
linkend="method-gtkclipboard--clear"><methodname>clear()</methodname></link>
method have been subsequently called. This method returns
<literal>None</literal> otherwise.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--store">
      <title>gtk.Clipboard.store</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>store</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>store</methodname>() method stores the current
clipboard data (as specified by the <link
linkend="method-gtkclipboard--set-can-store"><methodname>set_can_store</methodname>()</link>
method) somewhere so that it will stay around after the application has
quit.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--clear">
      <title>gtk.Clipboard.clear</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>clear</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>clear</methodname>() method clears the contents
of the clipboard. Generally this should only be called between the time you
call the <!--<link
linkend="method-gtkclipboard- -set-with-owner"><methodname>set_with_owner()</methodname></link>
or --><link
linkend="method-gtkclipboard--set-with-data"><methodname>set_with_data()</methodname></link>,
and when the <parameter>clear_func</parameter> you supplied is
called. Otherwise, the clipboard may be owned by someone else.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--set-can-store">
      <title>gtk.Clipboard.set_can_store</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_can_store</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">targets</parameter>&nbsp;:</term>
	  <listitem><simpara>a list of 3-tuples containing information about
the available forms that should be stored or <literal>None</literal> to
indicate that all forms should be stored.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>set_can_store</methodname>() method sets a hint
that the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link> can
store the list of targets specified by <parameter>targets</parameter> can be
stored somewhere when the application exits or when the <link
linkend="method-gtkclipboard--store"><methodname>store</methodname>()</link>
method is called. This value is reset when the clipboard owner
changes. Where the clipboard data is stored is platform dependent, see the
<link
linkend="method-gdkdisplay--store-clipboard"><methodname>gtk.gdk.Display.store_clipboard</methodname>()</link>
method for more information. If <parameter>targets</parameter> is
<literal>None</literal> all target forms currently available on the
clipboard should be stored.</para>

      <para>The 3-tuples listed in <parameter>targets</parameter> contain
the following items:</para>

    <itemizedlist>
      <listitem>
	<simpara>a string representing a target supported by the
clipboard</simpara>
      </listitem>
      <listitem>
	  <simpara>a flags value used for drag and drop - a combination of:
<literal>gtk.TARGET_SAME_APP</literal> and
<literal>gtk.TARGET_SAME_WIDGET</literal></simpara>
      </listitem>
      <listitem>
	<simpara>an application assigned integer that is passed as a signal
parameter to help identify the target type</simpara>
      </listitem>
   </itemizedlist>

    </refsect2>

    <refsect2 id="method-gtkclipboard--set-with-data">
      <title>gtk.Clipboard.set_with_data</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_with_data</methodname>
	  <methodparam><parameter role="keyword">targets</parameter></methodparam>
	  <methodparam><parameter role="keyword">get_func</parameter></methodparam>
	  <methodparam><parameter role="keyword">clear_func</parameter></methodparam>
	  <methodparam><parameter role="keyword">user_data</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">targets</parameter>&nbsp;:</term>
	  <listitem><simpara>a list of 3-tuples containing information about
the available forms for the clipboard data</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">get_func</parameter>&nbsp;:</term>
	  <listitem><simpara>a function to call to get the actual clipboard
data</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">clear_func</parameter>&nbsp;:</term>
	  <listitem><simpara>when the clipboard contents are set again,
this function will be called, and <parameter>get_func</parameter> will not
be subsequently called.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
	  <listitem><simpara>the user data to pass to
<parameter>get_func</parameter> and
<parameter>clear_func</parameter>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if setting the
clipboard data succeeded. If setting the clipboard data failed the
provided callback functions will be ignored.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>set_with_data</methodname>() method virtually
sets the contents of the specified clipboard by providing a list of
supported formats (specified by <parameter>targets</parameter>) for the
clipboard data and a function (specified by <parameter>get_func</parameter>)
to call to get the actual data when it is
requested. <parameter>clear_func</parameter> is a function that is called
when the contents of the clipboard are being changed to provide cleanup
operations on
<parameter>user_data</parameter>. <parameter>user_data</parameter> is passed
to <parameter>get_func</parameter> and <parameter>clear_func</parameter>
when they are invoked. The 3-tuples listed in <parameter>targets</parameter>
contain the following items:</para>

    <itemizedlist>
      <listitem>
	<simpara>a string representing a target supported by the
clipboard</simpara>
      </listitem>
      <listitem>
	  <simpara>a flags value used for drag and drop - a combination of:
<literal>gtk.TARGET_SAME_APP</literal> and
<literal>gtk.TARGET_SAME_WIDGET</literal></simpara>
      </listitem>
      <listitem>
	<simpara>an application assigned integer that is passed as a signal
parameter to help identify the target type</simpara>
      </listitem>
   </itemizedlist>

      <para>The signature of <parameter>get_func</parameter> is:</para>

      <programlisting>
  def get_func(clipboard, selectiondata, info, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>,
<parameter>selectiondata</parameter> is a <link
linkend="class-gtkselectiondata"><classname>gtk.SelectionData</classname></link>
object to set with the data, <parameter>info</parameter> is the application
assigned integer associated with a target, and <parameter>data</parameter>
is the <parameter>user_data</parameter> argument.</para>

      <para>The signature of <parameter>clear_func</parameter> is:</para>

      <programlisting>
  def clear_func(clipboard, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link> and
<parameter>data</parameter> is the <parameter>user_data</parameter>
argument.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--set-text">
      <title>gtk.Clipboard.set_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_text</methodname>
	  <methodparam><parameter role="keyword">text</parameter></methodparam>
	  <methodparam><parameter role="keyword">len</parameter><initializer>-1</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">text</parameter>&nbsp;:</term>
	  <listitem><simpara>a string.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">len</parameter>&nbsp;:</term>
	  <listitem><simpara>the length of <parameter>text</parameter>, in
bytes, or -1, to calculate the length.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>set_text</methodname>() method sets the contents
of the clipboard to the string specified by <parameter>text</parameter>. If
<parameter>len</parameter> is given it determines the length of
<parameter>text</parameter> to be copied. If <parameter>len</parameter> is
not specified it defaults to -1 and the method calculates the text
length.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--set-image">
      <title>gtk.Clipboard.set_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_image</methodname>
	  <methodparam><parameter role="keyword">pixbuf</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">pixbuf</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>set_image</methodname>() method sets the
contents of the clipboard to the <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
specified by <parameter>pixbuf</parameter>. GTK+ will take responsibility
for responding for requests for the image, and for converting the image into
the requested format.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-for-contents">
      <title>gtk.Clipboard.wait_for_contents</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_for_contents</methodname>
	  <methodparam><parameter role="keyword">target</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">target</parameter>&nbsp;:</term>
	  <listitem><simpara>an atom or string representing the form into
which the clipboard owner should convert the selection.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a newly-allocated <link
linkend="class-gtkselectiondata"><classname>gtk.SelectionData</classname></link>
object or <literal>None</literal> if retrieving the given target
failed.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>wait_for_contents</methodname>() method requests
the contents of the clipboard using the target specified by
<parameter>target</parameter>. This method waits for the data to be received
using the main loop, so events, timeouts, etc, may be dispatched during the
wait.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-for-targets">
      <title>gtk.Clipboard.wait_for_targets</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_for_targets</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>returns a tuple containing any targets that are
present on the clipboard or <literal>None</literal>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>wait_for_targets</methodname>() method returns a
tuple containing the targets (as <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link> objects)
that are present on the clipboard, or <literal>None</literal> if there
aren't any targets available. This function waits for the data to be
received using the main loop, so events, timeouts, etc, may be dispatched
during the wait.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-for-text">
      <title>gtk.Clipboard.wait_for_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_for_text</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a string, or <literal>None</literal> if
retrieving the selection data failed. (This could happen for various reasons,
in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into text form.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>wait_for_text</methodname>() method requests the
contents of the clipboard as text and converts the result to UTF-8 if
necessary. This method waits for the data to be received using the main
loop, so events, timeouts, etc, may be dispatched during the wait.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-for-rich-text">
      <title>gtk.Clipboard.wait_for_rich_text</title>
 
      <programlisting><methodsynopsis language="python">
        <methodname>wait_for_rich_text</methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
      </methodsynopsis></programlisting>
 
      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">buffer</parameter>&nbsp;:</term>
          <listitem><simpara>a <link
          linkend="class-gtktextbuffer"><classname>gtk.TextBuffer</classname></link>
          to retrieve the deserialize formats from.</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a 2-tuple containing the rich text as a string
          and the format string , or <literal>None</literal> if retrieving
          the selection data failed. (This could happen for various reasons,
          in particular if the clipboard was empty or if the contents of the
          clipboard could not be converted into text
          form.)</simpara></listitem>
        </varlistentry>
      </variablelist>
 
      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>
 
      <para>The <methodname>wait_for_rich_text</methodname>() method
      requests the contents of the clipboard as rich text. This method
      waits for the data to be received using the main loop, so events,
      timeouts, etc, may be dispatched during the wait.</para>
 
    </refsect2>
 
    <refsect2 id="method-gtkclipboard--wait-for-image">
      <title>gtk.Clipboard.wait_for_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_for_image</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>,
or <literal>None</literal> if retrieving the selection data failed.
(This could happen for various reasons, in particular if the clipboard was
empty or if the contents of the clipboard could not be converted into an
image.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>wait_for_image</methodname>() method requests
the contents of the clipboard as an image and converts the result to a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>. This
method waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-is-target-available">
      <title>gtk.Clipboard.wait_is_target_available</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_is_target_available</methodname>
	  <methodparam><parameter role="keyword">target</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">target</parameter>&nbsp;:</term>
	  <listitem><simpara>an atom or string representing the target of
interest.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if the target is
available.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>wait_is_target_available</methodname>() method
tests to see if the target specified by <parameter>target</parameter> is
available to be copied from the clipboard. This method can be used to
determine if a <guimenuitem>Paste</guimenuitem> menu item should be
insensitive or not.</para>

      <para>If you want to see if there's text available on the clipboard,
use the <link
linkend="method-gtkclipboard--wait-is-text-available"><methodname>wait_is_text_available</methodname>()</link>
method instead.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-is-uris-available">
      <title>gtk.Clipboard.wait_is_uris_available</title>
 
      <programlisting><methodsynopsis language="python">
        <methodname>wait_is_uris_available</methodname>
        <methodparam></methodparam>
      </methodsynopsis></programlisting>
                                                                                
      <variablelist>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara><literal>True</literal> if is there is an URI list
	  available, <literal>False</literal>
          otherwise.</simpara></listitem>
        </varlistentry>
      </variablelist>
 
      <note>
        <para>This method is available in PyGTK 2.14 and above.</para>
      </note>
 
      <para>
	The <methodname>wait_is_uris_available</methodname>()
	method Test to see if there is a list of URIs available to be pasted This
	is done by requesting the TARGETS atom and checking if it contains the URI targets.
	This function waits for the data to be received using the main loop, so events,
	timeouts, etc, may be dispatched during the wait.
      </para>
       
      <!-- NOT IMPLEMENTED
      <para>This method is a little faster than calling <link
      linkend="method-gtkclipboard- -wait-for-uris"><methodname>gtk.Clipboard.wait_for_uris</methodname></link>()
      since it doesn't need to retrieve the actual text.</para>
      -->
 
    </refsect2>
 
    <refsect2 id="method-gtkclipboard--wait-is-text-available">
      <title>gtk.Clipboard.wait_is_text_available</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_is_text_available</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> is there is text
available.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.2 and above.</para>
      </note>

      <para>The <methodname>wait_is_text_available</methodname>() method
tests to see if there is text available to be copied from the clipboard.
This is done by requesting the "TARGETS" atom and checking if it contains
any of the names: "STRING", "TEXT", "COMPOUND_TEXT", "UTF8_STRING". This
method waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</para>

      <para>This method is a little faster than calling the <link
linkend="method-gtkclipboard--wait-for-text"><methodname>wait_for_text()</methodname></link>
since it doesn't need to retrieve the actual text.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--wait-is-rich-text-available">
      <title>gtk.Clipboard.wait_is_rich_text_available</title>
 
      <programlisting><methodsynopsis language="python">
        <methodname>wait_is_rich_text_available</methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
      </methodsynopsis></programlisting>
                                                                                
      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">buffer</parameter>&nbsp;:</term>
          <listitem><simpara>a <link
          linkend="class-gtktextbuffer"><classname>gtk.TextBuffer</classname></link>
          to retrieve the deserialize formats from.</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara><literal>True</literal> if is there is rich
          text available, <literal>False</literal>
          otherwise.</simpara></listitem>
        </varlistentry>
      </variablelist>
 
      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>
 
      <para>The <methodname>wait_is_rich_text_available</methodname>()
      method tests to see if there is rich text available to be pasted. This
      is done by requesting the <literal>TARGETS</literal> atom and checking
      if it contains any of the supported rich text targets. This method
      waits for the data to be received using the main loop, so events,
      timeouts, etc, may be dispatched during the wait.</para>
       
      <para>This method is a little faster than calling <link
      linkend="method-gtkclipboard--wait-for-rich-text"><methodname>wait_for_rich_text()</methodname></link>
      since it doesn't need to retrieve the actual text.</para>
 
    </refsect2>
 
    <refsect2 id="method-gtkclipboard--wait-is-image-available">
      <title>gtk.Clipboard.wait_is_image_available</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>wait_is_image_available</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> is there is an image
available.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>wait_is_image_available</methodname>() method
tests to see if there is an image available to be copied from the clipboard.
This is done by requesting the "TARGETS" atom and checking if it contains
any of the supported image targets. This method waits for the data to be
received using the main loop, so events, timeouts, etc, may be dispatched
during the wait.</para>

      <para>This method is a little faster than calling the <link
linkend="method-gtkclipboard--wait-for-image"><methodname>wait_for_image()</methodname></link>
since it doesn't need to retrieve the actual image data.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--request-contents">
      <title>gtk.Clipboard.request_contents</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>request_contents</methodname>
	  <methodparam><parameter role="keyword">target</parameter></methodparam>
	  <methodparam><parameter role="keyword">callback</parameter></methodparam>
	  <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">target</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link>
or string representing the form that the clipboard owner should convert
the selection to.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">callback</parameter>&nbsp;:</term>
	  <listitem><simpara>a function to call when the results are received
(or the retrieval fails).</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
	  <listitem><simpara>user data to pass to <parameter>callback</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>request_contents</methodname>() method requests
the contents of clipboard in the form specified by
<parameter>target</parameter>.  When the results of the request are later
received the function specified by <parameter>callback</parameter> will be
invoked and passed the data specified by
<parameter>user_data</parameter>. The signature of
<parameter>callback</parameter> is:</para>

      <programlisting>
  def callback(clipboard, selection_data, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
that invoked callback and <parameter>selection_data</parameter> is the <link
linkend="class-gtkselectiondata"><classname>gtk.SelectionData</classname></link>
containing the target data and <parameter>data</parameter> is
<parameter>user_data</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--request-targets">
      <title>gtk.Clipboard.request_targets</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>request_targets</methodname>
	  <methodparam><parameter role="keyword">callback</parameter></methodparam>
	  <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">callback</parameter>&nbsp;:</term>
	  <listitem><simpara>a function to call when the targets are received,
or the retrieval fails. (It will always be called
one way or the other.)</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
	  <listitem><simpara>user data to pass to
<parameter>callback</parameter>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>request_targets</methodname>() method requests
the contents of the clipboard as list of supported targets.  When the list
is later received, <parameter>callback</parameter> will be called with the
data specified by <parameter>user_data</parameter>. The signature of
<parameter>callback</parameter> is:</para>

      <programlisting>
  def callback(clipboard, targets, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
that <parameter>targets</parameter> is retrieved
from. <parameter>targets</parameter> is a tuple containing the <link
linkend="class-gdkatom"><classname>gtk.gdk.Atom</classname></link> objects
corresponding to the targets of clipboard. <parameter>targets</parameter>
will contain the resulting targets if the request succeeded, or an empty
tuple if it failed.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--request-text">
      <title>gtk.Clipboard.request_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>request_text</methodname>
	  <methodparam><parameter role="keyword">callback</parameter></methodparam>
	  <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">callback</parameter>&nbsp;:</term>
	  <listitem><simpara>a function to call when the text is received,
or the retrieval fails. (It will always be called
one way or the other.)</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
	  <listitem><simpara>user data to pass to
<parameter>callback</parameter>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>request_text</methodname>() method requests the
contents of the clipboard as text. When the text is later received, it will
be converted to UTF-8 if necessary, and <parameter>callback</parameter> will
be called with the data specified by <parameter>user_data</parameter>. The
signature of <parameter>callback</parameter> is:</para>

      <programlisting>
  def callback(clipboard, text, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
that <parameter>text</parameter> is retrieved from and
<parameter>data</parameter> is <parameter>user_data</parameter>.
<parameter>text</parameter> will contain the resulting text if the request
succeeded, or the empty string if it failed. This could happen for various
reasons, in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into text form.</para>

    </refsect2>

    <refsect2 id="method-gtkclipboard--request-rich-text">
      <title>gtk.Clipboard.request_rich_text</title>
 
      <programlisting><methodsynopsis language="python">
        <methodname>request_rich_text</methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
        <methodparam><parameter role="keyword">callback</parameter></methodparam>
        <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis></programlisting>
 
      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">buffer</parameter>&nbsp;:</term>
          <listitem><simpara>a <link
          linkend="class-gtktextbuffer"><classname>gtk.TextBuffer</classname></link>
          to retrieve the deserialize formats from.</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter role="keyword">callback</parameter>&nbsp;:</term>
          <listitem><simpara>a function to call when the text is received,
          or the retrieval fails. (It will always be called one way or the
          other.)</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
          <listitem><simpara>user data to pass to
          <parameter>callback</parameter>.</simpara></listitem>
        </varlistentry>
      </variablelist>
 
      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>
 
      <para>The <methodname>request_rich_text</methodname>() method requests
      the contents of the clipboard as rich text. When the rich text is
      later received, the function specified by
      <parameter>callback</parameter> will be called with the argument
      specified by <parameter>user_data</parameter>.</para>

      <para>The signature of the callback is:</para>

      <programlisting>
        def callback(clipboard, format, text, length, data):
      </programlisting>
       
      <para>where <parameter>format</parameter> is the atom indicating the
      text format, <parameter>text</parameter> contains the resulting rich
      text if the request succeeded, or <literal>None</literal> if it
      failed, <parameter>length</parameter> contains the length of
      <parameter>text</parameter> and <parameter>data</parameter> is
      <parameter>user_data</parameter>. This function can fail for various
      reasons, in particular if the clipboard was empty or if the contents
      of the clipboard could not be converted into rich text form.</para>
 
    </refsect2>

    <refsect2 id="method-gtkclipboard--request-image">
      <title>gtk.Clipboard.request_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>request_image</methodname>
	  <methodparam><parameter role="keyword">callback</parameter></methodparam>
	  <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">callback</parameter>&nbsp;:</term>
	  <listitem><simpara>a function to call when the image is received,
or the retrieval fails. (It will always be called
one way or the other.)</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
	  <listitem><simpara>user data to pass to
<parameter>callback</parameter>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>request_image</methodname>() method requests the
contents of the clipboard as a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
image. When the image is later received, it will be converted to a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> and
<parameter>callback</parameter> will be called with the data specified by
<parameter>user_data</parameter>. The signature of
<parameter>callback</parameter> is:</para>

      <programlisting>
  def callback(clipboard, pixbuf, data):
</programlisting>

      <para>where <parameter>clipboard</parameter> is the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
that <parameter>pixbuf</parameter> is retrieved from and
<parameter>data</parameter> is <parameter>user_data</parameter>.
<parameter>pixbuf</parameter> will contain the resulting image data if the
request succeeded, or <literal>None</literal> if it failed. This could
happen for various reasons, in particular if the clipboard was empty or if
the contents of the clipboard could not be converted into an image.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-gtk--clipboard-get">
      <title>gtk.clipboard_get</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.clipboard_get</methodname>
	  <methodparam><parameter
			 role="keyword">selection</parameter><initializer>"CLIPBOARD"</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
	  role="keyword">selection</parameter>&nbsp;:</term>
	  <listitem><simpara>a string specifying a <link
	  linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>. If
	  not specified it defaults to "CLIPBOARD".</simpara></listitem>
	</varlistentry>
	<varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the appropriate clipboard object or if no
	clipboard already exists, a new one will be created. Once a
	clipboard object has been created, it is persistent for all time and
	cannot be freed.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <function>gtk.clipboard_get</function>() function returns
the <link
linkend="class-gtkclipboard"><classname>gtk.Clipboard</classname></link>
specified by selection for the default <link
linkend="class-gdkdisplay"><classname>gtk.gdk.Display</classname></link>. See
the <link linkend="constructor-gtkclipboard">gtk.Clipboard</link>
constructor for more information.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkclipboard--owner-change">
      <title>The "owner-change" gtk.Clipboard Signal</title>

      <programlisting><methodsynopsis language="python"><methodname>callback</methodname>
      <methodparam><parameter>clipboard</parameter></methodparam>
      <methodparam><parameter>event</parameter></methodparam>
      <methodparam><parameter>user_param1</parameter></methodparam>
      <methodparam><parameter>...</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter>clipboard</parameter>&nbsp;:</term>
          <listitem><simpara>the object that received the signal.</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter>event</parameter>&nbsp;:</term>
          <listitem><simpara>the event marking the ownership
          change.</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
          with the <link
          linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
          method</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter>...</parameter>&nbsp;:</term>
          <listitem><simpara>additional user parameters (if any)</simpara></listitem>
        </varlistentry>
      </variablelist>

      <note>
        <para>This signal is available in GTK+ 2.8 and above.</para>
      </note>

      <para>The "owner-changed" signal is emitted when the owner of the
      clipboard is changed.</para>

    </refsect2>

  </refsect1>

</refentry>