diff --git a/gtk/gtkcolumnlistitemfactory.c b/gtk/gtkcolumnlistitemfactory.c index 9951a7c47a..d69bd12e04 100644 --- a/gtk/gtkcolumnlistitemfactory.c +++ b/gtk/gtkcolumnlistitemfactory.c @@ -65,10 +65,11 @@ gtk_column_list_item_factory_setup (GtkListItemFactory *factory, { GtkColumnViewColumn *column = g_list_model_get_item (columns, i); - gtk_column_list_item_factory_add_column (self, - widget, - column, - FALSE); + if (gtk_column_view_column_get_visible (column)) + gtk_column_list_item_factory_add_column (self, + widget, + column, + FALSE); g_object_unref (column); } diff --git a/gtk/gtkcolumnviewcolumn.c b/gtk/gtkcolumnviewcolumn.c index 715248f1c8..d4357760cb 100644 --- a/gtk/gtkcolumnviewcolumn.c +++ b/gtk/gtkcolumnviewcolumn.c @@ -579,7 +579,8 @@ gtk_column_view_column_remove_header (GtkColumnViewColumn *self) static void gtk_column_view_column_ensure_cells (GtkColumnViewColumn *self) { - if (self->view && gtk_widget_get_root (GTK_WIDGET (self->view))) + if (self->view && gtk_widget_get_root (GTK_WIDGET (self->view)) && + gtk_column_view_column_get_visible (self)) gtk_column_view_column_create_cells (self); else gtk_column_view_column_remove_cells (self); @@ -804,8 +805,6 @@ void gtk_column_view_column_set_visible (GtkColumnViewColumn *self, gboolean visible) { - GtkColumnViewCell *cell; - g_return_if_fail (GTK_IS_COLUMN_VIEW_COLUMN (self)); if (self->visible == visible) @@ -819,10 +818,7 @@ gtk_column_view_column_set_visible (GtkColumnViewColumn *self, if (self->header) gtk_widget_set_visible (GTK_WIDGET (self->header), visible); - for (cell = self->first_cell; cell; cell = gtk_column_view_cell_get_next (cell)) - { - gtk_widget_set_visible (GTK_WIDGET (cell), visible); - } + gtk_column_view_column_ensure_cells (self); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VISIBLE]); }