diff options
author | Tor Lillqvist <tml@novell.com> | 2007-01-17 01:24:47 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2007-01-17 01:24:47 +0000 |
commit | 4759035f4a2fb4206a1da204f518b165fcfcea51 (patch) | |
tree | 4bffe8b304c91e6a446e705d6b8c296d69a4ca1e | |
parent | f44e1fa81c699ffc5a68aa11c2102d697b632eea (diff) | |
download | gdk-pixbuf-4759035f4a2fb4206a1da204f518b165fcfcea51.tar.gz |
Merge from trunk, for discussion see #396175:
2007-01-17 Tor Lillqvist <tml@novell.com>
Merge from trunk, for discussion see #396175:
* gtk/gtkimmodule.c: 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, in case
GTK_LOCALEDIR is not a descendant of GTK_LIBDIR.
(gtk_im_module_initialize): Thus call correct_localedir_prefix()
on the domain_dirname instead of correct_libdir_prefix().
(_gtk_im_module_list): Call correct_localedir_prefix() on
simple_context_info.domain_dirname.
svn path=/branches/gtk-2-10/; revision=17162
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | gtk/gtkimmodule.c | 54 |
2 files changed, 59 insertions, 12 deletions
@@ -1,3 +1,20 @@ +2007-01-17 Tor Lillqvist <tml@novell.com> + + Merge from trunk, for discussion see #396175: + + * gtk/gtkimmodule.c: 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, in case + GTK_LOCALEDIR is not a descendant of GTK_LIBDIR. + (gtk_im_module_initialize): Thus call correct_localedir_prefix() + on the domain_dirname instead of correct_libdir_prefix(). + (_gtk_im_module_list): Call correct_localedir_prefix() on + simple_context_info.domain_dirname. + 2007-01-16 Matthias Clasen <mclasen@redhat.com> * Merge from trunk: diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index 5b07cad92..52d86d670 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); |