diff options
Diffstat (limited to 'src/nmcli/settings.c')
| -rw-r--r-- | src/nmcli/settings.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/nmcli/settings.c b/src/nmcli/settings.c index c80d0c7c..3c1f3c38 100644 --- a/src/nmcli/settings.c +++ b/src/nmcli/settings.c @@ -246,10 +246,10 @@ wireless_band_channel_changed_cb(GObject *object, GParamSpec *pspec, gpointer us mode = nm_setting_wireless_get_mode(NM_SETTING_WIRELESS(object)); if (!mode || !*mode || strcmp(mode, NM_SETTING_WIRELESS_MODE_INFRA) == 0) { - g_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), - nm_setting_get_name(NM_SETTING(s_wireless)), - g_param_spec_get_name(pspec), - value); + nmc_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), + nm_setting_get_name(NM_SETTING(s_wireless)), + g_param_spec_get_name(pspec), + value); } } @@ -266,9 +266,9 @@ connection_master_changed_cb(GObject *object, GParamSpec *pspec, gpointer user_d s_ipv4 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP4_CONFIG_SETTING_NAME); s_ipv6 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP6_CONFIG_SETTING_NAME); if (s_ipv4 || s_ipv6) { - g_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), - nm_setting_get_name(NM_SETTING(s_con)), - g_param_spec_get_name(pspec)); + nmc_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), + nm_setting_get_name(NM_SETTING(s_con)), + g_param_spec_get_name(pspec)); tmp_str = nmc_get_user_input(_("Do you want to remove them? [yes] ")); if (!tmp_str || matches(tmp_str, "yes")) { if (s_ipv4) @@ -373,8 +373,8 @@ _set_fcn_precheck_connection_secondaries(NMClient *client, if (nm_utils_is_uuid(*iter)) { con = nmc_find_connection(connections, "uuid", *iter, NULL, FALSE); if (!con) { - g_print(_("Warning: %s is not an UUID of any existing connection profile\n"), - *iter); + nmc_print(_("Warning: %s is not an UUID of any existing connection profile\n"), + *iter); } else { /* Currently, NM only supports VPN connections as secondaries */ if (!nm_connection_is_type(con, NM_SETTING_VPN_SETTING_NAME)) { @@ -385,7 +385,7 @@ _set_fcn_precheck_connection_secondaries(NMClient *client, } else { con = nmc_find_connection(connections, "id", *iter, NULL, FALSE); if (!con) { - g_set_error(error, 1, 0, _("'%s' is not a name of any exiting profile"), *iter); + g_set_error(error, 1, 0, _("'%s' is not a name of any existing profile"), *iter); return FALSE; } @@ -431,13 +431,13 @@ _env_warn_fcn_handle( switch (warn_level) { case NM_META_ENV_WARN_LEVEL_WARN: - g_print(_("Warning: %s\n"), m); + nmc_print(_("Warning: %s\n"), m); return; case NM_META_ENV_WARN_LEVEL_INFO: - g_print(_("Info: %s\n"), m); + nmc_print(_("Info: %s\n"), m); return; } - g_print(_("Error: %s\n"), m); + nmc_print(_("Error: %s\n"), m); } static NMDevice *const * @@ -488,12 +488,23 @@ _env_get_nm_connections(const NMMetaEnvironment *environment, return (NMRemoteConnection *const *) values->pdata; } +static NMMetaEnvFlags +_env_get_env_flags(const NMMetaEnvironment *environment, gpointer environment_user_data) +{ + NmCli *nmc = environment_user_data; + + nm_assert(nmc); + + return (nmc->offline ? NM_META_ENV_FLAGS_OFFLINE : NM_META_ENV_FLAGS_NONE); +} + /*****************************************************************************/ const NMMetaEnvironment *const nmc_meta_environment = &((NMMetaEnvironment){ .warn_fcn = _env_warn_fcn_handle, .get_nm_devices = _env_get_nm_devices, .get_nm_connections = _env_get_nm_connections, + .get_env_flags = _env_get_env_flags, }); static char * @@ -748,7 +759,7 @@ setting_details(const NmcConfig *nmc_config, NMSetting *setting, const char *one fields_str = g_strdup_printf("%s.%s", nm_setting_get_name(setting), one_prop); } - if (!nmc_print( + if (!nmc_print_table( nmc_config, (gpointer[]){setting, NULL}, NULL, |