Commit e96b1270 authored by Thomas Haller's avatar Thomas Haller

core: sort DHCP options that are exported on D-Bus

Otherwise, the order is undefined and unstable. If you call
GetManagedObjects() on D-Bus multiple times, it's a very nice
property if the diff is small and not full not noise.
parent 86b54a65
......@@ -27,6 +27,7 @@
#include "nm-dbus-interface.h"
#include "nm-utils.h"
#include "nm-dbus-object.h"
#include "nm-core-utils.h"
/*****************************************************************************/
......@@ -58,22 +59,14 @@ nm_dhcp4_config_set_options (NMDhcp4Config *self,
GHashTable *options)
{
NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self);
GHashTableIter iter;
const char *key, *value;
GVariantBuilder builder;
GVariant *val;
g_return_if_fail (NM_IS_DHCP4_CONFIG (self));
g_return_if_fail (options != NULL);
g_return_if_fail (options);
val = nm_utils_strdict_to_variant (options);
g_variant_unref (priv->options);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_hash_table_iter_init (&iter, options);
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
g_variant_builder_add (&builder, "{sv}", key, g_variant_new_string (value));
priv->options = g_variant_builder_end (&builder);
g_variant_ref_sink (priv->options);
priv->options = g_variant_ref_sink (val);
_notify (self, PROP_OPTIONS);
}
......
......@@ -27,6 +27,7 @@
#include "nm-dbus-interface.h"
#include "nm-utils.h"
#include "nm-dbus-object.h"
#include "nm-core-utils.h"
/*****************************************************************************/
......@@ -58,22 +59,14 @@ nm_dhcp6_config_set_options (NMDhcp6Config *self,
GHashTable *options)
{
NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self);
GHashTableIter iter;
const char *key, *value;
GVariantBuilder builder;
GVariant *val;
g_return_if_fail (NM_IS_DHCP6_CONFIG (self));
g_return_if_fail (options != NULL);
g_return_if_fail (options);
val = nm_utils_strdict_to_variant (options);
g_variant_unref (priv->options);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_hash_table_iter_init (&iter, options);
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
g_variant_builder_add (&builder, "{sv}", key, g_variant_new_string (value));
priv->options = g_variant_builder_end (&builder);
g_variant_ref_sink (priv->options);
priv->options = g_variant_ref_sink (val);
_notify (self, PROP_OPTIONS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment