mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 21:12:07 +03:00
(dialog_switch_list): simplify the listbox selector.
We use the new run_listbox_with_data(). Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
parent
6273b46bb5
commit
bc46978036
@ -220,9 +220,8 @@ dialog_switch_list (void)
|
|||||||
const size_t dlg_num = g_list_length (mc_dialogs);
|
const size_t dlg_num = g_list_length (mc_dialogs);
|
||||||
int lines, cols;
|
int lines, cols;
|
||||||
Listbox *listbox;
|
Listbox *listbox;
|
||||||
GList *h;
|
GList *h, *selected;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int rv;
|
|
||||||
|
|
||||||
if (mc_global.midnight_shutdown || mc_current == NULL)
|
if (mc_global.midnight_shutdown || mc_current == NULL)
|
||||||
return;
|
return;
|
||||||
@ -244,20 +243,14 @@ dialog_switch_list (void)
|
|||||||
else
|
else
|
||||||
title = g_strdup ("");
|
title = g_strdup ("");
|
||||||
|
|
||||||
listbox_add_item (listbox->list, LISTBOX_APPEND_BEFORE, get_hotkey (i++), title, NULL,
|
listbox_add_item (listbox->list, LISTBOX_APPEND_BEFORE, get_hotkey (i++), title, h, FALSE);
|
||||||
FALSE);
|
|
||||||
|
|
||||||
g_free (title);
|
g_free (title);
|
||||||
}
|
}
|
||||||
|
|
||||||
listbox_select_entry (listbox->list, dlg_num - 1 - g_list_position (mc_dialogs, mc_current));
|
selected = run_listbox_with_data (listbox, mc_current);
|
||||||
rv = run_listbox (listbox);
|
if (selected != NULL)
|
||||||
|
dialog_switch_goto (selected);
|
||||||
if (rv >= 0)
|
|
||||||
{
|
|
||||||
h = g_list_nth (mc_dialogs, dlg_num - 1 - rv);
|
|
||||||
dialog_switch_goto (h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user