mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
gridview: Add a filler tile for empty space
That stupid space in the bottom right when n_items isn't a multiple of n_columns needs its own tile, or we'll get errors about not finding a tile. So make one.
This commit is contained in:
parent
882dcda53b
commit
e8c5a771e5
@ -737,6 +737,21 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
/* Add a filler tile for empty space in the bottom right */
|
||||
if (i < self->n_columns)
|
||||
{
|
||||
GtkListTile *filler;
|
||||
tile = gtk_list_item_manager_get_last (self->item_manager);
|
||||
filler = gtk_list_tile_split (self->item_manager, tile, tile->n_items);
|
||||
gtk_list_tile_set_area_position (self->item_manager,
|
||||
filler,
|
||||
ceil (self->column_width * i),
|
||||
y);
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
filler,
|
||||
ceil (self->column_width * self->n_columns) - filler->area.x,
|
||||
tile->area.height);
|
||||
}
|
||||
|
||||
/* step 4: allocate the rest */
|
||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||
|
@ -184,6 +184,12 @@ gtk_list_item_manager_get_first (GtkListItemManager *self)
|
||||
return gtk_rb_tree_get_first (self->items);
|
||||
}
|
||||
|
||||
gpointer
|
||||
gtk_list_item_manager_get_last (GtkListItemManager *self)
|
||||
{
|
||||
return gtk_rb_tree_get_last (self->items);
|
||||
}
|
||||
|
||||
gpointer
|
||||
gtk_list_item_manager_get_root (GtkListItemManager *self)
|
||||
{
|
||||
|
@ -71,6 +71,7 @@ void gtk_list_item_manager_get_tile_bounds (GtkListItemMana
|
||||
GdkRectangle *out_bounds);
|
||||
gpointer gtk_list_item_manager_get_root (GtkListItemManager *self);
|
||||
gpointer gtk_list_item_manager_get_first (GtkListItemManager *self);
|
||||
gpointer gtk_list_item_manager_get_last (GtkListItemManager *self);
|
||||
gpointer gtk_list_item_manager_get_nth (GtkListItemManager *self,
|
||||
guint position,
|
||||
guint *offset);
|
||||
|
Loading…
Reference in New Issue
Block a user