IpatchTypeProp

IpatchTypeProp — GObject style properties for GTypes

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Object Hierarchy

    GEnum
    ╰── IpatchSplitsType

Description

Provides a registry system for adding GObject style properties to GTypes. This is used to describe certain properties of different objects, such as "category".

Functions

IpatchTypePropGetFunc ()

void
(*IpatchTypePropGetFunc) (GType type,
                          GParamSpec *spec,
                          GValue *value,
                          GObject *object);

A function type used for active type property callbacks. Allows for dynamic type properties that can return values depending on an object's state.

Parameters

type

The GType of the type property

 

spec

The parameter specification

 

value

Initialized value to store the type prop value in

 

object

Object instance (might be NULL)

 

ipatch_type_install_property ()

void
ipatch_type_install_property (GParamSpec *prop_spec);

Install a new GType property which can be used to associate arbitrary information to GTypes.

Parameters

prop_spec

Specification for the new GType property. Ownership of the GParamSpec is taken over by this function. The name field of the GParamSpec should be a static string and is used as the property's ID.

[transfer full]

ipatch_type_find_property ()

GParamSpec *
ipatch_type_find_property (const char *name);

Lookup a GType property by name.

Parameters

name

Name of GType property

 

Returns

The matching GParamSpec or NULL if not found. The GParamSpec is internal and should NOT be modified or freed.

[transfer none]


ipatch_type_list_properties ()

GParamSpec **
ipatch_type_list_properties (guint *n_properties);

Get a list of all registered GType properties.

Parameters

n_properties

Length of returned array.

[out]

Returns

An array of GParamSpecs which should be freed when finished (only the array, not the GParamSpecs themselves).

[array length=n_properties][transfer container]


ipatch_type_find_types_with_property ()

GType *
ipatch_type_find_types_with_property (const char *name,
                                      const GValue *value,
                                      guint *n_types);

Get an array of types which have the given type property assigned and match value (optional, NULL matches any value).

Parameters

name

Name of type property

 

value

Optional value to match to type property values (NULL to match any value).

[nullable]

n_types

Location to store count of types in returned array or NULL to ignore.

[out][optional]

Returns

Newly allocated 0 terminated array of types which have the named property set or NULL if type property not found.

[array length=n_types]


ipatch_type_set ()

void
ipatch_type_set (GType type,
                 const char *first_property_name,
                 ...);

Set GType properties. GType properties are used to associate arbitrary information with GTypes.

Parameters

type

GType to set properties of

 

first_property_name

Name of first property to set

 

...

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

 

ipatch_type_set_valist ()

void
ipatch_type_set_valist (GType type,
                        const char *first_property_name,
                        va_list args);

Like ipatch_type_set() but uses a va_list.

Parameters

type

GType to set properties of

 

first_property_name

Name of first property to set

 

args

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

 

ipatch_type_set_property ()

void
ipatch_type_set_property (GType type,
                          const char *property_name,
                          const GValue *value);

Set a single property of a GType.

Parameters

type

GType to set property of

 

property_name

Name of property to set

 

value

Value to set the the property to. The value's type must be the same as the GType property's type.

 

ipatch_type_unset_property ()

void
ipatch_type_unset_property (GType type,
                            const char *property_name);

Unsets the value or dynamic function of a type property.

Parameters

type

GType to unset a property of

 

property_name

The property to unset

 

Since: 1.1.0


ipatch_type_get ()

void
ipatch_type_get (GType type,
                 const char *first_property_name,
                 ...);

Get GType property values.

Parameters

type

GType to get properties from

 

first_property_name

Name of first property to get

 

...

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

 

ipatch_type_get_valist ()

void
ipatch_type_get_valist (GType type,
                        const char *first_property_name,
                        va_list args);

Like ipatch_type_get() but uses a va_list.

Parameters

type

GType to get properties from

 

first_property_name

Name of first property to get

 

args

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

 

ipatch_type_get_property ()

void
ipatch_type_get_property (GType type,
                          const char *property_name,
                          GValue *value);

Get a single property from a GType.

Parameters

type

GType to get property from

 

property_name

Name of property to get

 

value

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

[out]

ipatch_type_object_get ()

void
ipatch_type_object_get (GObject *object,
                        const char *first_property_name,
                        ...);

Get GType property values. Like ipatch_type_get() but takes an object instance which can be used by any registered dynamic type property functions.

Parameters

object

Object instance to get type property from

 

first_property_name

Name of first property to get

 

...

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

 

ipatch_type_object_get_valist ()

void
ipatch_type_object_get_valist (GObject *object,
                               const char *first_property_name,
                               va_list args);

ipatch_type_object_get_property ()

void
ipatch_type_object_get_property (GObject *object,
                                 const char *property_name,
                                 GValue *value);

Get a single type property from an object instance.

Parameters

object

Object instance to get type property from

 

property_name

Name of property to get

 

value

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

[out]

ipatch_type_set_dynamic_func ()

void
ipatch_type_set_dynamic_func (GType type,
                              const char *property_name,
                              IpatchTypePropGetFunc func);

Registers a callback function for dynamically getting the value of a type property.

Example: A dynamic property is created for SoundFont presets to return a different "virtual-parent-type" depending on if its a percussion or melodic preset (determined from a preset's bank number).

[skip]

Parameters

type

GType of the type property

 

property_name

Name of a previously registered type property

 

func

Callback function used for getting values for this type property

 

ipatch_type_set_dynamic_func_full ()

void
ipatch_type_set_dynamic_func_full (GType type,
                                   const char *property_name,
                                   IpatchTypePropGetFunc func,
                                   GDestroyNotify notify_func,
                                   gpointer user_data);

Registers a callback function for dynamically getting the value of a type property. Like ipatch_type_set_dynamic_func() but more GObject Introspection friendly.

Example: A dynamic property is created for SoundFont presets to return a different "virtual-parent-type" depending on if its a percussion or melodic preset (determined from a preset's bank number).

[rename-to ipatch_type_set_dynamic_func]

Parameters

type

GType of the type property

 

property_name

Name of a previously registered type property

 

func

Callback function used for getting values for this type property

 

notify_func

Destroy function callback when func is removed.

[nullable][scope async][closure user_data]

user_data

Data passed to notify_func .

[nullable]

Since: 1.1.0


ipatch_type_get_dynamic_func ()

IpatchTypePropGetFunc
ipatch_type_get_dynamic_func (GType type,
                              const char *property_name);

Get a the dynamic function registered for a given type and property_name with ipatch_type_set_dynamic_func(). Also can be used as an indicator of whether a type property is dynamic or not.

[skip]

Parameters

type

GType of the type property

 

property_name

Name of a previously registered type property

 

Returns

Pointer to the registered function or NULL if no function registered (not a dynamic type property).

Types and Values

enum IpatchSplitsType

Members

IPATCH_SPLITS_NONE

   

IPATCH_SPLITS_NORMAL

   

IPATCH_SPLITS_NO_OVERLAP