summaryrefslogtreecommitdiff
path: root/gtk/gtklistitemmanager.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-09-28 02:05:46 +0200
committerMatthias Clasen <mclasen@redhat.com>2020-05-30 19:26:45 -0400
commitfbfc7dc6901dc724309e6b223a0a60667bab67ef (patch)
tree7cb52e53d59051bd3773de26905b48f36cb7596a /gtk/gtklistitemmanager.c
parentd8eec549f099d61d18971708c6eee6d69ad5b7a4 (diff)
downloadgtk+-fbfc7dc6901dc724309e6b223a0a60667bab67ef.tar.gz
listitemmanager: Switch from "insert_before" to "insert_after" argumnet
We reorder widgets start to end, so when reusing a list item, we correctly know the previous sibling for that list item, but not the next sibling yet. We just know the widget it should ultimately be in front of. So we can do a more correct guess of the list item's place in the widget tree if we think about where to place an item like this. Actually using this change will come in the next commit.
Diffstat (limited to 'gtk/gtklistitemmanager.c')
-rw-r--r--gtk/gtklistitemmanager.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gtk/gtklistitemmanager.c b/gtk/gtklistitemmanager.c
index cce8eda34d..32687440b2 100644
--- a/gtk/gtklistitemmanager.c
+++ b/gtk/gtklistitemmanager.c
@@ -232,8 +232,8 @@ gtk_list_item_manager_change_contains (GtkListItemManagerChange *change,
* gtk_list_item_manager_acquire_list_item:
* @self: a #GtkListItemManager
* @position: the row in the model to create a list item for
- * @next_sibling: the widget this widget should be inserted before or %NULL
- * if none
+ * @prev_sibling: the widget this widget should be inserted before or %NULL
+ * if it should be the first widget
*
* Creates a list item widget to use for @position. No widget may
* yet exist that is used for @position.
@@ -249,20 +249,20 @@ gtk_list_item_manager_change_contains (GtkListItemManagerChange *change,
GtkWidget *
gtk_list_item_manager_acquire_list_item (GtkListItemManager *self,
guint position,
- GtkWidget *next_sibling)
+ GtkWidget *prev_sibling)
{
GtkListItem *result;
gpointer item;
g_return_val_if_fail (GTK_IS_LIST_ITEM_MANAGER (self), NULL);
- g_return_val_if_fail (next_sibling == NULL || GTK_IS_WIDGET (next_sibling), NULL);
+ g_return_val_if_fail (prev_sibling == NULL || GTK_IS_WIDGET (prev_sibling), NULL);
result = gtk_list_item_factory_create (self->factory);
item = g_list_model_get_item (self->model, position);
gtk_list_item_factory_bind (self->factory, result, position, item);
g_object_unref (item);
- gtk_widget_insert_before (GTK_WIDGET (result), self->widget, next_sibling);
+ gtk_widget_insert_after (GTK_WIDGET (result), self->widget, prev_sibling);
return GTK_WIDGET (result);
}
@@ -271,8 +271,8 @@ gtk_list_item_manager_acquire_list_item (GtkListItemManager *self,
* gtk_list_item_manager_try_acquire_list_item_from_change:
* @self: a #GtkListItemManager
* @position: the row in the model to create a list item for
- * @next_sibling: the widget this widget should be inserted before or %NULL
- * if none
+ * @prev_sibling: the widget this widget should be inserted after or %NULL
+ * if it should be the first widget
*
* Like gtk_list_item_manager_acquire_list_item(), but only tries to acquire list
* items from those previously released as part of @change.
@@ -286,20 +286,20 @@ GtkWidget *
gtk_list_item_manager_try_reacquire_list_item (GtkListItemManager *self,
GtkListItemManagerChange *change,
guint position,
- GtkWidget *next_sibling)
+ GtkWidget *prev_sibling)
{
GtkListItem *result;
gpointer item;
g_return_val_if_fail (GTK_IS_LIST_ITEM_MANAGER (self), NULL);
- g_return_val_if_fail (next_sibling == NULL || GTK_IS_WIDGET (next_sibling), NULL);
+ g_return_val_if_fail (prev_sibling == NULL || GTK_IS_WIDGET (prev_sibling), NULL);
/* XXX: can we avoid temporarily allocating items on failure? */
item = g_list_model_get_item (self->model, position);
if (g_hash_table_steal_extended (change->items, item, NULL, (gpointer *) &result))
{
gtk_list_item_factory_update (self->factory, result, position);
- gtk_widget_insert_before (GTK_WIDGET (result), self->widget, next_sibling);
+ gtk_widget_insert_after (GTK_WIDGET (result), self->widget, prev_sibling);
/* XXX: Should we let the listview do this? */
gtk_widget_queue_resize (GTK_WIDGET (result));
}