]> Pileus Git - ~andy/gtk/commitdiff
Don't use zip -r on the etc directory, to avoid including editor backup
authorTor Lillqvist <tml@iki.fi>
Sat, 20 Sep 2003 23:52:16 +0000 (23:52 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sat, 20 Sep 2003 23:52:16 +0000 (23:52 +0000)
2003-09-20  Tor Lillqvist  <tml@iki.fi>

* gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
including editor backup files. List files we want explicitly.

* gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
LC_ALL, LC_CTYPE and LANG environment variables, than calls
g_win32_getlocale().

(gtk_get_default_language): Code snippet moved to above function,
call it.

* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
* gtk/gtkrc.c (gtk_rc_context_parse_file): Call
_gtk_get_lc_ctype() instead of setlocale().

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk-zip.sh.in
gtk/gtkimmulticontext.c
gtk/gtkmain.c
gtk/gtkmain.h
gtk/gtkrc.c

index dff289a954425317d384f574ee4beb99476a4573..cf317394788296103a729ee00fae036b0182c57e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2003-09-20  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
+       including editor backup files. List files we want explicitly.
+
+       * gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
+       calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
+       LC_ALL, LC_CTYPE and LANG environment variables, than calls
+       g_win32_getlocale().
+
+       (gtk_get_default_language): Code snippet moved to above function,
+       call it.
+
+       * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
+       * gtk/gtkrc.c (gtk_rc_context_parse_file): Call
+       _gtk_get_lc_ctype() instead of setlocale().
+
 Fri Sep 19 18:15:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping
index dff289a954425317d384f574ee4beb99476a4573..cf317394788296103a729ee00fae036b0182c57e 100644 (file)
@@ -1,3 +1,20 @@
+2003-09-20  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
+       including editor backup files. List files we want explicitly.
+
+       * gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
+       calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
+       LC_ALL, LC_CTYPE and LANG environment variables, than calls
+       g_win32_getlocale().
+
+       (gtk_get_default_language): Code snippet moved to above function,
+       call it.
+
+       * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
+       * gtk/gtkrc.c (gtk_rc_context_parse_file): Call
+       _gtk_get_lc_ctype() instead of setlocale().
+
 Fri Sep 19 18:15:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping
index dff289a954425317d384f574ee4beb99476a4573..cf317394788296103a729ee00fae036b0182c57e 100644 (file)
@@ -1,3 +1,20 @@
+2003-09-20  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
+       including editor backup files. List files we want explicitly.
+
+       * gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
+       calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
+       LC_ALL, LC_CTYPE and LANG environment variables, than calls
+       g_win32_getlocale().
+
+       (gtk_get_default_language): Code snippet moved to above function,
+       call it.
+
+       * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
+       * gtk/gtkrc.c (gtk_rc_context_parse_file): Call
+       _gtk_get_lc_ctype() instead of setlocale().
+
 Fri Sep 19 18:15:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping
index dff289a954425317d384f574ee4beb99476a4573..cf317394788296103a729ee00fae036b0182c57e 100644 (file)
@@ -1,3 +1,20 @@
+2003-09-20  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
+       including editor backup files. List files we want explicitly.
+
+       * gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
+       calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
+       LC_ALL, LC_CTYPE and LANG environment variables, than calls
+       g_win32_getlocale().
+
+       (gtk_get_default_language): Code snippet moved to above function,
+       call it.
+
+       * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
+       * gtk/gtkrc.c (gtk_rc_context_parse_file): Call
+       _gtk_get_lc_ctype() instead of setlocale().
+
 Fri Sep 19 18:15:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping
index dff289a954425317d384f574ee4beb99476a4573..cf317394788296103a729ee00fae036b0182c57e 100644 (file)
@@ -1,3 +1,20 @@
+2003-09-20  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Don't use zip -r on the etc directory, to avoid
+       including editor backup files. List files we want explicitly.
+
+       * gtk/gtkmain.c (_gtk_get_lc_ctype): New function. On Unix, just
+       calls setlocale (LC_CTYPE, NULL). On Windows, looks for the
+       LC_ALL, LC_CTYPE and LANG environment variables, than calls
+       g_win32_getlocale().
+
+       (gtk_get_default_language): Code snippet moved to above function,
+       call it.
+
+       * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave)
+       * gtk/gtkrc.c (gtk_rc_context_parse_file): Call
+       _gtk_get_lc_ctype() instead of setlocale().
+
 Fri Sep 19 18:15:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping
index cee5bac8c2e48b7ef37a679afa6dcf222f0d2d4d..16ed3cb71effac3a65e71ac2b752e8a23be90f41 100755 (executable)
@@ -10,9 +10,11 @@ rm $ZIP
 DLLDIR=lib
 [ -f bin/libgdk_pixbuf-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll ] && DLLDIR=bin
 
-zip -r $ZIP -@ <<EOF
+zip $ZIP -@ <<EOF
 COPYING.LIB-2
-etc/gtk-2.0
+etc/gtk-2.0/gdk-pixbuf.loaders
+etc/gtk-2.0/gtkrc
+etc/gtk-2.0/gtk.immodues
 $DLLDIR/libgdk_pixbuf-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
 $DLLDIR/libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
 $DLLDIR/libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
index 75636820156e89af9c2b92b3214eda051eecd937..6a2e44f301001245df4ec00e4334c612cdaf15a2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "gtkimmulticontext.h"
 #include "gtkimmodule.h"
+#include "gtkmain.h"
 #include "gtkradiomenuitem.h"
 #include "gtkintl.h"
 #include "gtkprivate.h"
@@ -254,11 +255,9 @@ gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext)
 
       if (!global_context_id)
        {
-         const char *locale;
-         
-         locale = setlocale (LC_CTYPE, NULL);
-
+         gchar *locale = _gtk_get_lc_ctype ();
          global_context_id = _gtk_im_module_get_default_context_id (locale);
+         g_free (locale);
        }
        
       slave = _gtk_im_module_create (global_context_id);
index 02e236140513442836340baf8d56e2e87a6063b8..78dc4d1c02fca6708371d481d33821e7695917c6 100644 (file)
@@ -989,8 +989,13 @@ gtk_exit (gint errorcode)
  * <literal>setlocale (LC_ALL, "")</literal> but also takes care of the 
  * locale specific setup of the windowing system used by GDK.
  * 
- * Return value: a string corresponding to the locale set, as with the
- * C library function <function>setlocale()</function>.
+ * Return: a string corresponding to the locale set, typically in the
+ * form lang_COUNTRY, where lang is an ISO-639 language code, and
+ * COUNTRY is an ISO-3166 country code. On Unix, this form matches the
+ * result of the <function>setlocale()</function>; it is also used on
+ * other machines, such as Windows, where the C library returns a
+ * different result. The string is owned by GTK+ and should not be
+ * modified or freed.
  **/
 gchar *
 gtk_set_locale (void)
@@ -999,55 +1004,86 @@ gtk_set_locale (void)
 }
 
 /**
- * gtk_get_default_language:
+ * _gtk_get_lc_ctype:
  *
- * Returns the #PangoLanguage for the default language currently in
- * effect. (Note that this can change over the life of an
- * application.)  The default language is derived from the current
- * locale. It determines, for example, whether GTK+ uses the
- * right-to-left or left-to-right text direction.
+ * Return the Unix-style locale string for the language currently in
+ * effect. On Unix systems, this is the return value from
+ * <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
+ * affect this through the environment variables LC_ALL, LC_CTYPE or
+ * LANG (checked in that order). The locale strings typically is in
+ * the form lang_COUNTRY, where lang is an ISO-639 language code, and
+ * COUNTRY is an ISO-3166 country code. For instance, sv_FI for
+ * Swedish as written in Finland or pt_BR for Portuguese as written in
+ * Brazil.
  * 
- * Return value: the default language as a #PangoLanguage, must not be
- * freed
- **/
-PangoLanguage *
-gtk_get_default_language (void)
+ * On Windows, the C library doesn't use any such environment
+ * variables, and setting them won't affect the behaviour of functions
+ * like <function>ctime()</function>. The user sets the locale through
+ * the Regional Options in the Control Panel. The C library (in the
+ * <function>setlocale()</function> function) does not use country and
+ * language codes, but country and language names spelled out in
+ * English. However, this function does check the above environment
+ * variables, and does return a Unix-style locale string based on
+ * either said environment variables or the thread's current locale.
+ *
+ * Return value: a dynamically allocated string, free with g_free().
+ */
+
+gchar *
+_gtk_get_lc_ctype (void)
 {
-  gchar *lang;
-  PangoLanguage *result;
   gchar *p;
-  
+
 #ifdef G_OS_WIN32
   /* Somebody might try to set the locale for this process using the
    * LANG or LC_ environment variables. The Microsoft C library
    * doesn't know anything about them. You set the locale in the
    * Control Panel. Setting these env vars won't have any affect on
-   * locale-dependent C library functions like ctime. But just for
-   * kicks, do obey LC_ALL, LANG and LC_CTYPE in GTK. (This also makes
+   * locale-dependent C library functions like ctime(). But just for
+   * kicks, do obey LC_ALL, LC_CTYPE and LANG in GTK. (This also makes
    * it easier to test GTK and Pango in various default languages, you
    * don't have to clickety-click in the Control Panel, you can simply
    * start the program with LC_ALL=something on the command line.)
    */
   p = getenv ("LC_ALL");
   if (p != NULL)
-    lang = g_strdup (p);
-  else
-    {
-      p = getenv ("LANG");
-      if (p != NULL)
-       lang = g_strdup (p);
-      else
-       {
-         p = getenv ("LC_CTYPE");
-         if (p != NULL)
-           lang = g_strdup (p);
-         else
-           lang = g_win32_getlocale ();
-       }
-    }
+    return g_strdup (p);
+
+  p = getenv ("LC_CTYPE");
+  if (p != NULL)
+    return g_strdup (p);
+
+  p = getenv ("LANG");
+  if (p != NULL)
+    return g_strdup (p);
+
+  return g_win32_getlocale ();
 #else
-  lang = g_strdup (setlocale (LC_CTYPE, NULL));
+  return g_strdup (setlocale (LC_CTYPE, NULL));
 #endif
+}
+
+/**
+ * gtk_get_default_language:
+ *
+ * Returns the #PangoLanguage for the default language currently in
+ * effect. (Note that this can change over the life of an
+ * application.)  The default language is derived from the current
+ * locale. It determines, for example, whether GTK+ uses the
+ * right-to-left or left-to-right text direction. See
+ * _gtk_get_lc_ctype for notes on behaviour on Windows.
+ * 
+ * Return value: the default language as a #PangoLanguage, must not be
+ * freed
+ **/
+PangoLanguage *
+gtk_get_default_language (void)
+{
+  gchar *lang;
+  PangoLanguage *result;
+  gchar *p;
+  
+  lang = _gtk_get_lc_ctype ();
   p = strchr (lang, '.');
   if (p)
     *p = '\0';
index 45527b7203ba471f1e3fcf6d190eae0a0192bc68..a159aff0a3c9c02b60b247e6024bba07c1b4c417 100644 (file)
@@ -215,6 +215,8 @@ gchar * _gtk_find_module     (const gchar *name,
                              const gchar *type);
 gchar **_gtk_get_module_path (const gchar *type);
 
+gchar *_gtk_get_lc_ctype (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index ff6864e949be6e1dbaf39a480933bdf32962e142..1c488973446c93db8dcef72314ff7fb51e77a236 100644 (file)
@@ -840,15 +840,11 @@ gtk_rc_context_parse_file (GtkRcContext *context,
   gchar *locale_suffixes[2];
   gint n_locale_suffixes = 0;
   gchar *p;
-  const gchar *locale;
+  gchar *locale;
   gint length, j;
   gboolean found = FALSE;
 
-#ifdef G_OS_WIN32      
-  locale = g_win32_getlocale ();
-#else      
-  locale = setlocale (LC_CTYPE, NULL);
-#endif
+  locale = _gtk_get_lc_ctype ();
 
   if (strcmp (locale, "C") && strcmp (locale, "POSIX"))
     {
@@ -873,6 +869,8 @@ gtk_rc_context_parse_file (GtkRcContext *context,
          locale_suffixes[n_locale_suffixes++] = g_strndup (locale, length);
        }
     }
+
+  g_free (locale);
   
   gtk_rc_context_parse_one_file (context, filename, priority, reload);
   for (j = 0; j < n_locale_suffixes; j++)