Added listbox_set_list() function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-01-08 13:12:06 +03:00
parent 1d16fd3a88
commit 1695465594
2 changed files with 14 additions and 1 deletions

View File

@ -2146,6 +2146,18 @@ listbox_select_first (WListbox *l)
l->pos = l->top = 0;
}
void
listbox_set_list (WListbox *l, GList *list)
{
listbox_remove_list (l);
if (l != NULL) {
l->list = list;
l->top = l->pos = 0;
l->count = g_list_length (list);
}
}
void
listbox_remove_list (WListbox *l)
{
@ -2153,7 +2165,7 @@ listbox_remove_list (WListbox *l)
g_list_foreach (l->list, (GFunc) listbox_entry_free, NULL);
g_list_free (l->list);
l->list = NULL;
l->pos = l->top = 0;
l->count = l->pos = l->top = 0;
}
}

View File

@ -228,6 +228,7 @@ void listbox_select_entry (WListbox *l, int dest);
void listbox_select_first (WListbox *l);
void listbox_select_last (WListbox *l);
void listbox_remove_current (WListbox *l);
void listbox_set_list (WListbox *l, GList *list);
void listbox_remove_list (WListbox *l);
void listbox_get_current (WListbox *l, char **string, void **extra);