### Struct

# Gdk ContentFormats

since: 4.0

#### Description [src]

    struct GdkContentFormats {
      /* No available fields */
    }

The `GdkContentFormats` structure is used to advertise and negotiate the format of content.

You will encounter `GdkContentFormats` when interacting with objects controlling operations that pass data between different widgets, window or application, like `GdkDrag`, `GdkDrop`, `GdkClipboard` or `GdkContentProvider`.

GDK supports content in 2 forms: `GType` and mime type. Using `GTypes` is meant only for in-process content transfers. Mime types are meant to be used for data passing both in-process and out-of-process. The details of how data is passed is described in the documentation of the actual implementations. To transform between the two forms, `GdkContentSerializer` and `GdkContentDeserializer` are used.

A `GdkContentFormats` describes a set of possible formats content can be exchanged in. It is assumed that this set is ordered. `GTypes` are more important than mime types. Order between different `GTypes` or mime types is the order they were added in, most important first. Functions that care about order, such as `gdk_content_formats_union()`, will describe in their documentation how they interpret that order, though in general the order of the first argument is considered the primary order of the result, followed by the order of further arguments.

For debugging purposes, the function `gdk_content_formats_to_string()` exists. It will print a comma-separated list of formats from most important to least important.

`GdkContentFormats` is an immutable struct. After creation, you cannot change the types it represents. Instead, new `GdkContentFormats` have to be created. The `GdkContentFormatsBuilder` structure is meant to help in this endeavor.

Available since: 4.0

#### Constructors

###### gdk_content_formats_new

Creates a new `GdkContentFormats` from an array of mime types.

since: 4.0

###### gdk_content_formats_new_for_gtype

Creates a new `GdkContentFormats` for a given `GType`.

since: 4.0

#### Functions

###### gdk_content_formats_parse

Parses the given `string` into `GdkContentFormats` and returns the formats.

since: 4.4

#### Instance methods

###### gdk_content_formats_contain_gtype

Checks if a given `GType` is part of the given `formats`.

since: 4.0

###### gdk_content_formats_contain_mime_type

Checks if a given mime type is part of the given `formats`.

since: 4.0

###### gdk_content_formats_get_gtypes

Gets the `GType`s included in `formats`.

since: 4.0

###### gdk_content_formats_get_mime_types

Gets the mime types included in `formats`.

since: 4.0

###### gdk_content_formats_match

Checks if `first` and `second` have any matching formats.

since: 4.0

###### gdk_content_formats_match_gtype

Finds the first `GType` from `first` that is also contained in `second`.

since: 4.0

###### gdk_content_formats_match_mime_type

Finds the first mime type from `first` that is also contained in `second`.

since: 4.0

###### gdk_content_formats_print

Prints the given `formats` into a string for human consumption.

since: 4.0

###### gdk_content_formats_ref

Increases the reference count of a `GdkContentFormats` by one.

since: 4.0

###### gdk_content_formats_to_string

Prints the given `formats` into a human-readable string.

since: 4.0

###### gdk_content_formats_union

Append all missing types from `second` to `first`, in the order they had in `second`.

since: 4.0

###### gdk_content_formats_union_deserialize_gtypes

Add GTypes for mime types in `formats` for which deserializers are registered.

since: 4.0

###### gdk_content_formats_union_deserialize_mime_types

Add mime types for GTypes in `formats` for which deserializers are registered.

since: 4.0

###### gdk_content_formats_union_serialize_gtypes

Add GTypes for the mime types in `formats` for which serializers are registered.

since: 4.0

###### gdk_content_formats_union_serialize_mime_types

Add mime types for GTypes in `formats` for which serializers are registered.

since: 4.0

###### gdk_content_formats_unref

Decreases the reference count of a `GdkContentFormats` by one.

since: 4.0