Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
gnome-desktop
bnc952146-wall-clock-replace-ratio-with-colon-o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc952146-wall-clock-replace-ratio-with-colon-on-non-UTF-8-locales.patch of Package gnome-desktop
From 1b9b7a267ade221ad4000cd024547b42a3056bf4 Mon Sep 17 00:00:00 2001 From: Rui Matos <tiagomatos@gmail.com> Date: Tue, 21 Jan 2014 22:04:42 +0100 Subject: wall-clock: Replace ratio with colon on non-UTF-8 locales Some of our translations use the ratio symbol which isn't convertible to non-UTF-8 locale encodings which causes g_date_time_format() to fail. Work around it by replacing the ratio symbol with a plain colon. https://bugzilla.gnome.org/show_bug.cgi?id=722664 --- libgnome-desktop/gnome-wall-clock.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libgnome-desktop/gnome-wall-clock.c b/libgnome-desktop/gnome-wall-clock.c index a2f5e2c..8ccaac0 100644 --- a/libgnome-desktop/gnome-wall-clock.c +++ b/libgnome-desktop/gnome-wall-clock.c @@ -229,12 +229,32 @@ gnome_wall_clock_class_init (GnomeWallClockClass *klass) g_type_class_add_private (gobject_class, sizeof (GnomeWallClockPrivate)); } +/* Some of our translations use the ratio symbol which isn't + * convertible to non-UTF-8 locale encodings. + */ +static char * +filter_ratio_for_locale (const char *input) +{ + char **pieces = NULL; + char *output = NULL; + + if (g_get_charset (NULL)) /* UTF-8 is ok */ + return g_strdup (input); + + /* else, we'll replace ratio with a plain colon */ + pieces = g_strsplit (input, "∶", -1); + output = g_strjoinv (":", pieces); + g_strfreev (pieces); + return output; +} + static gboolean update_clock (gpointer data) { GnomeWallClock *self = data; GDesktopClockFormat clock_format; const char *format_string; + char *safe_format_string; gboolean show_full_date; gboolean show_weekday; gboolean show_seconds; @@ -298,12 +318,15 @@ update_clock (gpointer data) } } + safe_format_string = filter_ratio_for_locale (format_string); + g_free (self->priv->clock_string); - self->priv->clock_string = g_date_time_format (now, format_string); + self->priv->clock_string = g_date_time_format (now, safe_format_string); g_date_time_unref (now); g_date_time_unref (expiry); - + g_free (safe_format_string); + g_object_notify ((GObject*)self, "clock"); return FALSE; -- cgit v0.11.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor