cli: don't recheck group options if already done

This commit is contained in:
Aleksander Morgado
2011-12-21 15:15:28 +01:00
parent 8fc2050e76
commit 73ca5dcb24
3 changed files with 18 additions and 3 deletions

View File

@@ -83,7 +83,11 @@ mmcli_bearer_get_option_group (void)
gboolean
mmcli_bearer_options_enabled (void)
{
guint n_actions;
static guint n_actions = 0;
static gboolean checked = FALSE;
if (checked)
return !!n_actions;
n_actions = (!!connect_with_number_str +
connect_flag +
@@ -103,6 +107,7 @@ mmcli_bearer_options_enabled (void)
if (info_flag)
mmcli_force_sync_operation ();
checked = TRUE;
return !!n_actions;
}

View File

@@ -86,7 +86,11 @@ mmcli_manager_get_option_group (void)
gboolean
mmcli_manager_options_enabled (void)
{
guint n_actions;
static guint n_actions = 0;
static gboolean checked = FALSE;
if (checked)
return !!n_actions;
n_actions = (list_modems_flag +
monitor_modems_flag +
@@ -101,6 +105,7 @@ mmcli_manager_options_enabled (void)
if (monitor_modems_flag)
mmcli_force_async_operation ();
checked = TRUE;
return !!n_actions;
}

View File

@@ -108,7 +108,11 @@ mmcli_modem_get_option_group (void)
gboolean
mmcli_modem_options_enabled (void)
{
guint n_actions;
static guint n_actions = 0;
static gboolean checked = FALSE;
if (checked)
return !!n_actions;
n_actions = (monitor_state_flag +
enable_flag +
@@ -136,6 +140,7 @@ mmcli_modem_options_enabled (void)
if (info_flag)
mmcli_force_sync_operation ();
checked = TRUE;
return !!n_actions;
}