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 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 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.
Checks if a given GType is part of the given self.
Passed: a <GdkContentFormats>.
Passed: a class, or a GType number.
the GType to search for
Returned: a boolean.
#t if the GType was found
Checks if a given mime type is part of the given self.
Passed: a <GdkContentFormats>.
Passed: a string.
the mime type to search for
Returned: a boolean.
#t if the mime_type was found
Gets the GTypes included in self.
Note that self may not contain any GTypes, in particular
when they are empty. In that case #f will be returned.
Passed: a <GdkContentFormats>.
Returned: a vector, each a class, or a GType number, or #f.
G_TYPE_INVALID-terminated array of types included in self
Not returned: it is the length of %return.
optional pointer to take the number of GTypes contained in the
return value
Gets the mime types included in self.
Note that self may not contain any mime types, in particular when
they are empty. In that case #f will be returned.
Passed: a <GdkContentFormats>.
Returned: a vector, each a string, or #f.
#f-terminated array of interned strings of mime types included in
self
Not returned: it is the length of %return.
optional pointer to take the number of mime types contained in the return value
Returns whether the content formats contain any formats.
Passed: a <GdkContentFormats>.
content formats
Returned: a boolean.
true if self contains no mime types and no GTypes
Finds the first GType from self that is also contained in
second.
If no matching GType is found, G_TYPE_INVALID is returned.
Passed: a <GdkContentFormats>.
the primary <GdkContentFormats> to
intersect
Passed: a <GdkContentFormats>.
the <GdkContentFormats> to intersect with
Returned: a class, or a GType number.
The first common GType or G_TYPE_INVALID if none.
Finds the first mime type from self that is also contained in second.
If no matching mime type is found, #f is returned.
Passed: a <GdkContentFormats>.
the primary <GdkContentFormats> to
intersect
Passed: a <GdkContentFormats>.
the <GdkContentFormats> to intersect with
Returned: a string, or #f.
The first common mime type or #f if none
Checks if self and second have any matching formats.
Passed: a <GdkContentFormats>.
the primary <GdkContentFormats> to
intersect
Passed: a <GdkContentFormats>.
the <GdkContentFormats> to intersect with
Returned: a boolean.
#t if a matching format was found.
Creates a new <GdkContentFormats> from an
array of mime types.
The mime types must be valid and different from each other or the
behavior of the return value is undefined. If you cannot guarantee
this, use <GdkContentFormatsBuilder>
instead.
Passed: a list or vector, each a string, or #f.
Pointer to an array of mime types
Returned: a <GdkContentFormats>.
the new <GdkContentFormats>.
Not passed: guile-gi gives the length of mime-types.
number of entries in mime-types.
Creates a new <GdkContentFormats> for a
given GType.
Passed: a class, or a GType number.
a GType
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Parses the given string into
<GdkContentFormats> and returns the
formats.
Strings printed via content-formats:to-string can be read in again successfully
using this function.
If string does not describe valid content formats, #f is
returned.
Passed: a string.
the string to parse
Returned: a <GdkContentFormats>, or
#f.
the content formats if string is valid
Prints the given self into a string for human consumption.
The result of this function can later be parsed with
content-formats:parse.
Passed: a <GdkContentFormats>.
Passed: a <GString>.
a <GString> to print into
Increases the reference count of a
<GdkContentFormats> by one.
Passed: a <GdkContentFormats>.
Returned: a <GdkContentFormats>.
the passed in <GdkContentFormats>.
Prints the given self into a human-readable string.
The resulting string can be parsed with content-formats:parse.
This is a small wrapper around content-formats:print to help when debugging.
Passed: a <GdkContentFormats>.
Returned: a string.
a new string
Append all missing types from second to self, in the order they had in second.
Passed: a <GdkContentFormats>.
the <GdkContentFormats> to merge into
Passed: a <GdkContentFormats>.
the <GdkContentFormats> to merge from
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Add GTypes for mime types in self for which deserializers are registered.
Passed: a <GdkContentFormats>.
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Add mime types for GTypes in self for which deserializers are registered.
Passed: a <GdkContentFormats>.
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Add GTypes for the mime types in self for which serializers are registered.
Passed: a <GdkContentFormats>.
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Add mime types for GTypes in self for which serializers are registered.
Passed: a <GdkContentFormats>.
Returned: a <GdkContentFormats>.
a new <GdkContentFormats>
Decreases the reference count of a
<GdkContentFormats> by one.
If the resulting reference count is zero, frees the formats.
Passed: a <GdkContentFormats>.