rpms/gdm/F-12 fix-clock.patch,NONE,1.1 gdm.spec,1.497,1.498

Ray Strode rstrode at fedoraproject.org
Wed Oct 21 15:02:09 UTC 2009


Author: rstrode

Update of /cvs/pkgs/rpms/gdm/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4806

Modified Files:
	gdm.spec 
Added Files:
	fix-clock.patch 
Log Message:
- Move date from panel to clock tooltip


fix-clock.patch:
 gdm-clock-widget.c |   98 ++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 67 insertions(+), 31 deletions(-)

--- NEW FILE fix-clock.patch ---
>From 87248d5c3e0a90c3b0748c7be05a9e6eac231737 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode at redhat.com>
Date: Wed, 21 Oct 2009 10:57:59 -0400
Subject: [PATCH] Move date to tooltip in panel clock

It's a bit long at the moment. Dropping the
date makes the screen look a little cleaner, and putting
the date in the tooltip makes it still available for those
people who want to see it.
---
 gui/simple-greeter/gdm-clock-widget.c |   97 +++++++++++++++++++++++----------
 1 files changed, 67 insertions(+), 30 deletions(-)

diff --git a/gui/simple-greeter/gdm-clock-widget.c b/gui/simple-greeter/gdm-clock-widget.c
index a3816d2..9008e6d 100644
--- a/gui/simple-greeter/gdm-clock-widget.c
+++ b/gui/simple-greeter/gdm-clock-widget.c
@@ -44,8 +44,10 @@ struct GdmClockWidgetPrivate
 {
         GtkWidget *label;
         char      *time_format;
+        char      *tooltip_format;
         guint      update_clock_id;
         guint      should_show_seconds : 1;
+        guint      should_show_date : 1;
 };
 
 static void     gdm_clock_widget_class_init  (GdmClockWidgetClass *klass);
@@ -55,38 +57,59 @@ static gboolean update_timeout_cb            (GdmClockWidget      *clock);
 
 G_DEFINE_TYPE (GdmClockWidget, gdm_clock_widget, GTK_TYPE_ALIGNMENT)
 
-static char *
-get_time_format (GdmClockWidget *clock)
+static void
+update_time_format (GdmClockWidget *clock)
 {
-        const char *time_format;
-        const char *date_format;
         char       *clock_format;
-        char       *result;
-
-        time_format = clock->priv->should_show_seconds ? _("%l:%M:%S %p") : _("%l:%M %p");
-        /* translators: replace %e with %d if, when the day of the
-         *              month as a decimal number is a single digit, it
-         *              should begin with a 0 in your locale (e.g. "May
-         *              01" instead of "May  1").
-         */
-        date_format = _("%a %b %e");
-        /* translators: reverse the order of these arguments
-         *              if the time should come before the
-         *              date on a clock in your locale.
-         */
-        clock_format = g_strdup_printf (_("%1$s, %2$s"),
-                                        date_format,
-                                        time_format);
-
-        result = g_locale_from_utf8 (clock_format, -1, NULL, NULL, NULL);
-        g_free (clock_format);
-
-        return result;
+        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");
+        } 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");
+        }
+
+        g_free (clock->priv->time_format);
+        clock->priv->time_format = g_locale_from_utf8 (clock_format, -1, NULL, NULL, NULL);
+
+        g_free (clock->priv->tooltip_format);
+
+        if (tooltip_format != NULL) {
+                clock->priv->tooltip_format = g_locale_from_utf8 (tooltip_format, -1, NULL, NULL, NULL);
+        } else {
+                clock->priv->tooltip_format = NULL;
+        }
 }
 
 static void
 update_clock (GtkLabel   *label,
-              const char *format)
+              const char *clock_format,
+              const char *tooltip_format)
 {
         time_t     t;
         struct tm *tm;
@@ -99,13 +122,25 @@ update_clock (GtkLabel   *label,
                 g_warning ("Unable to get broken down local time");
                 return;
         }
-        if (strftime (buf, sizeof (buf), format, tm) == 0) {
-                g_warning ("Couldn't format time: %s", format);
+        if (strftime (buf, sizeof (buf), clock_format, tm) == 0) {
+                g_warning ("Couldn't format time: %s", clock_format);
                 strcpy (buf, "???");
         }
         utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
         gtk_label_set_text (label, utf8);
         g_free (utf8);
+
+        if (tooltip_format != NULL) {
+                if (strftime (buf, sizeof (buf), tooltip_format, tm) == 0) {
+                        g_warning ("Couldn't format tooltip date: %s", tooltip_format);
+                        strcpy (buf, "???");
+                }
+                utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+                gtk_widget_set_tooltip_text (GTK_WIDGET (label), utf8);
+                g_free (utf8);
+        } else {
+                gtk_widget_set_has_tooltip (GTK_WIDGET (label), FALSE);
+        }
 }
 
 static void
@@ -142,7 +177,8 @@ update_timeout_cb (GdmClockWidget *clock)
 
         if (clock->priv->label != NULL) {
                 update_clock (GTK_LABEL (clock->priv->label),
-                              clock->priv->time_format);
+                              clock->priv->time_format,
+                              clock->priv->tooltip_format);
         }
 
         set_clock_timeout (clock, new_time);
@@ -214,10 +250,11 @@ gdm_clock_widget_init (GdmClockWidget *widget)
         gtk_container_add (GTK_CONTAINER (widget), box);
 
         widget->priv->label = gtk_label_new ("");
+
         gtk_widget_show (widget->priv->label);
         gtk_box_pack_start (GTK_BOX (box), widget->priv->label, FALSE, FALSE, 0);
 
-        widget->priv->time_format = get_time_format (widget);
+        update_time_format (widget);
         update_timeout_cb (widget);
 }
 
-- 
1.6.5.rc2



Index: gdm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdm/F-12/gdm.spec,v
retrieving revision 1.497
retrieving revision 1.498
diff -u -p -r1.497 -r1.498
--- gdm.spec	20 Oct 2009 23:45:00 -0000	1.497
+++ gdm.spec	21 Oct 2009 15:02:08 -0000	1.498
@@ -16,7 +16,7 @@
 Summary: The GNOME Display Manager
 Name: gdm
 Version: 2.28.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: User Interface/X
@@ -102,6 +102,7 @@ Patch13: gdm-system-keyboard.patch
 
 Patch19: gdm-multistack.patch
 Patch20: gdm-2.28.1-move-shutdown-functions.patch
+Patch21: fix-clock.patch
 
 # Fedora-specific
 Patch98: gdm-bubble-location.patch
@@ -148,6 +149,7 @@ The GDM fingerprint plugin provides func
 
 %patch19 -p1 -b .multistack
 %patch20 -p1 -b .move-shutdown-functions
+%patch21 -p1 -b .fix-clock
 
 %patch98 -p1 -b .bubble-location
 %patch99 -p1 -b .fedora-logo
@@ -399,6 +401,9 @@ fi
 %{_libdir}/gdm/simple-greeter/plugins/fingerprint.so
 
 %changelog
+* Wed Oct 21 2009 Ray Strode <rstrode at redhat.com> 2.28.1-3
+- Move date from panel to clock tooltip
+
 * Tue Oct 20 2009 Ray Strode <rstrode at redhat.com> 2.28.1-2
 - Move shutdown functions to panel from login window
 




More information about the fedora-extras-commits mailing list