diff options
author | Tor Lillqvist <tml@novell.com> | 2007-01-17 01:18:42 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2007-01-17 01:18:42 +0000 |
commit | e6a490588f42c59cf09edda2f714820a6a394223 (patch) | |
tree | 12599d946c21be2207f98f0743f5dceea42e2817 /gtk/gtkimmodule.c | |
parent | 2955a65dd7e839ebdaadf98829913971ab6f131f (diff) | |
download | gtk+-e6a490588f42c59cf09edda2f714820a6a394223.tar.gz |
Proper fix for #396175:
2007-01-17 Tor Lillqvist <tml@novell.com>
Proper fix for #396175:
* gtk/gtkimmulticontext.c: Revert change by Hans Breuer below: Do
include gtkprivate.h. On Win32 we do want to use the redefinition
of GTK_LOCALEDIR as a call to the function _gtk_get_localedir().
* gtk/gtkimmodule.c: Instead, correct the prefix also on
simple_context_info.domain_dirname. Do the prefix corrections
always on Win32, not just when GTK_LIBDIR is defined. i.e., until
now they were done only in the autoconfiscated gcc builds. Hans
needs to make sure GTK_LIBDIR and GTK_LOCALEDIR are defined also
in MSVC builds now.
(correct_localedir_prefix): New function, like
correct_libdir_prefix(), but for GTK_LOCALEDIR.
(_gtk_im_module_list): Call correct_localedir_prefix() on
simple_context_info.domain_dirname.
svn path=/trunk/; revision=17161
Diffstat (limited to 'gtk/gtkimmodule.c')
-rw-r--r-- | gtk/gtkimmodule.c | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index 5b07cad927..52d86d670a 100644 --- a/gtk/gtkimmodule.c +++ b/gtk/gtkimmodule.c @@ -42,8 +42,8 @@ #include "gtkalias.h" /* Do *not* include "gtkprivate.h" in this file. If you do, the - * correct_libdir_prefix() function below will have to move somewhere - * else. + * correct_libdir_prefix() and correct_localedir_prefix() functions + * below will have to move somewhere else. */ #ifdef __GTK_PRIVATE_H__ @@ -217,12 +217,7 @@ add_module (GtkIMModule *module, GSList *infos) modules_list = g_slist_prepend (modules_list, module); } -#if defined (G_OS_WIN32) && defined (GTK_LIBDIR) -/* This is needes on Win32, but not wanted when compiling with MSVC, - * as the makefile.msc doesn't define any GTK_LIBDIR value. - */ - -#define DO_CORRECT_LIBDIR_PREFIX /* Flag to check below whether to call this */ +#ifdef G_OS_WIN32 static void correct_libdir_prefix (gchar **path) @@ -247,6 +242,21 @@ correct_libdir_prefix (gchar **path) g_free (tem); } } + +static void +correct_localedir_prefix (gchar **path) +{ + /* As above, but for GTK_LOCALEDIR. Use separate function in case + * GTK_LOCALEDIR isn't a subfolder of GTK_LIBDIR. + */ + if (strncmp (*path, GTK_LOCALEDIR, strlen (GTK_LOCALEDIR)) == 0) + { + extern const gchar *_gtk_get_localedir (); + gchar *tem = *path; + *path = g_strconcat (_gtk_get_localedir (), tem + strlen (GTK_LOCALEDIR), NULL); + g_free (tem); + } +} #endif @@ -311,7 +321,7 @@ gtk_im_module_initialize (void) } module->path = g_strdup (tmp_buf->str); -#ifdef DO_CORRECT_LIBDIR_PREFIX +#ifdef G_OS_WIN32 correct_libdir_prefix (&module->path); #endif g_type_module_set_name (G_TYPE_MODULE (module), module->path); @@ -337,8 +347,8 @@ gtk_im_module_initialize (void) if (!pango_scan_string (&p, tmp_buf)) goto context_error; info->domain_dirname = g_strdup (tmp_buf->str); -#ifdef DO_CORRECT_LIBDIR_PREFIX - correct_libdir_prefix ((char **) &info->domain_dirname); +#ifdef G_OS_WIN32 + correct_localedir_prefix ((char **) &info->domain_dirname); #endif if (!pango_scan_string (&p, tmp_buf)) @@ -402,7 +412,11 @@ _gtk_im_module_list (const GtkIMContextInfo ***contexts, { int n = 0; - static const GtkIMContextInfo simple_context_info = { + static +#ifndef G_OS_WIN32 + const +#endif + GtkIMContextInfo simple_context_info = { SIMPLE_ID, N_("Default"), GETTEXT_PACKAGE, @@ -414,9 +428,25 @@ _gtk_im_module_list (const GtkIMContextInfo ***contexts, "" }; +#ifdef G_OS_WIN32 + static gboolean beenhere = FALSE; +#endif + if (!contexts_hash) gtk_im_module_initialize (); +#ifdef G_OS_WIN32 + if (!beenhere) + { + beenhere = TRUE; + /* correct_localedir_prefix() requires its parameter to be a + * malloced string + */ + simple_context_info.domain_dirname = g_strdup (simple_context_info.domain_dirname); + correct_localedir_prefix ((char **) &simple_context_info.domain_dirname); + } +#endif + if (n_contexts) *n_contexts = (n_loaded_contexts + 1); |