summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-01 12:24:25 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-01 12:25:50 -0400
commit213476252cbf171f6f65361e763cfab6614c407b (patch)
tree62d39de3eb5207976ccf8f07fc71b5af232c5a98 /service
parenta27c6a3e9c38a96cc8a11294d5b4ae03b986cfd7 (diff)
downloaddconf-213476252cbf171f6f65361e763cfab6614c407b.tar.gz
service: Drop a level of variant wrapping
Internally, the service was passing around GVariant values with an extra layer of variant wrapping (ie: how we received them off the wire). Stop doing that because it's pointless.
Diffstat (limited to 'service')
-rw-r--r--service/dconf-rebuilder.c5
-rw-r--r--service/service.c13
2 files changed, 9 insertions, 9 deletions
diff --git a/service/dconf-rebuilder.c b/service/dconf-rebuilder.c
index d7f4cb3..65271cd 100644
--- a/service/dconf-rebuilder.c
+++ b/service/dconf-rebuilder.c
@@ -97,12 +97,9 @@ dconf_rebuilder_put_item (DConfRebuilderState *state)
if (state->values[state->index] != NULL)
{
gchar *fullname;
- GVariant *ouch;
fullname = g_strconcat (state->prefix, state->keys[state->index], NULL);
- ouch = g_variant_get_variant (state->values[state->index]);
- dconf_rebuilder_insert (state->table, fullname, ouch);
- g_variant_unref (ouch);
+ dconf_rebuilder_insert (state->table, fullname, state->values[state->index]);
g_free (fullname);
}
diff --git a/service/service.c b/service/service.c
index 84ede50..3a87b63 100644
--- a/service/service.c
+++ b/service/service.c
@@ -95,7 +95,7 @@ emit_notify_signal (GDBusConnection *connection,
}
static void
-unwrap_maybe (GVariant **ptr)
+unwrap_maybe_and_variant (GVariant **ptr)
{
GVariant *array, *child;
gsize n_children;
@@ -109,11 +109,12 @@ unwrap_maybe (GVariant **ptr)
child = NULL;
break;
case 1: default:
- child = g_variant_get_child_value (array, 0);
+ g_variant_get_child (array, 0, "v", &child);
break;
case 2:
{
GVariant *untrusted;
+ GVariant *trusted;
GVariant *ay;
g_variant_get_child (array, 0, "v", &ay);
@@ -130,8 +131,10 @@ unwrap_maybe (GVariant **ptr)
FALSE,
(GDestroyNotify) g_variant_unref, ay);
g_variant_ref_sink (untrusted);
- child = g_variant_get_normal_form (untrusted);
+ trusted = g_variant_get_normal_form (untrusted);
g_variant_unref (untrusted);
+
+ g_variant_get (trusted, "v", &child);
}
}
@@ -244,7 +247,7 @@ method_call (GDBusConnection *connection,
g_variant_get (parameters, "(@s@av)", &keyvalue, &value);
key = g_variant_get_string (keyvalue, &key_length);
g_variant_unref (keyvalue);
- unwrap_maybe (&value);
+ unwrap_maybe_and_variant (&value);
if (key[0] != '/' || strstr (key, "//"))
{
@@ -312,7 +315,7 @@ method_call (GDBusConnection *connection,
values = g_new (GVariant *, length);
while (g_variant_iter_next (iter, "(&s@av)", &keys[i], &values[i]))
{
- unwrap_maybe (&values[i]);
+ unwrap_maybe_and_variant (&values[i]);
if (keys[i][0] == '/' || strstr (keys[i], "//") ||
(i > 0 && !(strcmp (keys[i - 1], keys[i]) < 0)))