mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 10:50:08 +00:00
eventcontroller: Get rid of constructed vfunc
Instead, add the controller to the widget in set_property.
This commit is contained in:
parent
8920639a2b
commit
074e7001dc
@ -70,19 +70,21 @@ gtk_event_controller_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkEventControllerPrivate *priv;
|
GtkEventController *self = GTK_EVENT_CONTROLLER (object);
|
||||||
|
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
|
||||||
priv = gtk_event_controller_get_instance_private (GTK_EVENT_CONTROLLER (object));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_WIDGET:
|
case PROP_WIDGET:
|
||||||
priv->widget = g_value_get_object (value);
|
priv->widget = g_value_get_object (value);
|
||||||
if (priv->widget)
|
if (priv->widget)
|
||||||
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
|
g_object_add_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
|
||||||
|
_gtk_widget_add_controller (priv->widget, self);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_PROPAGATION_PHASE:
|
case PROP_PROPAGATION_PHASE:
|
||||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (object),
|
gtk_event_controller_set_propagation_phase (self,
|
||||||
g_value_get_enum (value));
|
g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -96,9 +98,8 @@ gtk_event_controller_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkEventControllerPrivate *priv;
|
GtkEventController *self = GTK_EVENT_CONTROLLER (object);
|
||||||
|
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
|
||||||
priv = gtk_event_controller_get_instance_private (GTK_EVENT_CONTROLLER (object));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -113,19 +114,6 @@ gtk_event_controller_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_event_controller_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
GtkEventController *controller = GTK_EVENT_CONTROLLER (object);
|
|
||||||
GtkEventControllerPrivate *priv;
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_event_controller_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv = gtk_event_controller_get_instance_private (controller);
|
|
||||||
if (priv->widget)
|
|
||||||
_gtk_widget_add_controller (priv->widget, controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_event_controller_dispose (GObject *object)
|
gtk_event_controller_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -153,7 +141,6 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
|||||||
|
|
||||||
object_class->set_property = gtk_event_controller_set_property;
|
object_class->set_property = gtk_event_controller_set_property;
|
||||||
object_class->get_property = gtk_event_controller_get_property;
|
object_class->get_property = gtk_event_controller_get_property;
|
||||||
object_class->constructed = gtk_event_controller_constructed;
|
|
||||||
object_class->dispose = gtk_event_controller_dispose;
|
object_class->dispose = gtk_event_controller_dispose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user