Refactored finch to report plugin load/unload errors soc.2013.gobjectification.plugins

Sun, 11 Aug 2013 19:35:41 +0530

author
Ankit Vani <a@nevitus.org>
date
Sun, 11 Aug 2013 19:35:41 +0530
branch
soc.2013.gobjectification.plugins
changeset 36510
c00f65ba575f
parent 36509
86e882c3cfdf
child 36511
1ebd4a8f2b4a

Refactored finch to report plugin load/unload errors

finch/finch.c file | annotate | diff | comparison | revisions
finch/gntblist.c file | annotate | diff | comparison | revisions
finch/gntplugin.c file | annotate | diff | comparison | revisions
--- a/finch/finch.c	Sun Aug 11 19:25:33 2013 +0530
+++ b/finch/finch.c	Sun Aug 11 19:35:41 2013 +0530
@@ -30,7 +30,7 @@
 #include "ft.h"
 #include "log.h"
 #include "notify.h"
-#include "prefs.h"
+#include "plugins.h"
 #include "prpl.h"
 #include "pounce.h"
 #include "savedstatuses.h"
--- a/finch/gntblist.c	Sun Aug 11 19:25:33 2013 +0530
+++ b/finch/gntblist.c	Sun Aug 11 19:35:41 2013 +0530
@@ -31,6 +31,7 @@
 #include <log.h>
 #include <notify.h>
 #include <request.h>
+#include <plugins.h>
 #include <savedstatuses.h>
 #include <server.h>
 #include <signal.h>
--- a/finch/gntplugin.c	Sun Aug 11 19:25:33 2013 +0530
+++ b/finch/gntplugin.c	Sun Aug 11 19:35:41 2013 +0530
@@ -192,21 +192,27 @@
 static void
 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null)
 {
+	GError *error = NULL;
+
 	if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
 	{
-		if (!purple_plugin_load(plugin)) {
-			purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"), NULL);
+		if (!purple_plugin_load(plugin, &error)) {
+			purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"),
+					error->message);
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, FALSE);
+			g_error_free(error);
 		}
 	}
 	else
 	{
 		GntWidget *win;
 
-		if (!purple_plugin_unload(plugin)) {
-			purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), NULL);
+		if (!purple_plugin_unload(plugin, &error)) {
+			purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"),
+					error->message);
 			purple_plugin_disable(plugin);
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
+			g_error_free(error);
 		}
 
 		if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL)

mercurial