From d97a1b476bd27b7bc707081ef32883b2ba0c6ae9 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 14 Jul 2006 16:58:25 +0000 Subject: [PATCH] Use locale encoding for Find in files and remember previous searches. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@557 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/callbacks.c | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8b32cf7..68a1cf8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2006-07-14 Nick Treleaven * src/search.c: Give accurate message on finishing finding in files. + * src/callbacks.c: Use locale encoding for Find in files and + remember previous searches. 2006-07-14 Enrico Tröger diff --git a/src/callbacks.c b/src/callbacks.c index 67f462b7..3398a9d5 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1961,25 +1961,31 @@ on_find_in_files_dialog_response (GtkDialog *dialog, { if (response == GTK_RESPONSE_ACCEPT) { - const gchar *entry_text = + const gchar *search_text = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(user_data)))); - gchar *search_text = g_strstrip(g_strdup(entry_text)); + gchar *utf8_dir = utils_get_current_file_dir(); - if (search_text && *search_text) + if (utf8_dir == NULL) + msgwin_status_add(_("Invalid directory for find in files.")); + else if (search_text && *search_text) { - gchar *cur_dir = utils_get_current_file_dir(); - if (cur_dir) - search_find_in_files(search_text, cur_dir); - else - msgwin_status_add(_("Invalid directory for find in files.")); - g_free(cur_dir); + gchar *locale_dir; + + locale_dir = g_locale_from_utf8(utf8_dir, -1, NULL, NULL, NULL); + if (locale_dir == NULL) locale_dir = g_strdup(utf8_dir); + + gtk_combo_box_prepend_text(GTK_COMBO_BOX(user_data), search_text); + search_find_in_files(search_text, locale_dir); + g_free(locale_dir); + gtk_widget_hide(app->find_in_files_dialog); } else msgwin_status_add(_("No text to find.")); - g_free(search_text); + g_free(utf8_dir); } - gtk_widget_hide(app->find_in_files_dialog); + else + gtk_widget_hide(app->find_in_files_dialog); }