mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
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().
This commit is contained in:
parent
ad25e5c970
commit
fcfb4b40ba
|
@ -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,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, "", "",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:psk:
|
||||
|
@ -1532,12 +1541,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PSK_FLAGS,
|
||||
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_PSK_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_WIRELESS_SECURITY_PSK_FLAGS, "", "",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:leap-password:
|
||||
|
@ -1561,12 +1569,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_LEAP_PASSWORD_FLAGS,
|
||||
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_LEAP_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_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS, "", "",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:wep-key-type:
|
||||
|
@ -1580,11 +1587,15 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_WEP_KEY_TYPE,
|
||||
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, "", "",
|
||||
NM_WEP_KEY_TYPE_UNKNOWN,
|
||||
NM_WEP_KEY_TYPE_LAST,
|
||||
g_param_spec_enum (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, "", "",
|
||||
NM_TYPE_WEP_KEY_TYPE,
|
||||
NM_WEP_KEY_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE,
|
||||
G_VARIANT_TYPE_UINT32,
|
||||
wep_key_type_to_dbus,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -690,6 +690,10 @@ get_property_for_dbus (NMSetting *setting,
|
|||
dbus_value = property->to_dbus (&prop_value);
|
||||
else if (property->dbus_type)
|
||||
dbus_value = g_dbus_gvalue_to_gvariant (&prop_value, property->dbus_type);
|
||||
else if (g_type_is_a (prop_value.g_type, G_TYPE_ENUM))
|
||||
dbus_value = g_variant_new_int32 (g_value_get_enum (&prop_value));
|
||||
else if (g_type_is_a (prop_value.g_type, G_TYPE_FLAGS))
|
||||
dbus_value = g_variant_new_uint32 (g_value_get_flags (&prop_value));
|
||||
else
|
||||
dbus_value = g_dbus_gvalue_to_gvariant (&prop_value, variant_type_for_gtype (prop_value.g_type));
|
||||
g_value_unset (&prop_value);
|
||||
|
|
|
@ -102,7 +102,7 @@ GQuark nm_setting_error_quark (void);
|
|||
* is to be stored and/or requested when it is needed.
|
||||
*
|
||||
**/
|
||||
typedef enum {
|
||||
typedef enum { /*< flags >*/
|
||||
NM_SETTING_SECRET_FLAG_NONE = 0x00000000,
|
||||
NM_SETTING_SECRET_FLAG_AGENT_OWNED = 0x00000001,
|
||||
NM_SETTING_SECRET_FLAG_NOT_SAVED = 0x00000002,
|
||||
|
|
|
@ -575,6 +575,7 @@ make_test_wsec_setting (const char *detail)
|
|||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
|
||||
NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, "foobarbaz",
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK, "random psk",
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, NM_SETTING_SECRET_FLAG_NOT_SAVED,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, "aaaaaaaaaa",
|
||||
NULL);
|
||||
|
||||
|
@ -706,6 +707,55 @@ test_setting_to_dbus_transform (void)
|
|||
g_object_unref (s_wired);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_to_dbus_enum (void)
|
||||
{
|
||||
NMSetting *s_ip6, *s_wsec;
|
||||
GVariant *dict, *val;
|
||||
|
||||
/* enum */
|
||||
s_ip6 = nm_setting_ip6_config_new ();
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
|
||||
NULL);
|
||||
|
||||
dict = _nm_setting_to_dbus (s_ip6, NULL, NM_CONNECTION_SERIALIZE_ALL);
|
||||
g_assert (dict != NULL);
|
||||
|
||||
val = g_variant_lookup_value (dict, NM_SETTING_IP6_CONFIG_IP6_PRIVACY, G_VARIANT_TYPE_INT32);
|
||||
g_assert (val != NULL);
|
||||
g_assert_cmpint (g_variant_get_int32 (val), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
|
||||
g_variant_unref (val);
|
||||
|
||||
g_variant_unref (dict);
|
||||
g_object_unref (s_ip6);
|
||||
|
||||
/* flags (and a transformed enum) */
|
||||
s_wsec = nm_setting_wireless_security_new ();
|
||||
g_object_set (s_wsec,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_KEY,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, (NM_SETTING_SECRET_FLAG_AGENT_OWNED |
|
||||
NM_SETTING_SECRET_FLAG_NOT_SAVED),
|
||||
NULL);
|
||||
|
||||
dict = _nm_setting_to_dbus (s_wsec, NULL, NM_CONNECTION_SERIALIZE_ALL);
|
||||
g_assert (dict != NULL);
|
||||
|
||||
val = g_variant_lookup_value (dict, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, G_VARIANT_TYPE_UINT32);
|
||||
g_assert (val != NULL);
|
||||
g_assert_cmpint (g_variant_get_uint32 (val), ==, NM_WEP_KEY_TYPE_KEY);
|
||||
g_variant_unref (val);
|
||||
|
||||
val = g_variant_lookup_value (dict, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, G_VARIANT_TYPE_UINT32);
|
||||
g_assert (val != NULL);
|
||||
g_assert_cmpint (g_variant_get_uint32 (val), ==, (NM_SETTING_SECRET_FLAG_AGENT_OWNED |
|
||||
NM_SETTING_SECRET_FLAG_NOT_SAVED));
|
||||
g_variant_unref (val);
|
||||
|
||||
g_variant_unref (dict);
|
||||
g_object_unref (s_wsec);
|
||||
}
|
||||
|
||||
static void
|
||||
test_connection_to_dbus_setting_name (void)
|
||||
{
|
||||
|
@ -832,6 +882,52 @@ test_setting_new_from_dbus_transform (void)
|
|||
g_object_unref (s_wired);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_new_from_dbus_enum (void)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
GVariant *dict;
|
||||
GVariantBuilder builder;
|
||||
GError *error = NULL;
|
||||
|
||||
/* enum */
|
||||
g_variant_builder_init (&builder, NM_VARIANT_TYPE_SETTING);
|
||||
g_variant_builder_add (&builder, "{sv}",
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY,
|
||||
g_variant_new_int32 (NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR));
|
||||
dict = g_variant_builder_end (&builder);
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) _nm_setting_new_from_dbus (NM_TYPE_SETTING_IP6_CONFIG, dict, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (s_ip6), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
|
||||
|
||||
g_variant_unref (dict);
|
||||
g_object_unref (s_ip6);
|
||||
|
||||
/* flags (and a transformed enum) */
|
||||
g_variant_builder_init (&builder, NM_VARIANT_TYPE_SETTING);
|
||||
g_variant_builder_add (&builder, "{sv}",
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE,
|
||||
g_variant_new_uint32 (NM_WEP_KEY_TYPE_KEY));
|
||||
g_variant_builder_add (&builder, "{sv}",
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS,
|
||||
g_variant_new_uint32 (NM_SETTING_SECRET_FLAG_AGENT_OWNED |
|
||||
NM_SETTING_SECRET_FLAG_NOT_SAVED));
|
||||
dict = g_variant_builder_end (&builder);
|
||||
|
||||
s_wsec = (NMSettingWirelessSecurity *) _nm_setting_new_from_dbus (NM_TYPE_SETTING_WIRELESS_SECURITY, dict, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_wep_key_type (s_wsec), ==, NM_WEP_KEY_TYPE_KEY);
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_wep_key_flags (s_wsec), ==, (NM_SETTING_SECRET_FLAG_AGENT_OWNED |
|
||||
NM_SETTING_SECRET_FLAG_NOT_SAVED));
|
||||
|
||||
g_variant_unref (dict);
|
||||
g_object_unref (s_wsec);
|
||||
}
|
||||
|
||||
static NMConnection *
|
||||
new_test_connection (void)
|
||||
{
|
||||
|
@ -3184,6 +3280,7 @@ int main (int argc, char **argv)
|
|||
g_test_add_func ("/core/general/test_setting_to_dbus_no_secrets", test_setting_to_dbus_no_secrets);
|
||||
g_test_add_func ("/core/general/test_setting_to_dbus_only_secrets", test_setting_to_dbus_only_secrets);
|
||||
g_test_add_func ("/core/general/test_setting_to_dbus_transform", test_setting_to_dbus_transform);
|
||||
g_test_add_func ("/core/general/test_setting_to_dbus_enum", test_setting_to_dbus_enum);
|
||||
g_test_add_func ("/core/general/test_setting_compare_id", test_setting_compare_id);
|
||||
#define ADD_FUNC(func, secret_flags, comp_flags, remove_secret) \
|
||||
g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func), \
|
||||
|
@ -3203,6 +3300,7 @@ int main (int argc, char **argv)
|
|||
g_test_add_func ("/core/general/test_connection_to_dbus_deprecated_props", test_connection_to_dbus_deprecated_props);
|
||||
g_test_add_func ("/core/general/test_setting_new_from_dbus", test_setting_new_from_dbus);
|
||||
g_test_add_func ("/core/general/test_setting_new_from_dbus_transform", test_setting_new_from_dbus_transform);
|
||||
g_test_add_func ("/core/general/test_setting_new_from_dbus_enum", test_setting_new_from_dbus_enum);
|
||||
g_test_add_func ("/core/general/test_connection_replace_settings", test_connection_replace_settings);
|
||||
g_test_add_func ("/core/general/test_connection_replace_settings_from_connection", test_connection_replace_settings_from_connection);
|
||||
g_test_add_func ("/core/general/test_connection_replace_settings_bad", test_connection_replace_settings_bad);
|
||||
|
|
|
@ -388,13 +388,13 @@ get_property (GObject *object,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_FLAGS:
|
||||
g_value_set_uint (value, nm_access_point_get_flags (ap));
|
||||
g_value_set_flags (value, nm_access_point_get_flags (ap));
|
||||
break;
|
||||
case PROP_WPA_FLAGS:
|
||||
g_value_set_uint (value, nm_access_point_get_wpa_flags (ap));
|
||||
g_value_set_flags (value, nm_access_point_get_wpa_flags (ap));
|
||||
break;
|
||||
case PROP_RSN_FLAGS:
|
||||
g_value_set_uint (value, nm_access_point_get_rsn_flags (ap));
|
||||
g_value_set_flags (value, nm_access_point_get_rsn_flags (ap));
|
||||
break;
|
||||
case PROP_SSID:
|
||||
g_value_set_boxed (value, nm_access_point_get_ssid (ap));
|
||||
|
@ -409,7 +409,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_access_point_get_bssid (ap));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_uint (value, nm_access_point_get_mode (ap));
|
||||
g_value_set_enum (value, nm_access_point_get_mode (ap));
|
||||
break;
|
||||
case PROP_MAX_BITRATE:
|
||||
g_value_set_uint (value, nm_access_point_get_max_bitrate (ap));
|
||||
|
@ -474,12 +474,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_FLAGS,
|
||||
g_param_spec_uint (NM_ACCESS_POINT_FLAGS, "", "",
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_ACCESS_POINT_FLAGS, "", "",
|
||||
NM_TYPE_802_11_AP_FLAGS,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMAccessPoint:wpa-flags:
|
||||
|
@ -488,10 +487,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_WPA_FLAGS,
|
||||
g_param_spec_uint (NM_ACCESS_POINT_WPA_FLAGS, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_ACCESS_POINT_WPA_FLAGS, "", "",
|
||||
NM_TYPE_802_11_AP_SECURITY_FLAGS,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMAccessPoint:rsn-flags:
|
||||
|
@ -500,10 +500,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_RSN_FLAGS,
|
||||
g_param_spec_uint (NM_ACCESS_POINT_RSN_FLAGS, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_ACCESS_POINT_RSN_FLAGS, "", "",
|
||||
NM_TYPE_802_11_AP_SECURITY_FLAGS,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMAccessPoint:ssid:
|
||||
|
@ -564,8 +565,9 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_uint (NM_ACCESS_POINT_MODE, "", "",
|
||||
NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
||||
g_param_spec_enum (NM_ACCESS_POINT_MODE, "", "",
|
||||
NM_TYPE_802_11_MODE,
|
||||
NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ get_property (GObject *object,
|
|||
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_active_connection_get_devices (self)));
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, nm_active_connection_get_state (self));
|
||||
g_value_set_enum (value, nm_active_connection_get_state (self));
|
||||
break;
|
||||
case PROP_DEFAULT:
|
||||
g_value_set_boolean (value, nm_active_connection_get_default (self));
|
||||
|
@ -581,9 +581,8 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STATE,
|
||||
g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "",
|
||||
NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
|
||||
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
|
||||
g_param_spec_enum (NM_ACTIVE_CONNECTION_STATE, "", "",
|
||||
NM_TYPE_ACTIVE_CONNECTION_STATE,
|
||||
NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
|
|
@ -2017,7 +2017,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_client_get_version (self));
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, nm_client_get_state (self));
|
||||
g_value_set_enum (value, nm_client_get_state (self));
|
||||
break;
|
||||
case PROP_STARTUP:
|
||||
g_value_set_boolean (value, nm_client_get_startup (self));
|
||||
|
@ -2050,7 +2050,7 @@ get_property (GObject *object,
|
|||
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_client_get_active_connections (self)));
|
||||
break;
|
||||
case PROP_CONNECTIVITY:
|
||||
g_value_set_uint (value, priv->connectivity);
|
||||
g_value_set_enum (value, priv->connectivity);
|
||||
break;
|
||||
case PROP_PRIMARY_CONNECTION:
|
||||
g_value_set_object (value, priv->primary_connection);
|
||||
|
@ -2109,8 +2109,9 @@ nm_client_class_init (NMClientClass *client_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STATE,
|
||||
g_param_spec_uint (NM_CLIENT_STATE, "", "",
|
||||
NM_STATE_UNKNOWN, NM_STATE_CONNECTED_GLOBAL, NM_STATE_UNKNOWN,
|
||||
g_param_spec_enum (NM_CLIENT_STATE, "", "",
|
||||
NM_TYPE_STATE,
|
||||
NM_STATE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
@ -2243,8 +2244,9 @@ nm_client_class_init (NMClientClass *client_class)
|
|||
*/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CONNECTIVITY,
|
||||
g_param_spec_uint (NM_CLIENT_CONNECTIVITY, "", "",
|
||||
NM_CONNECTIVITY_UNKNOWN, NM_CONNECTIVITY_FULL, NM_CONNECTIVITY_UNKNOWN,
|
||||
g_param_spec_enum (NM_CLIENT_CONNECTIVITY, "", "",
|
||||
NM_TYPE_CONNECTIVITY_STATE,
|
||||
NM_CONNECTIVITY_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "nm-device-bt.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-object-private.h"
|
||||
#include "nm-enum-types.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE)
|
||||
|
||||
|
@ -257,7 +258,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_device_bt_get_name (device));
|
||||
break;
|
||||
case PROP_BT_CAPABILITIES:
|
||||
g_value_set_uint (value, nm_device_bt_get_capabilities (device));
|
||||
g_value_set_flags (value, nm_device_bt_get_capabilities (device));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -319,9 +320,10 @@ nm_device_bt_class_init (NMDeviceBtClass *bt_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_BT_CAPABILITIES,
|
||||
g_param_spec_uint (NM_DEVICE_BT_CAPABILITIES, "", "",
|
||||
NM_BT_CAPABILITY_NONE, G_MAXUINT32, NM_BT_CAPABILITY_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_DEVICE_BT_CAPABILITIES, "", "",
|
||||
NM_TYPE_BLUETOOTH_CAPABILITIES,
|
||||
NM_BT_CAPABILITY_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "nm-device-modem.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-object-private.h"
|
||||
#include "nm-enum-types.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceModem, nm_device_modem, NM_TYPE_DEVICE)
|
||||
|
||||
|
@ -208,10 +209,10 @@ get_property (GObject *object,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_MODEM_CAPS:
|
||||
g_value_set_uint (value, nm_device_modem_get_modem_capabilities (self));
|
||||
g_value_set_flags (value, nm_device_modem_get_modem_capabilities (self));
|
||||
break;
|
||||
case PROP_CURRENT_CAPS:
|
||||
g_value_set_uint (value, nm_device_modem_get_current_capabilities (self));
|
||||
g_value_set_flags (value, nm_device_modem_get_current_capabilities (self));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -249,10 +250,11 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODEM_CAPS,
|
||||
g_param_spec_uint (NM_DEVICE_MODEM_MODEM_CAPABILITIES, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_DEVICE_MODEM_MODEM_CAPABILITIES, "", "",
|
||||
NM_TYPE_DEVICE_MODEM_CAPABILITIES,
|
||||
NM_DEVICE_MODEM_CAPABILITY_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMDeviceModem:current-capabilities:
|
||||
|
@ -262,8 +264,9 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CURRENT_CAPS,
|
||||
g_param_spec_uint (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, "", "",
|
||||
NM_TYPE_DEVICE_MODEM_CAPABILITIES,
|
||||
NM_DEVICE_MODEM_CAPABILITY_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
|
|
@ -588,7 +588,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_device_wifi_get_permanent_hw_address (self));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_uint (value, nm_device_wifi_get_mode (self));
|
||||
g_value_set_enum (value, nm_device_wifi_get_mode (self));
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
g_value_set_uint (value, nm_device_wifi_get_bitrate (self));
|
||||
|
@ -597,7 +597,7 @@ get_property (GObject *object,
|
|||
g_value_set_object (value, nm_device_wifi_get_active_access_point (self));
|
||||
break;
|
||||
case PROP_WIRELESS_CAPABILITIES:
|
||||
g_value_set_uint (value, nm_device_wifi_get_capabilities (self));
|
||||
g_value_set_flags (value, nm_device_wifi_get_capabilities (self));
|
||||
break;
|
||||
case PROP_ACCESS_POINTS:
|
||||
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_wifi_get_access_points (self)));
|
||||
|
@ -753,8 +753,9 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_uint (NM_DEVICE_WIFI_MODE, "", "",
|
||||
NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_AP, NM_802_11_MODE_INFRA,
|
||||
g_param_spec_enum (NM_DEVICE_WIFI_MODE, "", "",
|
||||
NM_TYPE_802_11_MODE,
|
||||
NM_802_11_MODE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
@ -789,10 +790,11 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_WIRELESS_CAPABILITIES,
|
||||
g_param_spec_uint (NM_DEVICE_WIFI_CAPABILITIES, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_DEVICE_WIFI_CAPABILITIES, "", "",
|
||||
NM_TYPE_DEVICE_WIFI_CAPABILITIES,
|
||||
NM_WIFI_DEVICE_CAP_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMDeviceWifi:access-points:
|
||||
|
|
|
@ -389,7 +389,7 @@ get_property (GObject *object,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE_TYPE:
|
||||
g_value_set_uint (value, nm_device_get_device_type (device));
|
||||
g_value_set_enum (value, nm_device_get_device_type (device));
|
||||
break;
|
||||
case PROP_UDI:
|
||||
g_value_set_string (value, nm_device_get_udi (device));
|
||||
|
@ -410,7 +410,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_device_get_firmware_version (device));
|
||||
break;
|
||||
case PROP_CAPABILITIES:
|
||||
g_value_set_uint (value, nm_device_get_capabilities (device));
|
||||
g_value_set_flags (value, nm_device_get_capabilities (device));
|
||||
break;
|
||||
case PROP_MANAGED:
|
||||
g_value_set_boolean (value, nm_device_get_managed (device));
|
||||
|
@ -434,7 +434,7 @@ get_property (GObject *object,
|
|||
g_value_set_object (value, nm_device_get_dhcp6_config (device));
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, nm_device_get_state (device));
|
||||
g_value_set_enum (value, nm_device_get_state (device));
|
||||
break;
|
||||
case PROP_STATE_REASON:
|
||||
g_value_set_uint (value, nm_device_get_state_reason (device));
|
||||
|
@ -476,7 +476,7 @@ set_property (GObject *object,
|
|||
switch (prop_id) {
|
||||
case PROP_DEVICE_TYPE:
|
||||
/* Construct only */
|
||||
priv->device_type = g_value_get_uint (value);
|
||||
priv->device_type = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_AUTOCONNECT:
|
||||
b = g_value_get_boolean (value);
|
||||
|
@ -545,8 +545,9 @@ nm_device_class_init (NMDeviceClass *device_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_DEVICE_TYPE,
|
||||
g_param_spec_uint (NM_DEVICE_DEVICE_TYPE, "", "",
|
||||
NM_DEVICE_TYPE_UNKNOWN, G_MAXUINT32, NM_DEVICE_TYPE_UNKNOWN,
|
||||
g_param_spec_enum (NM_DEVICE_DEVICE_TYPE, "", "",
|
||||
NM_TYPE_DEVICE_TYPE,
|
||||
NM_DEVICE_TYPE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
|
@ -609,10 +610,11 @@ nm_device_class_init (NMDeviceClass *device_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CAPABILITIES,
|
||||
g_param_spec_uint (NM_DEVICE_CAPABILITIES, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_param_spec_flags (NM_DEVICE_CAPABILITIES, "", "",
|
||||
NM_TYPE_DEVICE_CAPABILITIES,
|
||||
NM_DEVICE_CAP_NONE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMDevice:managed:
|
||||
|
@ -706,8 +708,9 @@ nm_device_class_init (NMDeviceClass *device_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STATE,
|
||||
g_param_spec_uint (NM_DEVICE_STATE, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
g_param_spec_enum (NM_DEVICE_STATE, "", "",
|
||||
NM_TYPE_DEVICE_STATE,
|
||||
NM_DEVICE_STATE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
|
|
@ -1318,6 +1318,28 @@ demarshal_generic (NMObject *object,
|
|||
*param = g_bytes_new (val, length);
|
||||
else
|
||||
*param = NULL;
|
||||
} else if (G_IS_PARAM_SPEC_ENUM (pspec)) {
|
||||
int *param = (int *) field;
|
||||
|
||||
if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32))
|
||||
*param = g_variant_get_int32 (value);
|
||||
else if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))
|
||||
*param = g_variant_get_uint32 (value);
|
||||
else {
|
||||
success = FALSE;
|
||||
goto done;
|
||||
}
|
||||
} else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
|
||||
guint *param = (guint *) field;
|
||||
|
||||
if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32))
|
||||
*param = g_variant_get_int32 (value);
|
||||
else if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))
|
||||
*param = g_variant_get_uint32 (value);
|
||||
else {
|
||||
success = FALSE;
|
||||
goto done;
|
||||
}
|
||||
} else if (pspec->value_type == G_TYPE_BOOLEAN)
|
||||
HANDLE_TYPE (G_VARIANT_TYPE_BOOLEAN, gboolean, g_variant_get_boolean);
|
||||
else if (pspec->value_type == G_TYPE_UCHAR)
|
||||
|
|
|
@ -163,7 +163,7 @@ get_property (GObject *object,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_VPN_STATE:
|
||||
g_value_set_uint (value, nm_vpn_connection_get_vpn_state (self));
|
||||
g_value_set_enum (value, nm_vpn_connection_get_vpn_state (self));
|
||||
break;
|
||||
case PROP_BANNER:
|
||||
g_value_set_string (value, nm_vpn_connection_get_banner (self));
|
||||
|
@ -201,9 +201,8 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_VPN_STATE,
|
||||
g_param_spec_uint (NM_VPN_CONNECTION_VPN_STATE, "", "",
|
||||
NM_VPN_CONNECTION_STATE_UNKNOWN,
|
||||
NM_VPN_CONNECTION_STATE_DISCONNECTED,
|
||||
g_param_spec_enum (NM_VPN_CONNECTION_VPN_STATE, "", "",
|
||||
NM_TYPE_VPN_CONNECTION_STATE,
|
||||
NM_VPN_CONNECTION_STATE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
|
|
@ -796,7 +796,7 @@ set_property (GObject *object, guint prop_id,
|
|||
break;
|
||||
case PROP_STATE:
|
||||
nm_vpn_plugin_set_state (NM_VPN_PLUGIN (object),
|
||||
(NMVpnServiceState) g_value_get_uint (value));
|
||||
(NMVpnServiceState) g_value_get_enum (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -815,7 +815,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_string (value, priv->dbus_service_name);
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, nm_vpn_plugin_get_state (NM_VPN_PLUGIN (object)));
|
||||
g_value_set_enum (value, nm_vpn_plugin_get_state (NM_VPN_PLUGIN (object)));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -949,9 +949,8 @@ nm_vpn_plugin_class_init (NMVpnPluginClass *plugin_class)
|
|||
*/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STATE,
|
||||
g_param_spec_uint (NM_VPN_PLUGIN_STATE, "", "",
|
||||
NM_VPN_SERVICE_STATE_UNKNOWN,
|
||||
NM_VPN_SERVICE_STATE_STOPPED,
|
||||
g_param_spec_enum (NM_VPN_PLUGIN_STATE, "", "",
|
||||
NM_TYPE_VPN_SERVICE_STATE,
|
||||
NM_VPN_SERVICE_STATE_INIT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nm-wimax-nsp.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-object-private.h"
|
||||
#include "nm-enum-types.h"
|
||||
|
||||
G_DEFINE_TYPE (NMWimaxNsp, nm_wimax_nsp, NM_TYPE_OBJECT)
|
||||
|
||||
|
@ -206,7 +207,7 @@ get_property (GObject *object,
|
|||
g_value_set_uint (value, nm_wimax_nsp_get_signal_quality (nsp));
|
||||
break;
|
||||
case PROP_NETWORK_TYPE:
|
||||
g_value_set_uint (value, nm_wimax_nsp_get_network_type (nsp));
|
||||
g_value_set_enum (value, nm_wimax_nsp_get_network_type (nsp));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -281,8 +282,9 @@ nm_wimax_nsp_class_init (NMWimaxNspClass *nsp_class)
|
|||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_NETWORK_TYPE,
|
||||
g_param_spec_uint (NM_WIMAX_NSP_NETWORK_TYPE, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
g_param_spec_enum (NM_WIMAX_NSP_NETWORK_TYPE, "", "",
|
||||
NM_TYPE_WIMAX_NSP_NETWORK_TYPE,
|
||||
NM_WIMAX_NSP_NETWORK_TYPE_UNKNOWN,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue