comparison src/plugin.h @ 9015:67421e0dc497

[gaim-migrate @ 9791] (05:54:53) siege: that's the first pass on merging the two action sources (05:55:27) siege: using it right now, seems to be working fine. You may want to look it over though... (05:56:04) siege: found a small mem-leak in a GList getting created and not destroyed, this fixes that as well (13:20:40) KingAnt: LSchiere: Well it's probably ok. I haven't even had a chance to look at the commit for the other thing committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 22 May 2004 17:33:38 +0000
parents c209e287bb6e
children f8e395a054e2
comparison
equal deleted inserted replaced
9014:51b5b3a622ce 9015:67421e0dc497
32 32
33 typedef struct _GaimPlugin GaimPlugin; 33 typedef struct _GaimPlugin GaimPlugin;
34 typedef struct _GaimPluginInfo GaimPluginInfo; 34 typedef struct _GaimPluginInfo GaimPluginInfo;
35 typedef struct _GaimPluginUiInfo GaimPluginUiInfo; 35 typedef struct _GaimPluginUiInfo GaimPluginUiInfo;
36 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; 36 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo;
37
38 typedef struct _GaimPluginAction GaimPluginAction;
37 39
38 typedef int GaimPluginPriority; /**< Plugin priority. */ 40 typedef int GaimPluginPriority; /**< Plugin priority. */
39 41
40 #include "pluginpref.h" 42 #include "pluginpref.h"
41 43
87 void (*destroy)(GaimPlugin *plugin); 89 void (*destroy)(GaimPlugin *plugin);
88 90
89 void *ui_info; 91 void *ui_info;
90 void *extra_info; 92 void *extra_info;
91 GaimPluginUiInfo *prefs_info; 93 GaimPluginUiInfo *prefs_info;
92 GList *(*actions)(GaimPlugin *plugin); 94 GList *(*actions)(GaimPlugin *plugin, gpointer context);
93 }; 95 };
94 96
95 /** 97 /**
96 * Extra information for loader plugins. 98 * Extra information for loader plugins.
97 */ 99 */
135 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \ 137 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \
136 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) 138 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL)
137 139
138 #define GAIM_PLUGIN_UI_INFO(plugin) \ 140 #define GAIM_PLUGIN_UI_INFO(plugin) \
139 ((GaimPluginUiInfo*)(plugin)->info->prefs_info) 141 ((GaimPluginUiInfo*)(plugin)->info->prefs_info)
142
143
144 /**
145 * The structure used in the actions member of GaimPluginInfo
146 */
147 struct _GaimPluginAction {
148 char *label;
149 void (*callback)(GaimPluginAction *);
150
151 /** set to the owning plugin */
152 GaimPlugin *plugin;
153
154 /** NULL for plugin actions menu, set to the GaimConnection for
155 account actions menu */
156 gpointer context;
157 };
158
159 #define GAIM_PLUGIN_HAS_ACTIONS(plugin) \
160 ((plugin)->info != NULL && (plugin)->info->actions != NULL)
161
162 #define GAIM_PLUGIN_ACTIONS(plugin, context) \
163 (GAIM_PLUGIN_HAS_ACTIONS(plugin)? \
164 (plugin)->info->actions(plugin, context): NULL)
165
140 166
141 /** 167 /**
142 * Handles the initialization of modules. 168 * Handles the initialization of modules.
143 */ 169 */
144 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL) 170 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL)
156 initfunc((plugin)); \ 182 initfunc((plugin)); \
157 return gaim_plugin_register(plugin); \ 183 return gaim_plugin_register(plugin); \
158 } 184 }
159 #endif 185 #endif
160 186
187
161 #ifdef __cplusplus 188 #ifdef __cplusplus
162 extern "C" { 189 extern "C" {
163 #endif 190 #endif
164 191
165 192
479 */ 506 */
480 GList *gaim_plugins_get_all(void); 507 GList *gaim_plugins_get_all(void);
481 508
482 /*@}*/ 509 /*@}*/
483 510
511
512 /**
513 * Allocates and returns a new GaimPluginAction.
514 */
515 GaimPluginAction *gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *));
516
484 #ifdef __cplusplus 517 #ifdef __cplusplus
485 } 518 }
486 #endif 519 #endif
487 520
488 #endif /* _GAIM_PLUGIN_H_ */ 521 #endif /* _GAIM_PLUGIN_H_ */