comparison finch/libgnt/gntclipboard.c @ 15818:0e3a8505ebbe

renamed gaim-text to finch
author Sean Egan <seanegan@gmail.com>
date Sun, 18 Mar 2007 19:38:15 +0000
parents
children 8410511f4dbb
comparison
equal deleted inserted replaced
15817:317e7613e581 15818:0e3a8505ebbe
1 #include "gntclipboard.h"
2
3 gchar *string;
4
5 enum {
6 SIG_CLIPBOARD = 0,
7 SIGS
8 };
9
10 static guint signals[SIGS] = { 0 };
11
12 static void
13 gnt_clipboard_class_init(GntClipboardClass *klass)
14 {
15 signals[SIG_CLIPBOARD] =
16 g_signal_new("clipboard_changed",
17 G_TYPE_FROM_CLASS(klass),
18 G_SIGNAL_RUN_LAST,
19 0,
20 NULL, NULL,
21 g_cclosure_marshal_VOID__POINTER,
22 G_TYPE_NONE, 1, G_TYPE_POINTER);
23
24 }
25
26 /******************************************************************************
27 * GntClipboard API
28 *****************************************************************************/
29
30 void
31 gnt_clipboard_set_string(GntClipboard *clipboard, gchar *string)
32 {
33 g_free(clipboard->string);
34 clipboard->string = g_strdup(string);
35 g_signal_emit(clipboard, signals[SIG_CLIPBOARD], 0, clipboard->string);
36 }
37
38 gchar *
39 gnt_clipboard_get_string(GntClipboard *clipboard)
40 {
41 return g_strdup(clipboard->string);
42 }
43
44 static void gnt_clipboard_init(GTypeInstance *instance, gpointer class) {
45 GntClipboard *clipboard = GNT_CLIPBOARD(instance);
46 clipboard->string = g_strdup("");
47 }
48
49 GType
50 gnt_clipboard_get_gtype(void)
51 {
52 static GType type = 0;
53
54 if (type == 0) {
55 static const GTypeInfo info = {
56 sizeof(GntClipboardClass),
57 NULL, /* base_init */
58 NULL, /* base_finalize */
59 (GClassInitFunc)gnt_clipboard_class_init,
60 NULL,
61 NULL, /* class_data */
62 sizeof(GntClipboard),
63 0, /* n_preallocs */
64 gnt_clipboard_init, /* instance_init */
65 NULL /* value_table */
66 };
67
68 type = g_type_register_static(G_TYPE_OBJECT,
69 "GntClipboard",
70 &info, 0);
71 }
72
73 return type;
74 }