ObjectWrap.notifyByPspec

void notifyByPspec(gobject.param_spec.ParamSpec pspec)

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

This function omits the property name lookup, hence it is faster than [gobject.object.ObjectWrap.notify].

One way to avoid using [gobject.object.ObjectWrap.notify] from within the class that registered the properties, and using [gobject.object.ObjectWrap.notifyByPspec] instead, is to store the GParamSpec used with [gobject.object_class.ObjectClass.installProperty] inside a static array, e.g.:

typedef enum
 {
   PROP_FOO = 1,
   PROP_LAST
 } MyObjectProperty;

 static GParamSpec *properties[PROP_LAST];

 static void
 my_object_class_init (MyObjectClass *klass)
 {
   properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
                                            0, 100,
                                            50,
                                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (gobject_class,
                                    PROP_FOO,
                                    properties[PROP_FOO]);
 }

and then notify a change on the "foo" property with:

g_object_notify_by_pspec (self, properties[PROP_FOO]);

Parameters

pspecthe #GParamSpec of a property installed on the class of object.