changeset 21201:3695fbebc8bf

Use the new purple_plugin_disable() function and purple_plugin_unload()'s setting of plugin->error to display an appropriate message if a plugin fails to unload.
author Richard Laager <rlaager@wiktel.com>
date Sun, 07 Oct 2007 16:06:20 +0000
parents 31821456d93f
children e34e56eeb2da
files pidgin/gtkplugin.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkplugin.c	Sun Oct 07 16:03:37 2007 +0000
+++ b/pidgin/gtkplugin.c	Sun Oct 07 16:06:20 2007 +0000
@@ -303,7 +303,24 @@
 	{
 		pidgin_set_cursor(plugin_dialog, GDK_WATCH);
 
-		purple_plugin_unload(plug);
+		if (!purple_plugin_unload(plug))
+		{
+			const char *primary = _("Could not unload plugin");
+			const char *reload = _("The plugin could not be unloaded now, but will be disabled at the next startup.");
+
+			if (!plug->error)
+			{
+				purple_notify_warning(NULL, NULL, primary, reload);
+			}
+			else
+			{
+				char *tmp = g_strdup_printf("%s\n\n%s", reload, plug->error);
+				purple_notify_warning(NULL, NULL, primary, tmp);
+				g_free(tmp);
+			}
+
+			purple_plugin_disable(plug);
+		}
 
 		pidgin_clear_cursor(plugin_dialog);
 	}