libotutil: Add API to create an "ay" GVariant from GBytes

We used to have a version of this, but since I'm trying to use
GBytes more, this became a more common operation, and it's annoying
to type out the whole G_VARIANT_TYPE ("ay") each time, and pass
TRUE for trusted.

https://bugzilla.gnome.org/show_bug.cgi?id=706031
This commit is contained in:
Colin Walters committed 2013-08-14 19:23:33 -04:00
1 parent 71f6f10cd2
commit 76cd7ae4ea
3 files changed
+11 -3

No files matched your search

+6
View File
@@ -41,6 +41,12 @@ ot_gvariant_new_bytearray (const guchar *data,
return ret;
}
GVariant *
ot_gvariant_new_ay_bytes (GBytes *bytes)
{
return g_variant_new_from_bytes (G_VARIANT_TYPE ("ay"), bytes, TRUE);
}
GHashTable *
ot_util_variant_asv_to_hash_table (GVariant *variant)
{
+2
View File
@@ -29,6 +29,8 @@ G_BEGIN_DECLS
GVariant *ot_gvariant_new_bytearray (const guchar *data,
gsize len);
GVariant *ot_gvariant_new_ay_bytes (GBytes *bytes);
GHashTable *ot_util_variant_asv_to_hash_table (GVariant *variant);
GVariant * ot_util_variant_take_ref (GVariant *variant);