Mon, 20 Mar 2006 05:06:26 +0000
[gaim-migrate @ 15903]
Prevent plugins that have more than one period in the name from being duplicated with every probe.
| 8713 | 1 | /** |
| 2 | * @file pluginpref.h Plugin Preferences API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 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. | |
| 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
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9529
diff
changeset
|
26 | #ifndef _GAIM_PLUGINPREF_H_ |
|
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9529
diff
changeset
|
27 | #define _GAIM_PLUGINPREF_H_ |
| 8713 | 28 | |
| 29 | typedef struct _GaimPluginPrefFrame GaimPluginPrefFrame; | |
| 30 | typedef struct _GaimPluginPref GaimPluginPref; | |
| 31 | ||
| 32 | typedef enum { | |
| 33 | GAIM_PLUGIN_PREF_NONE, | |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
9000
diff
changeset
|
34 | GAIM_PLUGIN_PREF_CHOICE, |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
9000
diff
changeset
|
35 | GAIM_PLUGIN_PREF_INFO, /**< no-value label */ |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
36 | GAIM_PLUGIN_PREF_STRING_FORMAT |
| 8713 | 37 | } GaimPluginPrefType; |
| 38 | ||
| 39 | #include <glib.h> | |
| 40 | #include "prefs.h" | |
| 41 | ||
| 42 | #ifdef __cplusplus | |
| 43 | extern "C" { | |
| 44 | #endif | |
| 45 | ||
| 46 | /**************************************************************************/ | |
| 47 | /** @name Plugin Preference API */ | |
| 48 | /**************************************************************************/ | |
| 49 | /*@{*/ | |
| 50 | ||
| 51 | /** | |
| 52 | * Create a new plugin preference frame | |
| 53 | * | |
| 54 | * @return a new GaimPluginPrefFrame | |
| 55 | */ | |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
10414
diff
changeset
|
56 | GaimPluginPrefFrame *gaim_plugin_pref_frame_new(void); |
| 8713 | 57 | |
| 58 | /** | |
| 59 | * Destroy a plugin preference frame | |
| 60 | * | |
| 61 | * @param frame The plugin frame to destroy | |
| 62 | */ | |
| 63 | void gaim_plugin_pref_frame_destroy(GaimPluginPrefFrame *frame); | |
| 64 | ||
| 65 | /** | |
| 66 | * Adds a plugin preference to a plugin preference frame | |
| 67 | * | |
| 68 | * @param frame The plugin frame to add the preference to | |
| 69 | * @param pref The preference to add to the frame | |
| 70 | */ | |
| 71 | void gaim_plugin_pref_frame_add(GaimPluginPrefFrame *frame, GaimPluginPref *pref); | |
| 72 | ||
| 73 | /** | |
| 74 | * Get the plugin preferences from a plugin preference frame | |
| 75 | * | |
| 76 | * @param frame The plugin frame to get the plugin preferences from | |
| 77 | * @return a GList of plugin preferences | |
| 78 | */ | |
| 79 | GList *gaim_plugin_pref_frame_get_prefs(GaimPluginPrefFrame *frame); | |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
9939
diff
changeset
|
80 | |
| 8713 | 81 | /** |
| 82 | * Create a new plugin preference | |
| 83 | * | |
| 84 | * @return a new GaimPluginPref | |
| 85 | */ | |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
10414
diff
changeset
|
86 | GaimPluginPref *gaim_plugin_pref_new(void); |
| 8713 | 87 | |
| 88 | /** | |
| 89 | * Create a new plugin preference with name | |
| 90 | * | |
| 91 | * @param name The name of the pref | |
| 92 | * @return a new GaimPluginPref | |
| 93 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
94 | GaimPluginPref *gaim_plugin_pref_new_with_name(const char *name); |
| 8713 | 95 | |
| 96 | /** | |
| 97 | * Create a new plugin preference with label | |
| 98 | * | |
| 99 | * @param label The label to be displayed | |
| 100 | * @return a new GaimPluginPref | |
| 101 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
102 | GaimPluginPref *gaim_plugin_pref_new_with_label(const char *label); |
| 8713 | 103 | |
| 104 | /** | |
| 105 | * Create a new plugin preference with name and label | |
| 106 | * | |
| 107 | * @param name The name of the pref | |
| 108 | * @param label The label to be displayed | |
| 109 | * @return a new GaimPluginPref | |
| 110 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
111 | GaimPluginPref *gaim_plugin_pref_new_with_name_and_label(const char *name, const char *label); |
| 8713 | 112 | |
| 113 | /** | |
| 114 | * Destroy a plugin preference | |
| 115 | * | |
| 116 | * @param pref The preference to destroy | |
| 117 | */ | |
| 118 | void gaim_plugin_pref_destroy(GaimPluginPref *pref); | |
| 119 | ||
| 120 | /** | |
| 121 | * Set a plugin pref name | |
| 122 | * | |
| 123 | * @param pref The plugin pref | |
| 124 | * @param name The name of the pref | |
| 125 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
126 | void gaim_plugin_pref_set_name(GaimPluginPref *pref, const char *name); |
| 8713 | 127 | |
| 128 | /** | |
| 129 | * Get a plugin pref name | |
| 130 | * | |
| 131 | * @param pref The plugin pref | |
| 132 | * @return The name of the pref | |
| 133 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
134 | const char *gaim_plugin_pref_get_name(GaimPluginPref *pref); |
| 8713 | 135 | |
| 136 | /** | |
| 137 | * Set a plugin pref label | |
| 138 | * | |
| 139 | * @param pref The plugin pref | |
| 140 | * @param label The label for the plugin pref | |
| 141 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
142 | void gaim_plugin_pref_set_label(GaimPluginPref *pref, const char *label); |
| 8713 | 143 | |
| 144 | /** | |
| 145 | * Get a plugin pref label | |
| 146 | * | |
| 147 | * @param pref The plugin pref | |
| 148 | * @return The label for the plugin pref | |
| 149 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
150 | const char *gaim_plugin_pref_get_label(GaimPluginPref *pref); |
| 8713 | 151 | |
| 152 | /** | |
| 153 | * Set the bounds for an integer pref | |
| 154 | * | |
| 155 | * @param pref The plugin pref | |
| 156 | * @param min The min value | |
| 157 | * @param max The max value | |
| 158 | */ | |
| 159 | void gaim_plugin_pref_set_bounds(GaimPluginPref *pref, int min, int max); | |
| 160 | ||
| 161 | /** | |
| 162 | * Get the bounds for an integer pref | |
| 163 | * | |
| 164 | * @param pref The plugin pref | |
| 165 | * @param min The min value | |
| 166 | * @param max The max value | |
| 167 | */ | |
| 168 | void gaim_plugin_pref_get_bounds(GaimPluginPref *pref, int *min, int *max); | |
| 169 | ||
| 170 | /** | |
| 171 | * Set the type of a plugin pref | |
| 172 | * | |
| 173 | * @param pref The plugin pref | |
| 174 | * @param type The type | |
| 175 | */ | |
| 176 | void gaim_plugin_pref_set_type(GaimPluginPref *pref, GaimPluginPrefType type); | |
| 177 | ||
| 178 | /** | |
| 179 | * Get the type of a plugin pref | |
| 180 | * | |
| 181 | * @param pref The plugin pref | |
| 182 | * @return The type | |
| 183 | */ | |
| 184 | GaimPluginPrefType gaim_plugin_pref_get_type(GaimPluginPref *pref); | |
| 185 | ||
| 186 | /** | |
| 187 | * Set the choices for a choices plugin pref | |
| 188 | * | |
| 189 | * @param pref The plugin pref | |
| 190 | * @param label The label for the choice | |
| 191 | * @param choice A gpointer of the choice | |
| 192 | */ | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12712
diff
changeset
|
193 | void gaim_plugin_pref_add_choice(GaimPluginPref *pref, const char *label, gpointer choice); |
| 8713 | 194 | |
| 195 | /** | |
| 196 | * Get the choices for a choices plugin pref | |
| 197 | * | |
| 198 | * @param pref The plugin pref | |
| 199 | * @return GList of the choices | |
| 200 | */ | |
| 201 | GList *gaim_plugin_pref_get_choices(GaimPluginPref *pref); | |
| 202 | ||
| 203 | /** | |
| 204 | * Set the max length for a string plugin pref | |
| 205 | * | |
| 9000 | 206 | * @param pref The plugin pref |
| 207 | * @param max_length The max length of the string | |
| 8713 | 208 | */ |
| 209 | void gaim_plugin_pref_set_max_length(GaimPluginPref *pref, unsigned int max_length); | |
| 210 | ||
| 211 | /** | |
| 212 | * Get the max length for a string plugin pref | |
| 213 | * | |
| 214 | * @param pref The plugin pref | |
| 215 | * @return the max length | |
| 216 | */ | |
| 217 | unsigned int gaim_plugin_pref_get_max_length(GaimPluginPref *pref); | |
| 218 | ||
| 9841 | 219 | /** |
| 220 | * Sets the masking of a string plugin pref | |
| 221 | * | |
| 9939 | 222 | * @param pref The plugin pref |
| 223 | * @param mask The value to set | |
| 9841 | 224 | */ |
| 225 | void gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean mask); | |
| 226 | ||
| 227 | /** | |
| 228 | * Gets the masking of a string plugin pref | |
| 229 | * | |
| 230 | * @param pref The plugin pref | |
| 231 | * @return The masking | |
| 232 | */ | |
| 233 | gboolean gaim_plugin_pref_get_masked(GaimPluginPref *pref); | |
| 234 | ||
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
235 | /** |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
236 | * Sets the format type for a formattable-string plugin pref. You need to set the |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
237 | * pref type to GAIM_PLUGIN_PREF_STRING_FORMAT first before setting the format. |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
238 | * |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
239 | * @param pref The plugin pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
240 | * @param format The format of the string |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
241 | */ |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
242 | void gaim_plugin_pref_set_format_type(GaimPluginPref *pref, GaimStringFormatType format); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
243 | |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
244 | /** |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
245 | * Gets the format type of the formattable-string plugin pref. |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
246 | * |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
247 | * @param pref The plugin pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
248 | * @return The format of the pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
249 | */ |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
250 | GaimStringFormatType gaim_plugin_pref_get_format_type(GaimPluginPref *pref); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
251 | |
| 8713 | 252 | /*@}*/ |
| 253 | ||
| 254 | #ifdef __cplusplus | |
| 255 | } | |
| 256 | #endif | |
| 257 | ||
|
9713
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9529
diff
changeset
|
258 | #endif /* _GAIM_PLUGINPREF_H_ */ |