/soc/2013/ankitkv/gobjectification: c00f65ba575f: Refactored fin...

Ankit Vani a at nevitus.org
Sun Aug 11 10:06:06 EDT 2013


Changeset: c00f65ba575ffb786856b6f124b684f98016c45d
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-11 19:35 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/c00f65ba575f

Description:

Refactored finch to report plugin load/unload errors

diffstat:

 finch/finch.c     |   2 +-
 finch/gntblist.c  |   1 +
 finch/gntplugin.c |  14 ++++++++++----
 3 files changed, 12 insertions(+), 5 deletions(-)

diffs (58 lines):

diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -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"
diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -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>
diff --git a/finch/gntplugin.c b/finch/gntplugin.c
--- a/finch/gntplugin.c
+++ b/finch/gntplugin.c
@@ -192,21 +192,27 @@ decide_conf_button(PurplePlugin *plugin)
 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)



More information about the Commits mailing list