[gtk/columnview-reorder-cells: 3/3] columnview: Update column positions on reordering
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/columnview-reorder-cells: 3/3] columnview: Update column positions on reordering
- Date: Fri, 5 Jun 2020 16:43:45 +0000 (UTC)
commit 8ec3690f8d6ca9d33f68f637d8d91f7e1c2c7f8d
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 5 12:40:32 2020 -0400
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.
gtk/gtkcolumnview.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcolumnview.c b/gtk/gtkcolumnview.c
index 46fb357147..190a3ae0e9 100644
--- a/gtk/gtkcolumnview.c
+++ b/gtk/gtkcolumnview.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]