summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--gtk/gtkimmodule.c54
-rw-r--r--gtk/gtkimmulticontext.c10
3 files changed, 62 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 27143877cd..653e82ac8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+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.
+
2007-01-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (range_grab_remove): Queue a redraw when the
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);
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 7129dfe637..7d37cd795f 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -27,17 +27,9 @@
#include "gtkmain.h"
#include "gtkradiomenuitem.h"
#include "gtkintl.h"
+#include "gtkprivate.h" /* To get redefinition of GTK_LOCALE_DIR on Win32 */
#include "gtkalias.h"
-/* Do *not* include "gtkprivate.h" in this file. If you do, the
- * the two definitions of GTK_LOCALEDIR will trigger a wrong
- * warning in gtk_im_multicontext_append_menuitems()
- */
-
-#ifdef __GTK_PRIVATE_H__
-#error gtkprivate.h should not be included in this file
-#endif
-
struct _GtkIMMulticontextPrivate
{
GdkWindow *client_window;