diff src/plugin.c @ 10479:12460aa2c820

[gaim-migrate @ 11766] grim made me do it committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 06 Jan 2005 06:16:50 +0000
parents 61ef9a964574
children 1a97d5e88d12
line wrap: on
line diff
--- a/src/plugin.c	Thu Jan 06 05:49:36 2005 +0000
+++ b/src/plugin.c	Thu Jan 06 06:16:50 2005 +0000
@@ -33,11 +33,11 @@
 #ifdef _WIN32
 # define PLUGIN_EXT ".dll"
 #else
-#ifdef __hpux
-# define PLUGIN_EXT ".sl"
-#else
-# define PLUGIN_EXT ".so"
-#endif
+# ifdef __hpux
+#  define PLUGIN_EXT ".sl"
+# else
+#  define PLUGIN_EXT ".so"
+# endif
 #endif
 
 typedef struct
@@ -72,16 +72,6 @@
 static void (*unload_cb)(GaimPlugin *, void *) = NULL;
 static void *unload_cb_data = NULL;
 
-
-void *
-gaim_plugins_get_handle(void)
-{
-	static int handle;
-
-	return &handle;
-}
-
-
 #ifdef GAIM_PLUGINS
 static gboolean
 has_file_extension(const char *filename, const char *ext)
@@ -787,6 +777,37 @@
 /**************************************************************************
  * Plugins subsystem
  **************************************************************************/
+void *
+gaim_plugins_get_handle(void) {
+	static int handle;
+
+	return &handle;
+}
+
+void
+gaim_plugins_init(void) {
+	void *handle = gaim_plugins_get_handle();
+
+	gaim_signal_register(handle, "plugin-load",
+						 gaim_marshal_VOID__POINTER,
+						 NULL, 1,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_PLUGIN));
+	gaim_signal_register(handle, "plugin-unload",
+						 gaim_marshal_VOID__POINTER,
+						 NULL, 1,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_PLUGIN));
+}
+
+void
+gaim_plugins_uninit(void) {
+	gaim_signals_disconnect_by_handle(gaim_plugins_get_handle());
+}
+
+/**************************************************************************
+ * Plugins API
+ **************************************************************************/
 void
 gaim_plugins_add_search_path(const char *path)
 {
@@ -871,23 +892,9 @@
 	GList *cur;
 	const char *search_path;
 
-	void *handle;
-
 	if (!g_module_supported())
 		return;
 
-	handle = gaim_plugins_get_handle();
-
-	/* TODO: These signals need to be registered in an init function */
-	gaim_debug_info("plugins", "registering plugin-load signal\n");
-	gaim_signal_register(handle, "plugin-load", gaim_marshal_VOID__POINTER, NULL,
-			1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN));
-
-	gaim_debug_info("plugins", "registering plugin-unload signal\n");
-	gaim_signal_register(handle, "plugin-unload", gaim_marshal_VOID__POINTER, NULL,
-			1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN));
-
-
 	/* Probe plugins */
 	for (cur = search_paths; cur != NULL; cur = cur->next)
 	{