event controller: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
This commit is contained in:
parent
143d3c1204
commit
89ca0db7c5
@ -42,9 +42,12 @@ typedef struct _GtkEventControllerPrivate GtkEventControllerPrivate;
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_WIDGET = 1,
|
PROP_WIDGET = 1,
|
||||||
PROP_PROPAGATION_PHASE
|
PROP_PROPAGATION_PHASE,
|
||||||
|
LAST_PROP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||||
|
|
||||||
struct _GtkEventControllerPrivate
|
struct _GtkEventControllerPrivate
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
@ -160,14 +163,12 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 3.14
|
* Since: 3.14
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
properties[PROP_WIDGET] =
|
||||||
PROP_WIDGET,
|
g_param_spec_object ("widget",
|
||||||
g_param_spec_object ("widget",
|
P_("Widget"),
|
||||||
P_("Widget"),
|
P_("Widget the gesture relates to"),
|
||||||
P_("Widget the gesture relates to"),
|
GTK_TYPE_WIDGET,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||||
GTK_PARAM_READWRITE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
|
||||||
/**
|
/**
|
||||||
* GtkEventController:propagation-phase:
|
* GtkEventController:propagation-phase:
|
||||||
*
|
*
|
||||||
@ -175,14 +176,15 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 3.14
|
* Since: 3.14
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
properties[PROP_PROPAGATION_PHASE] =
|
||||||
PROP_PROPAGATION_PHASE,
|
g_param_spec_enum ("propagation-phase",
|
||||||
g_param_spec_enum ("propagation-phase",
|
P_("Propagation phase"),
|
||||||
P_("Propagation phase"),
|
P_("Propagation phase at which this controller is run"),
|
||||||
P_("Propagation phase at which this controller is run"),
|
GTK_TYPE_PROPAGATION_PHASE,
|
||||||
GTK_TYPE_PROPAGATION_PHASE,
|
GTK_PHASE_BUBBLE,
|
||||||
GTK_PHASE_BUBBLE,
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -359,5 +361,5 @@ gtk_event_controller_set_propagation_phase (GtkEventController *controller,
|
|||||||
if (phase == GTK_PHASE_NONE)
|
if (phase == GTK_PHASE_NONE)
|
||||||
gtk_event_controller_reset (controller);
|
gtk_event_controller_reset (controller);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (controller), "propagation-phase");
|
g_object_notify_by_pspec (G_OBJECT (controller), properties[PROP_PROPAGATION_PHASE]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user