summaryrefslogtreecommitdiff
path: root/libnm/nm-device-bt.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-06-26 16:47:46 -0400
committerDan Winship <danw@gnome.org>2014-10-03 09:36:28 -0400
commitfcfb4b40badbb5cd944cee0c9819cb2649d0bb58 (patch)
tree51694da6d5ae3e13f98e065942ee6768d835b3bd /libnm/nm-device-bt.c
parentad25e5c9706e255b459bd84feb69f826b67ee5da (diff)
downloadNetworkManager-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/nm-device-bt.c')
-rw-r--r--libnm/nm-device-bt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libnm/nm-device-bt.c b/libnm/nm-device-bt.c
index b5cefe817f..5bd93b9773 100644
--- a/libnm/nm-device-bt.c
+++ b/libnm/nm-device-bt.c
@@ -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));
}