summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-dcb.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-20 13:52:23 -0400
committerDan Winship <danw@gnome.org>2014-10-22 08:29:07 -0400
commit2d8e7bd2476011e7b156d6365b28a78a3ecd84bf (patch)
tree72967281ffe2f06ad97c3d4f02425f2d1ab2e611 /libnm-core/nm-setting-dcb.c
parentaeb3d093f66aea3c5bf7e235226bdb0431cf9a9a (diff)
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them had exactly the same three errors ("unknown", "missing property", and "invalid property"), and none of the other values was of much use programmatically anyway. So, this commit merges NMSettingError, NMSettingAdslError, etc, all into NMConnectionError. (The reason for merging into NMConnectionError rather than NMSettingError is that we also already have "NMSettingsError", for errors related to the settings service, so "NMConnectionError" is a less-confusable name for settings/connection errors than "NMSettingError".) Also, make sure that all of the affected error messages are localized, and (where appropriate) prefix them with the relevant property name. Renamed error codes: NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET Remapped error codes: NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY Dropped error codes (were previously defined but unused): NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
Diffstat (limited to 'libnm-core/nm-setting-dcb.c')
-rw-r--r--libnm-core/nm-setting-dcb.c54
1 files changed, 18 insertions, 36 deletions
diff --git a/libnm-core/nm-setting-dcb.c b/libnm-core/nm-setting-dcb.c
index b708098ca..e68be5e10 100644
--- a/libnm-core/nm-setting-dcb.c
+++ b/libnm-core/nm-setting-dcb.c
@@ -39,24 +39,6 @@
* of storage technologies like Fibre Channel over Ethernet (FCoE) and iSCSI.
**/
-/**
- * nm_setting_dcb_error_quark:
- *
- * Registers an error quark for #NMSettingDcb if necessary.
- *
- * Returns: the error quark used for #NMSettingDcb errors.
- **/
-GQuark
-nm_setting_dcb_error_quark (void)
-{
- static GQuark quark;
-
- if (G_UNLIKELY (!quark))
- quark = g_quark_from_static_string ("nm-setting-dcb-error-quark");
- return quark;
-}
-
-
G_DEFINE_TYPE_WITH_CODE (NMSettingDcb, nm_setting_dcb, NM_TYPE_SETTING,
_nm_register_setting (DCB, 2))
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_DCB)
@@ -534,8 +516,8 @@ check_dcb_flags (NMSettingDcbFlags flags, const char *prop_name, GError **error)
{
if (flags & ~DCB_FLAGS_ALL) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("flags invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -543,8 +525,8 @@ check_dcb_flags (NMSettingDcbFlags flags, const char *prop_name, GError **error)
if (!(flags & NM_SETTING_DCB_FLAG_ENABLE) && (flags & ~NM_SETTING_DCB_FLAG_ENABLE)) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("flags invalid - disabled"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -569,8 +551,8 @@ check_uint_array (const guint *array,
for (i = 0; i < len; i++) {
if (!(flags & NM_SETTING_DCB_FLAG_ENABLE) && array[i]) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property invalid (not enabled)"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -578,8 +560,8 @@ check_uint_array (const guint *array,
if ((array[i] > max) && (array[i] != extra)) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("element invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -593,8 +575,8 @@ check_uint_array (const guint *array,
/* If the feature is enabled, sum must equal 100% */
if (sum != 100) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("sum not 100%"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -618,8 +600,8 @@ check_priority (gint val,
{
if (!(flags & NM_SETTING_DCB_FLAG_ENABLE) && (val >= 0)) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property invalid (not enabled)"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -627,8 +609,8 @@ check_priority (gint val,
if (val < -1 || val > 7) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, prop_name);
return FALSE;
@@ -649,8 +631,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
if (!priv->app_fcoe_mode) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_MISSING_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_MISSING_PROPERTY,
_("property missing"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, NM_SETTING_DCB_APP_FCOE_MODE);
return FALSE;
@@ -659,8 +641,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
if (strcmp (priv->app_fcoe_mode, NM_SETTING_DCB_FCOE_MODE_FABRIC) &&
strcmp (priv->app_fcoe_mode, NM_SETTING_DCB_FCOE_MODE_VN2VN)) {
g_set_error_literal (error,
- NM_SETTING_DCB_ERROR,
- NM_SETTING_DCB_ERROR_INVALID_PROPERTY,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_DCB_SETTING_NAME, NM_SETTING_DCB_APP_FCOE_MODE);
return FALSE;