1.5 <GParam>

Class: <GParam>

<GParam> encapsulates the metadata required to specify parameters, such as <GObject> properties.

Parameter names

A property name consists of one or more segments consisting of ASCII letters and digits, separated by either the - or _ character. The first character of a property name must be a letter. These are the same rules as for signal naming (see GObject.signal_new).

When creating and looking up a <GParam>, either separator can be used, but they cannot be mixed. Using - is considerably more efficient, and is the ‘canonical form’. Using _ is discouraged.

Fields

g-type-instance

private GTypeInstance portion

name

name of this parameter: always an interned string

flags

<%GParamFlags> flags for this parameter

value-type

the <GValue> type for this parameter

owner-type

GType type that uses (introduces) this parameter

Procedures

Method: param-spec:get-blurb self ⇒ %return
Method: get-blurb self ⇒ %return

Get the short description of a <GParam>.

self

Passed: a <GParam>.

a valid <GParam>

%return

Returned: a string, or #f.

the short description of self.

Method: param-spec:get-default-value self ⇒ %return
Method: get-default-value self ⇒ %return

Gets the default value of self as a pointer to a <GValue>.

The <GValue> will remain valid for the life of self.

self

Passed: a <GParam>.

a <GParam>

%return

Returned: a <GValue>.

a pointer to a <GValue> which must not be modified

Method: param-spec:get-name self ⇒ %return
Method: get-name self ⇒ %return

Get the name of a <GParam>.

The name is always an "interned" string (as per intern-string). This allows for pointer-value comparisons.

self

Passed: a <GParam>.

a valid <GParam>

%return

Returned: a string.

the name of self.

Method: param-spec:get-name-quark self ⇒ %return
Method: get-name-quark self ⇒ %return

Gets the GQuark for the name.

self

Passed: a <GParam>.

a <GParam>

%return

Returned: an unsigned 32-bit integer.

the GQuark for self->name.

Method: param-spec:get-nick self ⇒ %return
Method: get-nick self ⇒ %return

Get the nickname of a <GParam>.

self

Passed: a <GParam>.

a valid <GParam>

%return

Returned: a string.

the nickname of self.

Method: param-spec:get-qdata self quark ⇒ %return
Method: get-qdata self quark ⇒ %return

Gets back user data pointers stored via param-spec:set-qdata.

self

Passed: a <GParam>.

a valid <GParam>

quark

Passed: an unsigned 32-bit integer.

a GQuark, naming the user data pointer

%return

Returned: a foreign pointer, or #f.

the user data pointer set, or #f

Method: param-spec:get-redirect-target self ⇒ %return
Method: get-redirect-target self ⇒ %return

If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of type <GParamOverride>. See g_object_class_override_property() for an example of the use of this capability.

self

Passed: a <GParam>.

a <GParam>

%return

Returned: a <GParam>, or #f.

paramspec to which requests on this paramspec should be redirected, or #f if none.

Procedure: param-spec:is-valid-name? name ⇒ %return

Validate a property name for a <GParam>. This can be useful for dynamically-generated properties which need to be validated at run-time before actually trying to create them.

See [canonical parameter names][class@GObject.ParamSpec#parameter-names] for details of the rules for valid names.

name

Passed: a string.

the canonical name of the property

%return

Returned: a boolean.

#t if name is a valid property name, #f otherwise.

Method: param-spec:set-qdata self quark [data]
Method: set-qdata self quark [data]

Sets an opaque, named pointer on a <GParam>. The name is specified through a GQuark (retrieved e.g. via quark-from-static-string), and the pointer can be gotten back from the self with param-spec:get-qdata. Setting a previously set user data pointer, overrides (frees) the old pointer set, using #f as pointer essentially removes the data stored.

self

Passed: a <GParam>.

the <GParam> to set store a user data pointer

quark

Passed: an unsigned 32-bit integer.

a GQuark, naming the user data pointer

data

Passed, or left out: a foreign pointer, or a bytevector, or #f.

an opaque user data pointer

Method: param-spec:sink self
Method: sink self

The initial reference count of a newly created <GParam> is 1, even though no one has explicitly called g_param_spec_ref() on it yet. So the initial reference count is flagged as "floating", until someone calls g_param_spec_ref (pspec); g_param_spec_sink (pspec); in sequence on it, taking over the initial reference count (thus ending up with a self that has a reference count of 1 still, but is not flagged "floating" anymore).

self

Passed: a <GParam>.

a valid <GParam>

Method: param-spec:steal-qdata self quark ⇒ %return
Method: steal-qdata self quark ⇒ %return

Gets back user data pointers stored via param-spec:set-qdata and removes the data from self without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier.

self

Passed: a <GParam>.

the <GParam> to get a stored user data pointer from

quark

Passed: an unsigned 32-bit integer.

a GQuark, naming the user data pointer

%return

Returned: a foreign pointer, or #f.

the user data pointer set, or #f

Virtual methods

Virtual method: param-spec:do-finalize implementor self

The instance finalization function (optional), should chain up to the finalize method of the parent class.

To override it in a new class, give register-type #:vfuncs `((finalize . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GParam>, or a class that derives from it, or its GType number.

self

Passed: a <GParam>.

Virtual method: param-spec:do-value-is-valid implementor self value ⇒ %return

Checks if contents of value comply with the specifications set out by this type, without modifying the value. This vfunc is optional. If it isn’t set, GObject will use value-validate. Since 2.74

To override it in a new class, give register-type #:vfuncs `((value-is-valid . ,procedure)). The procedure is called as (procedure self value) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GParam>, or a class that derives from it, or its GType number.

self

Passed: a <GParam>.

value

Passed: a <GValue>.

%return

Returned: a boolean.

Virtual method: param-spec:do-value-set-default implementor self value

Resets a value to the default value for this type (recommended, the default is value:reset), see param-value-set-default.

To override it in a new class, give register-type #:vfuncs `((value-set-default . ,procedure)). The procedure is called as (procedure self value).

implementor

Passed: the class whose implementation to call: <GParam>, or a class that derives from it, or its GType number.

self

Passed: a <GParam>.

value

Passed: a <GValue>.

Virtual method: param-spec:do-value-validate implementor self value ⇒ %return

Ensures that the contents of value comply with the specifications set out by this type (optional), see param-value-validate?.

To override it in a new class, give register-type #:vfuncs `((value-validate . ,procedure)). The procedure is called as (procedure self value) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GParam>, or a class that derives from it, or its GType number.

self

Passed: a <GParam>.

value

Passed: a <GValue>.

%return

Returned: a boolean.

Virtual method: param-spec:do-values-cmp implementor self value1 value2 ⇒ %return

Compares value1 with value2 according to this type (recommended, the default is memcmp()), see param-values-cmp.

To override it in a new class, give register-type #:vfuncs `((values-cmp . ,procedure)). The procedure is called as (procedure self value1 value2) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GParam>, or a class that derives from it, or its GType number.

self

Passed: a <GParam>.

value1

Passed: a <GValue>.

value2

Passed: a <GValue>.

%return

Returned: a 32-bit integer.