Method

GLibVariantDictlookup_value

Declaration

GVariant*
g_variant_dict_lookup_value (
  GVariantDict* dict,
  const gchar* key,
  const GVariantType* expected_type
)

Description

Looks up a value in a GVariantDict.

If key is not found in dictionary, NULL is returned.

The expected_type string specifies what type of value is expected. If the value associated with key has a different type then NULL is returned.

If the key is found and the value has the correct type, it is returned. If expected_type was specified then any non-NULL return value will have this type.

Available since:2.40

Parameters

key const gchar*
 

The key to look up in the dictionary.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
expected_type GVariantType
 

A GVariantType, or NULL.

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

Return value

Returns: GVariant
 

The value of the dictionary key, or NULL.

 The caller of the method takes ownership of the data, and is responsible for freeing it.