Mercurial > pidgin
annotate finch/libgnt/gntclipboard.c @ 31949:16b33ffd75f8
merge of '1ca17dd26ee879f7580c72b03d018e444e0a5144'
and '9000557e8a6b7649547a10cfc0fe85dbb8ce661d'
author | masca@cpw.pidgin.im |
---|---|
date | Thu, 25 Aug 2011 04:40:34 +0000 |
parents | a8cc50c2279f |
children |
rev | line source |
---|---|
17928
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
1 /** |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
2 * GNT - The GLib Ncurses Toolkit |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
3 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
4 * GNT is the legal property of its developers, whose names are too numerous |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
6 * source distribution. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
7 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
8 * This library is free software; you can redistribute it and/or modify |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
11 * (at your option) any later version. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
12 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
16 * GNU General Public License for more details. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
17 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17928
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
17928
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
21 */ |
15817 | 22 |
17928
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
23 #include "gntclipboard.h" |
15817 | 24 |
25 enum { | |
26 SIG_CLIPBOARD = 0, | |
27 SIGS | |
28 }; | |
29 | |
30 static guint signals[SIGS] = { 0 }; | |
31 | |
32 static void | |
33 gnt_clipboard_class_init(GntClipboardClass *klass) | |
34 { | |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
20306
diff
changeset
|
35 signals[SIG_CLIPBOARD] = |
15817 | 36 g_signal_new("clipboard_changed", |
37 G_TYPE_FROM_CLASS(klass), | |
38 G_SIGNAL_RUN_LAST, | |
39 0, | |
40 NULL, NULL, | |
41 g_cclosure_marshal_VOID__POINTER, | |
42 G_TYPE_NONE, 1, G_TYPE_POINTER); | |
43 | |
44 } | |
45 | |
46 /****************************************************************************** | |
47 * GntClipboard API | |
48 *****************************************************************************/ | |
49 | |
50 void | |
20306
665d6d7eea83
applied changes from 88f296b3653b5a7578a7581c1582d37390c9d212
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
51 gnt_clipboard_set_string(GntClipboard *clipboard, const gchar *string) |
15817 | 52 { |
53 g_free(clipboard->string); | |
54 clipboard->string = g_strdup(string); | |
55 g_signal_emit(clipboard, signals[SIG_CLIPBOARD], 0, clipboard->string); | |
56 } | |
57 | |
58 gchar * | |
59 gnt_clipboard_get_string(GntClipboard *clipboard) | |
60 { | |
61 return g_strdup(clipboard->string); | |
62 } | |
63 | |
64 static void gnt_clipboard_init(GTypeInstance *instance, gpointer class) { | |
65 GntClipboard *clipboard = GNT_CLIPBOARD(instance); | |
66 clipboard->string = g_strdup(""); | |
67 } | |
68 | |
69 GType | |
70 gnt_clipboard_get_gtype(void) | |
71 { | |
72 static GType type = 0; | |
73 | |
74 if (type == 0) { | |
75 static const GTypeInfo info = { | |
76 sizeof(GntClipboardClass), | |
77 NULL, /* base_init */ | |
78 NULL, /* base_finalize */ | |
79 (GClassInitFunc)gnt_clipboard_class_init, | |
80 NULL, | |
81 NULL, /* class_data */ | |
82 sizeof(GntClipboard), | |
83 0, /* n_preallocs */ | |
84 gnt_clipboard_init, /* instance_init */ | |
85 NULL /* value_table */ | |
86 }; | |
87 | |
88 type = g_type_register_static(G_TYPE_OBJECT, | |
89 "GntClipboard", | |
90 &info, 0); | |
91 } | |
92 | |
93 return type; | |
94 } |