mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
GDBus: Use call() instead of invoke_method()
Lots of people been suggesting this. We still use MethodInvocation / method_invocation for handling incoming method calls so use call() instead of invoke_method() helps to separate the client and server facilities. Which is a good thing(tm).
This commit is contained in:
@@ -331,9 +331,9 @@ get_name_owner_cb (GObject *source_object,
|
||||
name_owner = NULL;
|
||||
result = NULL;
|
||||
|
||||
result = g_dbus_connection_invoke_method_finish (client->connection,
|
||||
res,
|
||||
NULL);
|
||||
result = g_dbus_connection_call_finish (client->connection,
|
||||
res,
|
||||
NULL);
|
||||
if (result != NULL)
|
||||
{
|
||||
g_variant_get (result, "(s)", &name_owner);
|
||||
@@ -362,17 +362,17 @@ get_name_owner_cb (GObject *source_object,
|
||||
static void
|
||||
invoke_get_name_owner (Client *client)
|
||||
{
|
||||
g_dbus_connection_invoke_method (client->connection,
|
||||
"org.freedesktop.DBus", /* bus name */
|
||||
"/org/freedesktop/DBus", /* object path */
|
||||
"org.freedesktop.DBus", /* interface name */
|
||||
"GetNameOwner", /* method name */
|
||||
g_variant_new ("(s)", client->name),
|
||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) get_name_owner_cb,
|
||||
client_ref (client));
|
||||
g_dbus_connection_call (client->connection,
|
||||
"org.freedesktop.DBus", /* bus name */
|
||||
"/org/freedesktop/DBus", /* object path */
|
||||
"org.freedesktop.DBus", /* interface name */
|
||||
"GetNameOwner", /* method name */
|
||||
g_variant_new ("(s)", client->name),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) get_name_owner_cb,
|
||||
client_ref (client));
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
@@ -387,9 +387,9 @@ start_service_by_name_cb (GObject *source_object,
|
||||
|
||||
result = NULL;
|
||||
|
||||
result = g_dbus_connection_invoke_method_finish (client->connection,
|
||||
res,
|
||||
NULL);
|
||||
result = g_dbus_connection_call_finish (client->connection,
|
||||
res,
|
||||
NULL);
|
||||
if (result != NULL)
|
||||
{
|
||||
guint32 start_service_result;
|
||||
@@ -452,17 +452,17 @@ has_connection (Client *client)
|
||||
|
||||
if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
|
||||
{
|
||||
g_dbus_connection_invoke_method (client->connection,
|
||||
"org.freedesktop.DBus", /* bus name */
|
||||
"/org/freedesktop/DBus", /* object path */
|
||||
"org.freedesktop.DBus", /* interface name */
|
||||
"StartServiceByName", /* method name */
|
||||
g_variant_new ("(su)", client->name, 0),
|
||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) start_service_by_name_cb,
|
||||
client_ref (client));
|
||||
g_dbus_connection_call (client->connection,
|
||||
"org.freedesktop.DBus", /* bus name */
|
||||
"/org/freedesktop/DBus", /* object path */
|
||||
"org.freedesktop.DBus", /* interface name */
|
||||
"StartServiceByName", /* method name */
|
||||
g_variant_new ("(su)", client->name, 0),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) start_service_by_name_cb,
|
||||
client_ref (client));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user