summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-04-22 07:54:56 +0000
committerTor Lillqvist <tml@src.gnome.org>2005-04-22 07:54:56 +0000
commit8cf1f87e6ed8bf4ebe5177ffc6e640abe0b83840 (patch)
tree0fec9683226980505394ea50796630cb3e0be563
parent0f8cfc90f721864d9d99c72842037ce7126fcb27 (diff)
downloadatk-8cf1f87e6ed8bf4ebe5177ffc6e640abe0b83840.tar.gz
Initialize gettext before use. Calling bindtextdomain() and
2005-04-22 Tor Lillqvist <tml@novell.com> * atk/atkobject.c: Initialize gettext before use. Calling bindtextdomain() and bind_textdomain_codeset() in atk_role_get_localized_name() was too late. Put the calls in new function gettext_initialization() and call that from atk_object_class_init() and atk_role_get_localized_name(). Move the Win32-specific DllMain() and get_atk_locale_dir() functions and theredefinition of ATK_LOCALEDIR before gettext_initialization() as it uses ATK_LOCALEDIR. Fixes #170948 for atk's part. Thanks to Robert Ögren, Daniel Atallah and Kevin Strange.
-rw-r--r--ChangeLog13
-rwxr-xr-xatk/atkobject.c75
2 files changed, 55 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 5320dc4..b2c640c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-04-22 Tor Lillqvist <tml@novell.com>
+
+ * atk/atkobject.c: Initialize gettext before use. Calling
+ bindtextdomain() and bind_textdomain_codeset() in
+ atk_role_get_localized_name() was too late. Put the calls in new
+ function gettext_initialization() and call that from
+ atk_object_class_init() and atk_role_get_localized_name(). Move
+ the Win32-specific DllMain() and get_atk_locale_dir() functions
+ and theredefinition of ATK_LOCALEDIR before
+ gettext_initialization() as it uses ATK_LOCALEDIR. Fixes #170948
+ for atk's part. Thanks to Robert Ögren, Daniel Atallah and Kevin
+ Strange.
+
2005-04-09 Hans Breuer <hans@breuer.org>
* atk/makefile.msc : updated $(LIBINTL_LIBS)
diff --git a/atk/atkobject.c b/atk/atkobject.c
index 2c17358..b8e225a 100755
--- a/atk/atkobject.c
+++ b/atk/atkobject.c
@@ -224,6 +224,45 @@ static const gchar* atk_object_name_property_table_summary = "accessible-table-s
static const gchar* atk_object_name_property_table_caption_object = "accessible-table-caption-object";
static const gchar* atk_object_name_property_hypertext_num_links = "accessible-hypertext-nlinks";
+#ifdef G_OS_WIN32
+
+#undef ATK_LOCALEDIR
+
+#define ATK_LOCALEDIR get_atk_locale_dir()
+
+G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
+
+static char *
+get_atk_locale_dir (void)
+{
+ return g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "lib/locale");
+}
+
+#endif
+
+static void
+gettext_initialization (void)
+{
+#ifdef ENABLE_NLS
+ static gboolean gettext_initialized = FALSE;
+
+ if (!gettext_initialized)
+ {
+ const char *dir = g_getenv ("ATK_ALT_LOCALEDIR");
+
+ gettext_initialized = TRUE;
+ if (dir == NULL)
+ dir = ATK_LOCALEDIR;
+
+ bindtextdomain (GETTEXT_PACKAGE, dir);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+ }
+#endif
+}
+
GType
atk_object_get_type (void)
{
@@ -290,6 +329,8 @@ atk_object_class_init (AtkObjectClass *klass)
klass->visible_data_changed = NULL;
klass->active_descendant_changed = NULL;
+ gettext_initialization ();
+
g_object_class_install_property (gobject_class,
PROP_NAME,
g_param_spec_string (atk_object_name_property_name,
@@ -1286,23 +1327,6 @@ atk_role_get_name (AtkRole role)
return name;
}
-#ifdef G_OS_WIN32
-
-#undef ATK_LOCALEDIR
-
-#define ATK_LOCALEDIR get_atk_locale_dir()
-
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
-
-static char *
-get_atk_locale_dir (void)
-{
- return g_win32_get_package_installation_subdirectory
- (GETTEXT_PACKAGE, dll_name, "lib/locale");
-}
-
-#endif
-
/**
* atk_role_get_localized_name:
* @role: The #AtkRole whose localized name is required
@@ -1316,23 +1340,8 @@ atk_role_get_localized_name (AtkRole role)
{
G_CONST_RETURN gchar *name;
gint i;
- static gboolean gettext_initialized = FALSE;
-
-#ifdef ENABLE_NLS
- if (!gettext_initialized)
- {
- const char *dir = g_getenv ("ATK_ALT_LOCALEDIR");
-
- gettext_initialized = TRUE;
- if (dir == NULL)
- dir = ATK_LOCALEDIR;
- bindtextdomain (GETTEXT_PACKAGE, dir);
-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
- }
-#endif
+ gettext_initialization ();
for (i = 0; i < G_N_ELEMENTS (role_items); i++)
{