diff options
author | Thomas Haller <thaller@redhat.com> | 2020-06-10 15:27:59 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-06-10 15:30:38 +0200 |
commit | 9959bc58de5c331e2ef29034d03c3c81bda12a52 (patch) | |
tree | 15004dd4a2bcaf9111c7aa1d6e290f49d625a762 /clients/cli | |
parent | 1573ca755b248b6f50b0882f27ca2d1c88a39443 (diff) | |
download | NetworkManager-th/mark-external-connection.tar.gz |
cli: show differnt text for state of externally connected devicesth/mark-external-connection
Diffstat (limited to 'clients/cli')
-rw-r--r-- | clients/cli/connections.c | 4 | ||||
-rw-r--r-- | clients/cli/devices.c | 16 | ||||
-rw-r--r-- | clients/cli/general.c | 6 |
3 files changed, 10 insertions, 16 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 5a4a8ecc3f..44e34d56a6 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -2613,7 +2613,7 @@ progress_active_connection_cb (gpointer user_data) } str = device - ? gettext (nmc_device_state_to_string (nm_device_get_state (device))) + ? gettext (nmc_device_state_to_string_with_external (device)) : active_connection_state_to_string (ac_state); nmc_terminal_show_progress (str); @@ -6820,7 +6820,7 @@ progress_activation_editor_cb (gpointer user_data) ac_state = nm_active_connection_get_state (ac); dev_state = nm_device_get_state (device); - nmc_terminal_show_progress (gettext (nmc_device_state_to_string (dev_state))); + nmc_terminal_show_progress (gettext (nmc_device_state_to_string_with_external (device))); if ( ac_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED || dev_state == NM_DEVICE_STATE_ACTIVATED) { diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 031017283d..eaa9f0c3d1 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -100,7 +100,7 @@ _metagen_device_status_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_TYPE: return nm_device_get_type_description (d); case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_STATE: - return nmc_meta_generic_get_str_i18n (nmc_device_state_to_string (nm_device_get_state (d)), + return nmc_meta_generic_get_str_i18n (nmc_device_state_to_string_with_external (d), get_type); case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_IP4_CONNECTIVITY: return nmc_meta_generic_get_str_i18n (nm_connectivity_to_string (nm_device_get_connectivity (d, AF_INET)), @@ -147,7 +147,6 @@ _metagen_device_detail_general_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) { NMDevice *d = target; NMActiveConnection *ac; - NMDeviceState state; NMDeviceStateReason state_reason; NMConnectivityState connectivity; const char *s; @@ -180,10 +179,9 @@ _metagen_device_detail_general_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_MTU: return (*out_to_free = g_strdup_printf ("%u", (guint) nm_device_get_mtu (d))); case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_STATE: - state = nm_device_get_state (d); return (*out_to_free = nmc_meta_generic_get_enum_with_detail (NMC_META_GENERIC_GET_ENUM_TYPE_PARENTHESES, - state, - nmc_device_state_to_string (state), + nm_device_get_state (d), + nmc_device_state_to_string_with_external (d), get_type)); case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_REASON: state_reason = nm_device_get_state_reason (d); @@ -1849,7 +1847,7 @@ progress_cb (gpointer user_data) { NMDevice *device = (NMDevice *) user_data; - nmc_terminal_show_progress (device ? gettext (nmc_device_state_to_string (nm_device_get_state (device))) : ""); + nmc_terminal_show_progress (device ? gettext (nmc_device_state_to_string_with_external (device)) : ""); return TRUE; } @@ -2620,17 +2618,15 @@ do_device_set (const NMCCommand *cmd, NmCli *nmc, int argc, const char *const*ar static void device_state (NMDevice *device, GParamSpec *pspec, NmCli *nmc) { - NMDeviceState state = nm_device_get_state (device); + gs_free char *str = NULL; NMMetaColor color; - char *str; color = nmc_device_state_to_color (device); str = nmc_colorize (&nmc->nmc_config, color, "%s: %s\n", nm_device_get_iface (device), - gettext (nmc_device_state_to_string (state))); + gettext (nmc_device_state_to_string_with_external (device))); g_print ("%s", str); - g_free (str); } static void diff --git a/clients/cli/general.c b/clients/cli/general.c index 550ccb14d0..a771e1d58f 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -1426,25 +1426,23 @@ nmc_command_func_overview (const NMCCommand *cmd, NmCli *nmc, int argc, const ch devices = nmc_get_devices_sorted (nmc->client); for (i = 0; devices[i]; i++) { NMDevice *device = devices[i]; - NMDeviceState state; ac = nm_device_get_active_connection (device); - state = nm_device_get_state (device); color = nmc_device_state_to_color (device); if (ac) { /* TRANSLATORS: prints header line for activated device in plain `nmcli` overview output as * "<interface-name>: <device-state> to <connection-id>" */ tmp = nmc_colorize (&nmc->nmc_config, color, C_("nmcli-overview", "%s: %s to %s"), nm_device_get_iface (device), - gettext (nmc_device_state_to_string (state)), + gettext (nmc_device_state_to_string_with_external (device)), nm_active_connection_get_id (ac)); } else { /* TRANSLATORS: prints header line for not active device in plain `nmcli` overview output as * "<interface-name>: <device-state>" */ tmp = nmc_colorize (&nmc->nmc_config, color, C_("nmcli-overview", "%s: %s"), nm_device_get_iface (device), - gettext (nmc_device_state_to_string (state))); + gettext (nmc_device_state_to_string_with_external (device))); } g_print ("%s\n", tmp); g_free (tmp); |