mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(input_get_text): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
f4a3112d5e
commit
f91d894f9b
@ -1193,6 +1193,25 @@ input_assign_text (WInput * in, const char *text)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Get text of input line.
|
||||
*
|
||||
* @param in input line
|
||||
*
|
||||
* @return newly allocated string that contains a copy of @in's text.
|
||||
* If @in is empty, return NULL.
|
||||
*/
|
||||
char *
|
||||
input_get_text (const WInput * in)
|
||||
{
|
||||
if (input_is_empty (in))
|
||||
return NULL;
|
||||
|
||||
return g_strdup (in->buffer);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
input_is_empty (const WInput * in)
|
||||
{
|
||||
|
@ -91,6 +91,7 @@ cb_ret_t input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm
|
||||
void input_set_default_colors (void);
|
||||
cb_ret_t input_handle_char (WInput * in, int key);
|
||||
void input_assign_text (WInput * in, const char *text);
|
||||
char *input_get_text (const WInput * in);
|
||||
gboolean input_is_empty (const WInput * in);
|
||||
void input_insert (WInput * in, const char *text, gboolean insert_extra_space);
|
||||
void input_set_point (WInput * in, int pos);
|
||||
|
@ -9,7 +9,7 @@
|
||||
Radek Doulik, 1994, 1995
|
||||
Jakub Jelinek, 1995
|
||||
Andrej Borsenkow, 1995
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012, 2013
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009-2022
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -599,7 +599,7 @@ quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
|
||||
*item->quick_widget->u.input.result =
|
||||
tilde_expand (INPUT (item->widget)->buffer);
|
||||
else
|
||||
*item->quick_widget->u.input.result = g_strdup (INPUT (item->widget)->buffer);
|
||||
*item->quick_widget->u.input.result = input_get_text (INPUT (item->widget));
|
||||
break;
|
||||
|
||||
case quick_radio:
|
||||
|
@ -7,7 +7,7 @@
|
||||
Written by:
|
||||
Miguel de Icaza, 1995
|
||||
Slava Zanko <slavazanko@gmail.com>, 2013
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2013
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2013-2022
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -820,12 +820,11 @@ find_parameters (WPanel * panel, char **start_dir, ssize_t * start_dir_len,
|
||||
options.skip_hidden = skip_hidden_cbox->state;
|
||||
options.ignore_dirs_enable = ignore_dirs_cbox->state;
|
||||
g_free (options.ignore_dirs);
|
||||
options.ignore_dirs = g_strdup (in_ignore->buffer);
|
||||
options.ignore_dirs = input_get_text (in_ignore);
|
||||
|
||||
*content = !input_is_empty (in_with) ? g_strdup (in_with->buffer) : NULL;
|
||||
if (!input_is_empty (in_name))
|
||||
*pattern = g_strdup (in_name->buffer);
|
||||
else
|
||||
*content = input_get_text (in_with);
|
||||
*pattern = input_get_text (in_name);
|
||||
if (*pattern == NULL)
|
||||
*pattern = g_strdup (options.file_pattern ? "*" : ".*");
|
||||
*start_dir = !input_is_empty (in_start) ? in_start->buffer : (char *) ".";
|
||||
if (in_start_dir != INPUT_LAST_TEXT)
|
||||
@ -861,7 +860,7 @@ find_parameters (WPanel * panel, char **start_dir, ssize_t * start_dir_len,
|
||||
|| DIR_IS_DOT (in_ignore->buffer))
|
||||
*ignore_dirs = NULL;
|
||||
else
|
||||
*ignore_dirs = g_strdup (in_ignore->buffer);
|
||||
*ignore_dirs = input_get_text (in_ignore);
|
||||
|
||||
find_save_options ();
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
Written by:
|
||||
Janne Kukonlehto, 1995
|
||||
Jakub Jelinek, 1995
|
||||
Andrew Borodin <aborodin@vmail.ru> 2011-2022
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -270,7 +271,7 @@ add2panelize_cmd (void)
|
||||
if (label == NULL || *label == '\0')
|
||||
g_free (label);
|
||||
else
|
||||
add2panelize (label, g_strdup (pname->buffer));
|
||||
add2panelize (label, input_get_text (pname));
|
||||
}
|
||||
}
|
||||
|
||||
@ -622,7 +623,7 @@ external_panelize (void)
|
||||
{
|
||||
char *cmd;
|
||||
|
||||
cmd = g_strdup (pname->buffer);
|
||||
cmd = input_get_text (pname);
|
||||
widget_destroy (WIDGET (panelize_dlg));
|
||||
do_external_panelize (cmd);
|
||||
g_free (cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user