aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-01-26 20:19:33 -0600
committerTed Gould <ted@gould.cx>2012-01-26 20:19:33 -0600
commit73a653d45a9be59d50f0ae14ab595719565cd32f (patch)
treeb7b0a5550a3acbf33326a08d6c75ac91dbcee243 /tests
parentd27208df523d669e2bf86ab0506634d0ae86e558 (diff)
downloadlibdbusmenu-73a653d45a9be59d50f0ae14ab595719565cd32f.tar.gz
libdbusmenu-73a653d45a9be59d50f0ae14ab595719565cd32f.tar.bz2
libdbusmenu-73a653d45a9be59d50f0ae14ab595719565cd32f.zip
Adding a way for the node2variant to know the name of what it's parsing
Diffstat (limited to 'tests')
-rw-r--r--tests/json-loader.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/json-loader.c b/tests/json-loader.c
index 36157dc..26fd768 100644
--- a/tests/json-loader.c
+++ b/tests/json-loader.c
@@ -21,13 +21,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "json-loader.h"
-static GVariant * node2variant (JsonNode * node);
+static GVariant * node2variant (JsonNode * node, const gchar * name);
static void
array_foreach (JsonArray * array, guint index, JsonNode * node, gpointer user_data)
{
GVariantBuilder * builder = (GVariantBuilder *)user_data;
- GVariant * variant = node2variant(node);
+ GVariant * variant = node2variant(node, NULL);
if (variant != NULL) {
g_variant_builder_add_value(builder, variant);
}
@@ -38,7 +38,7 @@ static void
object_foreach (JsonObject * array, const gchar * member, JsonNode * node, gpointer user_data)
{
GVariantBuilder * builder = (GVariantBuilder *)user_data;
- GVariant * variant = node2variant(node);
+ GVariant * variant = node2variant(node, member);
if (variant != NULL) {
g_variant_builder_add(builder, "{sv}", member, variant);
}
@@ -46,7 +46,7 @@ object_foreach (JsonObject * array, const gchar * member, JsonNode * node, gpoin
}
static GVariant *
-node2variant (JsonNode * node)
+node2variant (JsonNode * node, const gchar * name)
{
if (node == NULL) {
return NULL;
@@ -105,7 +105,7 @@ set_props (DbusmenuMenuitem * mi, JsonObject * node)
if (!g_strcmp0(member, "submenu")) { continue; }
JsonNode * lnode = json_object_get_member(node, member);
- GVariant * variant = node2variant(lnode);
+ GVariant * variant = node2variant(lnode, member);
if (variant != NULL) {
dbusmenu_menuitem_property_set_variant(mi, member, variant);