tSwap iterators in gtk_list_store_swap - vaccinewars - be a doctor and try to vaccinate the world
HTML git clone git://src.adamsgaard.dk/vaccinewars
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit ce18bc615c475854bc4b4bcd0e5750092a7c8cdf
DIR parent 3de454d0ab7052f5dbbb98742b61f7f23bfce7f7
HTML Author: Ben Webb <ben@salilab.org>
Date: Sat, 28 Nov 2020 21:54:07 -0800
Swap iterators in gtk_list_store_swap
Since our Win32 implementation uses row
indices for iterators, we need to swap these
ttoo when we swap the rows, in order for things
tto be consistent with regular GTK.
Diffstat:
M src/gtkport/treeview.c | 7 +++++++
1 file changed, 7 insertions(+), 0 deletions(-)
---
DIR diff --git a/src/gtkport/treeview.c b/src/gtkport/treeview.c
t@@ -407,12 +407,19 @@ void gtk_list_store_set(GtkListStore *list_store, GtkTreeIter *iter, ...)
void gtk_list_store_swap(GtkListStore *store, GtkTreeIter *a, GtkTreeIter *b)
{
+ GtkTreeIter tmp;
GtkListStoreRow rowa = g_array_index(store->rows, GtkListStoreRow, *a);
GtkListStoreRow rowb = g_array_index(store->rows, GtkListStoreRow, *b);
g_array_index(store->rows, GtkListStoreRow, *a) = rowb;
g_array_index(store->rows, GtkListStoreRow, *b) = rowa;
store->need_sort = TRUE;
+
+ /* Swap the iterators too since in our implementation they are just row
+ indices */
+ tmp = *a;
+ *a = *b;
+ *b = tmp;
}
void gtk_tree_model_get(GtkTreeModel *tree_model, GtkTreeIter *iter, ...)