Cleanup in gnome-dateedit.c
- From: Kjartan Maraas <kmaraas online no>
- To: desktop-devel-list gnome org
- Subject: Cleanup in gnome-dateedit.c
- Date: 01 May 2003 15:16:50 +0200
Hi.
Is there any reason why the attached cleanup wouldn't work?
Cheers
Kjartan
Index: libgnomeui/gnome-dateedit.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dateedit.c,v
retrieving revision 1.74
diff -u -r1.74 gnome-dateedit.c
--- libgnomeui/gnome-dateedit.c 31 May 2002 01:40:30 -0000 1.74
+++ libgnomeui/gnome-dateedit.c 1 May 2003 13:14:54 -0000
@@ -368,36 +368,20 @@
for (i = gde->_priv->lower_hour; i <= gde->_priv->upper_hour; i++){
GtkWidget *item, *submenu;
hour_info_t *hit;
- char buffer [40];
+ char buffer[40];
char *str_utf8;
mtm->tm_hour = i;
mtm->tm_min = 0;
- if (gde->_priv->flags & GNOME_DATE_EDIT_24_HR) {
- if (strftime (buffer, sizeof (buffer),
- "%H:00", mtm) == 0)
- strcpy (buffer, "???");
- } else {
- if (strftime (buffer, sizeof (buffer),
- "%I:00 %p ", mtm) == 0)
- strcpy (buffer, "???");
- }
+ if (strftime (buffer, sizeof (buffer), "%X", mtm) == 0)
+ strcpy (buffer, "???");
+
buffer[sizeof(buffer)-1] = '\0';
str_utf8 = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
item = gtk_menu_item_new_with_label (str_utf8 ? str_utf8 : "");
g_free (str_utf8);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-#if 0
- hit = g_new (hour_info_t, 1);
- hit->hour = g_strdup (buffer);
- hit->gde = gde;
- g_signal_connect_data (item, "activate",
- G_CALLBACK (set_time),
- hit,
- (GCallbackNotify) free_resources,
- 0);
-#endif
gtk_widget_show (item);
submenu = gtk_menu_new ();
@@ -407,15 +391,9 @@
mtm->tm_min = j;
- if (gde->_priv->flags & GNOME_DATE_EDIT_24_HR) {
- if (strftime (buffer, sizeof (buffer),
- "%H:%M", mtm) == 0)
- strcpy (buffer, "???");
- } else {
- if (strftime (buffer, sizeof (buffer),
- "%I:%M %p", mtm) == 0)
- strcpy (buffer, "???");
- }
+ if (strftime (buffer, sizeof (buffer), "%X", mtm) == 0)
+ strcpy (buffer, "???");
+
buffer[sizeof(buffer)-1] = '\0';
str_utf8 = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
mins = gtk_menu_item_new_with_label (str_utf8 ? str_utf8 : "");
@@ -692,13 +670,9 @@
g_free (str_utf8);
/* Set the time */
- if (gde->_priv->flags & GNOME_DATE_EDIT_24_HR) {
- if (strftime (buffer, sizeof (buffer), "%H:%M", mytm) == 0)
- strcpy (buffer, "???");
- } else {
- if (strftime (buffer, sizeof (buffer), "%I:%M %p", mytm) == 0)
- strcpy (buffer, "???");
- }
+ if (strftime (buffer, sizeof (buffer), "%X", mytm) == 0)
+ strcpy (buffer, "???");
+
buffer[sizeof(buffer)-1] = '\0';
str_utf8 = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]