gridview: Fix condition for adding filler tiles
authorАлексей Шилин <a.i.shilin@yandex.ru>
Thu, 16 Mar 2023 21:21:09 +0000 (00:21 +0300)
committerАлексей Шилин <a.i.shilin@yandex.ru>
Thu, 16 Mar 2023 21:21:09 +0000 (00:21 +0300)
Code above ensures that i is always in [0, n_columns - 1] range, so
the condition was always true, which resulted in filler tile always
being added to the grid. As the result, an empty row appeared at the
end of the grid if the number of columns divided the number of items.

Only add filler tile if last row is not full, i.e. when i > 0.

gtk/gtkgridview.c

index 41ea645125a560b337551055708d57af5dcecfdb..76f2e26e002c61d8d95b0c345f72ed088f0fef96 100644 (file)
@@ -820,7 +820,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
         }
     }
   /* Add a filler tile for empty space in the bottom right */
-  if (i < self->n_columns)
+  if (i > 0)
     {
       GtkListTile *filler;
       tile = gtk_list_item_manager_get_last (self->item_manager);