Skip to content

Gdk.ContentFormatsBuilder

record (struct)

Creates GdkContentFormats objects.

Constructors

new

@classmethod
def new(cls) -> ContentFormatsBuilder

Create a new GdkContentFormatsBuilder object.

The resulting builder would create an empty GdkContentFormats. Use addition functions to add types to it.

Methods

add_formats

def add_formats(self, formats: ContentFormats) -> None

Appends all formats from formats to builder, skipping those that already exist.

Parameters:

  • formats — the formats to add

add_gtype

def add_gtype(self, type: type | GObject.Type) -> None

Appends type to builder if it has not already been added.

Parameters:

  • type — a GType

add_mime_type

def add_mime_type(self, mime_type: str) -> None

Appends mime_type to builder if it has not already been added.

Parameters:

  • mime_type — a mime type

ref

def ref(self) -> ContentFormatsBuilder

Acquires a reference on the given builder.

This function is intended primarily for bindings. GdkContentFormatsBuilder objects should not be kept around.

to_formats

def to_formats(self) -> ContentFormats

Creates a new GdkContentFormats from the given builder.

The given GdkContentFormatsBuilder is reset once this function returns; you cannot call this function multiple times on the same builder instance.

This function is intended primarily for bindings. C code should use ContentFormatsBuilder.free_to_formats.

unref

def unref(self) -> None

Releases a reference on the given builder.