Centering columns inside GtkIconView

Hi GNOME Discourse! First time here. Getting started with GTK.

Does anybody know of a way to center the grid columns inside of a GtkIconView widget? I’m working with a page with columns set to -1, so that the number of columns is dynamic based on the size of the container. Visually, I’m looking to go from the layout on the left to the one on the right in this screenshot:

Checking the list of properties on and the inspector tool hasn’t led me anywhere useful. Curious to know if there’s a markup-only solution to this. Thanks!

You cannot center the columns inside an IconView; at most, you can center the IconView widget itself within the space allocated by its parent, by using the GtkWidget:halign and GtkWidget:hexpand properties:

  gtk_widget_set_halign (icon_view, GTK_ALIGN_CENTER);
  gtk_widget_set_hexpand (icon_view, TRUE);
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.