[easytag/wip/future-gtk: 80/81] Use g_str_to_ascii() for displaying filenames



commit 4e303af0271b68978c275ed6e9c5664115c98f65
Author: David King <amigadave amigadave com>
Date:   Fri Jan 15 18:41:16 2016 +0000

    Use g_str_to_ascii() for displaying filenames
    
    Rather than calling iconv() with the extra "//IGNORE" option, call
    g_str_to_ascii() with the current locale.

 configure.ac  |    4 ++--
 src/charset.c |   20 +-------------------
 2 files changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 545945a..4600e26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -334,9 +334,9 @@ AS_IF([test "x$have_libnautilus_extension" = "xno"],
 AM_CONDITIONAL([ENABLE_NAUTILUS_ACTIONS], [test x"$have_libnautilus_extension" != x"no"])
 
 dnl Check the pkg-config dependencies
-GIO_DEPS="gio-2.0 >= 2.38.0"
+GIO_DEPS="gio-2.0 >= 2.40.0"
 AC_SUBST([GLIB_DEPRECATION_FLAGS],
-         ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"])
+         ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40"])
 GTK_DEPS="gtk+-3.0 >= 3.14.0"
 AC_SUBST([GTK_DEPRECATION_FLAGS],
          ["-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_14 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14"])
diff --git a/src/charset.c b/src/charset.c
index 643c028..2a35bd8 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -504,25 +504,7 @@ filename_from_display (const gchar *string)
                 break;
             case ET_RENAME_ENCODING_TRANSLITERATE:
             {
-                /* iconv_open (3):
-                 * When the string "//TRANSLIT" is appended to tocode,
-                 * transliteration is activated. This means that when a
-                 * character cannot be represented in the target character set,
-                 * it can be approximated through one or several similarly
-                 * looking characters.
-                 */
-                /* TODO: Use g_str_to_ascii() in GLib 2.40. */
-                gchar *enc = g_strconcat (*filename_encodings, "//TRANSLIT", NULL);
-                ret = g_convert (string, -1, enc, "UTF-8", NULL, NULL, &error);
-
-                if (!ret)
-                {
-                    g_debug ("Error while converting filename from display to transliterated encoding '%s': 
%s",
-                             enc, error->message);
-                    g_clear_error (&error);
-                }
-
-                g_free (enc);
+                ret = g_str_to_ascii (string, NULL);
                 break;
             }
             case ET_RENAME_ENCODING_IGNORE:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]