mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
listfactorywidget: Stop trying to be smart
The widget would teardown the factory on unroot to avoid unnecessary work when it isn't shown. However, recycling may reposition widgets, and repositioning widgets does a unroot/root. We don't want to recycle widgets then.
This commit is contained in:
parent
924fd195ab
commit
3fb10ff2d8
@ -204,30 +204,6 @@ gtk_list_factory_widget_update (GtkListItemBase *base,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_factory_widget_root (GtkWidget *widget)
|
||||
{
|
||||
GtkListFactoryWidget *self = GTK_LIST_FACTORY_WIDGET (widget);
|
||||
GtkListFactoryWidgetPrivate *priv = gtk_list_factory_widget_get_instance_private (self);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_list_factory_widget_parent_class)->root (widget);
|
||||
|
||||
if (priv->factory)
|
||||
gtk_list_factory_widget_setup_factory (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_factory_widget_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkListFactoryWidget *self = GTK_LIST_FACTORY_WIDGET (widget);
|
||||
GtkListFactoryWidgetPrivate *priv = gtk_list_factory_widget_get_instance_private (self);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_list_factory_widget_parent_class)->unroot (widget);
|
||||
|
||||
if (priv->object)
|
||||
gtk_list_factory_widget_teardown_factory (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_factory_widget_set_property (GObject *object,
|
||||
guint property_id,
|
||||
@ -260,15 +236,25 @@ gtk_list_factory_widget_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_factory_widget_clear_factory (GtkListFactoryWidget *self)
|
||||
{
|
||||
GtkListFactoryWidgetPrivate *priv = gtk_list_factory_widget_get_instance_private (self);
|
||||
|
||||
if (priv->factory == NULL)
|
||||
return;
|
||||
|
||||
if (priv->object)
|
||||
gtk_list_factory_widget_teardown_factory (self);
|
||||
|
||||
g_clear_object (&priv->factory);
|
||||
}
|
||||
static void
|
||||
gtk_list_factory_widget_dispose (GObject *object)
|
||||
{
|
||||
GtkListFactoryWidget *self = GTK_LIST_FACTORY_WIDGET (object);
|
||||
GtkListFactoryWidgetPrivate *priv = gtk_list_factory_widget_get_instance_private (self);
|
||||
|
||||
g_assert (priv->object == NULL);
|
||||
|
||||
g_clear_object (&priv->factory);
|
||||
gtk_list_factory_widget_clear_factory (self);
|
||||
|
||||
G_OBJECT_CLASS (gtk_list_factory_widget_parent_class)->dispose (object);
|
||||
}
|
||||
@ -319,9 +305,6 @@ gtk_list_factory_widget_class_init (GtkListFactoryWidgetClass *klass)
|
||||
|
||||
base_class->update = gtk_list_factory_widget_update;
|
||||
|
||||
widget_class->root = gtk_list_factory_widget_root;
|
||||
widget_class->unroot = gtk_list_factory_widget_unroot;
|
||||
|
||||
gobject_class->set_property = gtk_list_factory_widget_set_property;
|
||||
gobject_class->dispose = gtk_list_factory_widget_dispose;
|
||||
|
||||
@ -553,19 +536,13 @@ gtk_list_factory_widget_set_factory (GtkListFactoryWidget *self,
|
||||
if (priv->factory == factory)
|
||||
return;
|
||||
|
||||
if (priv->factory)
|
||||
{
|
||||
if (priv->object)
|
||||
gtk_list_factory_widget_teardown_factory (self);
|
||||
g_clear_object (&priv->factory);
|
||||
}
|
||||
gtk_list_factory_widget_clear_factory (self);
|
||||
|
||||
if (factory)
|
||||
{
|
||||
priv->factory = g_object_ref (factory);
|
||||
|
||||
if (gtk_widget_get_root (GTK_WIDGET (self)))
|
||||
gtk_list_factory_widget_setup_factory (self);
|
||||
gtk_list_factory_widget_setup_factory (self);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
||||
|
Loading…
Reference in New Issue
Block a user