diff plugins/dbus-example.c @ 13955:2d6f7ac4b6f2

[gaim-migrate @ 16503] Get rid of an assertion failure when trying to load our D-BUS example plugin if the D-BUS subsystem is not initialized for whatever reason. Not only that, the plugin gracefully fails to load and prints an error message. These error messages could be improved. If you're familiar with how D-BUS works then go for it. Also, do we need to be uninitializing any of the D-BUS stuff? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 17 Jul 2006 05:50:28 +0000
parents a7b24ba66570
children f61428cc4019
line wrap: on
line diff
--- a/plugins/dbus-example.c	Mon Jul 17 04:33:32 2006 +0000
+++ b/plugins/dbus-example.c	Mon Jul 17 05:50:28 2006 +0000
@@ -37,8 +37,9 @@
 
 #include "internal.h"
 
+#include "blist.h"
+#include "notify.h"
 #include "plugin.h"
-#include "blist.h"
 #include "version.h"
 
 #include <stdio.h>
@@ -108,6 +109,17 @@
 static gboolean
 plugin_load(GaimPlugin *plugin)
 {
+	const char *dbus_init_error;
+
+	dbus_init_error = gaim_dbus_get_init_error();
+	if (dbus_init_error != NULL)
+	{
+		gaim_notify_error(NULL, _("Unable to Load Plugin"),
+				_("Gaim's D-BUS server is not running for the reason listed below"),
+				_(dbus_init_error));
+		return FALSE;
+	}
+
     /* First, we have to register our four exported functions with the
        main gaim dbus loop.  Without this statement, the gaim dbus
        code wouldn't know about our functions. */