* the well-known name and fall back to remote mode (!is_primary)
* in the case that we can't do that.
*/
- /* DBUS_NAME_FLAG_DO_NOT_QUEUE: 0x4 */
- reply = g_dbus_connection_call_sync (impl->session_bus, "org.freedesktop.DBus", "/org/freedesktop/DBus",
- "org.freedesktop.DBus", "RequestName",
- g_variant_new ("(su)",
- impl->bus_name,
- G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE),
- G_VARIANT_TYPE ("(u)"),
- 0, -1, cancellable, error);
-
- if (reply == NULL)
- return FALSE;
+ rval = g_dbus_request_name (impl->session_bus, impl->bus_name, G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE, error);
- g_variant_get (reply, "(u)", &rval);
- g_variant_unref (reply);
+ if (rval == G_BUS_REQUEST_NAME_FLAGS_ERROR)
+ return FALSE;
/* DBUS_REQUEST_NAME_REPLY_EXISTS: 3 */
- impl->primary = (rval != 3);
+ impl->primary = (rval != G_BUS_REQUEST_NAME_FLAGS_EXISTS);
return TRUE;
}