GLib.Variant.new_maybe
Description: Reference for GLib.Variant.new_maybe

### Function

# GLib Variantnew_maybe

since: 2.24

#### Declaration [src]

    GVariant*
    g_variant_new_maybe (
      const GVariantType* child_type,
      GVariant* child
    )

#### Description [src]

Depending on if `child` is `NULL`, either wraps `child` inside of a maybe container or creates a Nothing instance for the given `type`.

At least one of `child_type` and `child` must be non-`NULL`. If `child_type` is non-`NULL` then it must be a definite type. If they are both non-`NULL` then `child_type` must be the type of `child`.

If `child` is a floating reference (see g_variant_ref_sink()), the new instance takes ownership of `child`.

Available since: 2.24

#### Parameters

`child_type`

  Type: `GVariantType`

  The `GVariantType` of the child, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`child`

  Type: `GVariant`

  The child value, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `GVariant`

A floating reference to a new `GVariant` maybe instance.

The data is owned by the called function.