diff options
author | Dan Winship <danw@gnome.org> | 2014-06-26 16:47:46 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-03 09:36:28 -0400 |
commit | fcfb4b40badbb5cd944cee0c9819cb2649d0bb58 (patch) | |
tree | 51694da6d5ae3e13f98e065942ee6768d835b3bd /libnm-core/nm-setting-vlan.c | |
parent | ad25e5c9706e255b459bd84feb69f826b67ee5da (diff) | |
download | NetworkManager-fcfb4b40badbb5cd944cee0c9819cb2649d0bb58.tar.gz |
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().
Diffstat (limited to 'libnm-core/nm-setting-vlan.c')
-rw-r--r-- | libnm-core/nm-setting-vlan.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c index e043518615..d797164f29 100644 --- a/libnm-core/nm-setting-vlan.c +++ b/libnm-core/nm-setting-vlan.c @@ -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: |