IOExtensionPoint#

class IOExtensionPoint(*args, **kwargs)#

GIOExtensionPoint provides a mechanism for modules to extend the functionality of the library or application that loaded it in an organized fashion.

An extension point is identified by a name, and it may optionally require that any implementation must be of a certain type (or derived thereof). Use register to register an extension point, and set_required_type to set a required type.

A module can implement an extension point by specifying the Type that implements the functionality. Additionally, each implementation of an extension point has a name, and a priority. Use implement to implement an extension point.

GIOExtensionPoint *ep;

// Register an extension point
ep = g_io_extension_point_register ("my-extension-point");
g_io_extension_point_set_required_type (ep, MY_TYPE_EXAMPLE);

Methods#

class IOExtensionPoint
get_extension_by_name(name: str) IOExtension#

Finds a IOExtension for an extension point by name.

Parameters:

name – the name of the extension to get

get_extensions() list[IOExtension]#

Gets a list of all extensions that implement this extension point. The list is sorted by priority, beginning with the highest priority.

get_required_type() type#

Gets the required type for extension_point.

implement(extension_point_name: str, type: type, extension_name: str, priority: int) IOExtension#

Registers type as extension for the extension point with name extension_point_name.

If type has already been registered as an extension for this extension point, the existing IOExtension object is returned.

Parameters:
  • extension_point_name – the name of the extension point

  • type – the Type to register as extension

  • extension_name – the name for the extension

  • priority – the priority for the extension

lookup(name: str) IOExtensionPoint#

Looks up an existing extension point.

Parameters:

name – the name of the extension point

register(name: str) IOExtensionPoint#

Registers an extension point.

Parameters:

name – The name of the extension point

set_required_type(type: type) None#

Sets the required type for extension_point to type. All implementations must henceforth have this type.

Parameters:

type – the Type to require