diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-08-28 22:27:46 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-08-28 22:27:46 +0800 |
commit | 15c8a15ba18cb2c994acf97464d528fb536c41bf (patch) | |
tree | efeb17c9e6fc809c93ec160cc708f3fc7f409327 /widgets/misc | |
parent | 167ff0651a993e5f4e145cc92de2e86d64783220 (diff) | |
download | gsoc2013-evolution-15c8a15ba18cb2c994acf97464d528fb536c41bf.tar.gz gsoc2013-evolution-15c8a15ba18cb2c994acf97464d528fb536c41bf.tar.zst gsoc2013-evolution-15c8a15ba18cb2c994acf97464d528fb536c41bf.zip |
Fixes #15638.
2003-08-27 Hans Petter Jansson <hpj@ximian.com>
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
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-dateedit.c | 18 |
1 files changed, 15 insertions, 3 deletions
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); } } |