Gdk.ContentFormats¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gdk.ContentFormats¶
The
GdkContentFormats
structure is 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 [class`Gdk`.Drag], [class`Gdk`.Drop], [class`Gdk`.Clipboard] or [class`Gdk`.ContentProvider].GDK supports content in 2 forms:
GType
and mime type. UsingGTypes
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, [class`Gdk`.ContentSerializer] and [class`Gdk`.ContentDeserializer] 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 differentGTypes
or mime types is the order they were added in, most important first. Functions that care about order, such as [method`Gdk`.ContentFormats.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 [method`Gdk`.ContentFormats.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, newGdkContentFormats
have to be created. The [struct`Gdk`.ContentFormatsBuilder] structure is meant to help in this endeavor.- classmethod new(mime_types)[source]¶
- Parameters:
mime_types ([
str
] orNone
) – Pointer to an array of mime types- Returns:
the new
GdkContentFormats
.- Return type:
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 [struct`Gdk`.ContentFormatsBuilder] instead.
- classmethod new_for_gtype(type)[source]¶
- Parameters:
type (
GObject.GType
) – aGType
- Returns:
a new
GdkContentFormats
- Return type:
Creates a new
GdkContentFormats
for a givenGType
.
- classmethod parse(string)[source]¶
- Parameters:
string (
str
) – the string to parse- Returns:
the content formats if string is valid
- Return type:
Parses the given string into
GdkContentFormats
and returns the formats.Strings printed via [method`Gdk`.ContentFormats.to_string] can be read in again successfully using this function.
If string does not describe valid content formats,
None
is returned.New in version 4.4.
- contain_gtype(type)[source]¶
- Parameters:
type (
GObject.GType
) – theGType
to search for- Returns:
True
if theGType
was found- Return type:
Checks if a given
GType
is part of the given self.
- contain_mime_type(mime_type)[source]¶
- Parameters:
mime_type (
str
) – the mime type to search for- Returns:
True
if the mime_type was found- Return type:
Checks if a given mime type is part of the given self.
- get_gtypes()[source]¶
- Returns:
GObject.TYPE_INVALID
-terminated array of types included in self- Return type:
[
GObject.GType
] orNone
Gets the ``GType``s included in self.
Note that self may not contain any ``GType``s, in particular when they are empty. In that case
None
will be returned.
- get_mime_types()[source]¶
- Returns:
None
-terminated array of interned strings of mime types included in self- Return type:
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
None
will be returned.
- match(second)[source]¶
- Parameters:
second (
Gdk.ContentFormats
) – theGdkContentFormats
to intersect with- Returns:
True
if a matching format was found.- Return type:
Checks if self and second have any matching formats.
- match_gtype(second)[source]¶
- Parameters:
second (
Gdk.ContentFormats
) – theGdkContentFormats
to intersect with- Returns:
The first common
GType
orGObject.TYPE_INVALID
if none.- Return type:
Finds the first
GType
from self that is also contained in second.If no matching
GType
is found,GObject.TYPE_INVALID
is returned.
- match_mime_type(second)[source]¶
- Parameters:
second (
Gdk.ContentFormats
) – theGdkContentFormats
to intersect with- Returns:
The first common mime type or
None
if none- Return type:
Finds the first mime type from self that is also contained in second.
If no matching mime type is found,
None
is returned.
- print_(string)[source]¶
- Parameters:
string (
GLib.String
) – aGString
to print into
Prints the given self into a string for human consumption.
The result of this function can later be parsed with [func`Gdk`.ContentFormats.parse].
- ref()[source]¶
- Returns:
the passed in
GdkContentFormats
.- Return type:
Increases the reference count of a
GdkContentFormats
by one.
- to_string()[source]¶
- Returns:
a new string
- Return type:
Prints the given self into a human-readable string.
The resulting string can be parsed with [func`Gdk`.ContentFormats.parse].
This is a small wrapper around [method`Gdk`.ContentFormats.print] to help when debugging.
- union(second)[source]¶
- Parameters:
second (
Gdk.ContentFormats
) – theGdkContentFormats
to merge from- Returns:
a new
GdkContentFormats
- Return type:
Append all missing types from second to self, in the order they had in second.
- union_deserialize_gtypes()[source]¶
- Returns:
a new
GdkContentFormats
- Return type:
Add GTypes for mime types in self for which deserializers are registered.
- union_deserialize_mime_types()[source]¶
- Returns:
a new
GdkContentFormats
- Return type:
Add mime types for GTypes in self for which deserializers are registered.
- union_serialize_gtypes()[source]¶
- Returns:
a new
GdkContentFormats
- Return type:
Add GTypes for the mime types in self for which serializers are registered.