/soc/2013/ankitkv/gobjectification: ba8ead8477cb: Added PurplePl...
Ankit Vani
a at nevitus.org
Sat Aug 3 08:16:42 EDT 2013
Changeset: ba8ead8477cbf9412fa4ce3b103615b8dc678cce
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-03 16:06 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/ba8ead8477cb
Description:
Added PurplePlugin as an alias for GPluginPlugin
diffstat:
libpurple/plugins.c | 22 +++++++++++-----------
libpurple/plugins.h | 35 +++++++++++++++++++++++++++--------
2 files changed, 38 insertions(+), 19 deletions(-)
diffs (197 lines):
diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -65,7 +65,7 @@ static GList *plugins_to_disable = NULL;
* Plugin API
**************************************************************************/
gboolean
-purple_plugin_load(GPluginPlugin *plugin)
+purple_plugin_load(PurplePlugin *plugin)
{
PurplePluginInfo *plugin_info;
GError *error = NULL;
@@ -98,7 +98,7 @@ purple_plugin_load(GPluginPlugin *plugin
}
gboolean
-purple_plugin_unload(GPluginPlugin *plugin)
+purple_plugin_unload(PurplePlugin *plugin)
{
GError *error = NULL;
@@ -132,7 +132,7 @@ purple_plugin_unload(GPluginPlugin *plug
}
gboolean
-purple_plugin_is_loaded(const GPluginPlugin *plugin)
+purple_plugin_is_loaded(const PurplePlugin *plugin)
{
g_return_val_if_fail(plugin != NULL, FALSE);
@@ -140,7 +140,7 @@ purple_plugin_is_loaded(const GPluginPlu
}
void
-purple_plugin_add_action(GPluginPlugin *plugin, const char* label,
+purple_plugin_add_action(PurplePlugin *plugin, const char* label,
PurplePluginActionCallback callback)
{
GPluginPluginInfo *plugin_info;
@@ -165,7 +165,7 @@ purple_plugin_add_action(GPluginPlugin *
}
void
-purple_plugin_disable(GPluginPlugin *plugin)
+purple_plugin_disable(PurplePlugin *plugin)
{
g_return_if_fail(plugin != NULL);
@@ -467,14 +467,14 @@ purple_plugins_get_loaded(void)
return loaded_plugins;
}
-GPluginPlugin *
+PurplePlugin *
purple_plugins_find_by_filename(const char *filename)
{
GList *plugins, *l;
plugins = purple_plugins_find_all();
for (l = plugins; l != NULL; l = l->next) {
- GPluginPlugin *plugin = GPLUGIN_PLUGIN(l->data);
+ PurplePlugin *plugin = PURPLE_PLUGIN(l->data);
if (purple_strequal(gplugin_plugin_get_filename(plugin), filename)) {
purple_plugins_free_found_list(plugins);
@@ -493,7 +493,7 @@ purple_plugins_save_loaded(const char *k
GList *files = NULL;
for (pl = purple_plugins_get_loaded(); pl != NULL; pl = pl->next) {
- GPluginPlugin *plugin = GPLUGIN_PLUGIN(pl->data);
+ PurplePlugin *plugin = PURPLE_PLUGIN(pl->data);
if (!g_list_find(plugins_to_disable, plugin))
files = g_list_append(files, (gchar *)gplugin_plugin_get_filename(plugin));
}
@@ -514,7 +514,7 @@ purple_plugins_load_saved(const char *ke
for (l = files; l; l = l->next)
{
char *file;
- GPluginPlugin *plugin;
+ PurplePlugin *plugin;
if (l->data == NULL)
continue;
@@ -568,10 +568,10 @@ purple_plugins_init(void)
the new plugin API is properly established */
purple_signal_register(handle, "plugin-load",
purple_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, GPLUGIN_TYPE_PLUGIN);
+ G_TYPE_NONE, 1, PURPLE_TYPE_PLUGIN);
purple_signal_register(handle, "plugin-unload",
purple_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, GPLUGIN_TYPE_PLUGIN);
+ G_TYPE_NONE, 1, PURPLE_TYPE_PLUGIN);
}
void
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -38,6 +38,25 @@
/** Returns the minor version from an ABI version */
#define PURPLE_PLUGIN_ABI_MINOR_VERSION(abi) (abi & 0xFFFF)
+#define PURPLE_TYPE_PLUGIN GPLUGIN_TYPE_PLUGIN
+#define PURPLE_PLUGIN(obj) GPLUGIN_PLUGIN(obj)
+#define PURPLE_PLUGIN_CLASS(klass) GPLUGIN_PLUGIN_CLASS(klass)
+#define PURPLE_IS_PLUGIN(obj) GPLUGIN_IS_PLUGIN(obj)
+#define PURPLE_IS_PLUGIN_CLASS(klass) GPLUGIN_IS_PLUGIN_CLASS(klass)
+#define PURPLE_PLUGIN_GET_CLASS(obj) GPLUGIN_PLUGIN_GET_CLASS(obj)
+
+/**
+ * Represents a plugin handle.
+ * This type is an alias for GPluginPlugin.
+ */
+typedef GPluginPlugin PurplePlugin;
+
+/**
+ * The base class for all #PurplePlugin's.
+ * This type is an alias for GPluginPluginClass.
+ */
+typedef GPluginPluginClass PurplePluginClass;
+
#define PURPLE_TYPE_PLUGIN_INFO (purple_plugin_info_get_type())
#define PURPLE_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_PLUGIN_INFO, PurplePluginInfo))
#define PURPLE_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_PLUGIN_INFO, PurplePluginInfoClass))
@@ -58,7 +77,7 @@ typedef struct _PurplePluginAction Purpl
#include "pluginpref.h"
typedef void (*PurplePluginActionCallback)(PurplePluginAction *);
-typedef PurplePluginPrefFrame *(*PurplePluginPrefFrameCallback)(GPluginPlugin *);
+typedef PurplePluginPrefFrame *(*PurplePluginPrefFrameCallback)(PurplePlugin *);
/**
* Holds information about a plugin.
@@ -90,7 +109,7 @@ struct _PurplePluginInfoClass {
struct _PurplePluginAction {
char *label;
PurplePluginActionCallback callback;
- GPluginPlugin *plugin;
+ PurplePlugin *plugin;
};
G_BEGIN_DECLS
@@ -109,7 +128,7 @@ G_BEGIN_DECLS
*
* @see purple_plugin_unload()
*/
-gboolean purple_plugin_load(GPluginPlugin *plugin);
+gboolean purple_plugin_load(PurplePlugin *plugin);
/**
* Unloads the specified plugin.
@@ -120,7 +139,7 @@ gboolean purple_plugin_load(GPluginPlugi
*
* @see purple_plugin_load()
*/
-gboolean purple_plugin_unload(GPluginPlugin *plugin);
+gboolean purple_plugin_unload(PurplePlugin *plugin);
/**
* Returns whether or not a plugin is currently loaded.
@@ -129,7 +148,7 @@ gboolean purple_plugin_unload(GPluginPlu
*
* @return @c TRUE if loaded, or @c FALSE otherwise.
*/
-gboolean purple_plugin_is_loaded(const GPluginPlugin *plugin);
+gboolean purple_plugin_is_loaded(const PurplePlugin *plugin);
/**
* Adds a new action to a plugin.
@@ -138,7 +157,7 @@ gboolean purple_plugin_is_loaded(const G
* @param label The description of the action to show to the user.
* @param callback The callback to call when the user selects this action.
*/
-void purple_plugin_add_action(GPluginPlugin *plugin, const char* label,
+void purple_plugin_add_action(PurplePlugin *plugin, const char* label,
PurplePluginActionCallback callback);
/**
@@ -149,7 +168,7 @@ void purple_plugin_add_action(GPluginPlu
* UI needs to call purple_plugins_save_loaded() after calling this for it
* to have any effect.
*/
-void purple_plugin_disable(GPluginPlugin *plugin);
+void purple_plugin_disable(PurplePlugin *plugin);
/*@}*/
@@ -268,7 +287,7 @@ GList *purple_plugins_get_loaded(void);
*
* @return The referenced plugin if found, or @c NULL if not found.
*/
-GPluginPlugin *purple_plugins_find_by_filename(const char *filename);
+PurplePlugin *purple_plugins_find_by_filename(const char *filename);
/**
* Saves the list of loaded plugins to the specified preference key
More information about the Commits
mailing list