Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Find in Files invalid directory error #3818

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1628,9 +1630,15 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response,
ui_encodings_combo_box_get_active_encoding(GTK_COMBO_BOX(fif_dlg.encoding_combo));

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();
Expand Down
5 changes: 5 additions & 0 deletions src/ui_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down