mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
gdbus: Use symbolic constants to call message bus methods
These function arguments are arranged in the obvious order from conceptually largest to smallest: (bus name, path, interface, method). Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
2151a82007
commit
fe14968c0d
@ -32,6 +32,7 @@
|
|||||||
#include "gdbusconnection.h"
|
#include "gdbusconnection.h"
|
||||||
#include "gdbusintrospection.h"
|
#include "gdbusintrospection.h"
|
||||||
#include "gdbuserror.h"
|
#include "gdbuserror.h"
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "glib/gstdio.h"
|
#include "glib/gstdio.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -526,9 +527,9 @@ g_application_impl_attempt_primary (GApplicationImpl *impl,
|
|||||||
name_owner_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
|
name_owner_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
|
||||||
|
|
||||||
reply = g_dbus_connection_call_sync (impl->session_bus,
|
reply = g_dbus_connection_call_sync (impl->session_bus,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"RequestName",
|
"RequestName",
|
||||||
g_variant_new ("(su)", impl->bus_name, name_owner_flags),
|
g_variant_new ("(su)", impl->bus_name, name_owner_flags),
|
||||||
G_VARIANT_TYPE ("(u)"),
|
G_VARIANT_TYPE ("(u)"),
|
||||||
@ -599,8 +600,8 @@ g_application_impl_stop_primary (GApplicationImpl *impl)
|
|||||||
|
|
||||||
if (impl->primary && impl->bus_name)
|
if (impl->primary && impl->bus_name)
|
||||||
{
|
{
|
||||||
g_dbus_connection_call (impl->session_bus, "org.freedesktop.DBus",
|
g_dbus_connection_call (impl->session_bus, DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", "org.freedesktop.DBus",
|
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS,
|
||||||
"ReleaseName", g_variant_new ("(s)", impl->bus_name),
|
"ReleaseName", g_variant_new ("(s)", impl->bus_name),
|
||||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
||||||
impl->primary = FALSE;
|
impl->primary = FALSE;
|
||||||
|
@ -37,9 +37,10 @@
|
|||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include "glib/glib-private.h"
|
#include "glib/glib-private.h"
|
||||||
#include "gdbusprivate.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Escape values for console colors */
|
/* Escape values for console colors */
|
||||||
@ -332,9 +333,9 @@ print_names (GDBusConnection *c,
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_call_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"ListNames",
|
"ListNames",
|
||||||
NULL,
|
NULL,
|
||||||
G_VARIANT_TYPE ("(as)"),
|
G_VARIANT_TYPE ("(as)"),
|
||||||
@ -356,9 +357,9 @@ print_names (GDBusConnection *c,
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_call_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"ListActivatableNames",
|
"ListActivatableNames",
|
||||||
NULL,
|
NULL,
|
||||||
G_VARIANT_TYPE ("(as)"),
|
G_VARIANT_TYPE ("(as)"),
|
||||||
|
@ -2972,9 +2972,9 @@ initable_init (GInitable *initable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
hello_result = g_dbus_connection_call_sync (connection,
|
hello_result = g_dbus_connection_call_sync (connection,
|
||||||
"org.freedesktop.DBus", /* name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"Hello",
|
"Hello",
|
||||||
NULL, /* parameters */
|
NULL, /* parameters */
|
||||||
G_VARIANT_TYPE ("(s)"),
|
G_VARIANT_TYPE ("(s)"),
|
||||||
@ -3655,9 +3655,9 @@ add_match_rule (GDBusConnection *connection,
|
|||||||
if (match_rule[0] == '-')
|
if (match_rule[0] == '-')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"AddMatch");
|
"AddMatch");
|
||||||
g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule));
|
g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule));
|
||||||
error = NULL;
|
error = NULL;
|
||||||
@ -3686,9 +3686,9 @@ remove_match_rule (GDBusConnection *connection,
|
|||||||
if (match_rule[0] == '-')
|
if (match_rule[0] == '-')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"RemoveMatch");
|
"RemoveMatch");
|
||||||
g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule));
|
g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule));
|
||||||
|
|
||||||
|
@ -443,9 +443,9 @@ has_connection (Client *client)
|
|||||||
/* attempt to acquire the name */
|
/* attempt to acquire the name */
|
||||||
client->needs_release = TRUE;
|
client->needs_release = TRUE;
|
||||||
g_dbus_connection_call (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"RequestName", /* method name */
|
"RequestName", /* method name */
|
||||||
g_variant_new ("(su)",
|
g_variant_new ("(su)",
|
||||||
client->name,
|
client->name,
|
||||||
@ -936,9 +936,9 @@ g_bus_unown_name (guint owner_id)
|
|||||||
*/
|
*/
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_call_sync (client->connection,
|
result = g_dbus_connection_call_sync (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"ReleaseName", /* method name */
|
"ReleaseName", /* method name */
|
||||||
g_variant_new ("(s)", client->name),
|
g_variant_new ("(s)", client->name),
|
||||||
G_VARIANT_TYPE ("(u)"),
|
G_VARIANT_TYPE ("(u)"),
|
||||||
|
@ -424,9 +424,9 @@ static void
|
|||||||
invoke_get_name_owner (Client *client)
|
invoke_get_name_owner (Client *client)
|
||||||
{
|
{
|
||||||
g_dbus_connection_call (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetNameOwner", /* method name */
|
"GetNameOwner", /* method name */
|
||||||
g_variant_new ("(s)", client->name),
|
g_variant_new ("(s)", client->name),
|
||||||
G_VARIANT_TYPE ("(s)"),
|
G_VARIANT_TYPE ("(s)"),
|
||||||
@ -517,9 +517,9 @@ has_connection (Client *client)
|
|||||||
if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
|
if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
|
||||||
{
|
{
|
||||||
g_dbus_connection_call (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"StartServiceByName", /* method name */
|
"StartServiceByName", /* method name */
|
||||||
g_variant_new ("(su)", client->name, 0),
|
g_variant_new ("(su)", client->name, 0),
|
||||||
G_VARIANT_TYPE ("(u)"),
|
G_VARIANT_TYPE ("(u)"),
|
||||||
|
@ -1145,9 +1145,9 @@ subscribe_signals (GDBusObjectManagerClient *manager,
|
|||||||
/* The bus daemon may not implement path_namespace so gracefully
|
/* The bus daemon may not implement path_namespace so gracefully
|
||||||
* handle this by using a fallback triggered if @error is set. */
|
* handle this by using a fallback triggered if @error is set. */
|
||||||
ret = g_dbus_connection_call_sync (manager->priv->connection,
|
ret = g_dbus_connection_call_sync (manager->priv->connection,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"AddMatch",
|
"AddMatch",
|
||||||
g_variant_new ("(s)",
|
g_variant_new ("(s)",
|
||||||
manager->priv->match_rule),
|
manager->priv->match_rule),
|
||||||
@ -1230,9 +1230,9 @@ maybe_unsubscribe_signals (GDBusObjectManagerClient *manager)
|
|||||||
* fail - therefore, don't bother checking the return value
|
* fail - therefore, don't bother checking the return value
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_call (manager->priv->connection,
|
g_dbus_connection_call (manager->priv->connection,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"RemoveMatch",
|
"RemoveMatch",
|
||||||
g_variant_new ("(s)",
|
g_variant_new ("(s)",
|
||||||
manager->priv->match_rule),
|
manager->priv->match_rule),
|
||||||
|
@ -1485,9 +1485,9 @@ async_init_call_get_name_owner (GTask *task)
|
|||||||
GDBusProxy *proxy = g_task_get_source_object (task);
|
GDBusProxy *proxy = g_task_get_source_object (task);
|
||||||
|
|
||||||
g_dbus_connection_call (proxy->priv->connection,
|
g_dbus_connection_call (proxy->priv->connection,
|
||||||
"org.freedesktop.DBus", /* name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetNameOwner",
|
"GetNameOwner",
|
||||||
g_variant_new ("(s)",
|
g_variant_new ("(s)",
|
||||||
proxy->priv->name),
|
proxy->priv->name),
|
||||||
@ -1594,9 +1594,9 @@ async_init_call_start_service_by_name (GTask *task)
|
|||||||
GDBusProxy *proxy = g_task_get_source_object (task);
|
GDBusProxy *proxy = g_task_get_source_object (task);
|
||||||
|
|
||||||
g_dbus_connection_call (proxy->priv->connection,
|
g_dbus_connection_call (proxy->priv->connection,
|
||||||
"org.freedesktop.DBus", /* name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"StartServiceByName",
|
"StartServiceByName",
|
||||||
g_variant_new ("(su)",
|
g_variant_new ("(su)",
|
||||||
proxy->priv->name,
|
proxy->priv->name,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "giomodule-priv.h"
|
#include "giomodule-priv.h"
|
||||||
#include "gdbusconnection.h"
|
#include "gdbusconnection.h"
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gapplication.h"
|
#include "gapplication.h"
|
||||||
#include "gnotification-private.h"
|
#include "gnotification-private.h"
|
||||||
|
|
||||||
@ -58,8 +59,8 @@ g_gtk_notification_backend_is_supported (void)
|
|||||||
if (session_bus == NULL)
|
if (session_bus == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
reply = g_dbus_connection_call_sync (session_bus, "org.freedesktop.DBus", "/org/freedesktop/DBus",
|
reply = g_dbus_connection_call_sync (session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetNameOwner", g_variant_new ("(s)", "org.gtk.Notifications"),
|
"GetNameOwner", g_variant_new ("(s)", "org.gtk.Notifications"),
|
||||||
G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
|
G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
@ -424,9 +425,9 @@ test_connection_send (void)
|
|||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -441,9 +442,9 @@ test_connection_send (void)
|
|||||||
* Check that we get a reply to the GetId() method call.
|
* Check that we get a reply to the GetId() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -457,9 +458,9 @@ test_connection_send (void)
|
|||||||
* Check that we get an error reply to the NonExistantMethod() method call.
|
* Check that we get an error reply to the NonExistantMethod() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"NonExistantMethod", /* method name */
|
"NonExistantMethod", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -474,9 +475,9 @@ test_connection_send (void)
|
|||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -497,9 +498,9 @@ test_connection_send (void)
|
|||||||
g_assert_true (g_dbus_connection_is_closed (c));
|
g_assert_true (g_dbus_connection_is_closed (c));
|
||||||
|
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -687,9 +688,9 @@ test_connection_signals (void)
|
|||||||
* To ensure this is not the case, do a synchronous call on c1.
|
* To ensure this is not the case, do a synchronous call on c1.
|
||||||
*/
|
*/
|
||||||
result = g_dbus_connection_call_sync (c1,
|
result = g_dbus_connection_call_sync (c1,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, /* parameters */
|
NULL, /* parameters */
|
||||||
NULL, /* return type */
|
NULL, /* return type */
|
||||||
@ -1047,9 +1048,9 @@ test_connection_filter (void)
|
|||||||
&data,
|
&data,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
m = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetNameOwner");
|
"GetNameOwner");
|
||||||
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
|
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
|
||||||
error = NULL;
|
error = NULL;
|
||||||
@ -1197,9 +1198,9 @@ send_bogus_message (GDBusConnection *c, guint32 *out_serial)
|
|||||||
GDBusMessage *m;
|
GDBusMessage *m;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
m = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
m = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetNameOwner");
|
"GetNameOwner");
|
||||||
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
|
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
@ -137,9 +138,9 @@ test_exit_on_close_subprocess (gconstpointer test_data)
|
|||||||
GVariant *v;
|
GVariant *v;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
v = g_dbus_connection_call_sync (c, "org.freedesktop.DBus",
|
v = g_dbus_connection_call_sync (c, DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"ListNames",
|
"ListNames",
|
||||||
NULL,
|
NULL,
|
||||||
G_VARIANT_TYPE ("(as)"),
|
G_VARIANT_TYPE ("(as)"),
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
@ -181,9 +182,9 @@ test_bus_own_name (void)
|
|||||||
g_assert (c != NULL);
|
g_assert (c != NULL);
|
||||||
g_assert (!g_dbus_connection_is_closed (c));
|
g_assert (!g_dbus_connection_is_closed (c));
|
||||||
result = g_dbus_connection_call_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"NameHasOwner", /* method name */
|
"NameHasOwner", /* method name */
|
||||||
g_variant_new ("(s)", name),
|
g_variant_new ("(s)", name),
|
||||||
G_VARIANT_TYPE ("(b)"),
|
G_VARIANT_TYPE ("(b)"),
|
||||||
@ -209,9 +210,9 @@ test_bus_own_name (void)
|
|||||||
* Check that the name was actually released.
|
* Check that the name was actually released.
|
||||||
*/
|
*/
|
||||||
result = g_dbus_connection_call_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"NameHasOwner", /* method name */
|
"NameHasOwner", /* method name */
|
||||||
g_variant_new ("(s)", name),
|
g_variant_new ("(s)", name),
|
||||||
G_VARIANT_TYPE ("(b)"),
|
G_VARIANT_TYPE ("(b)"),
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
@ -757,9 +758,9 @@ kill_test_service (GDBusConnection *connection)
|
|||||||
gboolean name_disappeared = FALSE;
|
gboolean name_disappeared = FALSE;
|
||||||
|
|
||||||
ret = g_dbus_connection_call_sync (connection,
|
ret = g_dbus_connection_call_sync (connection,
|
||||||
"org.freedesktop.DBus",
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus",
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus",
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetConnectionUnixProcessID",
|
"GetConnectionUnixProcessID",
|
||||||
g_variant_new ("(s)", name),
|
g_variant_new ("(s)", name),
|
||||||
NULL,
|
NULL,
|
||||||
@ -977,9 +978,9 @@ add_or_remove_match_rule (GDBusConnection *connection,
|
|||||||
GDBusMessage *message = NULL;
|
GDBusMessage *message = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface */
|
DBUS_INTERFACE_DBUS,
|
||||||
(add_or_remove == ADD_MATCH) ? "AddMatch" : "RemoveMatch");
|
(add_or_remove == ADD_MATCH) ? "AddMatch" : "RemoveMatch");
|
||||||
g_dbus_message_set_body (message, match_rule);
|
g_dbus_message_set_body (message, match_rule);
|
||||||
g_dbus_connection_send_message (connection,
|
g_dbus_connection_send_message (connection,
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gdbusprivate.h"
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
/* all tests rely on a global connection */
|
/* all tests rely on a global connection */
|
||||||
@ -185,9 +186,9 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
* Check that we get a reply to the GetId() method call.
|
* Check that we get a reply to the GetId() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -212,9 +213,9 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -239,9 +240,9 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_dbus_connection_call (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", /* object path */
|
DBUS_PATH_DBUS,
|
||||||
"org.freedesktop.DBus", /* interface name */
|
DBUS_INTERFACE_DBUS,
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -563,8 +564,8 @@ ensure_connection_works (GDBusConnection *conn)
|
|||||||
GVariant *v;
|
GVariant *v;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
v = g_dbus_connection_call_sync (conn, "org.freedesktop.DBus",
|
v = g_dbus_connection_call_sync (conn, DBUS_SERVICE_DBUS,
|
||||||
"/org/freedesktop/DBus", "org.freedesktop.DBus", "GetId", NULL, NULL, 0, -1,
|
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetId", NULL, NULL, 0, -1,
|
||||||
NULL, &error);
|
NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_nonnull (v);
|
g_assert_nonnull (v);
|
||||||
|
Loading…
Reference in New Issue
Block a user