1.7 <GdkContentProvider>

Class: <GdkContentProvider>

It derives from <GObject>.

Provides content for the clipboard or for drag-and-drop operations in a number of formats.

To create a <GdkContentProvider>, use content-provider:new-for-value or 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.

Fields

parent

Properties

Property: content-provider:formats self

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

Its value is a <GdkContentFormats>, or #f.

It is read only.

Property: content-provider:storable-formats self

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

Its value is a <GdkContentFormats>, or #f.

It is read only.

Procedures

Method: content-provider:content-changed self
Method: content-changed self

Emits the ::content-changed signal.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

Method: content-provider:get-value! self value ⇒ %return value
Method: get-value! self value ⇒ %return value

Gets the contents of self 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 content-provider:ref-formats. However, if the given GType is not supported, this operation can fail and not-supported will be reported.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

value

Passed, filled in, and returned: a <GValue>.

the <GValue> to fill

%return

Returned: a boolean.

#t if the value was set successfully. Otherwise error will be set to describe the failure.

Procedure: content-provider:new-for-bytes mime-type bytes ⇒ %return

Create a content provider that provides the given bytes as data for the given mime-type.

mime-type

Passed: a string.

the mime type

bytes

Passed: a <GBytes>.

a <GBytes> with the data for mime-type

%return

Returned: a <GdkContentProvider>.

a new <GdkContentProvider>

Procedure: content-provider:new-for-value value ⇒ %return

Create a content provider that provides the given value.

value

Passed: a <GValue>.

a <GValue>

%return

Returned: a <GdkContentProvider>.

a new <GdkContentProvider>

Procedure: content-provider:new-union providers ⇒ %return

Creates a content provider that represents all the given providers.

Whenever data needs to be written, the union provider will try the given providers in the given order and the first one supporting a format will be chosen to provide it.

This allows an easy way to support providing data in different formats. For example, an image may be provided by its file and by the image contents with a call such as

gdk_content_provider_new_union ((GdkContentProvider *[2]) {
                                  gdk_content_provider_new_typed (G_TYPE_FILE, file),
                                  gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture)
                                }, 2);
providers

Passed: a list or vector, each a <GdkContentProvider>, or #f.

The <GdkContentProvider>s to present the union of

%return

Returned: a <GdkContentProvider>.

a new <GdkContentProvider>

n-providers

Not passed: guile-gi gives the length of providers.

the number of providers

Method: content-provider:ref-formats self ⇒ %return
Method: ref-formats self ⇒ %return

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

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

%return

Returned: a <GdkContentFormats>.

The formats of the provider

Method: content-provider:ref-storable-formats self ⇒ %return
Method: ref-storable-formats self ⇒ %return

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 content-provider:ref-formats.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

%return

Returned: a <GdkContentFormats>.

The storable formats of the provider

Method: content-provider:write-mime-type-async self mime-type stream io-priority [cancellable] [callback]
Method: write-mime-type-async self mime-type stream io-priority [cancellable] [callback]

Asynchronously writes the contents of self to stream in the given mime-type.

The given mime type does not need to be listed in the formats returned by content-provider:ref-formats. However, if the given GType is not supported, not-supported will be reported.

The given stream will not be closed.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

mime-type

Passed: a string.

the mime type to provide the data in

stream

Passed: a <GOutputStream>.

the <GOutputStream> to write to

io-priority

Passed: a 32-bit integer.

I/O priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

callback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: content-provider:write-mime-type-finish? self result ⇒ %return
Method: write-mime-type-finish? self result ⇒ %return

Finishes an asynchronous write operation.

See content-provider:write-mime-type-async.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation was completed successfully. Otherwise error will be set to describe the failure.

Signals

Signal: content-provider:content-changed

Connect a handler with (connect object content-provider:content-changed handler). It is called as (handler self).

Emitted whenever the content provided by this provider has changed.

self

Passed: a <GdkContentProvider>.

Virtual methods

Virtual method: content-provider:do-attach-clipboard implementor self clipboard

To override it in a new class, give register-type #:vfuncs `((attach-clipboard . ,procedure)). The procedure is called as (procedure self clipboard).

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

clipboard

Passed: a <GdkClipboard>.

Virtual method: content-provider:do-content-changed implementor self

Emits the ::content-changed signal.

To override it in a new class, give register-type #:vfuncs `((content-changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

Virtual method: content-provider:do-detach-clipboard implementor self clipboard

To override it in a new class, give register-type #:vfuncs `((detach-clipboard . ,procedure)). The procedure is called as (procedure self clipboard).

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

clipboard

Passed: a <GdkClipboard>.

Virtual method: content-provider:do-get-value implementor self value ⇒ %return value

Gets the contents of self 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 content-provider:ref-formats. However, if the given GType is not supported, this operation can fail and not-supported will be reported.

To override it in a new class, give register-type #:vfuncs `((get-value . ,procedure)). The procedure is called as (procedure self value) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

value

Passed, filled in, and returned: a <GValue>.

the <GValue> to fill

%return

Returned: a boolean.

#t if the value was set successfully. Otherwise error will be set to describe the failure.

Virtual method: content-provider:do-ref-formats implementor self ⇒ %return

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

To override it in a new class, give register-type #:vfuncs `((ref-formats . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

%return

Returned: a <GdkContentFormats>.

The formats of the provider

Virtual method: content-provider:do-ref-storable-formats implementor self ⇒ %return

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 content-provider:ref-formats.

To override it in a new class, give register-type #:vfuncs `((ref-storable-formats . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

%return

Returned: a <GdkContentFormats>.

The storable formats of the provider

Virtual method: content-provider:do-write-mime-type-async implementor self mime-type stream io-priority [cancellable] [callback]

Asynchronously writes the contents of self to stream in the given mime-type.

The given mime type does not need to be listed in the formats returned by content-provider:ref-formats. However, if the given GType is not supported, not-supported will be reported.

The given stream will not be closed.

To override it in a new class, give register-type #:vfuncs `((write-mime-type-async . ,procedure)). The procedure is called as (procedure self mime-type stream io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

mime-type

Passed: a string.

the mime type to provide the data in

stream

Passed: a <GOutputStream>.

the <GOutputStream> to write to

io-priority

Passed: a 32-bit integer.

I/O priority of the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

callback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: content-provider:do-write-mime-type-finish implementor self result ⇒ %return

Finishes an asynchronous write operation.

See content-provider:write-mime-type-async.

To override it in a new class, give register-type #:vfuncs `((write-mime-type-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GdkContentProvider>, or a class that derives from it, or its GType number.

self

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation was completed successfully. Otherwise error will be set to describe the failure.