## GdkContentDeserializer GdkContentDeserializer — Deserialize content for transfer |

## Functions

void | (*GdkContentDeserializeFunc) ()
const char * | gdk_content_deserializer_get_mime_type ()
GType | gdk_content_deserializer_get_gtype ()
GValue * | gdk_content_deserializer_get_value ()
GInputStream * | gdk_content_deserializer_get_input_stream ()
int | gdk_content_deserializer_get_priority ()
GCancellable * | gdk_content_deserializer_get_cancellable ()
gpointer | gdk_content_deserializer_get_user_data ()
void | gdk_content_deserializer_set_task_data ()
gpointer | gdk_content_deserializer_get_task_data ()
void | gdk_content_deserializer_return_success ()
void | gdk_content_deserializer_return_error ()
void | gdk_content_register_deserializer ()
void | gdk_content_deserialize_async ()
gboolean | gdk_content_deserialize_finish ()

## Types and Values

| GdkContentDeserializer

## Object Hierarchy

        GObject
        ╰── GdkContentDeserializer

## Implemented Interfaces

GdkContentDeserializer implements GAsyncResult.

## Includes

    #include <gdk/gdk.h>

## Description

A GdkContentDeserializer is used to deserialize content received via inter-application data transfers.

## Functions

### GdkContentDeserializeFunc ()

    void
    (*GdkContentDeserializeFunc) (GdkContentDeserializer *deserializer);

The type of a function that can be registered with `gdk_content_register_deserializer()`. When the function gets called to operate on content, it can call functions on the `deserializer` object to obtain the mime type, input stream, user data, etc. for its operation.

#### Parameters

deserializer | a GdkContentDeserializer |

### gdk_content_deserializer_get_mime_type ()

    const char *
    gdk_content_deserializer_get_mime_type
                                   (GdkContentDeserializer *deserializer);

Gets the mime type to deserialize from.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the mime type for the current operation.

[transfer none]

### gdk_content_deserializer_get_gtype ()

    GType
    gdk_content_deserializer_get_gtype (GdkContentDeserializer *deserializer);

Gets the GType to create an instance of.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the GType for the current operation

### gdk_content_deserializer_get_value ()

    GValue *
    gdk_content_deserializer_get_value (GdkContentDeserializer *deserializer);

Gets the GValue to store the deserialized object in.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the GValue for the current operation.

[transfer none]

### gdk_content_deserializer_get_input_stream ()

    GInputStream *
    gdk_content_deserializer_get_input_stream
                                   (GdkContentDeserializer *deserializer);

Gets the input stream that was passed to `gdk_content_deserialize_async()`.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the input stream for the current operation.

[transfer none]

### gdk_content_deserializer_get_priority ()

    int
    gdk_content_deserializer_get_priority (GdkContentDeserializer *deserializer);

Gets the io priority that was passed to `gdk_content_deserialize_async()`.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the io priority for the current operation

### gdk_content_deserializer_get_cancellable ()

    GCancellable *
    gdk_content_deserializer_get_cancellable
                                   (GdkContentDeserializer *deserializer);

Gets the cancellable that was passed to `gdk_content_deserialize_async()`.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the cancellable for the current operation.

[transfer none]

### gdk_content_deserializer_get_user_data ()

    gpointer
    gdk_content_deserializer_get_user_data
                                   (GdkContentDeserializer *deserializer);

Gets the user data that was passed when the deserializer was registered.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the user data for this deserializer.

[transfer none]

### gdk_content_deserializer_set_task_data ()

    void
    gdk_content_deserializer_set_task_data
                                   (GdkContentDeserializer *deserializer,
                                    gpointer data,
                                    GDestroyNotify notify);

Associate data with the current deserialization operation.

#### Parameters

deserializer | a GdkContentDeserializer |
data | data to associate with this operation |
notify | destroy notify for `data` |

### gdk_content_deserializer_get_task_data ()

    gpointer
    gdk_content_deserializer_get_task_data
                                   (GdkContentDeserializer *deserializer);

Gets the data that was associated with `deserializer` via `gdk_content_deserializer_set_task_data()`.

#### Parameters

deserializer | a GdkContentDeserializer |

#### Returns

the task data for `deserializer` .

[transfer none]

### gdk_content_deserializer_return_success ()

    void
    gdk_content_deserializer_return_success
                                   (GdkContentDeserializer *deserializer);

Indicate that the deserialization has been successfully completed.

#### Parameters

deserializer | a GdkContentDeserializer |

### gdk_content_deserializer_return_error ()

    void
    gdk_content_deserializer_return_error (GdkContentDeserializer *deserializer,
                                           GError *error);

Indicate that the deserialization has ended with an error. This function consumes `error` .

#### Parameters

deserializer | a GdkContentDeserializer |
error | a GError |

### gdk_content_register_deserializer ()

    void
    gdk_content_register_deserializer (const char *mime_type,
                                       GType type,
                                       GdkContentDeserializeFunc deserialize,
                                       gpointer data,
                                       GDestroyNotify notify);

Registers a function to create objects of a given `type` from a serialized representation with the given mime type.

#### Parameters

mime_type | the mime type which the function can deserialize from |
type | the type of objects that the function creates |
deserialize | the callback |
data | data that `deserialize` can access |
notify | destroy notify for `data` |

### gdk_content_deserialize_async ()

    void
    gdk_content_deserialize_async (GInputStream *stream,
                                   const char *mime_type,
                                   GType type,
                                   int io_priority,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Read content from the given input stream and deserialize it, asynchronously. When the operation is finished, `callback` will be called. You can then call `gdk_content_deserialize_finish()` to get the result of the operation.

#### Parameters

stream | a GInputStream to read the serialized content from |
mime_type | the mime type to deserialize from |
type | the GType to deserialize from |
io_priority | the io priority of the operation |
cancellable | optional GCancellable object. | [nullable]
callback | callback to call when the operation is done. | [scope async]
user_data | data to pass to the callback function. | [closure]

### gdk_content_deserialize_finish ()

    gboolean
    gdk_content_deserialize_finish (GAsyncResult *result,
                                    GValue *value,
                                    GError **error);

Finishes a content deserialization operation.

#### Parameters

result | the GAsyncResult |
value | return location for the result of the operation |
error | return location for an error |

#### Returns

`TRUE` if the operation was successful. In this case, `value` is set. `FALSE` if an error occurred. In this case, `error` is set

## Types and Values

### GdkContentDeserializer

    typedef struct _GdkContentDeserializer GdkContentDeserializer;

Should not be accessed directly.

## See Also

GdkContentSerializer