Sun, 18 Mar 2007 22:56:57 +0000
merge of 'd275b025481cd57c1b78be7300d12292eb33e171'
and '98b7f9bf8e2866a4663427b562f28e5934505e3b'
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
1 | #include "gntclipboard.h" |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
2 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
3 | gchar *string; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
4 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
5 | enum { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
6 | SIG_CLIPBOARD = 0, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
7 | SIGS |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
8 | }; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
9 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
10 | static guint signals[SIGS] = { 0 }; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
11 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
12 | static void |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
13 | gnt_clipboard_class_init(GntClipboardClass *klass) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
14 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
15 | signals[SIG_CLIPBOARD] = |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
16 | g_signal_new("clipboard_changed", |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
17 | G_TYPE_FROM_CLASS(klass), |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
18 | G_SIGNAL_RUN_LAST, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
19 | 0, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
20 | NULL, NULL, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
21 | g_cclosure_marshal_VOID__POINTER, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
22 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
23 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
24 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
25 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
26 | /****************************************************************************** |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
27 | * GntClipboard API |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
28 | *****************************************************************************/ |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
29 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
30 | void |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
31 | gnt_clipboard_set_string(GntClipboard *clipboard, gchar *string) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
32 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
33 | g_free(clipboard->string); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
34 | clipboard->string = g_strdup(string); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
35 | g_signal_emit(clipboard, signals[SIG_CLIPBOARD], 0, clipboard->string); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
36 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
37 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
38 | gchar * |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
39 | gnt_clipboard_get_string(GntClipboard *clipboard) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
40 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
41 | return g_strdup(clipboard->string); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
42 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
43 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
44 | static void gnt_clipboard_init(GTypeInstance *instance, gpointer class) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
45 | GntClipboard *clipboard = GNT_CLIPBOARD(instance); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
46 | clipboard->string = g_strdup(""); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
47 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
48 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
49 | GType |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
50 | gnt_clipboard_get_gtype(void) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
51 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
52 | static GType type = 0; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
53 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
54 | if (type == 0) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
55 | static const GTypeInfo info = { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
56 | sizeof(GntClipboardClass), |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
57 | NULL, /* base_init */ |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
58 | NULL, /* base_finalize */ |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
59 | (GClassInitFunc)gnt_clipboard_class_init, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
60 | NULL, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
61 | NULL, /* class_data */ |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
62 | sizeof(GntClipboard), |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
63 | 0, /* n_preallocs */ |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
64 | gnt_clipboard_init, /* instance_init */ |
|
15874
46df7421a1b5
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15814
diff
changeset
|
65 | NULL /* value_table */ |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
66 | }; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
67 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
68 | type = g_type_register_static(G_TYPE_OBJECT, |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
69 | "GntClipboard", |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
70 | &info, 0); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
71 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
72 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
73 | return type; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
74 | } |