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
This commit is contained in:
Hans Petter Jansson
2003-08-28 14:27:46 +00:00
committed by Hans Petter
parent 167ff0651a
commit 15c8a15ba1
2 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,10 @@
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.
2003-08-27 Bolian Yin <bolian.yin@sun.com>
* misc/Makefile.am: add dependency on a11y/widgets.

View File

@ -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);
}
}