From 720d6ec8e42d1067d32556d9b50e8b83cf6ca4b9 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 6 May 2011 15:25:49 -0400 Subject: [PATCH] gdbus: Add a --timeout option Signed-off-by: David Zeuthen --- docs/reference/gio/gdbus.xml | 3 +++ gio/gdbus-tool.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/reference/gio/gdbus.xml b/docs/reference/gio/gdbus.xml index 280b47873..75e7eeb03 100644 --- a/docs/reference/gio/gdbus.xml +++ b/docs/reference/gio/gdbus.xml @@ -48,6 +48,9 @@ --dest bus_name --object-path /path/to/object --method org.project.InterfaceName.MethodName + + --timeout seconds + ARG1 ARG2 diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c index 56efd40b4..9228122e2 100644 --- a/gio/gdbus-tool.c +++ b/gio/gdbus-tool.c @@ -527,12 +527,14 @@ _g_variant_parse_me_harder (GVariantType *type, static gchar *opt_call_dest = NULL; static gchar *opt_call_object_path = NULL; static gchar *opt_call_method = NULL; +static gint opt_call_timeout = -1; static const GOptionEntry call_entries[] = { { "dest", 'd', 0, G_OPTION_ARG_STRING, &opt_call_dest, N_("Destination name to invoke method on"), NULL}, { "object-path", 'o', 0, G_OPTION_ARG_STRING, &opt_call_object_path, N_("Object path to invoke method on"), NULL}, { "method", 'm', 0, G_OPTION_ARG_STRING, &opt_call_method, N_("Method and interface name"), NULL}, + { "timeout", 't', 0, G_OPTION_ARG_INT, &opt_call_timeout, N_("Timeout in seconds"), NULL}, { NULL } }; @@ -809,7 +811,7 @@ handle_call (gint *argc, parameters, NULL, G_DBUS_CALL_FLAGS_NONE, - -1, + opt_call_timeout > 0 ? opt_call_timeout * 1000 : opt_call_timeout, NULL, &error); if (result == NULL)