I have this array of 2 int's I want to sent over dbus. It always complains that value is not of type tuple or null depending on the attempt. Hwow does it need to look like?
GVariantBuilder builder;
g_variant_builder_init(&builder, G_VARIANT_TYPE("a(ii)"));
g_variant_builder_add(&builder, "(ii)", 99, 99);
g_variant_builder_add(&builder, "(ii)", 98, 98);
GVariant *value = g_variant_new("a(ii)", &builder);
g_dbus_method_invocation_return_value(invocation, value));
//g_dbus_method_invocation_return_value(invocation, &value)); - also tried
//Previous attempts
//GVariantBuilder *builder;
// builder = g_variant_builder_new(G_VARIANT_TYPE("a(ii)"));
//g_variant_builder_add(&builder, "(ii)", 99, 99);
//g_variant_builder_add(&builder, "(ii)", 98, 98);
//and
//g_variant_builder_add(builder, "(ii)", 99, 99);
//g_variant_builder_add(builder, "(ii)", 98, 98);
GVariantBuilder
is not meant to be used as the payload for aGVariant
: it's a builder pattern object, which will construct theGVariant
from its contents:You should see the documentation for
g_variant_builder_init()
andg_variant_builder_end()
for more information.