I think this was accidentally changed in revision
[pidgin-git.git] / libpurple / pluginpref.h
blob6ce04ad9ab51e0a494d44956da8a431c99bb1385
1 /**
2 * @file pluginpref.h Plugin Preferences API
3 * @ingroup core
4 */
6 /* purple
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef _PURPLE_PLUGINPREF_H_
28 #define _PURPLE_PLUGINPREF_H_
30 typedef struct _PurplePluginPrefFrame PurplePluginPrefFrame;
31 typedef struct _PurplePluginPref PurplePluginPref;
33 /**
34 * String format for preferences.
36 typedef enum
38 PURPLE_STRING_FORMAT_TYPE_NONE = 0, /**< The string is plain text. */
39 PURPLE_STRING_FORMAT_TYPE_MULTILINE = 1 << 0, /**< The string can have newlines. */
40 PURPLE_STRING_FORMAT_TYPE_HTML = 1 << 1 /**< The string can be in HTML. */
41 } PurpleStringFormatType;
43 typedef enum {
44 PURPLE_PLUGIN_PREF_NONE,
45 PURPLE_PLUGIN_PREF_CHOICE,
46 PURPLE_PLUGIN_PREF_INFO, /**< no-value label */
47 PURPLE_PLUGIN_PREF_STRING_FORMAT /**< The preference has a string value. */
48 } PurplePluginPrefType;
50 #include <glib.h>
51 #include "prefs.h"
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
57 /**************************************************************************/
58 /** @name Plugin Preference API */
59 /**************************************************************************/
60 /*@{*/
62 /**
63 * Create a new plugin preference frame
65 * @return a new PurplePluginPrefFrame
67 PurplePluginPrefFrame *purple_plugin_pref_frame_new(void);
69 /**
70 * Destroy a plugin preference frame
72 * @param frame The plugin frame to destroy
74 void purple_plugin_pref_frame_destroy(PurplePluginPrefFrame *frame);
76 /**
77 * Adds a plugin preference to a plugin preference frame
79 * @param frame The plugin frame to add the preference to
80 * @param pref The preference to add to the frame
82 void purple_plugin_pref_frame_add(PurplePluginPrefFrame *frame, PurplePluginPref *pref);
84 /**
85 * Get the plugin preferences from a plugin preference frame
87 * @param frame The plugin frame to get the plugin preferences from
88 * @constreturn a GList of plugin preferences
90 GList *purple_plugin_pref_frame_get_prefs(PurplePluginPrefFrame *frame);
92 /**
93 * Create a new plugin preference
95 * @return a new PurplePluginPref
97 PurplePluginPref *purple_plugin_pref_new(void);
99 /**
100 * Create a new plugin preference with name
102 * @param name The name of the pref
103 * @return a new PurplePluginPref
105 PurplePluginPref *purple_plugin_pref_new_with_name(const char *name);
108 * Create a new plugin preference with label
110 * @param label The label to be displayed
111 * @return a new PurplePluginPref
113 PurplePluginPref *purple_plugin_pref_new_with_label(const char *label);
116 * Create a new plugin preference with name and label
118 * @param name The name of the pref
119 * @param label The label to be displayed
120 * @return a new PurplePluginPref
122 PurplePluginPref *purple_plugin_pref_new_with_name_and_label(const char *name, const char *label);
125 * Destroy a plugin preference
127 * @param pref The preference to destroy
129 void purple_plugin_pref_destroy(PurplePluginPref *pref);
132 * Set a plugin pref name
134 * @param pref The plugin pref
135 * @param name The name of the pref
137 void purple_plugin_pref_set_name(PurplePluginPref *pref, const char *name);
140 * Get a plugin pref name
142 * @param pref The plugin pref
143 * @return The name of the pref
145 const char *purple_plugin_pref_get_name(PurplePluginPref *pref);
148 * Set a plugin pref label
150 * @param pref The plugin pref
151 * @param label The label for the plugin pref
153 void purple_plugin_pref_set_label(PurplePluginPref *pref, const char *label);
156 * Get a plugin pref label
158 * @param pref The plugin pref
159 * @return The label for the plugin pref
161 const char *purple_plugin_pref_get_label(PurplePluginPref *pref);
164 * Set the bounds for an integer pref
166 * @param pref The plugin pref
167 * @param min The min value
168 * @param max The max value
170 void purple_plugin_pref_set_bounds(PurplePluginPref *pref, int min, int max);
173 * Get the bounds for an integer pref
175 * @param pref The plugin pref
176 * @param min The min value
177 * @param max The max value
179 void purple_plugin_pref_get_bounds(PurplePluginPref *pref, int *min, int *max);
182 * Set the type of a plugin pref
184 * @param pref The plugin pref
185 * @param type The type
187 void purple_plugin_pref_set_type(PurplePluginPref *pref, PurplePluginPrefType type);
190 * Get the type of a plugin pref
192 * @param pref The plugin pref
193 * @return The type
195 PurplePluginPrefType purple_plugin_pref_get_type(PurplePluginPref *pref);
198 * Set the choices for a choices plugin pref
200 * @param pref The plugin pref
201 * @param label The label for the choice
202 * @param choice A gpointer of the choice
204 void purple_plugin_pref_add_choice(PurplePluginPref *pref, const char *label, gpointer choice);
207 * Get the choices for a choices plugin pref
209 * @param pref The plugin pref
210 * @constreturn GList of the choices
212 GList *purple_plugin_pref_get_choices(PurplePluginPref *pref);
215 * Set the max length for a string plugin pref
217 * @param pref The plugin pref
218 * @param max_length The max length of the string
220 void purple_plugin_pref_set_max_length(PurplePluginPref *pref, unsigned int max_length);
223 * Get the max length for a string plugin pref
225 * @param pref The plugin pref
226 * @return the max length
228 unsigned int purple_plugin_pref_get_max_length(PurplePluginPref *pref);
231 * Sets the masking of a string plugin pref
233 * @param pref The plugin pref
234 * @param mask The value to set
236 void purple_plugin_pref_set_masked(PurplePluginPref *pref, gboolean mask);
239 * Gets the masking of a string plugin pref
241 * @param pref The plugin pref
242 * @return The masking
244 gboolean purple_plugin_pref_get_masked(PurplePluginPref *pref);
247 * Sets the format type for a formattable-string plugin pref. You need to set the
248 * pref type to PURPLE_PLUGIN_PREF_STRING_FORMAT first before setting the format.
250 * @param pref The plugin pref
251 * @param format The format of the string
253 void purple_plugin_pref_set_format_type(PurplePluginPref *pref, PurpleStringFormatType format);
256 * Gets the format type of the formattable-string plugin pref.
258 * @param pref The plugin pref
259 * @return The format of the pref
261 PurpleStringFormatType purple_plugin_pref_get_format_type(PurplePluginPref *pref);
263 /*@}*/
265 #ifdef __cplusplus
267 #endif
269 #endif /* _PURPLE_PLUGINPREF_H_ */