#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <gio/gio.h>

void
try_connect (void)
{
    GDBusConnection *connection;
    GError *error;

    error = NULL;

    g_message ("connecting");
    connection = g_bus_get_sync (G_BUS_TYPE_SESSION,
			       NULL,
			       &error);
    if (connection == NULL)
    {
	g_printerr ("could not open connection to bus: %s\n",
		error->message);
	g_error_free (error);
	return;
    }
    g_message ("OK");
    g_object_unref (connection);
}

int
main (int argc, char **argv)
{
    int i;

    g_type_init ();

    try_connect ();
    try_connect ();

    exit (0);
}

