diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-12-09 17:58:20 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:33 +0100 |
commit | 62469445101babdff53d238e602d7e988dbaa0cb (patch) | |
tree | a829194c8618a15607714482851234de975ab945 /cli/mmcli-modem.c | |
parent | ec8da67921c648dbe2e3b82c2392f7196229c914 (diff) |
cli: allow option groups to force async/sync operations
Some operations are clearly asynchronous (e.g. monitoring modem state), while
others are clearly synchronous (e.g. printing modem info). So just allow option
groups to force the operation to be async or sync based on the detected action.
Diffstat (limited to 'cli/mmcli-modem.c')
-rw-r--r-- | cli/mmcli-modem.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c index 1c7703ac..72e2a34e 100644 --- a/cli/mmcli-modem.c +++ b/cli/mmcli-modem.c @@ -115,6 +115,12 @@ mmcli_modem_options_enabled (void) exit (EXIT_FAILURE); } + if (monitor_state_flag) + mmcli_force_async_operation (); + + if (info_flag) + mmcli_force_sync_operation (); + return !!n_actions; } @@ -436,16 +442,8 @@ get_modem_ready (GObject *source, ctx->object = mmcli_get_modem_finish (result); ctx->modem = mm_object_get_modem (ctx->object); - /* Request to get info from modem? */ - if (info_flag) { - /* TODO */ - - /* mm_modem_get_info_async (ctxt.modem, */ - /* cancellable, */ - /* (GAsyncReadyCallback)get_info_ready, */ - /* NULL); */ - return; - } + if (info_flag) + g_assert_not_reached (); /* Request to monitor modems? */ if (monitor_state_flag) { @@ -530,10 +528,8 @@ mmcli_modem_run_synchronous (GDBusConnection *connection) { GError *error = NULL; - if (monitor_state_flag) { - g_printerr ("error: monitoring state cannot be done synchronously\n"); - exit (EXIT_FAILURE); - } + if (monitor_state_flag) + g_assert_not_reached (); /* Initialize context */ ctx = g_new0 (Context, 1); |