Getting items in a GVariant representing a tuple containing a string array



Hi,

I understand that to obtain items in a GVariant tuple, say of type
"(ub)" you would do this:

  guint32 u;
  gboolean b;
  g_variant_get(variant, "(ub)", &u, &b);

And with a GVariant which contains a null-terminated string array of
type "as" you would do this:

  GVariantIter *iter;
  gchar *str;
  g_variant_get(variant, "as", &iter);
  while (g_variant_iter_loop(iter, "s", &str))
    [ ... do something with str ... ]
  g_variant_iter_free(iter);

However, how would you get at the strings in the array if the array
were held in a tuple, of type "(as)"?

I need to do this as the tuple is received from a dbus method using
gio's dbus implementation.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]