Remove "Search for content" checkbox.
If "Content" input field is empty, don't search for content. Also disable all content related checkboxes in this case. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
2b6c45a211
Коммит
9fba781d45
@ -98,7 +98,6 @@ typedef struct
|
||||
gboolean file_all_charsets;
|
||||
|
||||
/* file content options */
|
||||
gboolean content_use;
|
||||
gboolean content_case_sens;
|
||||
gboolean content_regexp;
|
||||
gboolean content_first_hit;
|
||||
@ -138,7 +137,6 @@ static WCheck *file_case_sens_cbox; /* "case sensitive" checkbox */
|
||||
static WCheck *file_pattern_cbox; /* File name is glob or regexp */
|
||||
static WCheck *recursively_cbox;
|
||||
static WCheck *skip_hidden_cbox;
|
||||
static WCheck *content_use_cbox; /* Take into account the Content field */
|
||||
static WCheck *content_case_sens_cbox; /* "case sensitive" checkbox */
|
||||
static WCheck *content_regexp_cbox; /* "find regular expression" checkbox */
|
||||
static WCheck *content_first_hit_cbox; /* "First hit" checkbox" */
|
||||
@ -207,7 +205,7 @@ static WListbox *find_list; /* Listbox with the file list */
|
||||
|
||||
static find_file_options_t options = {
|
||||
TRUE, TRUE, TRUE, FALSE, FALSE,
|
||||
FALSE, TRUE, FALSE, FALSE, FALSE, FALSE,
|
||||
TRUE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, NULL
|
||||
};
|
||||
|
||||
@ -294,7 +292,6 @@ find_load_options (void)
|
||||
mc_config_get_bool (mc_main_config, "FindFile", "file_skip_hidden", FALSE);
|
||||
options.file_all_charsets =
|
||||
mc_config_get_bool (mc_main_config, "FindFile", "file_all_charsets", FALSE);
|
||||
options.content_use = mc_config_get_bool (mc_main_config, "FindFile", "content_use", TRUE);
|
||||
options.content_case_sens =
|
||||
mc_config_get_bool (mc_main_config, "FindFile", "content_case_sens", TRUE);
|
||||
options.content_regexp =
|
||||
@ -323,7 +320,6 @@ find_save_options (void)
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "file_find_recurs", options.find_recurs);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "file_skip_hidden", options.skip_hidden);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "file_all_charsets", options.file_all_charsets);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "content_use", options.content_use);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "content_case_sens", options.content_case_sens);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "content_regexp", options.content_regexp);
|
||||
mc_config_set_bool (mc_main_config, "FindFile", "content_first_hit", options.content_first_hit);
|
||||
@ -434,9 +430,8 @@ find_toggle_enable_params (void)
|
||||
static void
|
||||
find_toggle_enable_content (void)
|
||||
{
|
||||
gboolean disable = !(content_use_cbox->state & C_BOOL)
|
||||
gboolean disable = in_with->buffer[0] == '\0';
|
||||
|
||||
widget_disable (WIDGET (in_with), disable);
|
||||
widget_disable (WIDGET (content_regexp_cbox), disable);
|
||||
widget_disable (WIDGET (content_case_sens_cbox), disable);
|
||||
#ifdef HAVE_CHARSET
|
||||
@ -476,13 +471,6 @@ find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
if (sender == WIDGET (content_use_cbox))
|
||||
{
|
||||
find_toggle_enable_content ();
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
if (sender == WIDGET (ignore_dirs_cbox))
|
||||
{
|
||||
gboolean disable = !(ignore_dirs_cbox->state & C_BOOL);
|
||||
@ -509,8 +497,8 @@ find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
||||
}
|
||||
|
||||
/* check content regexp */
|
||||
if ((content_use_cbox->state & C_BOOL) && (content_regexp_cbox->state & C_BOOL)
|
||||
&& (in_with->buffer[0] != '\0') && !find_check_regexp (in_with->buffer))
|
||||
if ((content_regexp_cbox->state & C_BOOL) && (in_with->buffer[0] != '\0')
|
||||
&& !find_check_regexp (in_with->buffer))
|
||||
{
|
||||
h->state = DLG_ACTIVE; /* Don't stop the dialog */
|
||||
message (D_ERROR, MSG_ERROR, _("Malformed regular expression"));
|
||||
@ -523,6 +511,8 @@ find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
||||
case MSG_POST_KEY:
|
||||
if (h->current->data == in_name)
|
||||
find_toggle_enable_params ();
|
||||
else if (h->current->data == in_with)
|
||||
find_toggle_enable_content ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_DRAW:
|
||||
@ -559,9 +549,9 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
{
|
||||
/* Size of the find parameters window */
|
||||
#ifdef HAVE_CHARSET
|
||||
const int lines = 19;
|
||||
#else
|
||||
const int lines = 18;
|
||||
#else
|
||||
const int lines = 17;
|
||||
#endif
|
||||
int cols = 68;
|
||||
|
||||
@ -707,9 +697,6 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
in_with->label = content_label;
|
||||
add_widget (find_dlg, in_with);
|
||||
|
||||
content_use_cbox = check_new (y2++, x2, options.content_use, content_use_label);
|
||||
add_widget (find_dlg, content_use_cbox);
|
||||
|
||||
/* Continue 1st column */
|
||||
recursively_cbox = check_new (y1++, x1, options.find_recurs, file_recurs_label);
|
||||
add_widget (find_dlg, recursively_cbox);
|
||||
@ -798,7 +785,6 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
options.file_all_charsets = file_all_charsets_cbox->state & C_BOOL;
|
||||
options.content_all_charsets = content_all_charsets_cbox->state & C_BOOL;
|
||||
#endif
|
||||
options.content_use = content_use_cbox->state & C_BOOL;
|
||||
options.content_case_sens = content_case_sens_cbox->state & C_BOOL;
|
||||
options.content_regexp = content_regexp_cbox->state & C_BOOL;
|
||||
options.content_first_hit = content_first_hit_cbox->state & C_BOOL;
|
||||
@ -811,8 +797,7 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
g_free (options.ignore_dirs);
|
||||
options.ignore_dirs = g_strdup (in_ignore->buffer);
|
||||
|
||||
*content = (options.content_use && in_with->buffer[0] != '\0')
|
||||
? g_strdup (in_with->buffer) : NULL;
|
||||
*content = in_with->buffer[0] != '\0' ? g_strdup (in_with->buffer) : NULL;
|
||||
if (in_name->buffer[0] != '\0')
|
||||
*pattern = g_strdup (in_name->buffer);
|
||||
else
|
||||
@ -1723,7 +1708,7 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
|
||||
find_pattern = (char *) pattern;
|
||||
|
||||
content_pattern = NULL;
|
||||
if (options.content_use && content != NULL && str_is_valid_string (content))
|
||||
if (content != NULL && str_is_valid_string (content))
|
||||
content_pattern = g_strdup (content);
|
||||
|
||||
init_find_vars ();
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user