summaryrefslogtreecommitdiff
path: root/callouts
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 /callouts
parent4750559548fd1a0fb73cb826fa818dfe1e4f6940 (diff)
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 'callouts')
-rw-r--r--callouts/nm-dispatcher-utils.c2
-rw-r--r--callouts/tests/test-dispatcher-envp.c21
2 files changed, 2 insertions, 21 deletions
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index 9a16880a57..66b6a07fd8 100644
--- a/callouts/nm-dispatcher-utils.c
+++ b/callouts/nm-dispatcher-utils.c
@@ -406,7 +406,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
}
/* UUID and ID */
- con_setting = g_variant_lookup_value (connection_dict, NM_SETTING_CONNECTION_SETTING_NAME, G_VARIANT_TYPE ("a{sv}"));
+ con_setting = g_variant_lookup_value (connection_dict, NM_SETTING_CONNECTION_SETTING_NAME, NM_VARIANT_TYPE_SETTING);
if (!con_setting) {
g_warning ("Failed to read connection setting");
return NULL;
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c
index b51c1c16a5..c2f1b41df7 100644
--- a/callouts/tests/test-dispatcher-envp.c
+++ b/callouts/tests/test-dispatcher-envp.c
@@ -30,25 +30,9 @@
#include "nm-dispatcher-utils.h"
#include "nm-dispatcher-api.h"
#include "nm-utils.h"
-#include "nm-dbus-glib-types.h"
/*******************************************/
-static GVariant *
-connection_hash_to_dict (GHashTable *hash)
-{
- GValue val = { 0, };
- GVariant *dict;
-
- g_value_init (&val, DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT);
- g_value_set_boxed (&val, hash);
- dict = dbus_g_value_build_g_variant (&val);
- g_value_unset (&val);
-
- g_variant_ref_sink (dict);
- return dict;
-}
-
static gboolean
parse_main (GKeyFile *kf,
GVariant **out_con_dict,
@@ -62,7 +46,6 @@ parse_main (GKeyFile *kf,
NMConnection *connection;
NMSettingConnection *s_con;
GVariantBuilder props;
- GHashTable *con_hash;
*out_expected_iface = g_key_file_get_string (kf, "main", "expected-iface", error);
if (*out_expected_iface == NULL)
@@ -93,10 +76,8 @@ parse_main (GKeyFile *kf,
g_free (id);
nm_connection_add_setting (connection, NM_SETTING (s_con));
- con_hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
+ *out_con_dict = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
g_object_unref (connection);
- *out_con_dict = connection_hash_to_dict (con_hash);
- g_hash_table_unref (con_hash);
g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&props, "{sv}",