Define ENABLE_NLS and GETTEXT_PACKAGE.

2001-01-17  Tor Lillqvist  <tml@iki.fi>

	* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.

	* makefile.mingw.in
	* makefile.msc.in: Use the GNU intl library.

	* gwin32.c (g_win32_get_package_installation_directory): New
	function. To be used by various GLib-using packages to get their
	installation directory, which should be stored in the Registry by
	some installer.

	* gwin32.h: Declare it.

	* testglib.c (main): Test it.

	* gutils.c: On Win32, define GLIB_LOCALE_DIR using
	g_win32_get_package_installation_directory().

	* glib.def: Update.
This commit is contained in:
Tor Lillqvist 2001-01-16 22:06:23 +00:00 committed by Tor Lillqvist
parent 62ce81bfc7
commit a9d05d4cc4
23 changed files with 321 additions and 10 deletions

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -1,3 +1,24 @@
2001-01-17 Tor Lillqvist <tml@iki.fi>
* config.h.win32.in: Define ENABLE_NLS and GETTEXT_PACKAGE.
* makefile.mingw.in
* makefile.msc.in: Use the GNU intl library.
* gwin32.c (g_win32_get_package_installation_directory): New
function. To be used by various GLib-using packages to get their
installation directory, which should be stored in the Registry by
some installer.
* gwin32.h: Declare it.
* testglib.c (main): Test it.
* gutils.c: On Win32, define GLIB_LOCALE_DIR using
g_win32_get_package_installation_directory().
* glib.def: Update.
Mon Jan 15 21:39:06 2001 Owen Taylor <otaylor@redhat.com>
* glib-2.0.pc.in (Libs) glib-config-2.0.in: Add @INTLLIBS@.

View File

@ -145,3 +145,8 @@
/* #undef HAVE_LIBW */
#define USE_LIBICONV 1
#define ENABLE_NLS 1
/* Dunno if this will expand correctly: */
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"

View File

@ -585,6 +585,7 @@ EXPORTS
g_win32_closedir
g_win32_error_message
g_win32_ftruncate
g_win32_get_package_installation_directory
g_win32_getlocale
g_win32_opendir
g_win32_readdir

View File

@ -585,6 +585,7 @@ EXPORTS
g_win32_closedir
g_win32_error_message
g_win32_ftruncate
g_win32_get_package_installation_directory
g_win32_getlocale
g_win32_opendir
g_win32_readdir

View File

@ -1006,6 +1006,15 @@ g_get_codeset (void)
#include <libintl.h>
#ifdef G_OS_WIN32
#define GLIB_LOCALE_DIR \
g_strconcat (g_win32_get_package_installation_directory (GETTEXT_PACKAGE), \
G_DIR_SEPARATOR_S, \
"locale", \
NULL)
#endif
int _glib_gettext_initialized = 0;
char *_glib_gettext_init (const char *str)

View File

@ -822,3 +822,55 @@ g_win32_error_message (gint error)
return retval;
}
gchar *
g_win32_get_package_installation_directory (gchar *package)
{
static GHashTable *installation_dirs = NULL;
gchar *result;
gchar *key;
char win_dir[MAX_PATH];
gchar *sep;
HKEY reg_key = NULL;
DWORD type;
DWORD nbytes;
if (installation_dirs == NULL)
installation_dirs = g_hash_table_new (g_str_hash, g_str_equal);
result = g_hash_table_lookup (installation_dirs, package);
if (result && result[0])
return result;
key = g_strconcat ("Software\\", package, NULL);
nbytes = 0;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, key, 0,
KEY_QUERY_VALUE, &reg_key) != ERROR_SUCCESS
|| RegQueryValueEx (reg_key, "InstallationDirectory", 0,
&type, NULL, &nbytes) != ERROR_SUCCESS
|| type != REG_SZ)
{
/* Uh oh. Use a default %WinDir%\package value */
if (GetWindowsDirectory (win_dir, sizeof (win_dir)) == 0)
strcpy (win_dir, (GetVersion () >= 0x80000000 ? "C:\\windows" : "C:\\winnt"));
sep = (win_dir[strlen (win_dir) - 1] == '\\' ? "" : "\\");
result = g_strconcat (win_dir, sep, package, NULL);
}
else
{
result = g_malloc (nbytes + 1);
RegQueryValueEx (reg_key, "InstallationDirectory", 0,
&type, result, &nbytes);
result[nbytes] = '\0';
}
g_hash_table_insert (installation_dirs, package, result);
if (reg_key != NULL)
RegCloseKey (reg_key);
g_free (key);
return result;
}

View File

@ -110,6 +110,8 @@ gchar * g_win32_getlocale (void);
*/
gchar * g_win32_error_message (gint error);
gchar * g_win32_get_package_installation_directory (gchar *package);
G_END_DECLS
#endif /* G_OS_WIN32 */

View File

@ -20,7 +20,7 @@ GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
INCLUDES = -I .
DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
DEPCFLAGS = $(LIBICONV_CFLAGS)
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
glib-$(GLIB_VER).dll \
@ -96,7 +96,7 @@ makefile.mingw: makefile.mingw.in
################ glib
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) $(LIBICONV_LIBS) -luser32 -lwsock32
./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) $(INTL_LIBS) $(LIBICONV_LIBS) -luser32 -lwsock32
gspawn-win32-helper.exe : gspawn-win32-helper.c
$(CC) $(CFLAGS) -mwindows -DG_LOG_DOMAIN=\"gspawn-win32-helper\" -o $@ $< -L . -lglib-$(GLIB_VER)

View File

@ -1,5 +1,5 @@
## Makefile for building the GLib dlls with Microsoft C
## Use: nmake -f makefile.msc install
## Use: nmake -f makefile.msc
# Change this to wherever you want to install the DLLs. This directory
# should be in your PATH.
@ -18,7 +18,7 @@ GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
INCLUDES = -I .
DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
DEPCFLAGS = $(LIBICONV_CFLAGS)
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
glib-$(GLIB_VER).dll \
@ -94,7 +94,7 @@ makefile.msc: makefile.msc.in
################ glib
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) $(LIBICONV_LIBS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) $(INTL_LIBS) $(LIBICONV_LIBS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
gspawn-win32-helper.exe : gspawn-win32-helper.c glib-$(GLIB_VER).dll
$(CC) $(CFLAGS) -Fe$@ -DG_LOG_DOMAIN=\"gspawn-win32-helper\" gspawn-win32-helper.c glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:windows user32.lib

View File

@ -1006,6 +1006,15 @@ g_get_codeset (void)
#include <libintl.h>
#ifdef G_OS_WIN32
#define GLIB_LOCALE_DIR \
g_strconcat (g_win32_get_package_installation_directory (GETTEXT_PACKAGE), \
G_DIR_SEPARATOR_S, \
"locale", \
NULL)
#endif
int _glib_gettext_initialized = 0;
char *_glib_gettext_init (const char *str)

View File

@ -822,3 +822,55 @@ g_win32_error_message (gint error)
return retval;
}
gchar *
g_win32_get_package_installation_directory (gchar *package)
{
static GHashTable *installation_dirs = NULL;
gchar *result;
gchar *key;
char win_dir[MAX_PATH];
gchar *sep;
HKEY reg_key = NULL;
DWORD type;
DWORD nbytes;
if (installation_dirs == NULL)
installation_dirs = g_hash_table_new (g_str_hash, g_str_equal);
result = g_hash_table_lookup (installation_dirs, package);
if (result && result[0])
return result;
key = g_strconcat ("Software\\", package, NULL);
nbytes = 0;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, key, 0,
KEY_QUERY_VALUE, &reg_key) != ERROR_SUCCESS
|| RegQueryValueEx (reg_key, "InstallationDirectory", 0,
&type, NULL, &nbytes) != ERROR_SUCCESS
|| type != REG_SZ)
{
/* Uh oh. Use a default %WinDir%\package value */
if (GetWindowsDirectory (win_dir, sizeof (win_dir)) == 0)
strcpy (win_dir, (GetVersion () >= 0x80000000 ? "C:\\windows" : "C:\\winnt"));
sep = (win_dir[strlen (win_dir) - 1] == '\\' ? "" : "\\");
result = g_strconcat (win_dir, sep, package, NULL);
}
else
{
result = g_malloc (nbytes + 1);
RegQueryValueEx (reg_key, "InstallationDirectory", 0,
&type, result, &nbytes);
result[nbytes] = '\0';
}
g_hash_table_insert (installation_dirs, package, result);
if (reg_key != NULL)
RegCloseKey (reg_key);
g_free (key);
return result;
}

View File

@ -110,6 +110,8 @@ gchar * g_win32_getlocale (void);
*/
gchar * g_win32_error_message (gint error);
gchar * g_win32_get_package_installation_directory (gchar *package);
G_END_DECLS
#endif /* G_OS_WIN32 */

View File

@ -20,7 +20,7 @@ GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
INCLUDES = -I .
DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
DEPCFLAGS = $(LIBICONV_CFLAGS)
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
glib-$(GLIB_VER).dll \
@ -96,7 +96,7 @@ makefile.mingw: makefile.mingw.in
################ glib
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) $(LIBICONV_LIBS) -luser32 -lwsock32
./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) $(INTL_LIBS) $(LIBICONV_LIBS) -luser32 -lwsock32
gspawn-win32-helper.exe : gspawn-win32-helper.c
$(CC) $(CFLAGS) -mwindows -DG_LOG_DOMAIN=\"gspawn-win32-helper\" -o $@ $< -L . -lglib-$(GLIB_VER)

View File

@ -1,5 +1,5 @@
## Makefile for building the GLib dlls with Microsoft C
## Use: nmake -f makefile.msc install
## Use: nmake -f makefile.msc
# Change this to wherever you want to install the DLLs. This directory
# should be in your PATH.
@ -18,7 +18,7 @@ GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
INCLUDES = -I .
DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
DEPCFLAGS = $(LIBICONV_CFLAGS)
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
glib-$(GLIB_VER).dll \
@ -94,7 +94,7 @@ makefile.msc: makefile.msc.in
################ glib
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) $(LIBICONV_LIBS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) $(INTL_LIBS) $(LIBICONV_LIBS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
gspawn-win32-helper.exe : gspawn-win32-helper.c glib-$(GLIB_VER).dll
$(CC) $(CFLAGS) -Fe$@ -DG_LOG_DOMAIN=\"gspawn-win32-helper\" gspawn-win32-helper.c glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:windows user32.lib

View File

@ -1144,6 +1144,11 @@ main (int argc,
#ifdef G_OS_WIN32
g_print ("current locale: %s\n", g_win32_getlocale ());
g_print ("GLib installation directory (used for message catalogs): %s\n",
g_win32_get_package_installation_directory (GETTEXT_PACKAGE));
g_print ("GTK+ 2.0 installation directory, if available: %s\n",
g_win32_get_package_installation_directory ("gtk20"));
#endif
g_print ("checking file functions...\n");

View File

@ -1144,6 +1144,11 @@ main (int argc,
#ifdef G_OS_WIN32
g_print ("current locale: %s\n", g_win32_getlocale ());
g_print ("GLib installation directory (used for message catalogs): %s\n",
g_win32_get_package_installation_directory (GETTEXT_PACKAGE));
g_print ("GTK+ 2.0 installation directory, if available: %s\n",
g_win32_get_package_installation_directory ("gtk20"));
#endif
g_print ("checking file functions...\n");