### Class

# Gdk ContentProvider

#### Description [src]

    class Gdk.ContentProvider : GObject.Object {
      parent: GObject
    }

A `GdkContentProvider` is used to provide content for the clipboard or for drag-and-drop operations in a number of formats.

To create a `GdkContentProvider`, use gdk_content_provider_new_for_value() or gdk_content_provider_new_for_bytes().

GDK knows how to handle common text and image formats out-of-the-box. See `GdkContentSerializer` and `GdkContentDeserializer` if you want to add support for application-specific data formats.

#### Hierarchy

#### Ancestors

- GObject

#### Constructors

###### gdk_content_provider_new_for_bytes

Create a content provider that provides the given `bytes` as data for the given `mime_type`.

###### gdk_content_provider_new_for_value

Create a content provider that provides the given `value`.

###### gdk_content_provider_new_typed

Create a content provider that provides the value of the given `type`.

###### gdk_content_provider_new_union

Creates a content provider that represents all the given `providers`.

#### Instance methods

###### gdk_content_provider_content_changed

Emits the ::content-changed signal.

###### gdk_content_provider_get_value

Gets the contents of `provider` stored in `value`.

###### gdk_content_provider_ref_formats

Gets the formats that the provider can provide its current contents in.

###### gdk_content_provider_ref_storable_formats

Gets the formats that the provider suggests other applications to store the data in.

###### gdk_content_provider_write_mime_type_async

Asynchronously writes the contents of `provider` to `stream` in the given `mime_type`.

###### gdk_content_provider_write_mime_type_finish

Finishes an asynchronous write operation.

#### Properties

###### Gdk.ContentProvider:formats

The possible formats that the provider can provide its data in.

###### Gdk.ContentProvider:storable-formats

The subset of formats that clipboard managers should store this provider’s data in.

#### Signals

###### Gdk.ContentProvider::content-changed

Emitted whenever the content provided by this provider has changed.

#### Class structure

    struct GdkContentProviderClass {
      GObjectClass parent_class;
      void (* content_changed) (
        GdkContentProvider* provider
      );
      void (* attach_clipboard) (
        GdkContentProvider* provider,
        GdkClipboard* clipboard
      );
      void (* detach_clipboard) (
        GdkContentProvider* provider,
        GdkClipboard* clipboard
      );
      GdkContentFormats* (* ref_formats) (
        GdkContentProvider* provider
      );
      GdkContentFormats* (* ref_storable_formats) (
        GdkContentProvider* provider
      );
      void (* write_mime_type_async) (
        GdkContentProvider* provider,
        const char* mime_type,
        GOutputStream* stream,
        int io_priority,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      );
      gboolean (* write_mime_type_finish) (
        GdkContentProvider* provider,
        GAsyncResult* result,
        GError** error
      );
      gboolean (* get_value) (
        GdkContentProvider* provider,
        GValue* value,
        GError** error
      );

    }

###### Class members

`parent_class` |
    GObjectClass
| No description available.
`content_changed` |
    void (* content_changed) (
        GdkContentProvider* provider
      )
| No description available.
`attach_clipboard` |
    void (* attach_clipboard) (
        GdkContentProvider* provider,
        GdkClipboard* clipboard
      )
| No description available.
`detach_clipboard` |
    void (* detach_clipboard) (
        GdkContentProvider* provider,
        GdkClipboard* clipboard
      )
| No description available.
`ref_formats` |
    GdkContentFormats* (* ref_formats) (
        GdkContentProvider* provider
      )
| No description available.
`ref_storable_formats` |
    GdkContentFormats* (* ref_storable_formats) (
        GdkContentProvider* provider
      )
| No description available.
`write_mime_type_async` |
    void (* write_mime_type_async) (
        GdkContentProvider* provider,
        const char* mime_type,
        GOutputStream* stream,
        int io_priority,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      )
| No description available.
`write_mime_type_finish` |
    gboolean (* write_mime_type_finish) (
        GdkContentProvider* provider,
        GAsyncResult* result,
        GError** error
      )
| No description available.
`get_value` |
    gboolean (* get_value) (
        GdkContentProvider* provider,
        GValue* value,
        GError** error
      )
| No description available.

#### Virtual methods

###### Gdk.ContentProviderClass.attach_clipboard

No description available.

###### Gdk.ContentProviderClass.content_changed

Emits the ::content-changed signal.

###### Gdk.ContentProviderClass.detach_clipboard

No description available.

###### Gdk.ContentProviderClass.get_value

Gets the contents of `provider` stored in `value`.

###### Gdk.ContentProviderClass.ref_formats

Gets the formats that the provider can provide its current contents in.

###### Gdk.ContentProviderClass.ref_storable_formats

Gets the formats that the provider suggests other applications to store the data in.

###### Gdk.ContentProviderClass.write_mime_type_async

Asynchronously writes the contents of `provider` to `stream` in the given `mime_type`.

###### Gdk.ContentProviderClass.write_mime_type_finish

Finishes an asynchronous write operation.