| Top |
Functions
Description
A GdkContentProvider is used to provide content for the clipboard 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.
Functions
gdk_content_provider_new_for_value ()
GdkContentProvider *
gdk_content_provider_new_for_value (const GValue *value);
Create a content provider that provides the given value
.
gdk_content_provider_new_for_bytes ()
GdkContentProvider * gdk_content_provider_new_for_bytes (const char *mime_type,GBytes *bytes);
Create a content provider that provides the given bytes
as data for
the given mime_type
.
gdk_content_provider_ref_formats ()
GdkContentFormats *
gdk_content_provider_ref_formats (GdkContentProvider *provider);
Gets the formats that the provider can provide its current contents in.
gdk_content_provider_ref_storable_formats ()
GdkContentFormats *
gdk_content_provider_ref_storable_formats
(GdkContentProvider *provider);
Gets the formats that the provider suggests other applications to store the data in. An example of such an application would be a clipboard manager.
This can be assumed to be a subset of gdk_content_provider_ref_formats().
gdk_content_provider_content_changed ()
void
gdk_content_provider_content_changed (GdkContentProvider *provider);
Emits the “contents-changed” signal.
gdk_content_provider_write_mime_type_async ()
void gdk_content_provider_write_mime_type_async (GdkContentProvider *provider,const char *mime_type,GOutputStream *stream,int io_priority,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Asynchronously writes the contents of provider
to stream
in the given
mime_type
. When the operation is finished callback
will be called. You
can then call gdk_content_provider_write_mime_type_finish() to get the
result of the operation.
The given mime type does not need to be listed in the formats returned by
gdk_content_provider_ref_formats(). However, if the given GType is not
supported, G_IO_ERROR_NOT_SUPPORTED will be reported.
The given stream
will not be closed.
Parameters
provider |
||
mime_type |
the mime type to provide the data in |
|
stream |
the GOutputStream to write to |
|
io_priority |
the I/O priority of the request. |
|
cancellable |
optional GCancellable object, |
[nullable] |
callback |
callback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
gdk_content_provider_write_mime_type_finish ()
gboolean gdk_content_provider_write_mime_type_finish (GdkContentProvider *provider,GAsyncResult *result,GError **error);
Finishes an asynchronous write operation started with
gdk_content_provider_write_mime_type_async().
gdk_content_provider_get_value ()
gboolean gdk_content_provider_get_value (GdkContentProvider *provider,GValue *value,GError **error);
Gets the convtents of provider
stored in value
.
The value
will have been initialized to the GType the value should be
provided in. This given GType does not need to be listed in the formats
returned by gdk_content_provider_ref_formats(). However, if the given
GType is not supported, this operation can fail and
G_IO_ERROR_NOT_SUPPORTED will be reported.
