10 #include <dbus/dbus.h>
13 main (int argc, char *argv[])
15 DBusConnection *conn = NULL;
18 dbus_setenv ("DBUS_SESSION_BUS_ADDRESS", NULL);
20 dbus_error_init (&error);
22 conn = dbus_bus_get (DBUS_BUS_SESSION, &error);
24 #ifdef DBUS_ENABLE_X11_AUTOLAUNCH
25 if (dbus_error_is_set (&error))
27 fprintf (stderr, "*** Failed to autolaunch session bus: %s\n",
29 dbus_error_free (&error);
33 /* We don't necessarily expect it to *work* without X (although it might -
34 * for instance on Mac OS it might have used launchd). Just check that the
35 * results are consistent. */
37 if (dbus_error_is_set (&error) && conn != NULL)
39 fprintf (stderr, "*** Autolaunched session bus, but an error was set!\n");
44 if (!dbus_error_is_set (&error) && conn == NULL)
46 fprintf (stderr, "*** Failed to autolaunch session bus but no error was set\n");