Commit fcfb4b40 authored by Dan Winship's avatar Dan Winship

libnm: make use of GParamSpecFlags and GParamSpecEnum

Make enum- and flags-valued properties use GParamSpecEnum and
GParamSpecFlags, for better introspectability/bindability.

This requires no changes outside libnm-core/libnm since the expected
data size is still the same with g_object_get()/g_object_set(), and
GLib will internally convert between int/uint and enum/flags GValues
when using g_object_get_property()/g_object_set_property().
parent ad25e5c9
......@@ -28,6 +28,7 @@
#include "crypto.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-8021x
......@@ -2917,7 +2918,7 @@ set_property (GObject *object, guint prop_id,
priv->password = g_value_dup_string (value);
break;
case PROP_PASSWORD_FLAGS:
priv->password_flags = g_value_get_uint (value);
priv->password_flags = g_value_get_flags (value);
break;
case PROP_PASSWORD_RAW:
if (priv->password_raw)
......@@ -2925,7 +2926,7 @@ set_property (GObject *object, guint prop_id,
priv->password_raw = g_value_dup_boxed (value);
break;
case PROP_PASSWORD_RAW_FLAGS:
priv->password_raw_flags = g_value_get_uint (value);
priv->password_raw_flags = g_value_get_flags (value);
break;
case PROP_PRIVATE_KEY:
if (priv->private_key)
......@@ -2942,7 +2943,7 @@ set_property (GObject *object, guint prop_id,
priv->private_key_password = g_value_dup_string (value);
break;
case PROP_PRIVATE_KEY_PASSWORD_FLAGS:
priv->private_key_password_flags = g_value_get_uint (value);
priv->private_key_password_flags = g_value_get_flags (value);
break;
case PROP_PHASE2_PRIVATE_KEY:
if (priv->phase2_private_key)
......@@ -2959,14 +2960,14 @@ set_property (GObject *object, guint prop_id,
priv->phase2_private_key_password = g_value_dup_string (value);
break;
case PROP_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS:
priv->phase2_private_key_password_flags = g_value_get_uint (value);
priv->phase2_private_key_password_flags = g_value_get_flags (value);
break;
case PROP_PIN:
g_free (priv->pin);
priv->pin = g_value_dup_string (value);
break;
case PROP_PIN_FLAGS:
priv->pin_flags = g_value_get_uint (value);
priv->pin_flags = g_value_get_flags (value);
break;
case PROP_SYSTEM_CA_CERTS:
priv->system_ca_certs = g_value_get_boolean (value);
......@@ -3046,13 +3047,13 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->password);
break;
case PROP_PASSWORD_FLAGS:
g_value_set_uint (value, priv->password_flags);
g_value_set_flags (value, priv->password_flags);
break;
case PROP_PASSWORD_RAW:
g_value_set_boxed (value, priv->password_raw);
break;
case PROP_PASSWORD_RAW_FLAGS:
g_value_set_uint (value, priv->password_raw_flags);
g_value_set_flags (value, priv->password_raw_flags);
break;
case PROP_PRIVATE_KEY:
g_value_set_boxed (value, priv->private_key);
......@@ -3061,7 +3062,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->private_key_password);
break;
case PROP_PRIVATE_KEY_PASSWORD_FLAGS:
g_value_set_uint (value, priv->private_key_password_flags);
g_value_set_flags (value, priv->private_key_password_flags);
break;
case PROP_PHASE2_PRIVATE_KEY:
g_value_set_boxed (value, priv->phase2_private_key);
......@@ -3070,13 +3071,13 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->phase2_private_key_password);
break;
case PROP_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS:
g_value_set_uint (value, priv->phase2_private_key_password_flags);
g_value_set_flags (value, priv->phase2_private_key_password_flags);
break;
case PROP_PIN:
g_value_set_string (value, priv->pin);
break;
case PROP_PIN_FLAGS:
g_value_set_uint (value, priv->pin_flags);
g_value_set_flags (value, priv->pin_flags);
break;
case PROP_SYSTEM_CA_CERTS:
g_value_set_boolean (value, priv->system_ca_certs);
......@@ -3468,12 +3469,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_802_1X_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSetting8021x:password-raw:
......@@ -3502,12 +3502,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_RAW_FLAGS,
g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSetting8021x:private-key:
......@@ -3576,12 +3575,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PRIVATE_KEY_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSetting8021x:phase2-private-key:
......@@ -3645,12 +3643,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSetting8021x:pin:
......@@ -3672,12 +3669,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PIN_FLAGS,
g_param_spec_uint (NM_SETTING_802_1X_PIN_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_802_1X_PIN_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSetting8021x:system-ca-certs:
......
......@@ -26,6 +26,7 @@
#include "nm-setting-ppp.h"
#include "nm-setting-private.h"
#include "nm-utils.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-adsl
......@@ -301,7 +302,7 @@ set_property (GObject *object, guint prop_id,
priv->password = g_value_dup_string (value);
break;
case PROP_PASSWORD_FLAGS:
priv->password_flags = g_value_get_uint (value);
priv->password_flags = g_value_get_flags (value);
break;
case PROP_PROTOCOL:
g_free (priv->protocol);
......@@ -337,7 +338,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, nm_setting_adsl_get_password (setting));
break;
case PROP_PASSWORD_FLAGS:
g_value_set_uint (value, nm_setting_adsl_get_password_flags (setting));
g_value_set_flags (value, nm_setting_adsl_get_password_flags (setting));
break;
case PROP_PROTOCOL:
g_value_set_string (value, nm_setting_adsl_get_protocol (setting));
......@@ -406,12 +407,11 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_ADSL_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_ADSL_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingAdsl:protocol:
......
......@@ -25,6 +25,7 @@
#include "nm-setting-cdma.h"
#include "nm-utils.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-cdma
......@@ -243,7 +244,7 @@ set_property (GObject *object, guint prop_id,
priv->password = g_value_dup_string (value);
break;
case PROP_PASSWORD_FLAGS:
priv->password_flags = g_value_get_uint (value);
priv->password_flags = g_value_get_flags (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -268,7 +269,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, nm_setting_cdma_get_password (setting));
break;
case PROP_PASSWORD_FLAGS:
g_value_set_uint (value, nm_setting_cdma_get_password_flags (setting));
g_value_set_flags (value, nm_setting_cdma_get_password_flags (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -343,10 +344,9 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_CDMA_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_CDMA_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
}
......@@ -26,6 +26,7 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-dcb
......@@ -802,7 +803,7 @@ set_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_APP_FCOE_FLAGS:
priv->app_fcoe_flags = g_value_get_uint (value);
priv->app_fcoe_flags = g_value_get_flags (value);
break;
case PROP_APP_FCOE_PRIORITY:
priv->app_fcoe_priority = g_value_get_int (value);
......@@ -811,25 +812,25 @@ set_property (GObject *object, guint prop_id,
priv->app_fcoe_mode = g_value_dup_string (value);
break;
case PROP_APP_ISCSI_FLAGS:
priv->app_iscsi_flags = g_value_get_uint (value);
priv->app_iscsi_flags = g_value_get_flags (value);
break;
case PROP_APP_ISCSI_PRIORITY:
priv->app_iscsi_priority = g_value_get_int (value);
break;
case PROP_APP_FIP_FLAGS:
priv->app_fip_flags = g_value_get_uint (value);
priv->app_fip_flags = g_value_get_flags (value);
break;
case PROP_APP_FIP_PRIORITY:
priv->app_fip_priority = g_value_get_int (value);
break;
case PROP_PFC_FLAGS:
priv->pfc_flags = g_value_get_uint (value);
priv->pfc_flags = g_value_get_flags (value);
break;
case PROP_PFC:
SET_ARRAY_FROM_GVALUE (value, priv->pfc);
break;
case PROP_PRIORITY_GROUP_FLAGS:
priv->priority_group_flags = g_value_get_uint (value);
priv->priority_group_flags = g_value_get_flags (value);
break;
case PROP_PRIORITY_GROUP_ID:
SET_ARRAY_FROM_GVALUE (value, priv->priority_group_id);
......@@ -861,7 +862,7 @@ get_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_APP_FCOE_FLAGS:
g_value_set_uint (value, priv->app_fcoe_flags);
g_value_set_flags (value, priv->app_fcoe_flags);
break;
case PROP_APP_FCOE_PRIORITY:
g_value_set_int (value, priv->app_fcoe_priority);
......@@ -870,25 +871,25 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->app_fcoe_mode);
break;
case PROP_APP_ISCSI_FLAGS:
g_value_set_uint (value, priv->app_iscsi_flags);
g_value_set_flags (value, priv->app_iscsi_flags);
break;
case PROP_APP_ISCSI_PRIORITY:
g_value_set_int (value, priv->app_iscsi_priority);
break;
case PROP_APP_FIP_FLAGS:
g_value_set_uint (value, priv->app_fip_flags);
g_value_set_flags (value, priv->app_fip_flags);
break;
case PROP_APP_FIP_PRIORITY:
g_value_set_int (value, priv->app_fip_priority);
break;
case PROP_PFC_FLAGS:
g_value_set_uint (value, priv->pfc_flags);
g_value_set_flags (value, priv->pfc_flags);
break;
case PROP_PFC:
SET_GVALUE_FROM_ARRAY (value, priv->pfc);
break;
case PROP_PRIORITY_GROUP_FLAGS:
g_value_set_uint (value, priv->priority_group_flags);
g_value_set_flags (value, priv->priority_group_flags);
break;
case PROP_PRIORITY_GROUP_ID:
SET_GVALUE_FROM_ARRAY (value, priv->priority_group_id);
......@@ -934,10 +935,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_APP_FCOE_FLAGS,
g_param_spec_uint (NM_SETTING_DCB_APP_FCOE_FLAGS, "", "",
0, DCB_FLAGS_ALL, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_DCB_APP_FCOE_FLAGS, "", "",
NM_TYPE_SETTING_DCB_FLAGS,
NM_SETTING_DCB_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingDcb:app-fcoe-priority:
......@@ -977,10 +979,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_APP_ISCSI_FLAGS,
g_param_spec_uint (NM_SETTING_DCB_APP_ISCSI_FLAGS, "", "",
0, DCB_FLAGS_ALL, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_DCB_APP_ISCSI_FLAGS, "", "",
NM_TYPE_SETTING_DCB_FLAGS,
NM_SETTING_DCB_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingDcb:app-iscsi-priority:
......@@ -1006,10 +1009,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_APP_FIP_FLAGS,
g_param_spec_uint (NM_SETTING_DCB_APP_FIP_FLAGS, "", "",
0, DCB_FLAGS_ALL, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_DCB_APP_FIP_FLAGS, "", "",
NM_TYPE_SETTING_DCB_FLAGS,
NM_SETTING_DCB_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingDcb:app-fip-priority:
......@@ -1035,10 +1039,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PFC_FLAGS,
g_param_spec_uint (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, "", "",
0, DCB_FLAGS_ALL, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, "", "",
NM_TYPE_SETTING_DCB_FLAGS,
NM_SETTING_DCB_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingDcb:priority-flow-control:
......@@ -1069,10 +1074,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PRIORITY_GROUP_FLAGS,
g_param_spec_uint (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, "", "",
0, DCB_FLAGS_ALL, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, "", "",
NM_TYPE_SETTING_DCB_FLAGS,
NM_SETTING_DCB_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingDcb:priority-group-id:
......
......@@ -65,7 +65,7 @@ GQuark nm_setting_dcb_error_quark (void);
*
* DCB feature flags.
**/
typedef enum {
typedef enum { /*< flags >*/
NM_SETTING_DCB_FLAG_NONE = 0x00000000,
NM_SETTING_DCB_FLAG_ENABLE = 0x00000001,
NM_SETTING_DCB_FLAG_ADVERTISE = 0x00000002,
......
......@@ -26,6 +26,7 @@
#include "nm-setting-gsm.h"
#include "nm-utils.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-gsm
......@@ -400,7 +401,7 @@ set_property (GObject *object, guint prop_id,
priv->password = g_value_dup_string (value);
break;
case PROP_PASSWORD_FLAGS:
priv->password_flags = g_value_get_uint (value);
priv->password_flags = g_value_get_flags (value);
break;
case PROP_APN:
g_free (priv->apn);
......@@ -421,7 +422,7 @@ set_property (GObject *object, guint prop_id,
priv->pin = g_value_dup_string (value);
break;
case PROP_PIN_FLAGS:
priv->pin_flags = g_value_get_uint (value);
priv->pin_flags = g_value_get_flags (value);
break;
case PROP_HOME_ONLY:
priv->home_only = g_value_get_boolean (value);
......@@ -449,7 +450,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, nm_setting_gsm_get_password (setting));
break;
case PROP_PASSWORD_FLAGS:
g_value_set_uint (value, nm_setting_gsm_get_password_flags (setting));
g_value_set_flags (value, nm_setting_gsm_get_password_flags (setting));
break;
case PROP_APN:
g_value_set_string (value, nm_setting_gsm_get_apn (setting));
......@@ -461,7 +462,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, nm_setting_gsm_get_pin (setting));
break;
case PROP_PIN_FLAGS:
g_value_set_uint (value, nm_setting_gsm_get_pin_flags (setting));
g_value_set_flags (value, nm_setting_gsm_get_pin_flags (setting));
break;
case PROP_HOME_ONLY:
g_value_set_boolean (value, nm_setting_gsm_get_home_only (setting));
......@@ -540,12 +541,11 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_GSM_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_GSM_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingGsm:apn:
......@@ -603,12 +603,11 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PIN_FLAGS,
g_param_spec_uint (NM_SETTING_GSM_PIN_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_GSM_PIN_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingGsm:home-only:
......
......@@ -27,6 +27,7 @@
#include "nm-utils-private.h"
#include "nm-glib-compat.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-ip6-config
......@@ -1006,7 +1007,7 @@ set_property (GObject *object, guint prop_id,
priv->may_fail = g_value_get_boolean (value);
break;
case PROP_IP6_PRIVACY:
priv->ip6_privacy = g_value_get_int (value);
priv->ip6_privacy = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -1052,7 +1053,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_boolean (value, priv->may_fail);
break;
case PROP_IP6_PRIVACY:
g_value_set_int (value, priv->ip6_privacy);
g_value_set_enum (value, priv->ip6_privacy);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -1268,13 +1269,12 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_IP6_PRIVACY,
g_param_spec_int (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, "", "",
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
g_param_spec_enum (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, "", "",
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
}
/********************************************************************/
......
......@@ -26,6 +26,7 @@
#include "nm-setting-pppoe.h"
#include "nm-setting-ppp.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-pppoe
......@@ -221,7 +222,7 @@ set_property (GObject *object, guint prop_id,
priv->password = g_value_dup_string (value);
break;
case PROP_PASSWORD_FLAGS:
priv->password_flags = g_value_get_uint (value);
priv->password_flags = g_value_get_flags (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -246,7 +247,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, nm_setting_pppoe_get_password (setting));
break;
case PROP_PASSWORD_FLAGS:
g_value_set_uint (value, nm_setting_pppoe_get_password_flags (setting));
g_value_set_flags (value, nm_setting_pppoe_get_password_flags (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -329,10 +330,9 @@ nm_setting_pppoe_class_init (NMSettingPppoeClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_PASSWORD_FLAGS,
g_param_spec_uint (NM_SETTING_PPPOE_PASSWORD_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_PPPOE_PASSWORD_FLAGS, "", "",
NM_TYPE_SETTING_SECRET_FLAGS,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
}
......@@ -27,6 +27,7 @@
#include "nm-utils.h"
#include "nm-setting-connection.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-vlan
......@@ -603,7 +604,7 @@ set_property (GObject *object, guint prop_id,
priv->id = g_value_get_uint (value);
break;
case PROP_FLAGS:
priv->flags = g_value_get_uint (value);
priv->flags = g_value_get_flags (value);
break;
case PROP_INGRESS_PRIORITY_MAP:
g_slist_free_full (priv->ingress_priority_map, g_free);
......@@ -654,7 +655,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_uint (value, priv->id);
break;
case PROP_FLAGS:
g_value_set_uint (value, priv->flags);
g_value_set_flags (value, priv->flags);
break;
case PROP_INGRESS_PRIORITY_MAP:
g_value_take_boxed (value, priority_maplist_to_strv (priv->ingress_priority_map));
......@@ -740,12 +741,13 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
**/
g_object_class_install_property
(object_class, PROP_FLAGS,
g_param_spec_uint (NM_SETTING_VLAN_FLAGS, "", "",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
g_param_spec_flags (NM_SETTING_VLAN_FLAGS, "", "",
NM_TYPE_VLAN_FLAGS,
0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingVlan:ingress-priority-map:
......
......@@ -101,7 +101,7 @@ typedef enum {
*
* #NMVlanFlags values control the behavior of the VLAN interface.
**/
typedef enum {
typedef enum { /*< flags >*/
NM_VLAN_FLAG_REORDER_HEADERS = 0x1,
NM_VLAN_FLAG_GVRP = 0x2,
NM_VLAN_FLAG_LOOSE_BINDING = 0x4,
......
......@@ -29,6 +29,7 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
/**
* SECTION:nm-setting-wireless-security
......@@ -1165,6 +1166,15 @@ finalize (GObject *object)
G_OBJECT_CLASS (nm_setting_wireless_security_parent_class)->finalize (object);
}
/* NMSettingWirelessSecurity:wep-key-type is an enum, but needs to be marshalled
* as 'u', not 'i', for backward-compatibility.
*/
static GVariant *
wep_key_type_to_dbus (const GValue *from)
{
return g_variant_new_uint32 (g_value_get_enum (from));
}
static void
set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
......@@ -1220,24 +1230,24 @@ set_property (GObject *object, guint prop_id,
priv->wep_key3 = g_value_dup_string (value);
break;
case PROP_WEP_KEY_FLAGS:
priv->wep_key_flags = g_value_get_uint (value);
priv->wep_key_flags = g_value_get_flags (value);
break;
case PROP_PSK:
g_free (priv->psk);
priv->psk = g_value_dup_string (value);
break;
case PROP_PSK_FLAGS:
priv->psk_flags = g_value_get_uint (value);
priv->psk_flags = g_value_get_flags (value);
break;
case PROP_LEAP_PASSWORD:
g_free (priv->leap_password);
priv->leap_password = g_value_dup_string (value);
break;
case PROP_LEAP_PASSWORD_FLAGS:
priv->leap_password_flags = g_value_get_uint (value);
priv->leap_password_flags = g_value_get_flags (value);
break;
case PROP_WEP_KEY_TYPE:
priv->wep_key_type = g_value_get_uint (value);
priv->wep_key_type = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -1287,22 +1297,22 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->wep_key3);
break;
case PROP_WEP_KEY_FLAGS:
g_value_set_uint (value, priv->wep_key_flags);
g_value_set_flags (value, priv->wep_key_flags);
break;
case PROP_PSK:
g_value_set_string (value, priv->psk);
break;
case PROP_PSK_FLAGS:
g_value_set_uint (value, priv->psk_flags);
g_value_set_flags (value, priv->psk_flags);
break;
case PROP_LEAP_PASSWORD:
g_value_set_string (value, priv->leap_password);
break;
case PROP_LEAP_PASSWORD_FLAGS:
g_value_set_uint (value, priv->leap_password_flags);
g_value_set_flags (value, priv->leap_password_flags);
break;
case PROP_WEP_KEY_TYPE:
g_value_set_uint (value, priv->wep_key_type);
g_value_set_enum (value, priv->wep_key_type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -1499,12 +1509,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
**/
g_object_class_install_property
(object_class, PROP_WEP_KEY_FLAGS,
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, "", "",
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,