abstract class GObject.ParamSpec : GObject.TypeInstance {
  g_type_instance: GTypeInstance,
  name: const gchar*,
  flags: GParamFlags,
  value_type: GType,
  owner_type: GType

GParamSpec is an object structure that encapsulates the metadata required to specify parameters, such as e.g. GObject properties.

Parameter names # {#canonical-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 g_signal_new()).

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



Creates a new GParamSpec instance.


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

since: 2.66

Instance methods


Get the short description of a GParamSpec.


Gets the default value of pspec as a pointer to a GValue.

since: 2.38


Get the name of a GParamSpec.


Gets the GQuark for the name.

since: 2.46


Get the nickname of a GParamSpec.


Gets back user data pointers stored via g_param_spec_set_qdata().


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 GParamSpecOverride. See g_object_class_override_property() for an example of the use of this capability.

since: 2.4


Increments the reference count of pspec.


Convenience function to ref and sink a GParamSpec.

since: 2.10


Sets an opaque, named pointer on a GParamSpec. The name is specified through a GQuark (retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the pspec with g_param_spec_get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as pointer essentially removes the data stored.


This function works like g_param_spec_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the pspec is finalized, or the data is being overwritten by a call to g_param_spec_set_qdata() with the same quark.


The initial reference count of a newly created GParamSpec 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 pspec that has a reference count of 1 still, but is not flagged “floating” anymore).


Gets back user data pointers stored via g_param_spec_set_qdata() and removes the data from pspec 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.


Decrements the reference count of a pspec.

Class structure

struct GObjectParamSpecClass {
  GTypeClass g_type_class;
  GType value_type;
  void (* finalize) (
    GParamSpec* pspec
  void (* value_set_default) (
    GParamSpec* pspec,
    GValue* value
  gboolean (* value_validate) (
    GParamSpec* pspec,
    GValue* value
  gint (* values_cmp) (
    GParamSpec* pspec,
    const GValue* value1,
    const GValue* value2
  gboolean (* value_is_valid) (
    GParamSpec* pspec,
    const GValue* value

The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by g_param_type_register_static().

Class members
g_type_class: GTypeClass

The parent class.

value_type: GType

The GValue type for this parameter.

finalize: void (* finalize) ( GParamSpec* pspec )
No description available.
value_set_default: void (* value_set_default) ( GParamSpec* pspec, GValue* value )
No description available.
value_validate: gboolean (* value_validate) ( GParamSpec* pspec, GValue* value )
No description available.
values_cmp: gint (* values_cmp) ( GParamSpec* pspec, const GValue* value1, const GValue* value2 )
No description available.
value_is_valid: gboolean (* value_is_valid) ( GParamSpec* pspec, const GValue* value )
No description available.

Virtual methods

No description available.

No description available.

No description available.

No description available.

No description available.