Check for nl_langinfo (CODESET), changed the algorithm ussed to look for
locale dependent rc files so it does a better job
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2001-06-06 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* configure.in: Check for nl_langinfo (CODESET). Code taken from
|
||||
glib 1.3 branch.
|
||||
* gtk/gtkrc.c,gtk/gtkrc.*,gtk/Makefile.am: changed the algorithm
|
||||
ussed to look for locale dependent rc files so it does a better job
|
||||
finding them based on charset.
|
||||
|
||||
2001-06-01 Alex Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c (expose_predicate):
|
||||
|
||||
@@ -192,6 +192,15 @@ LIBS="$LIBS $INTLLIBS"
|
||||
gtklocaledir='${prefix}/${DATADIRNAME}/locale'
|
||||
AC_SUBST(gtklocaledir)
|
||||
|
||||
dnl Check for nl_langinfo and CODESET
|
||||
AC_MSG_CHECKING([for nl_langinfo (CODESET)])
|
||||
AC_TRY_COMPILE([#include <langinfo.h>],
|
||||
[char *codeset = nl_langinfo (CODESET);],
|
||||
AC_DEFINE(HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
|
||||
have_codeset=yes,
|
||||
have_codeset=no)
|
||||
AC_MSG_RESULT($have_codeset)
|
||||
|
||||
dnl The DU4 header files don't provide library prototypes unless
|
||||
dnl -std1 is given to the native cc.
|
||||
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
|
||||
|
||||
@@ -374,9 +374,11 @@ $(srcdir)/gtktypebuiltins_evals.c: @REBUILD@ makeenums.pl $(gtk_public_h_sources
|
||||
|
||||
|
||||
gtkconfdir = $(sysconfdir)/gtk
|
||||
gtkconf_DATA = gtkrc.az gtkrc.el gtkrc.eo gtkrc.he gtkrc.hy gtkrc.ja \
|
||||
gtkrc.ko gtkrc.ru gtkrc.tr gtkrc.th gtkrc.uk gtkrc.iso-8859-2 \
|
||||
gtkrc.iso-8859-5 gtkrc.iso-8859-13 gtkrc.iso-8859-14 \
|
||||
gtkconf_DATA = gtkrc.az gtkrc.he gtkrc.hy gtkrc.ja \
|
||||
gtkrc.ko gtkrc.ru gtkrc.th gtkrc.uk \
|
||||
gtkrc.utf-8 gtkrc.iso-8859-2 \
|
||||
gtkrc.iso-8859-3 gtkrc.iso-8859-5 gtkrc.iso-8859-7 \
|
||||
gtkrc.iso-8859-9 gtkrc.iso-8859-13 gtkrc.iso-8859-14 \
|
||||
gtkrc.iso-8859-15 gtkrc.zh_CN gtkrc.zh_TW.big5 \
|
||||
gtkrc.ka_GE.georgianacademy gtkrc.ka_GE.georgianps \
|
||||
gtkrc.vi_VN.tcvn gtkrc.vi_VN.viscii gtkrc.cp1251 gtkrc.cp1255
|
||||
|
||||
104
gtk/gtkrc.c
104
gtk/gtkrc.c
@@ -33,6 +33,9 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_CODESET
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include "gtkrc.h"
|
||||
#include "gtkbindings.h"
|
||||
@@ -440,7 +443,7 @@ _gtk_normalize_codeset (const char *codeset, int name_len)
|
||||
void
|
||||
gtk_rc_init (void)
|
||||
{
|
||||
static gchar *locale_suffixes[3];
|
||||
static gchar *locale_suffixes[8];
|
||||
static gint n_locale_suffixes = 0;
|
||||
|
||||
gint i, j;
|
||||
@@ -449,8 +452,6 @@ gtk_rc_init (void)
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gint length;
|
||||
|
||||
char *locale = setlocale (LC_CTYPE, NULL);
|
||||
char *p;
|
||||
|
||||
@@ -470,38 +471,91 @@ gtk_rc_init (void)
|
||||
* We normalize the charset into a standard form,
|
||||
* which has all '-' and '_' characters removed,
|
||||
* and is lowercase.
|
||||
*
|
||||
* the search is done in that order:
|
||||
* gtkrc.ll_cc.lowercasecodeset
|
||||
* gtkrc.ll_cc.normalizedcodeset
|
||||
* gtkrc.ll.lowercasecodeset
|
||||
* gtkrc.ll.normalizedcodeset
|
||||
* gtkrc.lowercasecodeset
|
||||
* gtkrc.normalizedcodeset
|
||||
* gtkrc.ll_cc
|
||||
* gtkrc.ll
|
||||
*
|
||||
*/
|
||||
gchar *normalized_locale;
|
||||
char *codeset = NULL;
|
||||
char *normalized_codeset = NULL;
|
||||
char *cc = NULL;
|
||||
char *ll;
|
||||
char *tmp = NULL;
|
||||
|
||||
p = strchr (locale, '@');
|
||||
length = p ? (p -locale) : strlen (locale);
|
||||
if (p)
|
||||
*p = '\0';
|
||||
|
||||
#ifdef HAVE_CODESET
|
||||
codeset = nl_langinfo (CODESET);
|
||||
#endif
|
||||
p = strchr (locale, '.');
|
||||
if ((codeset==NULL) && (p))
|
||||
codeset = p+1;
|
||||
if (p)
|
||||
{
|
||||
gchar *tmp1 = g_strndup (locale, p - locale + 1);
|
||||
gchar *tmp2 = _gtk_normalize_codeset (p + 1, length - (p - locale + 1));
|
||||
|
||||
normalized_locale = g_strconcat (tmp1, tmp2, NULL);
|
||||
g_free (tmp1);
|
||||
g_free (tmp2);
|
||||
|
||||
locale_suffixes[n_locale_suffixes++] = g_strdup (normalized_locale);
|
||||
length = p - locale;
|
||||
}
|
||||
else
|
||||
normalized_locale = g_strndup (locale, length);
|
||||
*p = '\0';
|
||||
|
||||
p = strchr (normalized_locale, '_');
|
||||
if (p)
|
||||
if (codeset)
|
||||
{
|
||||
locale_suffixes[n_locale_suffixes++] = g_strndup (normalized_locale, length);
|
||||
length = p - normalized_locale;
|
||||
/* if codeset is the result of nl_langinfo() it is
|
||||
* read-only so we need to copy it to a rw place */
|
||||
tmp = g_strdup(codeset);
|
||||
p = tmp;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
/* tolower not used, because some locales are not
|
||||
* compatible with C locale in lowercasing ascii */
|
||||
if (*p >= 'A' && *p <= 'Z')
|
||||
*p = (*p)-'A'+'a';
|
||||
p++;
|
||||
}
|
||||
codeset = tmp;
|
||||
normalized_codeset =
|
||||
_gtk_normalize_codeset(codeset, strlen(codeset));
|
||||
if (strcmp(normalized_codeset,codeset) == 0)
|
||||
normalized_codeset = NULL;
|
||||
}
|
||||
|
||||
locale_suffixes[n_locale_suffixes++] = g_strndup (normalized_locale, length);
|
||||
|
||||
g_free (normalized_locale);
|
||||
p = strchr (locale, '_');
|
||||
if (p) {
|
||||
cc = p+1;
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
ll = locale;
|
||||
|
||||
if (cc && codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( g_strconcat(ll,"_",cc,".",codeset,NULL));
|
||||
if (cc && normalized_codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( g_strconcat(ll,"_",cc,".",normalized_codeset,NULL));
|
||||
if (codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( g_strconcat(ll,".",codeset,NULL));
|
||||
if (normalized_codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( g_strconcat(ll,".",normalized_codeset,NULL));
|
||||
if (codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( codeset );
|
||||
if (normalized_codeset)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( normalized_codeset );
|
||||
if (cc)
|
||||
locale_suffixes[n_locale_suffixes++] =
|
||||
g_strdup ( g_strconcat(ll,"_",cc,NULL));
|
||||
locale_suffixes[n_locale_suffixes++] = g_strdup ( ll );
|
||||
|
||||
if (tmp) g_free (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
gtk/gtkrc.utf-8
Normal file
9
gtk/gtkrc.utf-8
Normal file
@@ -0,0 +1,9 @@
|
||||
style "default-text" {
|
||||
fontset = "-b&h-lucida sans-medium-r-normal--14-*-*-*-*-*-iso10646-1,\
|
||||
-*-arial-medium-r-normal--14-*-*-*-*-*-iso10646-1,\
|
||||
-*-r-*-iso10646-1,*"
|
||||
|
||||
}
|
||||
|
||||
class "GtkWidget" style "default-text"
|
||||
|
||||
Reference in New Issue
Block a user