[gnome-desktop] wall-clock: Only use the 12h mode when AM/PM is available
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] wall-clock: Only use the 12h mode when AM/PM is available
- Date: Thu, 8 Nov 2012 11:31:29 +0000 (UTC)
commit 63b6982c2bcdfb4e69faeba3dd2f775cda7ca6c7
Author: Bastien Nocera <hadess hadess net>
Date: Thu Nov 8 12:23:02 2012 +0100
wall-clock: Only use the 12h mode when AM/PM is available
When the 12h mode is used but AM/PM aren't available, print
using the 24h format.
https://bugzilla.gnome.org/show_bug.cgi?id=687913
libgnome-desktop/gnome-wall-clock.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libgnome-desktop/gnome-wall-clock.c b/libgnome-desktop/gnome-wall-clock.c
index 48f0f4d..4842d6d 100644
--- a/libgnome-desktop/gnome-wall-clock.c
+++ b/libgnome-desktop/gnome-wall-clock.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <glib/gi18n-lib.h>
+#include <langinfo.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include "gnome-wall-clock.h"
@@ -40,6 +41,7 @@ struct _GnomeWallClockPrivate {
GSettings *desktop_settings;
gboolean time_only;
+ gboolean ampm_available;
};
enum {
@@ -65,6 +67,7 @@ static void
gnome_wall_clock_init (GnomeWallClock *self)
{
GFile *tz;
+ const char *ampm;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GNOME_TYPE_WALL_CLOCK, GnomeWallClockPrivate);
@@ -79,6 +82,10 @@ gnome_wall_clock_init (GnomeWallClock *self)
self->priv->desktop_settings = g_settings_new ("org.gnome.desktop.interface");
g_signal_connect (self->priv->desktop_settings, "changed", G_CALLBACK (on_schema_change), self);
+ ampm = nl_langinfo (AM_STR);
+ if (ampm != NULL && *ampm != '\0')
+ self->priv->ampm_available = FALSE;
+
update_clock (self);
}
@@ -231,7 +238,8 @@ update_clock (gpointer data)
self->priv->clock_update_id = g_source_attach (source, NULL);
g_source_unref (source);
- if (clock_format == G_DESKTOP_CLOCK_FORMAT_24H) {
+ if (clock_format == G_DESKTOP_CLOCK_FORMAT_24H ||
+ self->priv->ampm_available == FALSE) {
if (show_full_date) {
/* Translators: This is the time format with full date used
in 24-hour mode. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]