3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef PURPLE_PLUGINPREF_H
24 #define PURPLE_PLUGINPREF_H
27 * @section_id: libpurple-pluginpref
28 * @short_description: <filename>pluginpref.h</filename>
29 * @title: Plugin Preferences Frontend
32 typedef struct _PurplePluginPrefFrame PurplePluginPrefFrame
;
33 typedef struct _PurplePluginPref PurplePluginPref
;
36 * PurpleStringFormatType:
37 * @PURPLE_STRING_FORMAT_TYPE_NONE: The string is plain text.
38 * @PURPLE_STRING_FORMAT_TYPE_MULTILINE: The string can have newlines.
39 * @PURPLE_STRING_FORMAT_TYPE_HTML: The string can be in HTML.
41 * String format for preferences.
45 PURPLE_STRING_FORMAT_TYPE_NONE
= 0,
46 PURPLE_STRING_FORMAT_TYPE_MULTILINE
= 1 << 0,
47 PURPLE_STRING_FORMAT_TYPE_HTML
= 1 << 1
48 } PurpleStringFormatType
;
51 * PurplePluginPrefType:
52 * @PURPLE_PLUGIN_PREF_INFO: no-value label
53 * @PURPLE_PLUGIN_PREF_STRING_FORMAT: The preference has a string value.
56 PURPLE_PLUGIN_PREF_NONE
,
57 PURPLE_PLUGIN_PREF_CHOICE
,
58 PURPLE_PLUGIN_PREF_INFO
,
59 PURPLE_PLUGIN_PREF_STRING_FORMAT
60 } PurplePluginPrefType
;
67 /**************************************************************************/
68 /* Plugin Preference API */
69 /**************************************************************************/
72 * purple_plugin_pref_frame_new:
74 * Create a new plugin preference frame
76 * Returns: a new PurplePluginPrefFrame
78 PurplePluginPrefFrame
*purple_plugin_pref_frame_new(void);
81 * purple_plugin_pref_frame_destroy:
82 * @frame: The plugin frame to destroy
84 * Destroy a plugin preference frame
86 void purple_plugin_pref_frame_destroy(PurplePluginPrefFrame
*frame
);
89 * purple_plugin_pref_frame_add:
90 * @frame: The plugin frame to add the preference to
91 * @pref: The preference to add to the frame
93 * Adds a plugin preference to a plugin preference frame
95 void purple_plugin_pref_frame_add(PurplePluginPrefFrame
*frame
, PurplePluginPref
*pref
);
98 * purple_plugin_pref_frame_get_prefs:
99 * @frame: The plugin frame to get the plugin preferences from
101 * Get the plugin preferences from a plugin preference frame
103 * Returns: (element-type PurplePluginPref) (transfer none): a list of plugin preferences
105 GList
*purple_plugin_pref_frame_get_prefs(PurplePluginPrefFrame
*frame
);
108 * purple_plugin_pref_new:
110 * Create a new plugin preference
112 * Returns: a new PurplePluginPref
114 PurplePluginPref
*purple_plugin_pref_new(void);
117 * purple_plugin_pref_new_with_name:
118 * @name: The name of the pref
120 * Create a new plugin preference with name
122 * Returns: a new PurplePluginPref
124 PurplePluginPref
*purple_plugin_pref_new_with_name(const char *name
);
127 * purple_plugin_pref_new_with_label:
128 * @label: The label to be displayed
130 * Create a new plugin preference with label
132 * Returns: a new PurplePluginPref
134 PurplePluginPref
*purple_plugin_pref_new_with_label(const char *label
);
137 * purple_plugin_pref_new_with_name_and_label:
138 * @name: The name of the pref
139 * @label: The label to be displayed
141 * Create a new plugin preference with name and label
143 * Returns: a new PurplePluginPref
145 PurplePluginPref
*purple_plugin_pref_new_with_name_and_label(const char *name
, const char *label
);
148 * purple_plugin_pref_destroy:
149 * @pref: The preference to destroy
151 * Destroy a plugin preference
153 void purple_plugin_pref_destroy(PurplePluginPref
*pref
);
156 * purple_plugin_pref_set_name:
157 * @pref: The plugin pref
158 * @name: The name of the pref
160 * Set a plugin pref name
162 void purple_plugin_pref_set_name(PurplePluginPref
*pref
, const char *name
);
165 * purple_plugin_pref_get_name:
166 * @pref: The plugin pref
168 * Get a plugin pref name
170 * Returns: The name of the pref
172 const char *purple_plugin_pref_get_name(PurplePluginPref
*pref
);
175 * purple_plugin_pref_set_label:
176 * @pref: The plugin pref
177 * @label: The label for the plugin pref
179 * Set a plugin pref label
181 void purple_plugin_pref_set_label(PurplePluginPref
*pref
, const char *label
);
184 * purple_plugin_pref_get_label:
185 * @pref: The plugin pref
187 * Get a plugin pref label
189 * Returns: The label for the plugin pref
191 const char *purple_plugin_pref_get_label(PurplePluginPref
*pref
);
194 * purple_plugin_pref_set_bounds:
195 * @pref: The plugin pref
196 * @min: The min value
197 * @max: The max value
199 * Set the bounds for an integer pref
201 void purple_plugin_pref_set_bounds(PurplePluginPref
*pref
, int min
, int max
);
204 * purple_plugin_pref_get_bounds:
205 * @pref: The plugin pref
206 * @min: The min value
207 * @max: The max value
209 * Get the bounds for an integer pref
211 void purple_plugin_pref_get_bounds(PurplePluginPref
*pref
, int *min
, int *max
);
214 * purple_plugin_pref_set_pref_type:
215 * @pref: The plugin pref
218 * Set the type of a plugin pref
220 void purple_plugin_pref_set_pref_type(PurplePluginPref
*pref
, PurplePluginPrefType type
);
223 * purple_plugin_pref_get_pref_type:
224 * @pref: The plugin pref
226 * Get the type of a plugin pref
230 PurplePluginPrefType
purple_plugin_pref_get_pref_type(PurplePluginPref
*pref
);
233 * purple_plugin_pref_add_choice:
234 * @pref: The plugin pref
235 * @label: The label for the choice
236 * @choice: A gpointer of the choice
238 * Set the choices for a choices plugin pref
240 void purple_plugin_pref_add_choice(PurplePluginPref
*pref
, const char *label
, gpointer choice
);
243 * purple_plugin_pref_get_choices:
244 * @pref: The plugin pref
246 * Get the choices for a choices plugin pref
248 * Returns: (transfer none): GList of the choices
250 GList
*purple_plugin_pref_get_choices(PurplePluginPref
*pref
);
253 * purple_plugin_pref_set_max_length:
254 * @pref: The plugin pref
255 * @max_length: The max length of the string
257 * Set the max length for a string plugin pref
259 void purple_plugin_pref_set_max_length(PurplePluginPref
*pref
, unsigned int max_length
);
262 * purple_plugin_pref_get_max_length:
263 * @pref: The plugin pref
265 * Get the max length for a string plugin pref
267 * Returns: the max length
269 unsigned int purple_plugin_pref_get_max_length(PurplePluginPref
*pref
);
272 * purple_plugin_pref_set_masked:
273 * @pref: The plugin pref
274 * @mask: The value to set
276 * Sets the masking of a string plugin pref
278 void purple_plugin_pref_set_masked(PurplePluginPref
*pref
, gboolean mask
);
281 * purple_plugin_pref_get_masked:
282 * @pref: The plugin pref
284 * Gets the masking of a string plugin pref
286 * Returns: The masking
288 gboolean
purple_plugin_pref_get_masked(PurplePluginPref
*pref
);
291 * purple_plugin_pref_set_format_type:
292 * @pref: The plugin pref
293 * @format: The format of the string
295 * Sets the format type for a formattable-string plugin pref. You need to set the
296 * pref type to PURPLE_PLUGIN_PREF_STRING_FORMAT first before setting the format.
298 void purple_plugin_pref_set_format_type(PurplePluginPref
*pref
, PurpleStringFormatType format
);
301 * purple_plugin_pref_get_format_type:
302 * @pref: The plugin pref
304 * Gets the format type of the formattable-string plugin pref.
306 * Returns: The format of the pref
308 PurpleStringFormatType
purple_plugin_pref_get_format_type(PurplePluginPref
*pref
);
312 #endif /* PURPLE_PLUGINPREF_H */