diff options
author | Ted Gould <ted@gould.cx> | 2012-01-26 20:20:23 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-01-26 20:20:23 -0600 |
commit | 5b7844d079fe1579f60c1bc4fbcc5da128c70138 (patch) | |
tree | 42454f3f2461d186e903d891f10e5589e6f896f8 | |
parent | 73a653d45a9be59d50f0ae14ab595719565cd32f (diff) | |
download | libdbusmenu-5b7844d079fe1579f60c1bc4fbcc5da128c70138.tar.gz libdbusmenu-5b7844d079fe1579f60c1bc4fbcc5da128c70138.tar.bz2 libdbusmenu-5b7844d079fe1579f60c1bc4fbcc5da128c70138.zip |
If we see the 'icon-data' we undo a base64 string and make it a binary
-rw-r--r-- | tests/json-loader.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/json-loader.c b/tests/json-loader.c index 26fd768..7f0ec8e 100644 --- a/tests/json-loader.c +++ b/tests/json-loader.c @@ -62,8 +62,17 @@ node2variant (JsonNode * node, const gchar * name) return g_variant_new_double(json_node_get_double(node)); case G_TYPE_BOOLEAN: return g_variant_new_boolean(json_node_get_boolean(node)); - case G_TYPE_STRING: - return g_variant_new_string(json_node_get_string(node)); + case G_TYPE_STRING: { + if (g_strcmp0(name, DBUSMENU_MENUITEM_PROP_ICON_DATA) != 0) { + return g_variant_new_string(json_node_get_string(node)); + } else { + gsize length; + guchar * b64 = g_base64_decode(json_node_get_string(node), &length); + GVariant * retval = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, b64, length, sizeof(guchar)); + g_free(b64); + return retval; + } + } default: g_assert_not_reached(); } |