diff options
author | piernov <piernov@piernov.org> | 2011-09-02 19:07:00 +0200 |
---|---|---|
committer | piernov <piernov@piernov.org> | 2011-09-02 19:07:39 +0200 |
commit | 1d5a9bd5a8a877707f4bf5cdb2c8941babc73382 (patch) | |
tree | aa949b596cfcb273578d6dd15f626e9788d81f99 /gdm/patch/time_display_on_greeter.patch | |
parent | cef6a4403b5fbfc34d243942bcd89495dee54296 (diff) | |
download | gnome3-1d5a9bd5a8a877707f4bf5cdb2c8941babc73382.tar.gz gnome3-1d5a9bd5a8a877707f4bf5cdb2c8941babc73382.tar.bz2 gnome3-1d5a9bd5a8a877707f4bf5cdb2c8941babc73382.tar.xz gnome3-1d5a9bd5a8a877707f4bf5cdb2c8941babc73382.zip |
gdm 3.1.90-3 ajout patchs
Diffstat (limited to 'gdm/patch/time_display_on_greeter.patch')
-rw-r--r-- | gdm/patch/time_display_on_greeter.patch | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/gdm/patch/time_display_on_greeter.patch b/gdm/patch/time_display_on_greeter.patch new file mode 100644 index 0000000..7bcad89 --- /dev/null +++ b/gdm/patch/time_display_on_greeter.patch @@ -0,0 +1,104 @@ +Description: Display time on the greeter in accordance with the system wide settings in Language Support. +Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651506 +Bug-Ubuntu: https://launchpad.net/bugs/777264 +Forwarded: yes +Author: Gunnar Hjalmarsson <ubuntu@gunnar.cc> + +diff -Nur -x '*.orig' -x '*~' gdm-3.0.0//gui/simple-greeter/gdm-clock-widget.c gdm-3.0.0.new//gui/simple-greeter/gdm-clock-widget.c +--- gdm-3.0.0//gui/simple-greeter/gdm-clock-widget.c 2011-04-04 16:37:16.000000000 +0200 ++++ gdm-3.0.0.new//gui/simple-greeter/gdm-clock-widget.c 2011-06-05 23:55:31.140297043 +0200 +@@ -30,6 +30,7 @@ + #include <errno.h> + #include <dirent.h> + #include <sys/stat.h> ++#include <locale.h> + + #include <glib.h> + #include <glib/gi18n.h> +@@ -60,39 +61,23 @@ + static void + update_time_format (GdmClockWidget *clock) + { ++ time_t t; ++ struct tm *tm; ++ char ampm[16]; + char *clock_format; + char *tooltip_format; + +- if (clock->priv->should_show_date && clock->priv->should_show_seconds) { +- /* translators: This is the time format to use when both +- * the date and time with seconds are being shown together. +- */ +- clock_format = _("%a %b %e, %l:%M:%S %p"); +- tooltip_format = NULL; +- } else if (clock->priv->should_show_date && !clock->priv->should_show_seconds) { +- /* translators: This is the time format to use when both +- * the date and time without seconds are being shown together. +- */ +- clock_format = _("%a %b %e, %l:%M %p"); +- +- tooltip_format = NULL; +- } else if (!clock->priv->should_show_date && clock->priv->should_show_seconds) { +- /* translators: This is the time format to use when there is +- * no date, just weekday and time with seconds. +- */ +- clock_format = _("%a %l:%M:%S %p"); +- +- /* translators: This is the time format to use for the date +- */ +- tooltip_format = "%x"; ++ time (&t); ++ tm = localtime (&t); ++ setlocale(LC_TIME, ""); ++ strftime(ampm, sizeof(ampm), "%p", tm); ++ ++ if (strlen(ampm) > 0) { ++ clock_format = "%l:%M %p"; + } else { +- /* translators: This is the time format to use when there is +- * no date, just weekday and time without seconds. +- */ +- clock_format = _("%a %l:%M %p"); +- +- tooltip_format = "%x"; ++ clock_format = "%H:%M"; + } ++ tooltip_format = "%x"; + + g_free (clock->priv->time_format); + clock->priv->time_format = g_locale_from_utf8 (clock_format, -1, NULL, NULL, NULL); +@@ -113,6 +98,8 @@ + { + time_t t; + struct tm *tm; ++ char showed_time[32]; ++ char weekday[32]; + char buf[256]; + char *utf8; + char *markup; +@@ -123,10 +110,15 @@ + g_warning ("Unable to get broken down local time"); + return; + } +- if (strftime (buf, sizeof (buf), clock_format, tm) == 0) { ++ if (strftime (showed_time, sizeof (showed_time), clock_format, tm) == 0) { + g_warning ("Couldn't format time: %s", clock_format); +- strcpy (buf, "???"); ++ strcpy (showed_time, "???"); + } ++ ++ setlocale( LC_TIME, getenv("LC_MESSAGES") ); ++ strftime(weekday, sizeof(weekday), "%a", tm); ++ sprintf(buf, "%s %s", weekday, showed_time); ++ + utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL); + markup = g_strdup_printf ("<b><span foreground=\"white\">%s</span></b>", utf8); + gtk_label_set_markup (label, markup); +@@ -134,6 +126,7 @@ + g_free (utf8); + + if (tooltip_format != NULL) { ++ setlocale(LC_TIME, ""); + if (strftime (buf, sizeof (buf), tooltip_format, tm) == 0) { + g_warning ("Couldn't format tooltip date: %s", tooltip_format); + strcpy (buf, "???"); |