diff --git a/data/geany.glade b/data/geany.glade index eb9a89f837..bace956482 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -8808,7 +8808,7 @@ True True - Space separated list of file patterns used for the find in files dialog (e.g. *.c *.h) + Space separated list of file patterns used for the Find in Files dialog (e.g. *.c *.h) False diff --git a/src/search.c b/src/search.c index 2c6b351863..1a3040cd94 100644 --- a/src/search.c +++ b/src/search.c @@ -1123,6 +1123,8 @@ void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir) g_free(cur_dir); } + ui_set_search_entry_background(fif_dlg.search_combo, TRUE); + ui_set_search_entry_background(fif_dlg.dir_combo, TRUE); update_fif_file_mode_combo(); update_file_patterns(fif_dlg.files_mode_combo, fif_dlg.files_combo); @@ -1632,12 +1634,21 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response, GtkWidget *dir_combo = fif_dlg.dir_combo; const gchar *utf8_dir = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dir_combo)))); + gchar *locale_dir = utils_get_locale_from_utf8(utf8_dir); GeanyEncodingIndex enc_idx = ui_encodings_combo_box_get_active_encoding(GTK_COMBO_BOX(fif_dlg.encoding_combo)); - if (G_UNLIKELY(EMPTY(utf8_dir))) - ui_set_statusbar(FALSE, _("Invalid directory for find in files.")); - else if (!EMPTY(search_text)) + if (!g_file_test(locale_dir, G_FILE_TEST_IS_DIR)) + { + ui_set_statusbar(FALSE, _("Invalid directory for Find in Files.")); + ui_set_search_entry_background(dir_combo, FALSE); + } + else if (EMPTY(search_text)) + { + ui_set_statusbar(FALSE, _("No text to find.")); + ui_set_search_entry_background(search_combo, FALSE); + } + else { GString *opts = get_grep_options(); const gchar *enc = (enc_idx == GEANY_ENCODING_UTF_8) ? NULL : @@ -1652,8 +1663,7 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response, } g_string_free(opts, TRUE); } - else - ui_set_statusbar(FALSE, _("No text to find.")); + g_free(locale_dir); } else gtk_widget_hide(fif_dlg.dialog); diff --git a/src/ui_utils.c b/src/ui_utils.c index 60787c8f86..68d12f0ff8 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -1101,8 +1101,13 @@ void ui_document_show_hide(GeanyDocument *doc) } +/* success = FALSE indicates an error for widget */ void ui_set_search_entry_background(GtkWidget *widget, gboolean success) { + // set the entry, not just the button + if (GTK_IS_COMBO_BOX(widget)) + widget = gtk_bin_get_child(GTK_BIN(widget)); + gtk_widget_set_name(widget, success ? NULL : "geany-search-entry-no-match"); }