mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +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:
parent
717fd50963
commit
ec3595f7d4
@ -307,15 +307,18 @@ void dlg_listbox_clear(union control *ctrl, void *dlg)
|
|||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
struct dlgparam *dp = (struct dlgparam *)dlg;
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
GtkContainer *cont;
|
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->generic.type == CTRL_LISTBOX);
|
||||||
assert(uc->menu != NULL || uc->list != NULL);
|
assert(uc->menu != NULL || uc->list != NULL);
|
||||||
|
|
||||||
cont = (uc->menu ? GTK_CONTAINER(uc->menu) : GTK_CONTAINER(uc->list));
|
if (uc->menu) {
|
||||||
|
gtk_container_foreach(GTK_CONTAINER(uc->menu),
|
||||||
gtk_container_foreach(cont, container_remove_and_destroy, cont);
|
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)
|
void dlg_listbox_del(union control *ctrl, void *dlg, int index)
|
||||||
|
Loading…
Reference in New Issue
Block a user