Class

GObjectTypeModule

Description [src]

abstract class GObject.TypeModule : GObject.Object {
  parent_instance: GObject,
  use_count: guint,
  type_infos: GSList*,
  interface_infos: GSList*,
  name: gchar*
}

GTypeModule provides a simple implementation of the GTypePlugin interface.

The model of GTypeModule is a dynamically loaded module which implements some number of types and interface implementations.

When the module is loaded, it registers its types and interfaces using g_type_module_register_type() and g_type_module_add_interface(). As long as any instances of these types and interface implementations are in use, the module is kept loaded. When the types and interfaces are gone, the module may be unloaded. If the types and interfaces become used again, the module will be reloaded. Note that the last reference cannot be released from within the module code, since that would lead to the caller’s code being unloaded before g_object_unref() returns to it.

Keeping track of whether the module should be loaded or not is done by using a use count - it starts at zero, and whenever it is greater than zero, the module is loaded. The use count is maintained internally by the type system, but also can be explicitly controlled by g_type_module_use() and g_type_module_unuse(). Typically, when loading a module for the first type, g_type_module_use() will be used to load it so that it can initialize its types. At some later point, when the module no longer needs to be loaded except for the type implementations it contains, g_type_module_unuse() is called.

GTypeModule does not actually provide any implementation of module loading and unloading. To create a particular module type you must derive from GTypeModule and implement the load and unload functions in GTypeModuleClass.

Hierarchy

hierarchy this GTypeModule implements_0 GTypePlugin this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Implements

Instance methods

g_type_module_add_interface

Registers an additional interface for a type, whose interface lives in the given type plugin. If the interface was already registered for the type in this plugin, nothing will be done.

g_type_module_register_enum

Looks up or registers an enumeration that is implemented with a particular type plugin. If a type with name type_name was previously registered, the GType identifier for the type is returned, otherwise the type is newly registered, and the resulting GType identifier returned.

Available since: 2.6

g_type_module_register_flags

Looks up or registers a flags type that is implemented with a particular type plugin. If a type with name type_name was previously registered, the GType identifier for the type is returned, otherwise the type is newly registered, and the resulting GType identifier returned.

Available since: 2.6

g_type_module_register_type

Looks up or registers a type that is implemented with a particular type plugin. If a type with name type_name was previously registered, the GType identifier for the type is returned, otherwise the type is newly registered, and the resulting GType identifier returned.

g_type_module_set_name

Sets the name for a GTypeModule.

g_type_module_unuse

Decreases the use count of a GTypeModule by one. If the result is zero, the module will be unloaded. (However, the GTypeModule will not be freed, and types associated with the GTypeModule are not unregistered. Once a GTypeModule is initialized, it must exist forever.)

g_type_module_use

Increases the use count of a GTypeModule by one. If the use count was zero before, the plugin will be loaded. If loading the plugin fails, the use count is reset to its prior value.

Methods inherited from GObject (43)
g_object_add_toggle_ref

Increases the reference count of the object by one and sets a callback to be called when all other references to the object are dropped, or when this is already the last reference to the object and another reference is established.

Available since: 2.8

g_object_add_weak_pointer

Adds a weak reference from weak_pointer to object to indicate that the pointer located at weak_pointer_location is only valid during the lifetime of object. When the object is finalized, weak_pointer will be set to NULL.

g_object_bind_property

Creates a binding between source_property on source and target_property on target.

Available since: 2.26

g_object_bind_property_full

Complete version of g_object_bind_property().

Available since: 2.26

g_object_bind_property_with_closures

Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

Available since: 2.26

g_object_connect

A convenience function to connect multiple signals at once.

g_object_disconnect

A convenience function to disconnect multiple signals at once.

g_object_dup_data

This is a variant of g_object_get_data() which returns a ‘duplicate’ of the value. dup_func defines the meaning of ‘duplicate’ in this context, it could e.g. take a reference on a ref-counted object.

Available since: 2.34

g_object_dup_qdata

This is a variant of g_object_get_qdata() which returns a ‘duplicate’ of the value. dup_func defines the meaning of ‘duplicate’ in this context, it could e.g. take a reference on a ref-counted object.

Available since: 2.34

g_object_force_floating

This function is intended for GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

Available since: 2.10

g_object_freeze_notify

Increases the freeze count on object. If the freeze count is non-zero, the emission of “notify” signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one GObject::notify signal is emitted for each property modified while the object is frozen.

g_object_get

Gets properties of an object.

g_object_get_data

Gets a named field from the objects table of associations (see g_object_set_data()).

g_object_get_property

Gets a property of an object.

g_object_get_qdata

This function gets back user data pointers stored via g_object_set_qdata().

g_object_get_valist

Gets properties of an object.

g_object_getv

Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

Available since: 2.54

g_object_is_floating

Checks whether object has a [floating][floating-ref] reference.

Available since: 2.10

g_object_notify

Emits a “notify” signal for the property property_name on object.

g_object_notify_by_pspec

Emits a “notify” signal for the property specified by pspec on object.

Available since: 2.26

g_object_ref

Increases the reference count of object.

g_object_ref_sink

Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

Available since: 2.10

g_object_remove_toggle_ref

Removes a reference added with g_object_add_toggle_ref(). The reference count of the object is decreased by one.

Available since: 2.8

Methods inherited from GTypePlugin (4)
g_type_plugin_complete_interface_info

Calls the complete_interface_info function from the GTypePluginClass of plugin. There should be no need to use this function outside of the GObject type system itself.

g_type_plugin_complete_type_info

Calls the complete_type_info function from the GTypePluginClass of plugin. There should be no need to use this function outside of the GObject type system itself.

g_type_plugin_unuse

Calls the unuse_plugin function from the GTypePluginClass of plugin. There should be no need to use this function outside of the GObject type system itself.

g_type_plugin_use

Calls the use_plugin function from the GTypePluginClass of plugin. There should be no need to use this function outside of the GObject type system itself.

Signals

Signals inherited from GObject (1)
GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GObjectTypeModuleClass {
  GObjectClass parent_class;
  gboolean (* load) (
    GTypeModule* module
  );
  void (* unload) (
    GTypeModule* module
  );
  void (* reserved1) (
void
  );
  void (* reserved2) (
void
  );
  void (* reserved3) (
void
  );
  void (* reserved4) (
void
  );
  
}
Class members
parent_class
GObjectClass
 

The parent class.

load
gboolean (* load) (
    GTypeModule* module
  )
  No description available.
unload
void (* unload) (
    GTypeModule* module
  )
  No description available.
reserved1
void (* reserved1) (
void
  )
  No description available.
reserved2
void (* reserved2) (
void
  )
  No description available.
reserved3
void (* reserved3) (
void
  )
  No description available.
reserved4
void (* reserved4) (
void
  )
  No description available.

Virtual methods

GObject.TypeModuleClass.load
No description available.
GObject.TypeModuleClass.unload
No description available.