mirror of https://github.com/MidnightCommander/mc
(listbox_set_list): change argument type.
This commit is contained in:
parent
00f1229af3
commit
2fce07a7e1
|
@ -315,8 +315,9 @@ history_save (mc_config_t * cfg, const char *name, GList * h)
|
|||
char *
|
||||
history_show (GList ** history, Widget * widget, int current, int *action)
|
||||
{
|
||||
GList *z, *hlist = NULL, *hi;
|
||||
size_t maxlen, count = 0;
|
||||
GList *z, *hi;
|
||||
GQueue *hlist;
|
||||
size_t maxlen, count;
|
||||
char *r = NULL;
|
||||
WDialog *query_dlg;
|
||||
WListbox *query_list;
|
||||
|
@ -328,6 +329,8 @@ history_show (GList ** history, Widget * widget, int current, int *action)
|
|||
|
||||
maxlen = str_term_width1 (_("History")) + 2;
|
||||
|
||||
hlist = g_queue_new ();
|
||||
|
||||
for (z = *history; z != NULL; z = g_list_previous (z))
|
||||
{
|
||||
WLEntry *entry;
|
||||
|
@ -335,14 +338,15 @@ history_show (GList ** history, Widget * widget, int current, int *action)
|
|||
|
||||
i = str_term_width1 ((char *) z->data);
|
||||
maxlen = MAX (maxlen, i);
|
||||
count++;
|
||||
|
||||
entry = g_new0 (WLEntry, 1);
|
||||
/* history is being reverted here */
|
||||
entry->text = g_strdup ((char *) z->data);
|
||||
hlist = g_list_prepend (hlist, entry);
|
||||
g_queue_push_head (hlist, entry);
|
||||
}
|
||||
|
||||
count = g_queue_get_length (hlist);
|
||||
|
||||
hist_data.widget = widget;
|
||||
hist_data.count = count;
|
||||
hist_data.maxlen = maxlen;
|
||||
|
@ -379,7 +383,7 @@ history_show (GList ** history, Widget * widget, int current, int *action)
|
|||
{
|
||||
/* draw list entries from top downto bottom */
|
||||
/* revert history direction */
|
||||
hlist = g_list_reverse (hlist);
|
||||
g_queue_reverse (hlist);
|
||||
listbox_set_list (query_list, hlist);
|
||||
if (current > 0)
|
||||
listbox_select_entry (query_list, current);
|
||||
|
|
|
@ -760,22 +760,19 @@ listbox_is_empty (const WListbox * l)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Set new listbox items list.
|
||||
*
|
||||
* @param l WListbox object
|
||||
* @param list list of WLEntry objects
|
||||
*/
|
||||
void
|
||||
listbox_set_list (WListbox * l, GList * list)
|
||||
listbox_set_list (WListbox * l, GQueue * list)
|
||||
{
|
||||
listbox_remove_list (l);
|
||||
|
||||
if (l != NULL)
|
||||
{
|
||||
GList *ll;
|
||||
|
||||
l->list = g_queue_new ();
|
||||
|
||||
for (ll = list; ll != NULL; ll = g_list_next (ll))
|
||||
g_queue_push_tail (l->list, ll->data);
|
||||
|
||||
g_list_free (list);
|
||||
}
|
||||
l->list = list;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -73,7 +73,7 @@ WLEntry *listbox_get_nth_item (const WListbox * l, int pos);
|
|||
GList *listbox_get_first_link (const WListbox * l);
|
||||
void listbox_remove_current (WListbox * l);
|
||||
gboolean listbox_is_empty (const WListbox * l);
|
||||
void listbox_set_list (WListbox * l, GList * list);
|
||||
void listbox_set_list (WListbox * l, GQueue * list);
|
||||
void listbox_remove_list (WListbox * l);
|
||||
char *listbox_add_item (WListbox * l, listbox_append_t pos, int hotkey, const char *text,
|
||||
void *data, gboolean free_data);
|
||||
|
|
Loading…
Reference in New Issue