comparison 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
comparison
equal deleted inserted replaced
13954:3cd388613624 13955:2d6f7ac4b6f2
35 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 35 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 */ 36 */
37 37
38 #include "internal.h" 38 #include "internal.h"
39 39
40 #include "blist.h"
41 #include "notify.h"
40 #include "plugin.h" 42 #include "plugin.h"
41 #include "blist.h"
42 #include "version.h" 43 #include "version.h"
43 44
44 #include <stdio.h> 45 #include <stdio.h>
45 #include <stdlib.h> 46 #include <stdlib.h>
46 #include <string.h> 47 #include <string.h>
106 /* And now standard plugin stuff */ 107 /* And now standard plugin stuff */
107 108
108 static gboolean 109 static gboolean
109 plugin_load(GaimPlugin *plugin) 110 plugin_load(GaimPlugin *plugin)
110 { 111 {
112 const char *dbus_init_error;
113
114 dbus_init_error = gaim_dbus_get_init_error();
115 if (dbus_init_error != NULL)
116 {
117 gaim_notify_error(NULL, _("Unable to Load Plugin"),
118 _("Gaim's D-BUS server is not running for the reason listed below"),
119 _(dbus_init_error));
120 return FALSE;
121 }
122
111 /* First, we have to register our four exported functions with the 123 /* First, we have to register our four exported functions with the
112 main gaim dbus loop. Without this statement, the gaim dbus 124 main gaim dbus loop. Without this statement, the gaim dbus
113 code wouldn't know about our functions. */ 125 code wouldn't know about our functions. */
114 GAIM_DBUS_REGISTER_BINDINGS(plugin); 126 GAIM_DBUS_REGISTER_BINDINGS(plugin);
115 127