annotate src/pluginpref.c @ 9485:3fed61fa0f70

[gaim-migrate @ 10310] " 1. Lithuanian translator's last name was in invalid UTF8; this caused GTK/Pango to exhibit some very odd behaviour. The correct UTF8 is copied from the po file. 2. Polish translators' last names are copied from the po file. 3. A couple of missing mailto:'s are added" --Ambrose C. LI committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 08 Jul 2004 14:46:38 +0000
parents ffb333368cdc
children 1ae82c0c24ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /**
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
2 * gaim
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
3 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 * source distribution.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
21 */
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23 # include <config.h>
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24 #endif
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26 #include <glib.h>
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 #include "debug.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29 #include "internal.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 #include "pluginpref.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31 #include "prefs.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33 struct _GaimPluginPrefFrame {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 GList *prefs;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 };
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 struct _GaimPluginPref {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38 char *name;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 char *label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41 GaimPluginPrefType type;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43 int min;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 int max;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45 GList *choices;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46 unsigned int max_length;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47 };
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 GaimPluginPrefFrame *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50 gaim_plugin_pref_frame_new() {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51 GaimPluginPrefFrame *frame;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53 frame = g_new0(GaimPluginPrefFrame, 1);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 return frame;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
59 gaim_plugin_pref_frame_destroy(GaimPluginPrefFrame *frame) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 GaimPluginPref *pref;
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
61 GList *l;
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 g_return_if_fail(frame);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
65 for(l = frame->prefs; l != NULL; l = l->next) {
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 pref = (GaimPluginPref *)l->data;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67 gaim_plugin_pref_destroy(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
70 g_list_free(frame->prefs);
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
71 frame->prefs = NULL;
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
72
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
73 g_free(frame);
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 frame = NULL;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 gaim_plugin_pref_frame_add(GaimPluginPrefFrame *frame, GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 g_return_if_fail(frame);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
82 frame->prefs = g_list_append(frame->prefs, pref);
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85 GList *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 gaim_plugin_pref_frame_get_prefs(GaimPluginPrefFrame *frame) {
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
87 g_return_val_if_fail(frame, NULL);
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
88 g_return_val_if_fail(frame->prefs, NULL);
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
89
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90 return frame->prefs;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 GaimPluginPref *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94 gaim_plugin_pref_new() {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 GaimPluginPref *pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97 pref = g_new0(GaimPluginPref, 1);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 return pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102 GaimPluginPref *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 gaim_plugin_pref_new_with_name(char *name) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 GaimPluginPref *pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 g_return_val_if_fail(name, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 pref = g_new0(GaimPluginPref, 1);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 pref->name = g_strdup(name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111 return pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 GaimPluginPref *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 gaim_plugin_pref_new_with_label(char *label) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 GaimPluginPref *pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118 g_return_val_if_fail(label, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120 pref = g_new0(GaimPluginPref, 1);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121 pref->label = g_strdup(label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 return pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126 GaimPluginPref *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
127 gaim_plugin_pref_new_with_name_and_label(char *name, char *label) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 GaimPluginPref *pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
130 g_return_val_if_fail(name, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
131 g_return_val_if_fail(label, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
132
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
133 pref = g_new0(GaimPluginPref, 1);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
134 pref->name = g_strdup(name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
135 pref->label = g_strdup(label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 return pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141 gaim_plugin_pref_destroy(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
144 if(pref->name) {
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145 g_free(pref->name);
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
146 pref->name = NULL;
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
147 }
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
149 if(pref->label) {
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
150 g_free(pref->label);
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
151 pref->label = NULL;
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
152 }
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153
8745
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
154 if(pref->choices) {
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
155 g_list_free(pref->choices);
6c0fae7a4f1a [gaim-migrate @ 9500]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
156 pref->choices = NULL;
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 g_free(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163 gaim_plugin_pref_set_name(GaimPluginPref *pref, char *name) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
164 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
165 g_return_if_fail(name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
167 if(pref->name)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
168 g_free(pref->name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
170 pref->name = g_strdup(name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173 char *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174 gaim_plugin_pref_get_name(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 g_return_val_if_fail(pref, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 return pref->name;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 gaim_plugin_pref_set_label(GaimPluginPref *pref, char *label) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 g_return_if_fail(label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185 if(pref->label)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 g_free(pref->label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 pref->label = g_strdup(label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 char *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 gaim_plugin_pref_get_label(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193 g_return_val_if_fail(pref, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
195 return pref->label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
198 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199 gaim_plugin_pref_set_bounds(GaimPluginPref *pref, int min, int max) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
200 int tmp;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
201
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
202 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
203 g_return_if_fail(pref->name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
204
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
205 if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
206 gaim_debug(GAIM_DEBUG_INFO, "pluginpref",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
207 "gaim_plugin_pref_set_bounds: %s is not an integer pref\n",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
208 pref->name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
209 return;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
210 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
211
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
212 if(min > max) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
213 tmp = min;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
214 min = max;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
215 max = tmp;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
216 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
217
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
218 pref->min = min;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
219 pref->max = max;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
220 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
221
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
222 void gaim_plugin_pref_get_bounds(GaimPluginPref *pref, int *min, int *max) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
223 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
224 g_return_if_fail(pref->name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
225
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
226 if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
227 gaim_debug(GAIM_DEBUG_INFO, "pluginpref",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
228 "gaim_plugin_pref_get_bounds: %s is not an integer pref\n",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
229 pref->name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
230 return;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
231 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
232
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
233 *min = pref->min;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
234 *max = pref->max;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
235 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
236
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
237 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
238 gaim_plugin_pref_set_type(GaimPluginPref *pref, GaimPluginPrefType type) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
239 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
240
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
241 pref->type = type;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
242 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
243
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
244 GaimPluginPrefType
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
245 gaim_plugin_pref_get_type(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
246 g_return_val_if_fail(pref, GAIM_PLUGIN_PREF_NONE);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
247
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
248 return pref->type;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
249 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
250
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
251 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
252 gaim_plugin_pref_add_choice(GaimPluginPref *pref, char *label, gpointer choice) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
253 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
254 g_return_if_fail(label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
255 g_return_if_fail(choice);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
256
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
257 pref->choices = g_list_append(pref->choices, label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
258 pref->choices = g_list_append(pref->choices, choice);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
259 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
260
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
261 GList *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
262 gaim_plugin_pref_get_choices(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
263 g_return_val_if_fail(pref, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
264
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
265 return pref->choices;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
266 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
267
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
268 void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
269 gaim_plugin_pref_set_max_length(GaimPluginPref *pref, unsigned int max_length) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
270 g_return_if_fail(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
271
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
272 pref->max_length = max_length;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
273 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
274
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
275 unsigned int
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
276 gaim_plugin_pref_get_max_length(GaimPluginPref *pref) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
277 g_return_val_if_fail(pref, 0);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
278
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
279 return pref->max_length;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
280 }