From 15c8a15ba18cb2c994acf97464d528fb536c41bf Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Thu, 28 Aug 2003 14:27:46 +0000 Subject: Fixes #15638. 2003-08-27 Hans Petter Jansson Fixes #15638. * misc/e-dateedit.c (rebuild_time_popup): Make 12-hour time format not be zero-padded. Right-align time labels so digits line up. svn path=/trunk/; revision=22394 --- widgets/ChangeLog | 7 +++++++ widgets/misc/e-dateedit.c | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'widgets') diff --git a/widgets/ChangeLog b/widgets/ChangeLog index 8dd3170c62..e681335f80 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,10 @@ +2003-08-27 Hans Petter Jansson + + Fixes #15638. + + * misc/e-dateedit.c (rebuild_time_popup): Make 12-hour time format + not be zero-padded. Right-align time labels so digits line up. + 2003-08-27 Bolian Yin * misc/Makefile.am: add dependency on a11y/widgets. diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 33a3e0bc33..31b070a2e8 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -1375,7 +1375,7 @@ rebuild_time_popup (EDateEdit *dedit) { EDateEditPrivate *priv; GtkList *list; - GtkWidget *listitem; + GtkWidget *listitem, *label; char buffer[40], *format; struct tm tmp_tm; gint hour, min; @@ -1416,8 +1416,20 @@ rebuild_time_popup (EDateEdit *dedit) e_utf8_strftime (buffer, sizeof (buffer), format, &tmp_tm); - listitem = gtk_list_item_new_with_label (buffer); - gtk_widget_show (listitem); + /* For 12-hour am/pm format, we want space padding, not zero padding. This + * can be done with strftime's %l, but it's a potentially unportable extension. */ + if (!priv->use_24_hour_format && buffer [0] == '0') + buffer [0] = ' '; + + /* We need to make sure labels are right-aligned, since we want digits to line up, + * and with a nonproportional font, the width of a space != width of a digit. + * Technically, only 12-hour format needs this, but we do it always, for consistency. */ + listitem = gtk_list_item_new (); + label = gtk_label_new (buffer); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_container_add (GTK_CONTAINER (listitem), label); + + gtk_widget_show_all (listitem); gtk_container_add (GTK_CONTAINER (list), listitem); } } -- cgit