1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Removing items from a list box using gtk_container_remove is nasty,

because when the selected item is removed the selection moves on to
another item. Thus, calling dlg_listbox_clear causes repeated
selchanges in the list, which in turn cause repeated valchanges if
the list is attached to a combo box. This has been completely
scuppering the Translation panel.

[originally from svn r3130]
This commit is contained in:
Simon Tatham 2003-04-18 09:14:54 +00:00
parent 717fd50963
commit ec3595f7d4

View File

@ -307,15 +307,18 @@ void dlg_listbox_clear(union control *ctrl, void *dlg)
{
struct dlgparam *dp = (struct dlgparam *)dlg;
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
GtkContainer *cont;
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
uc->ctrl->generic.type == CTRL_LISTBOX);
assert(uc->menu != NULL || uc->list != NULL);
cont = (uc->menu ? GTK_CONTAINER(uc->menu) : GTK_CONTAINER(uc->list));
gtk_container_foreach(cont, container_remove_and_destroy, cont);
if (uc->menu) {
gtk_container_foreach(GTK_CONTAINER(uc->menu),
container_remove_and_destroy,
GTK_CONTAINER(uc->menu));
} else {
gtk_list_clear_items(GTK_LIST(uc->list), 0, -1);
}
}
void dlg_listbox_del(union control *ctrl, void *dlg, int index)