stack: Avoid some ugly unrefs

Instead of using the list model api that forces us
to drop the ref, just work with the list we have.
This commit is contained in:
Matthias Clasen 2019-02-13 08:40:13 -05:00
parent f4b26af255
commit c0c6c87781

View File

@ -464,8 +464,7 @@ gtk_stack_pages_is_selected (GtkSelectionModel *model,
GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
GtkStackPage *page;
page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position));
g_object_unref (page);
page = g_list_nth_data (priv->children, position);
return page == priv->visible_child;
}
@ -484,8 +483,7 @@ gtk_stack_pages_select_item (GtkSelectionModel *model,
GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
GtkStackPage *page;
page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position));
g_object_unref (page);
page = g_list_nth_data (priv->children, position);
set_visible_child (pages->stack, page, priv->transition_type, priv->transition_duration);