OBS User unknown 2008-12-15 11:32:06 +00:00 committed by Git OBS Bridge
parent 82b10a5d7a
commit ef90c0ddfb
3 changed files with 84 additions and 37 deletions

View File

@ -1,7 +1,7 @@
Index: glib/gkeyfile.c
===================================================================
--- glib/gkeyfile.c (révision 7473)
+++ glib/gkeyfile.c (copie de travail)
--- glib/gkeyfile.c.orig
+++ glib/gkeyfile.c
@@ -83,6 +83,8 @@ struct _GKeyFile
GKeyFileFlags flags;
@ -39,7 +39,47 @@ Index: glib/gkeyfile.c
tmp = key_file->groups;
while (tmp != NULL)
{
@@ -448,6 +464,14 @@ g_key_file_load_from_fd (GKeyFile
@@ -367,6 +383,39 @@ find_file_in_data_dirs (const gchar *f
return fd;
}
+static int _g_key_file_default_textdomain_codeset_bound = 0;
+#define _G_KEY_FILE_DEFAULT_DOMAIN "desktop_translations"
+
+static char *
+_g_key_file_get_default_gettext_domain (void)
+{
+ if (!_g_key_file_default_textdomain_codeset_bound)
+ {
+ const char *codeset;
+
+ _g_key_file_default_textdomain_codeset_bound = 1;
+
+ codeset = bind_textdomain_codeset (_G_KEY_FILE_DEFAULT_DOMAIN, "UTF-8");
+
+ if (codeset)
+ _g_key_file_default_textdomain_codeset_bound |= 1 << 1;
+ }
+
+ return g_strdup (_G_KEY_FILE_DEFAULT_DOMAIN);
+}
+
+static inline gboolean
+_g_key_file_is_default_gettext_domain (const char *domain)
+{
+ return (domain && strcmp (domain, _G_KEY_FILE_DEFAULT_DOMAIN) == 0);
+}
+
+static inline gboolean
+_g_key_file_default_gettext_domain_is_bound (void)
+{
+ return _g_key_file_default_textdomain_codeset_bound & (1 << 1);
+}
+
static gboolean
g_key_file_load_from_fd (GKeyFile *key_file,
gint fd,
@@ -448,6 +497,14 @@ g_key_file_load_from_fd (GKeyFile
return FALSE;
}
@ -49,12 +89,12 @@ Index: glib/gkeyfile.c
+ NULL);
+
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_strdup ("desktop_translations");
+ key_file->gettext_domain = _g_key_file_get_default_gettext_domain ();
+
return TRUE;
}
@@ -497,6 +521,8 @@ g_key_file_load_from_file (GKeyFile
@@ -497,6 +554,8 @@ g_key_file_load_from_file (GKeyFile
return FALSE;
}
@ -63,7 +103,7 @@ Index: glib/gkeyfile.c
return TRUE;
}
@@ -554,6 +580,13 @@ g_key_file_load_from_data (GKeyFile
@@ -554,6 +613,14 @@ g_key_file_load_from_data (GKeyFile
return FALSE;
}
@ -71,13 +111,14 @@ Index: glib/gkeyfile.c
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
+ NULL);
+
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_strdup ("desktop_translations");
+ key_file->gettext_domain = _g_key_file_get_default_gettext_domain ();
+
return TRUE;
}
@@ -623,6 +656,9 @@ g_key_file_load_from_dirs (GKeyFile
@@ -623,6 +690,9 @@ g_key_file_load_from_dirs (GKeyFile
}
}
@ -87,7 +128,7 @@ Index: glib/gkeyfile.c
if (found_file && full_path)
*full_path = output_path;
else
@@ -1653,6 +1689,8 @@ g_key_file_get_locale_string (GKeyFile
@@ -1653,6 +1723,8 @@ g_key_file_get_locale_string (GKeyFile
GError *key_file_error;
gchar **languages;
gboolean free_languages = FALSE;
@ -96,7 +137,7 @@ Index: glib/gkeyfile.c
gint i;
g_return_val_if_fail (key_file != NULL, NULL);
@@ -1682,7 +1720,24 @@ g_key_file_get_locale_string (GKeyFile
@@ -1682,7 +1754,24 @@ g_key_file_get_locale_string (GKeyFile
languages = (gchar **) g_get_language_names ();
free_languages = FALSE;
}
@ -122,7 +163,7 @@ Index: glib/gkeyfile.c
for (i = 0; languages[i]; i++)
{
candidate_key = g_strdup_printf ("%s[%s]", key, languages[i]);
@@ -1697,6 +1752,60 @@ g_key_file_get_locale_string (GKeyFile
@@ -1697,6 +1786,65 @@ g_key_file_get_locale_string (GKeyFile
g_free (translated_value);
translated_value = NULL;
@ -133,9 +174,14 @@ Index: glib/gkeyfile.c
+
+ if (orig_value)
+ {
+ const gchar *translated;
+ gboolean codeset_set;
+ const gchar *translated;
+ gboolean has_gettext;
+
+ if (!_g_key_file_is_default_gettext_domain (key_file->gettext_domain))
+ codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
+ else
+ codeset_set = _g_key_file_default_gettext_domain_is_bound ();
+ translated = NULL;
+
+ /* first try to translate with the context */
@ -169,7 +215,7 @@ Index: glib/gkeyfile.c
+
+ if (has_gettext)
+ {
+ if (bind_textdomain_codeset (key_file->gettext_domain, NULL))
+ if (codeset_set)
+ translated_value = g_strdup (translated);
+ else
+ translated_value = g_locale_to_utf8 (translated,
@ -185,8 +231,8 @@ Index: glib/gkeyfile.c
/* Fallback to untranslated key
Index: glib/gkeyfile.h
===================================================================
--- glib/gkeyfile.h (révision 7473)
+++ glib/gkeyfile.h (copie de travail)
--- glib/gkeyfile.h.orig
+++ glib/gkeyfile.h
@@ -240,6 +240,7 @@ gboolean g_key_file_remove_group
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed Dec 10 12:34:56 CET 2008 - olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
(bnc#437293)
-------------------------------------------------------------------
Mon Dec 8 13:22:24 CET 2008 - vuntz@novell.com
- Update glib2-fate300461-desktop-gettext.patch: correctly use
bind_textdomain_codeset(), and also only do it once for the
default gettext domain (for performance reasons).
Fix bnc#455987, thanks to Michael Meeks for debugging.
-------------------------------------------------------------------
Mon Nov 24 12:34:56 CET 2008 - olh@suse.de

View File

@ -31,12 +31,9 @@ AutoReqProv: on
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
Version: 2.18.2
Release: 4
Release: 5
Summary: A Library with Convenient Functions Written in C
Url: http://www.gtk.org/
Source: ftp://ftp.gnome.org/pub/GNOME/sources/%{_name}/2.14/%{_name}-%{version}.tar.bz2
@ -154,9 +151,6 @@ AutoReqProv: on
%ifarch ppc64
Obsoletes: glib2-devel-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-devel-32bit
%endif
#
%description devel
@ -195,9 +189,6 @@ Requires: %{name} = %{version}
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
%description -n libglib-2_0-0
@ -232,9 +223,6 @@ Requires: %{name} = %{version}
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
%description -n libgmodule-2_0-0
@ -269,9 +257,6 @@ Requires: %{name} = %{version}
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
# Temporarily disable this, pending further discussion
# Recommends: gvfs
@ -337,9 +322,6 @@ Requires: %{name} = %{version}
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
%description -n libgthread-2_0-0
@ -374,9 +356,6 @@ Requires: %{name} = %{version}
%ifarch ppc64
Obsoletes: glib2-64bit
%endif
%ifarch %ix86 ppc
Obsoletes: glib2-32bit
%endif
#
%description -n libgobject-2_0-0
@ -580,6 +559,14 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_datadir}/gtk-doc/html
%changelog
* Wed Dec 10 2008 olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
(bnc#437293)
* Mon Dec 08 2008 vuntz@novell.com
- Update glib2-fate300461-desktop-gettext.patch: correctly use
bind_textdomain_codeset(), and also only do it once for the
default gettext domain (for performance reasons).
Fix bnc#455987, thanks to Michael Meeks for debugging.
* Mon Nov 24 2008 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Tue Nov 11 2008 ro@suse.de