columnview: Update column positions on reordering

Tell reordered columns to reorder their cells to
the new position. This is necessary to get things
like separators right. The visible symptom of this
problem was the lack of the right border when the
last column is reorder to another position, since
the title widget was still the last in its container,
so :last-child applied.
This commit is contained in:
Matthias Clasen
2020-06-05 12:40:32 -04:00
parent 6df489d5a9
commit f631e0e1e0

View File

@@ -1363,6 +1363,7 @@ gtk_column_view_insert_column (GtkColumnView *self,
g_return_if_fail (gtk_column_view_column_get_column_view (column) == NULL ||
gtk_column_view_column_get_column_view (column) == self);
g_return_if_fail (position <= g_list_model_get_n_items (G_LIST_MODEL (self->columns)));
int old_position = -1;
g_object_ref (column);
@@ -1377,16 +1378,20 @@ gtk_column_view_insert_column (GtkColumnView *self,
g_object_unref (item);
if (item == column)
{
old_position = i;
g_list_store_remove (self->columns, i);
break;
}
}
}
else
gtk_column_view_column_set_column_view (column, self);
g_list_store_insert (self->columns, position, column);
gtk_column_view_column_set_column_view (column, self);
if (old_position != -1 && position != old_position)
gtk_column_view_column_set_position (column, position);
gtk_column_view_column_queue_resize (column);
g_object_unref (column);