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 if (!dbus_g_proxy_call(bus_proxy
, "RequestName", &error
,
43 G_TYPE_STRING
, "net.sourceforge.emacs-jabber.Tox",
45 /* these settings are good for debugging. we
46 should listen for the NameLost signal, though. */
47 DBUS_NAME_FLAG_ALLOW_REPLACEMENT
48 | DBUS_NAME_FLAG_REPLACE_EXISTING
49 | DBUS_NAME_FLAG_DO_NOT_QUEUE
,
53 g_printerr("Couldn't acquire name: %s\n", error
->message
);
56 else if (x
!= DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
) {
57 g_printerr("Couldn't acquire name: RequestName returned %u\n", x
);
61 obj
= g_object_new(TOX_TYPE_OBJECT
, "dbus-connection", connection
, NULL
);
62 dbus_g_connection_register_g_object(connection
, "/net/sourceforge/emacs_jabber/Tox", G_OBJECT(obj
));
64 loop
= g_main_loop_new(NULL
, FALSE
);
66 g_main_loop_run(loop
);