[gdk-pixbuf] Use run-time message catalog directory on Windows



commit 98d373ed51df92a1c784a91af91d880bf741208e
Author: Tor Lillqvist <tml iki fi>
Date:   Mon Dec 27 16:16:59 2010 +0200

    Use run-time message catalog directory on Windows
    
    Construct pathname at run-time instead of using a hardcoded
    GDK_PIXBUF_LOCALEDIR.
    
    Should fix bug #634659.

 gdk-pixbuf/gdk-pixbuf-io.c   |    8 ++++----
 gdk-pixbuf/gdk-pixbuf-util.c |   26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index b5e6c4d..d01575c 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -244,8 +244,8 @@ DllMain (HINSTANCE hinstDLL,
   return TRUE;
 }
 
-static char *
-get_toplevel (void)
+char *
+_gdk_pixbuf_win32_get_toplevel (void)
 {
   static char *toplevel = NULL;
 
@@ -261,7 +261,7 @@ get_libdir (void)
   static char *libdir = NULL;
 
   if (libdir == NULL)
-          libdir = g_build_filename (get_toplevel (), "lib", NULL);
+          libdir = g_build_filename (_gdk_pixbuf_win32_get_toplevel (), "lib", NULL);
 
   return libdir;
 }
@@ -290,7 +290,7 @@ correct_prefix (gchar **path)
        * installation prefix on this machine.
        */
       tem = *path;
-      *path = g_strconcat (get_toplevel (), tem + strlen (GDK_PIXBUF_PREFIX), NULL);
+      *path = g_strconcat (_gdk_pixbuf_win32_get_toplevel (), tem + strlen (GDK_PIXBUF_PREFIX), NULL);
       g_free (tem);
     }
 }
diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c
index fcac31f..08d09c6 100644
--- a/gdk-pixbuf/gdk-pixbuf-util.c
+++ b/gdk-pixbuf/gdk-pixbuf-util.c
@@ -333,6 +333,32 @@ gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src)
         return dest;
 }
 
+#ifdef G_OS_WIN32
+
+static const gchar *
+get_localedir (void)
+{
+    gchar *temp;
+    gchar *retval;
+    
+    /* In gdk-pixbuf-io.c */
+    extern char *_gdk_pixbuf_win32_get_toplevel (void);
+
+    temp = g_build_filename (_gdk_pixbuf_win32_get_toplevel (), "share/locale", NULL);
+
+    /* The localedir is passed to bindtextdomain() which isn't
+     * UTF-8-aware.
+     */
+    retval = g_win32_locale_filename_from_utf8 (temp);
+    g_free (temp);
+    return retval;
+}
+
+#undef GDK_PIXBUF_LOCALEDIR
+#define GDK_PIXBUF_LOCALEDIR get_localedir ()
+
+#endif
+
 const gchar *
 gdk_pixbuf_gettext (const gchar *msgid)
 {



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