/soc/2013/ankitkv/gobjectification: 891eea799578: Renamed plugin...

Ankit Vani a at nevitus.org
Mon Jul 29 02:34:28 EDT 2013


Changeset: 891eea799578abe9b6651c6693670ceb02b9385d
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-29 11:52 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/891eea799578

Description:

Renamed plugin.[ch] to plugins.[ch], since we (will) no longer have a PurplePlugin structure.

diffstat:

 doc/C-HOWTO.dox                              |   4 +-
 doc/plugin-signals.dox                       |   2 +-
 finch/gntaccount.c                           |   2 +-
 finch/gntplugin.h                            |   2 +-
 finch/plugins/gntclipboard.c                 |   2 +-
 finch/plugins/gntgf.c                        |   2 +-
 finch/plugins/gnttinyurl.c                   |   2 +-
 finch/plugins/lastlog.c                      |   2 +-
 libpurple/Makefile.am                        |   4 +-
 libpurple/core.c                             |  14 +--------
 libpurple/plugin.c                           |  43 +++++++++++++++++++++++++++-
 libpurple/plugin.h                           |  26 ++++++++++++++++-
 libpurple/plugins/autoaccept.c               |   2 +-
 libpurple/plugins/ciphertest.c               |   2 +-
 libpurple/plugins/codeinline.c               |   2 +-
 libpurple/plugins/dbus-example.c             |   2 +-
 libpurple/plugins/debug_example.c            |   2 +-
 libpurple/plugins/helloworld.c               |   2 +-
 libpurple/plugins/idle.c                     |   2 +-
 libpurple/plugins/ipc-test-client.c          |   2 +-
 libpurple/plugins/ipc-test-server.c          |   2 +-
 libpurple/plugins/joinpart.c                 |   2 +-
 libpurple/plugins/keyrings/gnomekeyring.c    |   2 +-
 libpurple/plugins/keyrings/internalkeyring.c |   2 +-
 libpurple/plugins/keyrings/kwallet.cpp       |   2 +-
 libpurple/plugins/keyrings/secretservice.c   |   2 +-
 libpurple/plugins/keyrings/wincred.c         |   2 +-
 libpurple/plugins/log_reader.c               |   2 +-
 libpurple/plugins/mono/loader/mono-helper.h  |   2 +-
 libpurple/plugins/mono/loader/mono.c         |   2 +-
 libpurple/plugins/newline.c                  |   2 +-
 libpurple/plugins/notify_example.c           |   2 +-
 libpurple/plugins/one_time_password.c        |   2 +-
 libpurple/plugins/perl/common/module.h       |   4 +-
 libpurple/plugins/perl/perl-common.h         |   2 +-
 libpurple/plugins/perl/perl-handlers.h       |   2 +-
 libpurple/plugins/perl/perl.c                |   2 +-
 libpurple/plugins/pluginpref_example.c       |   2 +-
 libpurple/plugins/psychic.c                  |   2 +-
 libpurple/plugins/simple.c                   |   2 +-
 libpurple/plugins/ssl/ssl-gnutls.c           |   2 +-
 libpurple/plugins/ssl/ssl-nss.c              |   2 +-
 libpurple/plugins/ssl/ssl.c                  |   2 +-
 libpurple/plugins/statenotify.c              |   2 +-
 libpurple/plugins/tcl/tcl.c                  |   2 +-
 libpurple/plugins/tcl/tcl_purple.h           |   2 +-
 libpurple/protocols/gg/gg.c                  |   2 +-
 libpurple/protocols/irc/irc.c                |   2 +-
 libpurple/protocols/myspace/myspace.h        |   2 +-
 libpurple/protocols/oscar/visibility.h       |   2 +-
 libpurple/protocols/sametime/sametime.c      |   2 +-
 libpurple/protocols/simple/simple.c          |   2 +-
 libpurple/protocols/simple/sipmsg.c          |   2 +-
 libpurple/prpl.h                             |   2 +-
 libpurple/purple.h.in                        |   2 +-
 libpurple/util.h                             |   2 +-
 pidgin/gtkaccount.c                          |   2 +-
 pidgin/gtkblist.c                            |   2 +-
 pidgin/gtkdialogs.c                          |   2 +-
 pidgin/gtkplugin.h                           |   2 +-
 pidgin/plugins/crazychat/cc_pidgin_plugin.c  |   2 +-
 pidgin/plugins/disco/xmppdisco.h             |   2 +-
 pidgin/plugins/pidgininc.c                   |   2 +-
 63 files changed, 131 insertions(+), 78 deletions(-)

diffs (truncated from 891 to 300 lines):

diff --git a/doc/C-HOWTO.dox b/doc/C-HOWTO.dox
--- a/doc/C-HOWTO.dox
+++ b/doc/C-HOWTO.dox
@@ -26,7 +26,7 @@
 #include <glib.h>
 
 #include "notify.h"
-#include "plugin.h"
+#include "plugins.h"
 #include "version.h"
 
 static gboolean
@@ -83,7 +83,7 @@ PURPLE_INIT_PLUGIN(hello_world, init_plu
   like described before.  Next we include glib.h, mainly for gboolean and the
   glib wrappers of the standard C types.
 
-  Next, we include plugin.h which has all the plugin specific stuff that we
+  Next, we include plugins.h which has all the plugin specific stuff that we
   need.  For example: @c PurplePlugin, @c PurplePluginInfo,
   @c PURPLE_PLUGIN_MAGIC, and @c PURPLE_INIT_PLUGIN().
 
diff --git a/doc/plugin-signals.dox b/doc/plugin-signals.dox
--- a/doc/plugin-signals.dox
+++ b/doc/plugin-signals.dox
@@ -5,7 +5,7 @@
   @signal plugin-unload
  @endsignals
 
- @see plugin.h
+ @see plugins.h
 
  <hr>
 
diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -43,7 +43,7 @@
 #include <accountopt.h>
 #include <connection.h>
 #include <notify.h>
-#include <plugin.h>
+#include <<plugins.h>>
 #include <request.h>
 #include <savedstatuses.h>
 
diff --git a/finch/gntplugin.h b/finch/gntplugin.h
--- a/finch/gntplugin.h
+++ b/finch/gntplugin.h
@@ -28,7 +28,7 @@
 
 #include <gnt.h>
 
-#include <plugin.h>
+#include <<plugins.h>>
 #include <pluginpref.h>
 
 #include <string.h>
diff --git a/finch/plugins/gntclipboard.c b/finch/plugins/gntclipboard.c
--- a/finch/plugins/gntclipboard.c
+++ b/finch/plugins/gntclipboard.c
@@ -35,7 +35,7 @@
 
 #include <glib.h>
 
-#include <plugin.h>
+#include <<plugins.h>>
 #include <version.h>
 #include <debug.h>
 #include <notify.h>
diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c
--- a/finch/plugins/gntgf.c
+++ b/finch/plugins/gntgf.c
@@ -42,7 +42,7 @@
 
 #include <glib.h>
 
-#include <plugin.h>
+#include <<plugins.h>>
 #include <version.h>
 #include <buddylist.h>
 #include <conversation.h>
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -34,7 +34,7 @@
 
 #include <glib.h>
 
-#include <plugin.h>
+#include <<plugins.h>>
 #include <version.h>
 #include <debug.h>
 #include <notify.h>
diff --git a/finch/plugins/lastlog.c b/finch/plugins/lastlog.c
--- a/finch/plugins/lastlog.c
+++ b/finch/plugins/lastlog.c
@@ -23,7 +23,7 @@
 
 #include "internal.h"
 
-#include <plugin.h>
+#include <<plugins.h>>
 #include <version.h>
 
 #include <cmds.h>
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -75,7 +75,7 @@ purple_coresources = \
 	network.c \
 	ntlm.c \
 	notify.c \
-	plugin.c \
+	plugins.c \
 	pluginpref.c \
 	pounce.c \
 	prefs.c \
@@ -146,7 +146,7 @@ purple_coreheaders = \
 	network.h \
 	notify.h \
 	ntlm.h \
-	plugin.h \
+	plugins.h \
 	pluginpref.h \
 	pounce.h \
 	prefs.h \
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -40,7 +40,7 @@
 #include "keyring.h"
 #include "network.h"
 #include "notify.h"
-#include "plugin.h"
+#include "plugins.h"
 #include "pounce.h"
 #include "prefs.h"
 #include "proxy.h"
@@ -150,8 +150,6 @@ purple_core_init(const char *ui)
 	/* Initialize all static protocols. */
 	static_proto_init();
 
-	purple_plugins_probe(G_MODULE_SUFFIX);
-
 	purple_keyring_init(); /* before accounts */
 	purple_theme_manager_init();
 
@@ -228,11 +226,6 @@ purple_core_quit(void)
 	/* The SSL plugins must be uninit before they're unloaded */
 	purple_ssl_uninit();
 
-	/* Unload all non-loader, non-prpl plugins before shutting down
-	 * subsystems. */
-	purple_debug_info("main", "Unloading normal plugins\n");
-	purple_plugins_unload(PURPLE_PLUGIN_STANDARD);
-
 	/* Save .xml files, remove signals, etc. */
 	purple_smileys_uninit();
 	purple_http_uninit();
@@ -255,11 +248,6 @@ purple_core_quit(void)
 	purple_imgstore_uninit();
 	purple_network_uninit();
 
-	/* Everything after unloading all plugins must not fail if prpls aren't
-	 * around */
-	purple_debug_info("main", "Unloading all plugins\n");
-	purple_plugins_destroy_all();
-
 	ops = purple_core_get_ui_ops();
 	if (ops != NULL && ops->quit != NULL)
 		ops->quit();
diff --git a/libpurple/plugin.c b/libpurple/plugins.c
rename from libpurple/plugin.c
rename to libpurple/plugins.c
--- a/libpurple/plugin.c
+++ b/libpurple/plugins.c
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#include "plugin.h"
+#include "plugins.h"
 
 #define PURPLE_PLUGIN_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_PLUGIN, PurplePluginPrivate))
@@ -153,3 +153,44 @@ purple_plugin_get_type(void)
 	return type;
 }
 
+/**************************************************************************
+ * Plugins Subsystem API
+ **************************************************************************/
+void *
+purple_plugins_get_handle(void) {
+	static int handle;
+
+	return &handle;
+}
+
+void
+purple_plugins_init(void) {
+	void *handle = purple_plugins_get_handle();
+
+	gplugin_init();
+	gplugin_plugin_manager_append_path(LIBDIR);
+	gplugin_plugin_manager_refresh();
+
+	/* TODO GPlugin already has signals for these, these should be removed once
+	        the new plugin API is properly established */
+	purple_signal_register(handle, "plugin-load",
+						 purple_marshal_VOID__POINTER,
+						 G_TYPE_NONE, 1, PURPLE_TYPE_PLUGIN);
+	purple_signal_register(handle, "plugin-unload",
+						 purple_marshal_VOID__POINTER,
+						 G_TYPE_NONE, 1, PURPLE_TYPE_PLUGIN);
+}
+
+void
+purple_plugins_uninit(void)
+{
+	void *handle = purple_plugins_get_handle();
+
+	purple_debug_info("plugins", "Unloading all plugins\n");
+	purple_plugins_destroy_all();
+
+	purple_signals_disconnect_by_handle(handle);
+	purple_signals_unregister_by_instance(handle);
+
+	gplugin_uninit();
+}
diff --git a/libpurple/plugin.h b/libpurple/plugins.h
rename from libpurple/plugin.h
rename to libpurple/plugins.h
--- a/libpurple/plugin.h
+++ b/libpurple/plugins.h
@@ -1,5 +1,5 @@
 /**
- * @file plugin.h Plugin API
+ * @file plugins.h Plugins API
  * @ingroup core
  */
 
@@ -82,6 +82,30 @@ GType purple_plugin_get_type(void);
 
 /*@}*/
 
+/**************************************************************************/
+/** @name Plugins Subsystem API                                            */
+/**************************************************************************/
+/*@{*/
+
+/**
+ * Returns the plugin subsystem handle.
+ *
+ * @return The plugin sybsystem handle.
+ */
+void *purple_plugins_get_handle(void);
+
+/**
+ * Initializes the plugin subsystem
+ */
+void purple_plugins_init(void);
+
+/**
+ * Uninitializes the plugin subsystem
+ */
+void purple_plugins_uninit(void);
+
+/*@}*/
+
 G_END_DECLS
 
 #endif /* _PURPLE_PLUGIN_H_ */
diff --git a/libpurple/plugins/autoaccept.c b/libpurple/plugins/autoaccept.c
--- a/libpurple/plugins/autoaccept.c
+++ b/libpurple/plugins/autoaccept.c
@@ -31,7 +31,7 @@
 #include <glib/gstdio.h>
 
 /* Purple headers */
-#include <plugin.h>
+#include <plugins.h>
 #include <version.h>
 
 #include <buddylist.h>
diff --git a/libpurple/plugins/ciphertest.c b/libpurple/plugins/ciphertest.c
--- a/libpurple/plugins/ciphertest.c
+++ b/libpurple/plugins/ciphertest.c
@@ -33,7 +33,7 @@
 #include <string.h>
 
 #include "debug.h"
-#include "plugin.h"
+#include "plugins.h"
 #include "version.h"
 #include "util.h"
 
diff --git a/libpurple/plugins/codeinline.c b/libpurple/plugins/codeinline.c
--- a/libpurple/plugins/codeinline.c
+++ b/libpurple/plugins/codeinline.c



More information about the Commits mailing list