mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 04:31:09 +00:00
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 {
|
||||
PROP_WIDGET = 1,
|
||||
PROP_PROPAGATION_PHASE
|
||||
PROP_PROPAGATION_PHASE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||
|
||||
struct _GtkEventControllerPrivate
|
||||
{
|
||||
GtkWidget *widget;
|
||||
@ -160,14 +163,12 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
||||
*
|
||||
* Since: 3.14
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_WIDGET,
|
||||
properties[PROP_WIDGET] =
|
||||
g_param_spec_object ("widget",
|
||||
P_("Widget"),
|
||||
P_("Widget the gesture relates to"),
|
||||
GTK_TYPE_WIDGET,
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||
/**
|
||||
* GtkEventController:propagation-phase:
|
||||
*
|
||||
@ -175,14 +176,15 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
||||
*
|
||||
* Since: 3.14
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_PROPAGATION_PHASE,
|
||||
properties[PROP_PROPAGATION_PHASE] =
|
||||
g_param_spec_enum ("propagation-phase",
|
||||
P_("Propagation phase"),
|
||||
P_("Propagation phase at which this controller is run"),
|
||||
GTK_TYPE_PROPAGATION_PHASE,
|
||||
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
|
||||
@ -359,5 +361,5 @@ gtk_event_controller_set_propagation_phase (GtkEventController *controller,
|
||||
if (phase == GTK_PHASE_NONE)
|
||||
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