Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GdkContentFormatsCtors

[327:14] static extends: object

Alternate constructors for GdkContentFormats. Usage: GdkContentFormatsCtors.<name>(...). The primary constructor lives directly on GdkContentFormats.

Methods

  • newForGtype (int type)

    Creates a new GdkContentFormats for a given GType.

    • @p type is a GType.
    • @r A new GdkContentFormats.

class: GdkContentFormats

[35:7] extends: object

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. 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, [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 different GTypes 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, new GdkContentFormats have to be created. The [struct@Gdk.ContentFormatsBuilder] structure is meant to help in this endeavor.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GdkContentFormats (mime_types = null, n_mime_types = null)

    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.

    • @p mime_types is Pointer to an array of mime types.
    • @p n_mime_types is number of entries in @mime_types..
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • contain_gtype (int type)

    Checks if a given GType is part of the given @formats.

    • @p type is the GType to search for.
    • @r %TRUE if the GType was found.
  • contain_mime_type (string mime_type)

    Checks if a given mime type is part of the given @formats.

    • @p mime_type is the mime type to search for.
    • @r %TRUE if the mime_type was found.
  • get_gtypes ()

    Gets the GTypes included in @formats. Note that @formats may not contain any GTypes, in particular when they are empty. In that case %NULL will be returned.

    • @p n_gtypes is optional pointer to take the number of GTypes contained in the return value.
    • @r %G_TYPE_INVALID-terminated array of types included in @formats.
  • get_mime_types ()

    Gets the mime types included in @formats. Note that @formats may not contain any mime types, in particular when they are empty. In that case %NULL will be returned.

    • @p n_mime_types is optional pointer to take the number of mime types contained in the return value.
    • @r %NULL-terminated array of interned strings of mime types included in
    • @formats. ``
  • is_empty ()

    Returns whether the content formats contain any formats.

    • @r true if @formats contains no mime types and no GTypes.
  • match (object second)

    Checks if @first and @second have any matching formats.

    • @p second is the GdkContentFormats to intersect with.
    • @r %TRUE if a matching format was found..
  • match_gtype (object second)

    Finds the first GType from @first that is also contained in @second. If no matching GType is found, %G_TYPE_INVALID is returned.

    • @p second is the GdkContentFormats to intersect with.
    • @r The first common GType or %G_TYPE_INVALID if none..
  • match_mime_type (object second)

    Finds the first mime type from @first that is also contained in @second. If no matching mime type is found, %NULL is returned.

    • @p second is the GdkContentFormats to intersect with.
    • @r The first common mime type or %NULL if none.
  • print (object arg1String)

    Prints the given @formats into a string for human consumption. The result of this function can later be parsed with [func@Gdk.ContentFormats.parse].

    • @p string is a GString to print into.
    • @r None.
  • ref ()

    Increases the reference count of a GdkContentFormats by one.

    • @r the passed in GdkContentFormats..
  • to_string ()

    Prints the given @formats 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.

    • @r a new string.
  • union (object second)

    Append all missing types from @second to @first, in the order they had in

    • @second. ``
    • @p second is the GdkContentFormats to merge from.
    • @r a new GdkContentFormats.
  • union_deserialize_gtypes ()

    Add GTypes for mime types in @formats for which deserializers are registered.

    • @r a new GdkContentFormats.
  • union_deserialize_mime_types ()

    Add mime types for GTypes in @formats for which deserializers are registered.

    • @r a new GdkContentFormats.
  • union_serialize_gtypes ()

    Add GTypes for the mime types in @formats for which serializers are registered.

    • @r a new GdkContentFormats.
  • union_serialize_mime_types ()

    Add mime types for GTypes in @formats for which serializers are registered.

    • @r a new GdkContentFormats.
  • unref ()

    Decreases the reference count of a GdkContentFormats by one. If the resulting reference count is zero, frees the formats.

    • @r None.