diff 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
line wrap: on
line diff
--- a/src/plugin.h	Sat May 22 17:20:27 2004 +0000
+++ b/src/plugin.h	Sat May 22 17:33:38 2004 +0000
@@ -35,6 +35,8 @@
 typedef struct _GaimPluginUiInfo     GaimPluginUiInfo;
 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo;
 
+typedef struct _GaimPluginAction     GaimPluginAction;
+
 typedef int GaimPluginPriority; /**< Plugin priority. */
 
 #include "pluginpref.h"
@@ -89,7 +91,7 @@
 	void *ui_info;
 	void *extra_info;
 	GaimPluginUiInfo *prefs_info;
-	GList *(*actions)(GaimPlugin *plugin);
+	GList *(*actions)(GaimPlugin *plugin, gpointer context);
 };
 
 /**
@@ -138,6 +140,30 @@
 #define GAIM_PLUGIN_UI_INFO(plugin) \
 	((GaimPluginUiInfo*)(plugin)->info->prefs_info)
 
+
+/**
+ * The structure used in the actions member of GaimPluginInfo
+ */
+struct _GaimPluginAction {
+	char *label;
+	void (*callback)(GaimPluginAction *);
+
+	/** set to the owning plugin */
+	GaimPlugin *plugin;
+
+	/** NULL for plugin actions menu, set to the GaimConnection for
+	    account actions menu */
+	gpointer context;
+};
+
+#define GAIM_PLUGIN_HAS_ACTIONS(plugin) \
+	((plugin)->info != NULL && (plugin)->info->actions != NULL)
+
+#define GAIM_PLUGIN_ACTIONS(plugin, context) \
+	(GAIM_PLUGIN_HAS_ACTIONS(plugin)? \
+	(plugin)->info->actions(plugin, context): NULL)
+
+
 /**
  * Handles the initialization of modules.
  */
@@ -158,6 +184,7 @@
 	}
 #endif
 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -481,6 +508,12 @@
 
 /*@}*/
 
+
+/**
+ * Allocates and returns a new GaimPluginAction.
+ */
+GaimPluginAction *gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *));
+
 #ifdef __cplusplus
 }
 #endif