tDon't add a listbox row if we're changing existing - vaccinewars - be a doctor… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 3de454d0ab7052f5dbbb98742b61f7f23bfce7f7 | |
parent f5de7c748d56a88c479065b9434a2d406d67c452 | |
Author: Ben Webb <[email protected]> | |
Date: Sat, 28 Nov 2020 21:45:41 -0800 | |
Don't add a listbox row if we're changing existing | |
Only add a new row to the underlying Win32 listbox | |
if we're adding a new row to the GtkTreeView, not | |
just changing an existing row. | |
Diffstat: | |
M src/gtkport/treeview.c | 10 +++++++++- | |
1 file changed, 9 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/src/gtkport/treeview.c b/src/gtkport/treeview.c | |
t@@ -360,6 +360,7 @@ void gtk_list_store_set(GtkListStore *list_store, GtkTreeI… | |
{ | |
va_list ap; | |
int colind; | |
+ gboolean new_row = TRUE; | |
GtkListStoreRow *row = &g_array_index(list_store->rows, GtkListStoreRow, | |
*iter); | |
list_store->need_sort = TRUE; | |
t@@ -369,6 +370,9 @@ void gtk_list_store_set(GtkListStore *list_store, GtkTreeI… | |
switch(list_store->coltype[colind]) { | |
case G_TYPE_STRING: | |
g_free(row->data[colind]); /* Free any existing string */ | |
+ if (row->data[colind]) { | |
+ new_row = FALSE; | |
+ } | |
row->data[colind] = g_strdup(va_arg(ap, const char*)); | |
break; | |
case G_TYPE_UINT: | |
t@@ -392,7 +396,11 @@ void gtk_list_store_set(GtkListStore *list_store, GtkTree… | |
if (GTK_WIDGET_REALIZED(widget)) { | |
HWND hWnd = widget->hWnd; | |
- mySendMessage(hWnd, LB_INSERTSTRING, (WPARAM)*iter, 1); | |
+ if (new_row) { | |
+ mySendMessage(hWnd, LB_INSERTSTRING, (WPARAM)*iter, 1); | |
+ } else { | |
+ InvalidateRect(hWnd, NULL, FALSE); | |
+ } | |
} | |
} | |
} |