Function
Giodbus_gvalue_to_gvariant
since: 2.30
Declaration [src]
GVariant*
g_dbus_gvalue_to_gvariant (
  const GValue* gvalue,
  const GVariantType* type
)
Description [src]
Converts a GValue to a GVariant of the type indicated by the type
parameter.
The conversion is using the following rules:
- G_TYPE_STRING: ‘s’, ‘o’, ‘g’ or ‘ay’
- G_TYPE_STRV: ‘as’, ‘ao’ or ‘aay’
- G_TYPE_BOOLEAN: ‘b’
- G_TYPE_UCHAR: ‘y’
- G_TYPE_INT: ‘i’, ‘n’
- G_TYPE_UINT: ‘u’, ‘q’
- G_TYPE_INT64: ‘x’
- G_TYPE_UINT64: ‘t’
- G_TYPE_DOUBLE: ‘d’
- G_TYPE_VARIANT: Any- GVariantType
This can fail if e.g. gvalue is of type G_TYPE_STRING and type
is ‘i’, i.e. G_VARIANT_TYPE_INT32. It will also fail for any GType
(including e.g. G_TYPE_OBJECT and G_TYPE_BOXED derived-types) not
in the table above.
Note that if gvalue is of type G_TYPE_VARIANT and its value is
NULL, the empty GVariant instance (never NULL) for type is
returned (e.g. 0 for scalar types, the empty string for string types,
‘/’ for object path types, the empty array for any array type and so on).
See the g_dbus_gvariant_to_gvalue() function for how to convert a
GVariant to a GValue.
Available since: 2.30
Parameters
- gvalue
- 
            Type: GValueA GValueto convert to aGVariant.The data is owned by the caller of the function. 
- type
- 
            Type: GVariantTypeA GVariantType.The data is owned by the caller of the function. 
Return value
Type: GVariant
A GVariant (never floating) of
    GVariantType type holding the data from gvalue or an empty GVariant
    in case of failure. Free with g_variant_unref().
| The caller of the function takes ownership of the data, and is responsible for freeing it. |