Method

GLibVariantBuilderadd

since: 2.24

Declaration [src]

void
g_variant_builder_add (
  GVariantBuilder* builder,
  const gchar* format_string,
  ...
)

Description [src]

Adds to a GVariantBuilder.

This call is a convenience wrapper that is exactly equivalent to calling g_variant_new() followed by g_variant_builder_add_value().

Note that the arguments must be of the correct width for their types specified in format_string. This can be achieved by casting them. See the GVariant varargs documentation.

This function might be used as follows:

GVariant *
make_pointless_dictionary (void)
{
  GVariantBuilder builder;
  int i;

  g_variant_builder_init_static (&builder, G_VARIANT_TYPE_ARRAY);
  for (i = 0; i < 16; i++)
    {
      gchar buf[3];

      sprintf (buf, "%d", i);
      g_variant_builder_add (&builder, "{is}", i, buf);
    }

  return g_variant_builder_end (&builder);
}

Available since: 2.24

This method is not directly available to language bindings.

Parameters

format_string

Type: const gchar*

A GVariant varargs format string.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
...

Type: 

Arguments, as per format_string.