mirror of https://github.com/MidnightCommander/mc
Listbox window: rename functions.
create_listbox_window -> listbox_window_new create_listbox_window_centered -> listbox_window_new_centered run_listbox -> listbox_run run_listbox_with_data -> listbox_run_with_data Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d9383ba8b3
commit
c157b048e5
|
@ -232,7 +232,7 @@ dialog_switch_list (void)
|
|||
lines = MIN ((size_t) (LINES * 2 / 3), dlg_num);
|
||||
cols = COLS * 2 / 3;
|
||||
|
||||
listbox = create_listbox_window (lines, cols, _("Screens"), "[Screen selector]");
|
||||
listbox = listbox_window_new (lines, cols, _("Screens"), "[Screen selector]");
|
||||
|
||||
for (h = mc_dialogs; h != NULL; h = g_list_next (h))
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ dialog_switch_list (void)
|
|||
g_free (title);
|
||||
}
|
||||
|
||||
selected = run_listbox_with_data (listbox, mc_current);
|
||||
selected = listbox_run_with_data (listbox, mc_current);
|
||||
if (selected != NULL)
|
||||
dialog_switch_goto (selected);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
Listbox *
|
||||
create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
||||
const char *title, const char *help)
|
||||
listbox_window_centered_new (int center_y, int center_x, int lines, int cols,
|
||||
const char *title, const char *help)
|
||||
{
|
||||
const int space = 4;
|
||||
|
||||
|
@ -117,16 +117,16 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
Listbox *
|
||||
create_listbox_window (int lines, int cols, const char *title, const char *help)
|
||||
listbox_window_new (int lines, int cols, const char *title, const char *help)
|
||||
{
|
||||
return create_listbox_window_centered (-1, -1, lines, cols, title, help);
|
||||
return listbox_window_centered_new (-1, -1, lines, cols, title, help);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/** Returns the number of the item selected */
|
||||
int
|
||||
run_listbox (Listbox * l)
|
||||
listbox_run (Listbox * l)
|
||||
{
|
||||
int val = -1;
|
||||
|
||||
|
@ -140,14 +140,14 @@ run_listbox (Listbox * l)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* A variant of run_listbox() which is more convenient to use when we
|
||||
* A variant of listbox_run() which is more convenient to use when we
|
||||
* need to select arbitrary 'data'.
|
||||
*
|
||||
* @param select the item to select initially, by its 'data'. Optional.
|
||||
* @return the 'data' of the item selected, or NULL if none selected.
|
||||
*/
|
||||
void *
|
||||
run_listbox_with_data (Listbox * l, const void *select)
|
||||
listbox_run_with_data (Listbox * l, const void *select)
|
||||
{
|
||||
void *val = NULL;
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ typedef struct
|
|||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
/* Listbox utility functions */
|
||||
Listbox *create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
||||
const char *title, const char *help);
|
||||
Listbox *create_listbox_window (int lines, int cols, const char *title, const char *help);
|
||||
int run_listbox (Listbox * l);
|
||||
void *run_listbox_with_data (Listbox * l, const void *select);
|
||||
Listbox *listbox_window_centered_new (int center_y, int center_x, int lines, int cols,
|
||||
const char *title, const char *help);
|
||||
Listbox *listbox_window_new (int lines, int cols, const char *title, const char *help);
|
||||
int listbox_run (Listbox * l);
|
||||
void *listbox_run_with_data (Listbox * l, const void *select);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ edit_window_list (const WDialog * h)
|
|||
lines = MIN ((size_t) (LINES * 2 / 3), dlg_num);
|
||||
cols = COLS * 2 / 3;
|
||||
|
||||
listbox = create_listbox_window (lines, cols, _("Open files"), "[Open files]");
|
||||
listbox = listbox_window_new (lines, cols, _("Open files"), "[Open files]");
|
||||
|
||||
for (w = g->widgets; w != NULL; w = g_list_next (w))
|
||||
if (edit_widget_is_editor (CONST_WIDGET (w->data)))
|
||||
|
@ -342,7 +342,7 @@ edit_window_list (const WDialog * h)
|
|||
g_free (fname);
|
||||
}
|
||||
|
||||
selected = run_listbox_with_data (listbox, g->current->data);
|
||||
selected = listbox_run_with_data (listbox, g->current->data);
|
||||
if (selected != NULL)
|
||||
widget_select (WIDGET (selected));
|
||||
}
|
||||
|
|
|
@ -838,13 +838,13 @@ spell_dialog_lang_list_show (GArray * languages)
|
|||
Listbox *lang_list;
|
||||
|
||||
/* Create listbox */
|
||||
lang_list = create_listbox_window_centered (-1, -1, lang_dlg_h, lang_dlg_w,
|
||||
_("Select language"), "[ASpell]");
|
||||
lang_list = listbox_window_centered_new (-1, -1, lang_dlg_h, lang_dlg_w,
|
||||
_("Select language"), "[ASpell]");
|
||||
|
||||
for (i = 0; i < languages->len; i++)
|
||||
LISTBOX_APPEND_TEXT (lang_list, 0, g_array_index (languages, char *, i), NULL, FALSE);
|
||||
|
||||
res = run_listbox (lang_list);
|
||||
res = listbox_run (lang_list);
|
||||
if (res >= 0)
|
||||
selected_lang = g_strdup (g_array_index (languages, char *, (unsigned int) res));
|
||||
|
||||
|
|
|
@ -1424,7 +1424,7 @@ exec_edit_syntax_dialog (const GPtrArray * names, const char *current_syntax)
|
|||
size_t i;
|
||||
Listbox *syntaxlist;
|
||||
|
||||
syntaxlist = create_listbox_window (LIST_LINES, MAX_ENTRY_LEN,
|
||||
syntaxlist = listbox_window_new (LIST_LINES, MAX_ENTRY_LEN,
|
||||
_("Choose syntax highlighting"), NULL);
|
||||
LISTBOX_APPEND_TEXT (syntaxlist, 'A', _("< Auto >"), NULL, FALSE);
|
||||
LISTBOX_APPEND_TEXT (syntaxlist, 'R', _("< Reload Current Syntax >"), NULL, FALSE);
|
||||
|
@ -1439,7 +1439,7 @@ exec_edit_syntax_dialog (const GPtrArray * names, const char *current_syntax)
|
|||
listbox_select_entry (syntaxlist->list, i + N_DFLT_ENTRIES);
|
||||
}
|
||||
|
||||
return run_listbox (syntaxlist);
|
||||
return listbox_run (syntaxlist);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -120,14 +120,14 @@ select_new_item (void)
|
|||
|
||||
possible_items = panel_get_user_possible_fields (NULL);
|
||||
|
||||
mylistbox = create_listbox_window (20, 12, "Add listing format item", listmode_section);
|
||||
mylistbox = listbox_window_new (20, 12, "Add listing format item", listmode_section);
|
||||
for (i = 0; possible_items[i]; i++)
|
||||
{
|
||||
listbox_add_item (mylistbox->list, LISTBOX_APPEND_AT_END, 0, possible_items[i], NULL,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
i = run_listbox (mylistbox);
|
||||
i = listbox_run (mylistbox);
|
||||
if (i >= 0)
|
||||
ret = g_strdup (possible_items[i]);
|
||||
|
||||
|
|
|
@ -77,15 +77,15 @@ get_hotkey (int n)
|
|||
int
|
||||
select_charset (int center_y, int center_x, int current_charset, gboolean seldisplay)
|
||||
{
|
||||
Listbox *listbox;
|
||||
size_t i;
|
||||
int listbox_result;
|
||||
char buffer[255];
|
||||
|
||||
/* Create listbox */
|
||||
Listbox *listbox = create_listbox_window_centered (center_y, center_x,
|
||||
codepages->len + 1, ENTRY_LEN + 2,
|
||||
_("Choose codepage"),
|
||||
"[Codepages Translation]");
|
||||
listbox =
|
||||
listbox_window_centered_new (center_y, center_x, codepages->len + 1, ENTRY_LEN + 2,
|
||||
_("Choose codepage"), "[Codepages Translation]");
|
||||
|
||||
if (!seldisplay)
|
||||
LISTBOX_APPEND_TEXT (listbox, '-', _("- < No translation >"), NULL, FALSE);
|
||||
|
@ -111,7 +111,7 @@ select_charset (int center_y, int center_x, int current_charset, gboolean seldis
|
|||
|
||||
listbox_select_entry (listbox->list, i);
|
||||
|
||||
listbox_result = run_listbox (listbox);
|
||||
listbox_result = listbox_run (listbox);
|
||||
|
||||
if (listbox_result < 0)
|
||||
{
|
||||
|
|
|
@ -1141,8 +1141,8 @@ user_menu_cmd (const Widget * edit_widget, const char *menu_file, int selected_e
|
|||
max_cols = MIN (MAX (max_cols, col), MAX_ENTRY_LEN);
|
||||
|
||||
/* Create listbox */
|
||||
listbox = create_listbox_window (menu_lines, max_cols + 2, _("User menu"),
|
||||
"[Edit Menu File]");
|
||||
listbox = listbox_window_new (menu_lines, max_cols + 2, _("User menu"),
|
||||
"[Edit Menu File]");
|
||||
/* insert all the items found */
|
||||
for (i = 0; i < menu_lines; i++)
|
||||
{
|
||||
|
@ -1153,7 +1153,7 @@ user_menu_cmd (const Widget * edit_widget, const char *menu_file, int selected_e
|
|||
/* Select the default entry */
|
||||
listbox_select_entry (listbox->list, selected);
|
||||
|
||||
selected = run_listbox (listbox);
|
||||
selected = listbox_run (listbox);
|
||||
}
|
||||
if (selected >= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue