summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-dcb.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-08-16 10:09:48 -0400
committerDan Winship <danw@gnome.org>2014-09-18 11:51:09 -0400
commitacf86f68b33b14070d9b03a681fe94ffeead66ef (patch)
tree28069ac74e5bc7ecfc185495969cdeab7ca203a8 /libnm-core/nm-setting-dcb.c
parent4750559548fd1a0fb73cb826fa818dfe1e4f6940 (diff)
downloadNetworkManager-acf86f68b33b14070d9b03a681fe94ffeead66ef.tar.gz
libnm-core: change connection hash tables to variants in API
In preparation for porting to GDBus, make nm_connection_to_dbus(), etc, represent connections as GVariants of type 'a{sa{sv}}' rather than as GHashTables-of-GHashTables-of-GValues. This means we're constantly converting back and forth internally, but this is just a stepping stone on the way to the full GDBus port, and all of that code will go away again later.
Diffstat (limited to 'libnm-core/nm-setting-dcb.c')
-rw-r--r--libnm-core/nm-setting-dcb.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/libnm-core/nm-setting-dcb.c b/libnm-core/nm-setting-dcb.c
index 67955b5809..8943db6b8f 100644
--- a/libnm-core/nm-setting-dcb.c
+++ b/libnm-core/nm-setting-dcb.c
@@ -20,13 +20,11 @@
*/
#include <string.h>
-#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include "nm-setting-dcb.h"
#include "nm-utils.h"
#include "nm-utils-private.h"
-#include "nm-dbus-glib-types.h"
#include "nm-setting-private.h"
/**
@@ -777,23 +775,23 @@ set_gvalue_from_array (GValue *v, uint *a, size_t len)
#define SET_GVALUE_FROM_ARRAY(v, a) set_gvalue_from_array (v, a, G_N_ELEMENTS (a))
-static void
-_nm_setting_dcb_uint_array_to_dbus (const GValue *prop_value,
- GValue *dbus_value)
+static GVariant *
+_nm_setting_dcb_uint_array_to_dbus (const GValue *prop_value)
{
GArray *src = g_value_get_boxed (prop_value);
- set_gvalue_from_array (dbus_value, (guint *) src->data, src->len);
+ return g_variant_new_fixed_array (G_VARIANT_TYPE_UINT32, src->data, src->len, sizeof (guint32));
}
static void
-_nm_setting_dcb_uint_array_from_dbus (const GValue *dbus_value,
+_nm_setting_dcb_uint_array_from_dbus (GVariant *dbus_value,
GValue *prop_value)
{
- GArray *src = g_value_get_boxed (dbus_value);
-
- set_gvalue_from_array (prop_value, (guint *) src->data, src->len);
+ gconstpointer array;
+ gsize length;
+ array = g_variant_get_fixed_array (dbus_value, &length, sizeof (guint32));
+ set_gvalue_from_array (prop_value, (guint *) array, length);
}
static void
@@ -1058,7 +1056,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_FLOW_CONTROL,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
@@ -1092,7 +1090,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_GROUP_ID,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
@@ -1113,7 +1111,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
@@ -1135,7 +1133,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_BANDWIDTH,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
@@ -1155,7 +1153,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
@@ -1175,7 +1173,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_transform_property (parent_class, NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS,
- DBUS_TYPE_G_UINT_ARRAY,
+ G_VARIANT_TYPE ("au"),
_nm_setting_dcb_uint_array_to_dbus,
_nm_setting_dcb_uint_array_from_dbus);
}