| 148 PurplePlugin *plugin; |
148 PurplePlugin *plugin; |
| 149 gpointer user_data; |
149 gpointer user_data; |
| 150 }; |
150 }; |
| 151 |
151 |
| 152 /** Returns an ABI version to set in plugins using major and minor versions */ |
152 /** Returns an ABI version to set in plugins using major and minor versions */ |
| 153 #define PURPLE_PLUGIN_ABI_VERSION(major,minor) (0x01000000 | \ |
153 #define PURPLE_PLUGIN_ABI_VERSION(major,minor) \ |
| 154 ((major) << 16) | (minor)) |
154 (0x01000000 | ((major) << 16) | (minor)) |
| 155 |
155 |
| 156 /** Returns the major version from an ABI version */ |
156 /** Returns the major version from an ABI version */ |
| 157 #define PURPLE_PLUGIN_ABI_MAJOR_VERSION(abi) ((abi >> 16) & 0xff) |
157 #define PURPLE_PLUGIN_ABI_MAJOR_VERSION(abi) \ |
| |
158 ((abi >> 16) & 0xff) |
| |
159 |
| 158 /** Returns the minor version from an ABI version */ |
160 /** Returns the minor version from an ABI version */ |
| 159 #define PURPLE_PLUGIN_ABI_MINOR_VERSION(abi) (abi & 0xffff) |
161 #define PURPLE_PLUGIN_ABI_MINOR_VERSION(abi) \ |
| |
162 (abi & 0xffff) |
| 160 |
163 |
| 161 /** |
164 /** |
| 162 * A convenienceā macro that returns an ABI version using PURPLE_MAJOR_VERSION |
165 * A convenienceā macro that returns an ABI version using PURPLE_MAJOR_VERSION |
| 163 * and PURPLE_MINOR_VERSION |
166 * and PURPLE_MINOR_VERSION |
| 164 */ |
167 */ |
| 165 #define PURPLE_ABI_VERSION PURPLE_PLUGIN_ABI_VERSION(PURPLE_MAJOR_VERSION, \ |
168 #define PURPLE_ABI_VERSION PURPLE_PLUGIN_ABI_VERSION(PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION) |
| 166 PURPLE_MINOR_VERSION) |
|
| 167 |
169 |
| 168 /** |
170 /** |
| 169 * PURPLE_PLUGIN_INIT: |
171 * PURPLE_PLUGIN_INIT: |
| 170 * |
172 * |
| 171 * Defines the plugin's entry points. |
173 * Defines the plugin's entry points. |
| 188 GError *e = NULL; \ |
190 GError *e = NULL; \ |
| 189 gboolean unloaded = pluginunload(NULL, &e); \ |
191 gboolean unloaded = pluginunload(NULL, &e); \ |
| 190 if (e) g_error_free(e); \ |
192 if (e) g_error_free(e); \ |
| 191 return unloaded; \ |
193 return unloaded; \ |
| 192 } |
194 } |
| 193 #else /* PURPLE_PLUGINS && !PURPLE_STATIC_PRPL */ |
195 #else /* PURPLE_PLUGINS && !PURPLE_STATIC_PRPL */ |
| 194 #define PURPLE_PLUGIN_INIT(pluginname,pluginquery,pluginload,pluginunload) \ |
196 #define PURPLE_PLUGIN_INIT(pluginname,pluginquery,pluginload,pluginunload) \ |
| 195 G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e); \ |
197 G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e); \ |
| 196 G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e) { \ |
198 G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e) { \ |
| 197 return GPLUGIN_PLUGIN_INFO(pluginquery(e)); \ |
199 return GPLUGIN_PLUGIN_INFO(pluginquery(e)); \ |
| 198 } \ |
200 } \ |
| 220 * @param TN The name of the new type, in Camel case. |
222 * @param TN The name of the new type, in Camel case. |
| 221 * @param t_n The name of the new type, in lowercase, words separated by '_'. |
223 * @param t_n The name of the new type, in lowercase, words separated by '_'. |
| 222 * @param T_P The #GType of the parent type. |
224 * @param T_P The #GType of the parent type. |
| 223 */ |
225 */ |
| 224 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) |
226 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) |
| 225 #define PURPLE_DEFINE_TYPE(TN, t_n, T_P) PURPLE_DEFINE_STATIC_TYPE(TN, t_n, T_P) |
227 #define PURPLE_DEFINE_TYPE(TN, t_n, T_P) \ |
| |
228 PURPLE_DEFINE_STATIC_TYPE(TN, t_n, T_P) |
| 226 #else |
229 #else |
| 227 #define PURPLE_DEFINE_TYPE(TN, t_n, T_P) PURPLE_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) |
230 #define PURPLE_DEFINE_TYPE(TN, t_n, T_P) \ |
| |
231 PURPLE_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) |
| 228 #endif |
232 #endif |
| 229 |
233 |
| 230 /** |
234 /** |
| 231 * PURPLE_DEFINE_TYPE_EXTENDED: |
235 * PURPLE_DEFINE_TYPE_EXTENDED: |
| 232 * |
236 * |
| 238 * @param T_P The #GType of the parent type. |
242 * @param T_P The #GType of the parent type. |
| 239 * @param flags #GTypeFlags to register the type with. |
243 * @param flags #GTypeFlags to register the type with. |
| 240 * @param CODE Custom code that gets inserted in *_get_type(). |
244 * @param CODE Custom code that gets inserted in *_get_type(). |
| 241 */ |
245 */ |
| 242 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) |
246 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) |
| 243 #define PURPLE_DEFINE_TYPE_EXTENDED PURPLE_DEFINE_STATIC_TYPE_EXTENDED |
247 #define PURPLE_DEFINE_TYPE_EXTENDED \ |
| |
248 PURPLE_DEFINE_STATIC_TYPE_EXTENDED |
| 244 #else |
249 #else |
| 245 #define PURPLE_DEFINE_TYPE_EXTENDED PURPLE_DEFINE_DYNAMIC_TYPE_EXTENDED |
250 #define PURPLE_DEFINE_TYPE_EXTENDED \ |
| |
251 PURPLE_DEFINE_DYNAMIC_TYPE_EXTENDED |
| 246 #endif |
252 #endif |
| 247 |
253 |
| 248 /** |
254 /** |
| 249 * PURPLE_IMPLEMENT_INTERFACE_STATIC: |
255 * PURPLE_IMPLEMENT_INTERFACE_STATIC: |
| 250 * |
256 * |