diff src/dbus-server.h @ 13956:f61428cc4019

[gaim-migrate @ 16505] Change the music messaging plugin to not try to load if our D-BUS stuff is not initialized. Also extracted the gaim_notify_error() message code to a #define in src/dbus-server.c And print a debug warning if something tries to register a callback for a signal using a handle that we don't have any registered signals for committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 17 Jul 2006 06:21:53 +0000
parents 2d6f7ac4b6f2
children 8bda65b88e49
line wrap: on
line diff
--- a/src/dbus-server.h	Mon Jul 17 05:50:28 2006 +0000
+++ b/src/dbus-server.h	Mon Jul 17 06:21:53 2006 +0000
@@ -74,6 +74,17 @@
 #define GAIM_DBUS_DEFINE_INHERITING_TYPE(type, parent) \
     GaimDBusType GAIM_DBUS_TYPE_##type = { GAIM_DBUS_TYPE(parent) };
 
+#define GAIM_DBUS_RETURN_FALSE_IF_DISABLED(plugin) \
+	if (gaim_dbus_get_init_error() != NULL) \
+	{ \
+		gchar *title; \
+		title = g_strdup_printf("Unable to Load %s Plugin", plugin->info->name); \
+		gaim_notify_error(NULL, title, \
+				_("Gaim's D-BUS server is not running for the reason listed below"), \
+				_(gaim_dbus_get_init_error())); \
+		g_free(title); \
+		return FALSE; \
+	}
 
 /**
    Initializes gaim dbus pointer registration engine.
@@ -139,8 +150,9 @@
  * NOT running then gaim_dbus_dispatch_init() failed for some reason,
  * and a message should have been gaim_debug_error()'ed.
  *
- * This function should be called by any DBUS plugin before trying
- * to use the DBUS API.  See plugins/dbus-example.c for usage.
+ * Gaim plugins that use D-BUS should use the
+ * GAIM_DBUS_RETURN_FALSE_IF_DISABLED macro to short-circuit
+ * initialization if Gaim's D-BUS subsystem is not running.
  *
  * @return If the D-BUS subsystem started with no problems then this
  *         will return NULL and everything will be hunky dory.  If