Mercurial > pidgin.yaz
annotate src/prefs.h @ 13770:9df4a46b0bb3
[gaim-migrate @ 16182]
SF Patch #1460287 from Jrme Poulin (ticpu), with a bug fix by Sadrul
Currently, with a string like "vnc://ticpu.myftp.org:1/", the "ftp.org:1/"
portion will be linkified as an FTP URL. This patch corrects that.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 12 May 2006 21:50:19 +0000 |
parents | ff267281e882 |
children |
rev | line source |
---|---|
5441 | 1 /** |
2 * @file prefs.h Prefs API | |
10066 | 3 * @ingroup core |
5441 | 4 * |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
5441 | 10 * |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
9713 | 26 #ifndef _GAIM_PREFS_H_ |
27 #define _GAIM_PREFS_H_ | |
5441 | 28 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
29 #include <glib.h> |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
30 |
5441 | 31 /** |
12712
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
32 * String format for preferences. |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
33 */ |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
34 typedef enum |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
35 { |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
36 GAIM_STRING_FORMAT_TYPE_NONE = 0, |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
37 GAIM_STRING_FORMAT_TYPE_MULTILINE = 1 << 0, |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
38 GAIM_STRING_FORMAT_TYPE_HTML = 1 << 1 |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
39 } GaimStringFormatType; |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
40 |
8ae981f2c9cb
[gaim-migrate @ 15056]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
41 /** |
5441 | 42 * Pref data types. |
43 */ | |
44 typedef enum _GaimPrefType | |
45 { | |
46 GAIM_PREF_NONE, | |
47 GAIM_PREF_BOOLEAN, | |
48 GAIM_PREF_INT, | |
5561 | 49 GAIM_PREF_STRING, |
50 GAIM_PREF_STRING_LIST | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
51 |
5441 | 52 } GaimPrefType; |
53 | |
54 /** | |
55 * Pref change callback type | |
56 */ | |
57 | |
58 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type, | |
12816 | 59 gconstpointer val, gpointer data); |
5441 | 60 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
61 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
62 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
63 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
64 |
5441 | 65 /**************************************************************************/ |
66 /** @name Prefs API */ | |
67 /**************************************************************************/ | |
68 /*@{*/ | |
69 | |
70 /** | |
10443 | 71 * Returns the prefs subsystem handle. |
72 * | |
73 * @return The prefs subsystem handle. | |
74 */ | |
75 void *gaim_prefs_get_handle(void); | |
76 | |
77 /** | |
5441 | 78 * Initialize core prefs |
79 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
80 void gaim_prefs_init(void); |
5441 | 81 |
82 /** | |
8235 | 83 * Uninitializes the prefs subsystem. |
84 */ | |
85 void gaim_prefs_uninit(void); | |
86 | |
87 /** | |
5441 | 88 * Add a new typeless pref. |
89 * | |
90 * @param name The name of the pref | |
91 */ | |
92 void gaim_prefs_add_none(const char *name); | |
93 | |
94 /** | |
95 * Add a new boolean pref. | |
96 * | |
97 * @param name The name of the pref | |
98 * @param value The initial value to set | |
99 */ | |
100 void gaim_prefs_add_bool(const char *name, gboolean value); | |
101 | |
102 /** | |
103 * Add a new integer pref. | |
104 * | |
105 * @param name The name of the pref | |
106 * @param value The initial value to set | |
107 */ | |
108 void gaim_prefs_add_int(const char *name, int value); | |
109 | |
110 /** | |
111 * Add a new string pref. | |
112 * | |
113 * @param name The name of the pref | |
114 * @param value The initial value to set | |
115 */ | |
116 void gaim_prefs_add_string(const char *name, const char *value); | |
117 | |
118 /** | |
5561 | 119 * Add a new string list pref. |
120 * | |
121 * @param name The name of the pref | |
122 * @param value The initial value to set | |
123 */ | |
124 void gaim_prefs_add_string_list(const char *name, GList *value); | |
125 | |
126 /** | |
5441 | 127 * Remove a pref. |
128 * | |
129 * @param name The name of the pref | |
130 */ | |
131 void gaim_prefs_remove(const char *name); | |
132 | |
133 /** | |
6693 | 134 * Rename a pref |
135 * | |
136 * @param oldname The old name of the pref | |
137 * @param newname The new name for the pref | |
138 */ | |
139 void gaim_prefs_rename(const char *oldname, const char *newname); | |
140 | |
141 /** | |
8705 | 142 * Rename a boolean pref, toggling it's value |
143 * | |
144 * @param oldname The old name of the pref | |
145 * @param newname The new name for the pref | |
146 */ | |
147 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname); | |
148 | |
149 /** | |
5441 | 150 * Remove all prefs. |
151 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
152 void gaim_prefs_destroy(void); |
5441 | 153 |
154 /** | |
155 * Set raw pref value | |
156 * | |
157 * @param name The name of the pref | |
158 * @param value The value to set | |
159 */ | |
160 void gaim_prefs_set_generic(const char *name, gpointer value); | |
161 | |
162 /** | |
163 * Set boolean pref value | |
164 * | |
165 * @param name The name of the pref | |
166 * @param value The value to set | |
167 */ | |
168 void gaim_prefs_set_bool(const char *name, gboolean value); | |
169 | |
170 /** | |
171 * Set integer pref value | |
172 * | |
173 * @param name The name of the pref | |
174 * @param value The value to set | |
175 */ | |
176 void gaim_prefs_set_int(const char *name, int value); | |
177 | |
178 /** | |
179 * Set string pref value | |
180 * | |
181 * @param name The name of the pref | |
182 * @param value The value to set | |
183 */ | |
5451 | 184 void gaim_prefs_set_string(const char *name, const char *value); |
5441 | 185 |
186 /** | |
5561 | 187 * Set string pref value |
188 * | |
189 * @param name The name of the pref | |
190 * @param value The value to set | |
191 */ | |
192 void gaim_prefs_set_string_list(const char *name, GList *value); | |
193 | |
194 /** | |
9611 | 195 * Check if a pref exists |
196 * | |
9619 | 197 * @param name The name of the pref |
198 * @return TRUE if the pref exists. Otherwise FALSE. | |
9611 | 199 */ |
200 gboolean gaim_prefs_exists(const char *name); | |
201 | |
202 /** | |
6538 | 203 * Get pref type |
204 * | |
205 * @param name The name of the pref | |
206 * @return The type of the pref | |
207 */ | |
208 GaimPrefType gaim_prefs_get_type(const char *name); | |
209 | |
210 /** | |
5441 | 211 * Get boolean pref value |
212 * | |
213 * @param name The name of the pref | |
214 * @return The value of the pref | |
215 */ | |
216 gboolean gaim_prefs_get_bool(const char *name); | |
217 | |
218 /** | |
219 * Get integer pref value | |
220 * | |
221 * @param name The name of the pref | |
222 * @return The value of the pref | |
223 */ | |
224 int gaim_prefs_get_int(const char *name); | |
225 | |
226 /** | |
227 * Get string pref value | |
228 * | |
229 * @param name The name of the pref | |
230 * @return The value of the pref | |
231 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
232 const char *gaim_prefs_get_string(const char *name); |
5441 | 233 |
234 /** | |
10071 | 235 * Get string list pref value |
5561 | 236 * |
237 * @param name The name of the pref | |
238 * @return The value of the pref | |
239 */ | |
240 GList *gaim_prefs_get_string_list(const char *name); | |
241 | |
242 /** | |
5441 | 243 * Add a callback to a pref (and its children) |
244 */ | |
10087 | 245 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb, |
5441 | 246 gpointer data); |
247 | |
248 /** | |
249 * Remove a callback to a pref | |
250 */ | |
251 void gaim_prefs_disconnect_callback(guint callback_id); | |
252 | |
253 /** | |
10087 | 254 * Remove all pref callbacks by handle |
255 */ | |
256 void gaim_prefs_disconnect_by_handle(void *handle); | |
257 | |
258 /** | |
5684 | 259 * Trigger callbacks as if the pref changed |
260 */ | |
261 void gaim_prefs_trigger_callback(const char *name); | |
262 | |
263 /** | |
5441 | 264 * Read preferences |
265 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
266 gboolean gaim_prefs_load(void); |
5441 | 267 |
268 /** | |
8900 | 269 * Rename legacy prefs and delete some that no longer exist. |
270 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
271 void gaim_prefs_update_old(void); |
8900 | 272 |
5441 | 273 /*@}*/ |
274 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
275 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
276 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
277 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
278 |
9713 | 279 #endif /* _GAIM_PREFS_H_ */ |