| 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 */ |
|
| 26 #ifndef _GAIM_PLUGINPREF_H_ |
|
| 27 #define _GAIM_PLUGINPREF_H_ |
|
| 28 |
|
| 29 typedef struct _GaimPluginPrefFrame GaimPluginPrefFrame; |
|
| 30 typedef struct _GaimPluginPref GaimPluginPref; |
|
| 31 |
|
| 32 typedef enum { |
|
| 33 GAIM_PLUGIN_PREF_NONE, |
|
| 34 GAIM_PLUGIN_PREF_CHOICE, |
|
| 35 GAIM_PLUGIN_PREF_INFO, /**< no-value label */ |
|
| 36 GAIM_PLUGIN_PREF_STRING_FORMAT |
|
| 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 */ |
|
| 56 GaimPluginPrefFrame *gaim_plugin_pref_frame_new(void); |
|
| 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); |
|
| 80 |
|
| 81 /** |
|
| 82 * Create a new plugin preference |
|
| 83 * |
|
| 84 * @return a new GaimPluginPref |
|
| 85 */ |
|
| 86 GaimPluginPref *gaim_plugin_pref_new(void); |
|
| 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 */ |
|
| 94 GaimPluginPref *gaim_plugin_pref_new_with_name(const char *name); |
|
| 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 */ |
|
| 102 GaimPluginPref *gaim_plugin_pref_new_with_label(const char *label); |
|
| 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 */ |
|
| 111 GaimPluginPref *gaim_plugin_pref_new_with_name_and_label(const char *name, const char *label); |
|
| 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 */ |
|
| 126 void gaim_plugin_pref_set_name(GaimPluginPref *pref, const char *name); |
|
| 127 |
|
| 128 /** |
|
| 129 * Get a plugin pref name |
|
| 130 * |
|
| 131 * @param pref The plugin pref |
|
| 132 * @return The name of the pref |
|
| 133 */ |
|
| 134 const char *gaim_plugin_pref_get_name(GaimPluginPref *pref); |
|
| 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 */ |
|
| 142 void gaim_plugin_pref_set_label(GaimPluginPref *pref, const char *label); |
|
| 143 |
|
| 144 /** |
|
| 145 * Get a plugin pref label |
|
| 146 * |
|
| 147 * @param pref The plugin pref |
|
| 148 * @return The label for the plugin pref |
|
| 149 */ |
|
| 150 const char *gaim_plugin_pref_get_label(GaimPluginPref *pref); |
|
| 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 */ |
|
| 193 void gaim_plugin_pref_add_choice(GaimPluginPref *pref, const char *label, gpointer choice); |
|
| 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 * |
|
| 206 * @param pref The plugin pref |
|
| 207 * @param max_length The max length of the string |
|
| 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 |
|
| 219 /** |
|
| 220 * Sets the masking of a string plugin pref |
|
| 221 * |
|
| 222 * @param pref The plugin pref |
|
| 223 * @param mask The value to set |
|
| 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 |
|
| 235 /** |
|
| 236 * Sets the format type for a formattable-string plugin pref. You need to set the |
|
| 237 * pref type to GAIM_PLUGIN_PREF_STRING_FORMAT first before setting the format. |
|
| 238 * |
|
| 239 * @param pref The plugin pref |
|
| 240 * @param format The format of the string |
|
| 241 */ |
|
| 242 void gaim_plugin_pref_set_format_type(GaimPluginPref *pref, GaimStringFormatType format); |
|
| 243 |
|
| 244 /** |
|
| 245 * Gets the format type of the formattable-string plugin pref. |
|
| 246 * |
|
| 247 * @param pref The plugin pref |
|
| 248 * @return The format of the pref |
|
| 249 */ |
|
| 250 GaimStringFormatType gaim_plugin_pref_get_format_type(GaimPluginPref *pref); |
|
| 251 |
|
| 252 /*@}*/ |
|
| 253 |
|
| 254 #ifdef __cplusplus |
|
| 255 } |
|
| 256 #endif |
|
| 257 |
|
| 258 #endif /* _GAIM_PLUGINPREF_H_ */ |
|