diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-25 10:04:20 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-25 11:44:01 +0200 |
commit | 8f8bcd7724e8c75cf7e0460946c04624ce6ed46a (patch) | |
tree | bd2d0a9050977197fb0ac2e50eeb75e8f8dd2f5e /cli/mmcli.c | |
parent | 8a34e417943df90f6b43a0de08550def557c7db7 (diff) |
cli: allow modifying default DBus timeout with `--timeout'
By default 30s will be used for every operation.
Diffstat (limited to 'cli/mmcli.c')
-rw-r--r-- | cli/mmcli.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/mmcli.c b/cli/mmcli.c index 78284ca9..b05df9bc 100644 --- a/cli/mmcli.c +++ b/cli/mmcli.c @@ -45,6 +45,7 @@ static GCancellable *cancellable; static gboolean verbose_flag; static gboolean version_flag; static gboolean async_flag; +static gint timeout = 30; /* by default, use 30s for all operations */ static GOptionEntry main_entries[] = { { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag, @@ -59,6 +60,10 @@ static GOptionEntry main_entries[] = { "Use asynchronous methods", NULL }, + { "timeout", 0, 0, G_OPTION_ARG_INT, &timeout, + "Timeout for the operation", + "[SECONDS]" + }, { NULL } }; @@ -163,6 +168,12 @@ mmcli_force_sync_operation (void) } } +void +mmcli_force_operation_timeout (GDBusProxy *proxy) +{ + g_dbus_proxy_set_default_timeout (proxy, timeout * 1000); +} + gint main (gint argc, gchar **argv) { |