1 #include <farsight/farsight.h>
2 #include <dbus/dbus-glib.h>
3 #include <glib/gprintf.h>
8 main(int argc
, char *argv
[])
11 DBusGConnection
*connection
;
12 DBusGProxy
*bus_proxy
;
18 gst_init(&argc
, &argv
);
21 GLogLevelFlags fatal_mask
;
23 fatal_mask
= g_log_set_always_fatal (G_LOG_FATAL_MASK
);
24 /* not aborting on warnings because of:
25 farsight-rtp-WARNING **: Not enough information in rtp caps
27 fatal_mask
|= /*G_LOG_LEVEL_WARNING | */ G_LOG_LEVEL_CRITICAL
;
28 g_log_set_always_fatal (fatal_mask
);
31 connection
= dbus_g_bus_get(DBUS_BUS_SESSION
, &error
);
32 if (connection
== NULL
) {
33 g_printerr("Failed to open connection to bus: %s\n",
38 bus_proxy
= dbus_g_proxy_new_for_name(connection
, "org.freedesktop.DBus",
39 "/org/freedesktop/DBus",
40 "org.freedesktop.DBus");
42 g_debug("About to request D-Bus name...\n");
43 if (!dbus_g_proxy_call(bus_proxy
, "RequestName", &error
,
44 G_TYPE_STRING
, "net.sourceforge.emacs-jabber.Tox",
46 /* these settings are good for debugging. we
47 should listen for the NameLost signal, though. */
48 DBUS_NAME_FLAG_ALLOW_REPLACEMENT
49 | DBUS_NAME_FLAG_REPLACE_EXISTING
50 | DBUS_NAME_FLAG_DO_NOT_QUEUE
,
54 g_printerr("Couldn't acquire name: %s\n", error
->message
);
57 else if (x
!= DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
) {
58 g_printerr("Couldn't acquire name: RequestName returned %u\n", x
);
61 g_debug("D-Bus name acquired\n");
63 obj
= g_object_new(TOX_TYPE_OBJECT
, "dbus-connection", connection
, NULL
);
64 dbus_g_connection_register_g_object(connection
, "/net/sourceforge/emacs_jabber/Tox", G_OBJECT(obj
));
66 loop
= g_main_loop_new(NULL
, FALSE
);
68 g_main_loop_run(loop
);