mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Use listbox_add_item_take() in obvious cases.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
401cd4a16c
commit
75ee44db20
@ -252,9 +252,8 @@ dialog_switch_list (void)
|
||||
else
|
||||
title = g_strdup ("");
|
||||
|
||||
listbox_add_item (listbox->list, LISTBOX_APPEND_BEFORE, get_hotkey (i++), title, h, FALSE);
|
||||
|
||||
g_free (title);
|
||||
listbox_add_item_take (listbox->list, LISTBOX_APPEND_BEFORE, get_hotkey (i++), title, h,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
selected = listbox_run_with_data (listbox, mc_current);
|
||||
|
@ -303,9 +303,8 @@ editcmd_dialog_select_definition_add (gpointer data, gpointer user_data)
|
||||
label_def =
|
||||
g_strdup_printf ("%s -> %s:%ld", def_hash->short_define, def_hash->filename,
|
||||
def_hash->line);
|
||||
listbox_add_item (def_list, LISTBOX_APPEND_AT_END, 0, label_def, def_hash, FALSE);
|
||||
listbox_add_item_take (def_list, LISTBOX_APPEND_AT_END, 0, label_def, def_hash, FALSE);
|
||||
def_width = str_term_width1 (label_def);
|
||||
g_free (label_def);
|
||||
def_max_width = MAX (def_max_width, def_width);
|
||||
}
|
||||
|
||||
|
@ -474,8 +474,7 @@ jobs_fill_listbox (WListbox * list)
|
||||
char *s;
|
||||
|
||||
s = g_strconcat (state_str[tl->state], " ", tl->info, (char *) NULL);
|
||||
listbox_add_item (list, LISTBOX_APPEND_AT_END, 0, s, (void *) tl, FALSE);
|
||||
g_free (s);
|
||||
listbox_add_item_take (list, LISTBOX_APPEND_AT_END, 0, s, (void *) tl, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,20 +271,16 @@ static void
|
||||
fill_listbox (WListbox * list)
|
||||
{
|
||||
struct hotlist *current;
|
||||
GString *buff;
|
||||
|
||||
buff = g_string_new ("");
|
||||
|
||||
for (current = current_group->head; current != NULL; current = current->next)
|
||||
switch (current->type)
|
||||
{
|
||||
case HL_TYPE_GROUP:
|
||||
{
|
||||
/* buff clean up */
|
||||
g_string_truncate (buff, 0);
|
||||
g_string_append (buff, "->");
|
||||
g_string_append (buff, current->label);
|
||||
listbox_add_item (list, LISTBOX_APPEND_AT_END, 0, buff->str, current, FALSE);
|
||||
char *lbl;
|
||||
|
||||
lbl = g_strconcat ("->", current->label, (char *) NULL);
|
||||
listbox_add_item_take (list, LISTBOX_APPEND_AT_END, 0, lbl, current, FALSE);
|
||||
}
|
||||
break;
|
||||
case HL_TYPE_DOTDOT:
|
||||
@ -294,8 +290,6 @@ fill_listbox (WListbox * list)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_string_free (buff, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -988,8 +982,7 @@ add2hotlist (char *label, char *directory, enum HotListType type, listbox_append
|
||||
char *lbl;
|
||||
|
||||
lbl = g_strconcat ("->", new->label, (char *) NULL);
|
||||
listbox_add_item (l_hotlist, pos, 0, lbl, new, FALSE);
|
||||
g_free (lbl);
|
||||
listbox_add_item_take (l_hotlist, pos, 0, lbl, new, FALSE);
|
||||
}
|
||||
else
|
||||
listbox_add_item (l_hotlist, pos, 0, new->label, new, FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user