cli: allow modifying default DBus timeout with `--timeout'

By default 30s will be used for every operation.
This commit is contained in:
Aleksander Morgado
2012-07-25 10:04:20 +02:00
parent 8a34e41794
commit 8f8bcd7724
12 changed files with 100 additions and 3 deletions

View File

@@ -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)
{