From bee6f66b5e393213d328afd14a9ac4cb926a0b9f Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 3 Nov 2001 00:44:35 +0000 Subject: Correct some renamed functions. 2001-11-03 Tor Lillqvist * gtk/gtk.def: Correct some renamed functions. * gtk/gtkimmodule.c (correct_libdir_prefix): New function, used on Windows to turn build-time paths from a gtk.immodules distributed as part of a binary package into runtime ones in the end-user-chosen installation directory. (gtk_im_module_init): Use it for module path and domain directory. --- gtk/gtkimmodule.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'gtk/gtkimmodule.c') diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index ea40819e37..1be18f554d 100644 --- a/gtk/gtkimmodule.c +++ b/gtk/gtkimmodule.c @@ -33,6 +33,7 @@ #include #include "gtkimmodule.h" #include "gtkimcontextsimple.h" +#include "gtkprivate.h" #include "gtkrc.h" #include "config.h" #include "gtkintl.h" @@ -222,6 +223,28 @@ add_module (GtkIMModule *module, GSList *infos) modules_list = g_slist_prepend (modules_list, module); } +#ifdef G_OS_WIN32 +static void +correct_libdir_prefix (gchar **path) +{ + if (strncmp (*path, GTK_LIBDIR, strlen (GTK_LIBDIR)) == 0) + { + /* This is an entry put there by make install on the + * packager's system. On Windows a prebuilt GTK+ + * package can be installed in a random + * location. The gtk.immodules file distributed in + * such a package contains paths from the package + * builder's machine. Replace the path with the real + * one on this machine. + */ + gchar *tem = *path; + *path = g_strconcat (GTK_LIBDIR, tem + strlen (GTK_LIBDIR), NULL); + g_free (tem); + } +} +#endif + + static void gtk_im_module_init () { @@ -280,6 +303,9 @@ gtk_im_module_init () } module->path = g_strdup (tmp_buf->str); +#ifdef G_OS_WIN32 + correct_libdir_prefix (&module->path); +#endif g_type_module_set_name (G_TYPE_MODULE (module), module->path); } else @@ -303,6 +329,9 @@ gtk_im_module_init () if (!pango_scan_string (&p, tmp_buf)) goto context_error; info->domain_dirname = g_strdup (tmp_buf->str); +#ifdef G_OS_WIN32 + correct_libdir_prefix (&info->domain_dirname); +#endif if (!pango_scan_string (&p, tmp_buf)) goto context_error; -- cgit v1.2.1