Mon, 09 Sep 2013 14:47:22 +0200
Request API: allow action_count = 0
| 8713 | 1 | /** |
| 2 | * @file pluginpref.h Plugin Preferences API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 8713 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8713 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 11 | * | |
| 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. | |
| 16 | * | |
| 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. | |
| 21 | * | |
| 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15884
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8713 | 25 | * |
| 26 | */ | |
| 15884 | 27 | #ifndef _PURPLE_PLUGINPREF_H_ |
| 28 | #define _PURPLE_PLUGINPREF_H_ | |
| 8713 | 29 | |
| 15884 | 30 | typedef struct _PurplePluginPrefFrame PurplePluginPrefFrame; |
| 31 | typedef struct _PurplePluginPref PurplePluginPref; | |
| 8713 | 32 | |
| 14782 | 33 | /** |
| 34 | * String format for preferences. | |
| 35 | */ | |
| 36 | typedef enum | |
| 37 | { | |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
38 | PURPLE_STRING_FORMAT_TYPE_NONE = 0, /**< The string is plain text. */ |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
39 | PURPLE_STRING_FORMAT_TYPE_MULTILINE = 1 << 0, /**< The string can have newlines. */ |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
40 | PURPLE_STRING_FORMAT_TYPE_HTML = 1 << 1 /**< The string can be in HTML. */ |
| 15884 | 41 | } PurpleStringFormatType; |
| 14782 | 42 | |
| 8713 | 43 | typedef enum { |
| 15884 | 44 | PURPLE_PLUGIN_PREF_NONE, |
| 45 | PURPLE_PLUGIN_PREF_CHOICE, | |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
46 | PURPLE_PLUGIN_PREF_INFO, /**< no-value label */ |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
47 | PURPLE_PLUGIN_PREF_STRING_FORMAT /**< The preference has a string value. */ |
| 15884 | 48 | } PurplePluginPrefType; |
| 8713 | 49 | |
| 50 | #include <glib.h> | |
| 51 | #include "prefs.h" | |
| 52 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20971
diff
changeset
|
53 | G_BEGIN_DECLS |
| 8713 | 54 | |
| 55 | /**************************************************************************/ | |
| 56 | /** @name Plugin Preference API */ | |
| 57 | /**************************************************************************/ | |
| 58 | /*@{*/ | |
| 59 | ||
| 60 | /** | |
| 61 | * Create a new plugin preference frame | |
| 62 | * | |
| 15884 | 63 | * @return a new PurplePluginPrefFrame |
| 8713 | 64 | */ |
| 15884 | 65 | PurplePluginPrefFrame *purple_plugin_pref_frame_new(void); |
| 8713 | 66 | |
| 67 | /** | |
| 68 | * Destroy a plugin preference frame | |
| 69 | * | |
| 70 | * @param frame The plugin frame to destroy | |
| 71 | */ | |
| 15884 | 72 | void purple_plugin_pref_frame_destroy(PurplePluginPrefFrame *frame); |
| 8713 | 73 | |
| 74 | /** | |
| 75 | * Adds a plugin preference to a plugin preference frame | |
| 76 | * | |
| 77 | * @param frame The plugin frame to add the preference to | |
| 78 | * @param pref The preference to add to the frame | |
| 79 | */ | |
| 15884 | 80 | void purple_plugin_pref_frame_add(PurplePluginPrefFrame *frame, PurplePluginPref *pref); |
| 8713 | 81 | |
| 82 | /** | |
| 83 | * Get the plugin preferences from a plugin preference frame | |
| 84 | * | |
| 85 | * @param frame The plugin frame to get the plugin preferences from | |
|
20971
b5e1eb080f33
Replace a bunch of @return markers with @constreturn markers. I believe these
Etan Reisner <deryni@pidgin.im>
parents:
20940
diff
changeset
|
86 | * @constreturn a GList of plugin preferences |
| 8713 | 87 | */ |
| 15884 | 88 | GList *purple_plugin_pref_frame_get_prefs(PurplePluginPrefFrame *frame); |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
9939
diff
changeset
|
89 | |
| 8713 | 90 | /** |
| 91 | * Create a new plugin preference | |
| 92 | * | |
| 15884 | 93 | * @return a new PurplePluginPref |
| 8713 | 94 | */ |
| 15884 | 95 | PurplePluginPref *purple_plugin_pref_new(void); |
| 8713 | 96 | |
| 97 | /** | |
| 98 | * Create a new plugin preference with name | |
| 99 | * | |
| 100 | * @param name The name of the pref | |
| 15884 | 101 | * @return a new PurplePluginPref |
| 8713 | 102 | */ |
| 15884 | 103 | PurplePluginPref *purple_plugin_pref_new_with_name(const char *name); |
| 8713 | 104 | |
| 105 | /** | |
| 106 | * Create a new plugin preference with label | |
| 107 | * | |
| 108 | * @param label The label to be displayed | |
| 15884 | 109 | * @return a new PurplePluginPref |
| 8713 | 110 | */ |
| 15884 | 111 | PurplePluginPref *purple_plugin_pref_new_with_label(const char *label); |
| 8713 | 112 | |
| 113 | /** | |
| 114 | * Create a new plugin preference with name and label | |
| 115 | * | |
| 116 | * @param name The name of the pref | |
| 117 | * @param label The label to be displayed | |
| 15884 | 118 | * @return a new PurplePluginPref |
| 8713 | 119 | */ |
| 15884 | 120 | PurplePluginPref *purple_plugin_pref_new_with_name_and_label(const char *name, const char *label); |
| 8713 | 121 | |
| 122 | /** | |
| 123 | * Destroy a plugin preference | |
| 124 | * | |
| 125 | * @param pref The preference to destroy | |
| 126 | */ | |
| 15884 | 127 | void purple_plugin_pref_destroy(PurplePluginPref *pref); |
| 8713 | 128 | |
| 129 | /** | |
| 130 | * Set a plugin pref name | |
| 131 | * | |
| 132 | * @param pref The plugin pref | |
| 133 | * @param name The name of the pref | |
| 134 | */ | |
| 15884 | 135 | void purple_plugin_pref_set_name(PurplePluginPref *pref, const char *name); |
| 8713 | 136 | |
| 137 | /** | |
| 138 | * Get a plugin pref name | |
| 139 | * | |
| 140 | * @param pref The plugin pref | |
| 141 | * @return The name of the pref | |
| 142 | */ | |
| 15884 | 143 | const char *purple_plugin_pref_get_name(PurplePluginPref *pref); |
| 8713 | 144 | |
| 145 | /** | |
| 146 | * Set a plugin pref label | |
| 147 | * | |
| 148 | * @param pref The plugin pref | |
| 149 | * @param label The label for the plugin pref | |
| 150 | */ | |
| 15884 | 151 | void purple_plugin_pref_set_label(PurplePluginPref *pref, const char *label); |
| 8713 | 152 | |
| 153 | /** | |
| 154 | * Get a plugin pref label | |
| 155 | * | |
| 156 | * @param pref The plugin pref | |
| 157 | * @return The label for the plugin pref | |
| 158 | */ | |
| 15884 | 159 | const char *purple_plugin_pref_get_label(PurplePluginPref *pref); |
| 8713 | 160 | |
| 161 | /** | |
| 162 | * Set 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 | */ | |
| 15884 | 168 | void purple_plugin_pref_set_bounds(PurplePluginPref *pref, int min, int max); |
| 8713 | 169 | |
| 170 | /** | |
| 171 | * Get the bounds for an integer pref | |
| 172 | * | |
| 173 | * @param pref The plugin pref | |
| 174 | * @param min The min value | |
| 175 | * @param max The max value | |
| 176 | */ | |
| 15884 | 177 | void purple_plugin_pref_get_bounds(PurplePluginPref *pref, int *min, int *max); |
| 8713 | 178 | |
| 179 | /** | |
| 180 | * Set the type of a plugin pref | |
| 181 | * | |
| 182 | * @param pref The plugin pref | |
| 183 | * @param type The type | |
| 184 | */ | |
| 15884 | 185 | void purple_plugin_pref_set_type(PurplePluginPref *pref, PurplePluginPrefType type); |
| 8713 | 186 | |
| 187 | /** | |
| 188 | * Get the type of a plugin pref | |
| 189 | * | |
| 190 | * @param pref The plugin pref | |
| 191 | * @return The type | |
| 192 | */ | |
| 15884 | 193 | PurplePluginPrefType purple_plugin_pref_get_type(PurplePluginPref *pref); |
| 8713 | 194 | |
| 195 | /** | |
| 196 | * Set the choices for a choices plugin pref | |
| 197 | * | |
| 198 | * @param pref The plugin pref | |
| 199 | * @param label The label for the choice | |
| 200 | * @param choice A gpointer of the choice | |
| 201 | */ | |
| 15884 | 202 | void purple_plugin_pref_add_choice(PurplePluginPref *pref, const char *label, gpointer choice); |
| 8713 | 203 | |
| 204 | /** | |
| 205 | * Get the choices for a choices plugin pref | |
| 206 | * | |
| 207 | * @param pref The plugin pref | |
|
20971
b5e1eb080f33
Replace a bunch of @return markers with @constreturn markers. I believe these
Etan Reisner <deryni@pidgin.im>
parents:
20940
diff
changeset
|
208 | * @constreturn GList of the choices |
| 8713 | 209 | */ |
| 15884 | 210 | GList *purple_plugin_pref_get_choices(PurplePluginPref *pref); |
| 8713 | 211 | |
| 212 | /** | |
| 213 | * Set the max length for a string plugin pref | |
| 214 | * | |
| 9000 | 215 | * @param pref The plugin pref |
| 216 | * @param max_length The max length of the string | |
| 8713 | 217 | */ |
| 15884 | 218 | void purple_plugin_pref_set_max_length(PurplePluginPref *pref, unsigned int max_length); |
| 8713 | 219 | |
| 220 | /** | |
| 221 | * Get the max length for a string plugin pref | |
| 222 | * | |
| 223 | * @param pref The plugin pref | |
| 224 | * @return the max length | |
| 225 | */ | |
| 15884 | 226 | unsigned int purple_plugin_pref_get_max_length(PurplePluginPref *pref); |
| 8713 | 227 | |
| 9841 | 228 | /** |
| 229 | * Sets the masking of a string plugin pref | |
| 230 | * | |
| 9939 | 231 | * @param pref The plugin pref |
| 232 | * @param mask The value to set | |
| 9841 | 233 | */ |
| 15884 | 234 | void purple_plugin_pref_set_masked(PurplePluginPref *pref, gboolean mask); |
| 9841 | 235 | |
| 236 | /** | |
| 237 | * Gets the masking of a string plugin pref | |
| 238 | * | |
| 239 | * @param pref The plugin pref | |
| 240 | * @return The masking | |
| 241 | */ | |
| 15884 | 242 | gboolean purple_plugin_pref_get_masked(PurplePluginPref *pref); |
| 9841 | 243 | |
|
12712
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 | * Sets the format type for a formattable-string plugin pref. You need to set the |
| 15884 | 246 | * pref type to PURPLE_PLUGIN_PREF_STRING_FORMAT first before setting the format. |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
247 | * |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
248 | * @param pref The plugin pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
249 | * @param format The format of the string |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
250 | */ |
| 15884 | 251 | void purple_plugin_pref_set_format_type(PurplePluginPref *pref, PurpleStringFormatType format); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
252 | |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
253 | /** |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
254 | * Gets the format type of the formattable-string plugin pref. |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
255 | * |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
256 | * @param pref The plugin pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
257 | * @return The format of the pref |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
258 | */ |
| 15884 | 259 | PurpleStringFormatType purple_plugin_pref_get_format_type(PurplePluginPref *pref); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12323
diff
changeset
|
260 | |
| 8713 | 261 | /*@}*/ |
| 262 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20971
diff
changeset
|
263 | G_END_DECLS |
| 8713 | 264 | |
| 15884 | 265 | #endif /* _PURPLE_PLUGINPREF_H_ */ |