2
#include "dbus/dbus-glib.h"
3
#include "tools/dbus-glib-bindings.h"
4
#include "test-objects.h"
6
#define TEST_NAMESPACE "org.freedesktop.DBus.GLib.Test.Interfaces"
7
#define TEST_OBJECT_PATH "/org/freedesktop/DBus/GLib/Test/Interfaces"
9
static GMainLoop *loop = NULL;
15
DBusGConnection *connection;
19
TestBeatlesSong *song;
23
/* Get the connection and ensure the name is not used yet */
24
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
25
if (connection == NULL) {
26
g_warning ("Failed to make connection to session bus: %s",
32
proxy = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE_DBUS,
33
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
34
if (!org_freedesktop_DBus_request_name (proxy, TEST_NAMESPACE,
36
g_warning ("There was an error requesting the name: %s",
42
if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
43
/* Someone else registered the name before us */
47
song = test_beatles_song_new ();
49
/* Register the app on the bus */
50
dbus_g_connection_register_g_object (connection,
54
loop = g_main_loop_new (NULL, FALSE);
55
g_main_loop_run (loop);