Synch with Hiroyuki's main branch.
authorDarko Koruga <darko@users.sourceforge.net>
Fri, 27 Apr 2001 16:05:55 +0000 (16:05 +0000)
committerDarko Koruga <darko@users.sourceforge.net>
Fri, 27 Apr 2001 16:05:55 +0000 (16:05 +0000)
ChangeLog.claws
configure.in
src/prefs_common.c
src/prefs_common.h
src/procheader.c

index eb4be31669c3d18b12ce431603dee0c1b196f73c..8c1aa6525838e622dffa1ed345f33e191478bdbb 100644 (file)
@@ -1,3 +1,10 @@
+2001-04-27 [darko]
+
+       * configure.in: remove check for availability of
+         strftime() as advised by Hiroyuki
+       * src/prefs_common.[ch], src/procheader.c:
+         synch strftime() code with Hiroyki's main branch
+
 2001-04-26 [sergey]
 
        * src/news.c: news_query_password(), news_authenticate(): new
@@ -17,7 +24,6 @@
          strftime() for displaying date in summary pane if it
          is available
 
-
 2001-04-25
 
        * more .cvsignore cleanups [alfons]
index a09effdbc44b14c283d83be0a83b76f3b19f74c4..7e81637b9c4d24289212c0951eda86d15508ab3e 100644 (file)
@@ -195,7 +195,7 @@ AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr \
               wcsstr wcswcs iswalnum iswspace towlower \
               wcslen wcscpy wcsncpy \
               uname flock lockf inet_aton inet_addr \
-              fchmod mkstemp strftime)
+              fchmod mkstemp)
 
 AC_OUTPUT([
 Makefile
index 8b62c81516ccd2ac523a36395144b4312cdf9ff0..9ef7b910ea6aa6e68bd938d0ad682c019d571d65 100644 (file)
@@ -104,10 +104,7 @@ static struct Display {
        GtkWidget *chkbtn_transhdr;
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_hscrollbar;
-#ifdef HAVE_STRFTIME
-       GtkWidget *entry_dateformat;
-       GtkTooltips tooltips_dateformat
-#endif
+       GtkWidget *entry_datefmt;
 } display;
 
 static struct Message {
@@ -287,13 +284,9 @@ static PrefParam param[] = {
        {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
         &display.chkbtn_hscrollbar,
         prefs_set_data_from_toggle, prefs_set_toggle},
-
-#ifdef HAVE_STRFTIME
        {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
-        P_STRING, &display.entry_dateformat,
+        P_STRING, &display.entry_datefmt,
         prefs_set_data_from_entry, prefs_set_entry},
-#endif
-
 
        {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
         NULL, NULL, NULL},
@@ -1095,15 +1088,11 @@ static void prefs_display_create(void)
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_hscrollbar;
        GtkWidget *hbox1;
+       GtkWidget *label_datefmt;
+       GtkWidget *entry_datefmt;
+       GtkTooltips *tooltips_datefmt;
        GtkWidget *button_dispitem;
 
-#ifdef HAVE_STRFTIME
-       GtkWidget *hbox_dateformat;
-       GtkWidget *label_dateformat;
-       GtkWidget *entry_dateformat;
-       GtkTooltips *tooltips_dateformat;
-#endif
-
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
@@ -1161,6 +1150,41 @@ static void prefs_display_create(void)
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_hscrollbar, _("Enable horizontal scroll bar"));
 
+       label_datefmt = gtk_label_new (_("Date format"));
+       gtk_widget_show (label_datefmt);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0);
+
+       entry_datefmt = gtk_entry_new ();
+       gtk_widget_show (entry_datefmt);
+       gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0);
+
+       tooltips_datefmt = gtk_tooltips_new ();
+       gtk_tooltips_set_tip
+               (tooltips_datefmt, entry_datefmt,
+                _("Ordinary characters placed in the format string are copied "
+                  "without conversion. Conversion specifiers are introduced by "
+                  "a % character, and are replaced as follows:\n"
+                  "%a: the abbreviated weekday name\n"
+                  "%A: the full weekday name\n"
+                  "%b: the abbreviated month name\n"
+                  "%B: the full month name\n"
+                  "%c: the preferred date and time for the current locale\n"
+                  "%C: the century number (year/100)\n"
+                  "%d: the day of the month as a decimal number\n"
+                  "%H: the hour as a decimal number using a 24-hour clock\n"
+                  "%I: the hour as a decimal number using a 12-hour clock\n"
+                  "%j: the day of the year as a decimal number\n"
+                  "%m: the month as a decimal number\n"
+                  "%M: the minute as a decimal number\n"
+                  "%p: either AM or PM\n"
+                  "%S: the second as a decimal number\n"
+                  "%w: the day of the week as a decimal number\n"
+                  "%x: the preferred date for the current locale\n"
+                  "%y: the last two digits of a year\n"
+                  "%Y: the year as a decimal number\n"
+                  "%Z: the time zone or name or abbreviation"),
+                NULL);
+
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
@@ -1173,54 +1197,6 @@ static void prefs_display_create(void)
                            GTK_SIGNAL_FUNC (prefs_summary_display_item_set),
                            NULL);
 
-       /* ---- Date format ---- */
-
-#ifdef HAVE_STRFTIME
-       hbox1 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
-
-       hbox_dateformat = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (hbox1), hbox_dateformat, FALSE, TRUE, 0);
-
-       label_dateformat = gtk_label_new (_("Date format"));
-       gtk_widget_show (label_dateformat);
-       gtk_box_pack_start (GTK_BOX (hbox_dateformat), label_dateformat,
-                           FALSE, FALSE, 0);
-       entry_dateformat = gtk_entry_new ();
-       gtk_widget_show (entry_dateformat);
-       gtk_box_pack_start (GTK_BOX (hbox1), entry_dateformat, TRUE, TRUE, 0);
-
-       tooltips_dateformat = gtk_tooltips_new();
-       gtk_tooltips_set_tip(tooltips_dateformat, entry_dateformat,
-               _("Ordinary characters placed in the format string are copied "
-                 "without conversion. Conversion specifiers are introduced by "
-                 "a % character, and are replaced as follows:\n"
-                 "%a the abbreviated weekday name\n"
-                 "%A the full weekday name\n"
-                 "%b the abbreviated month name\n"
-                 "%B the full month name\n"
-                 "%c the preferred date and time for the current locale\n"
-                 "%C the century number (year/100)\n"
-                 "%d the day of the month as a decimal number\n"
-                 "%H the hour as a decimal number using a 24-hour clock\n"
-                 "%I the hour as a decimal number using a 12-hour clock\n"
-                 "%j the day of the year as a decimal number\n"
-                 "%m the month as a decimal number\n"
-                 "%M the minute as a decimal number\n"
-                 "%p either AM or PM\n"
-                 "%S the second as a decimal number\n"
-                 "%w the day of the week as a decimal number\n"
-                 "%x the preferred date for the current locale\n"
-                 "%y the last two digits of a year\n"
-                 "%Y the year as a decimal number\n"
-                 "%Z the time zone or name or abbreviation"
-                ),
-            NULL);
-#endif
-
-
        display.entry_textfont  = entry_textfont;
        display.button_textfont = button_textfont;
 
@@ -1229,10 +1205,7 @@ static void prefs_display_create(void)
        display.chkbtn_transhdr   = chkbtn_transhdr;
        display.chkbtn_swapfrom   = chkbtn_swapfrom;
        display.chkbtn_hscrollbar = chkbtn_hscrollbar;
-
-#ifdef HAVE_STRFTIME
-       display.entry_dateformat  = entry_dateformat;
-#endif
+       display.entry_datefmt     = entry_datefmt;
 }
 
 static void prefs_message_create(void)
index b217a28e7f5247362fcb59e0930a8db7c6a70774..baabd1b3f3cb3927316b6255edb7e9d273b96a6a 100644 (file)
@@ -69,9 +69,7 @@ struct _PrefsCommon
        gboolean enable_thread;
        gboolean enable_hscrollbar;
        gboolean swap_from;
-#ifdef HAVE_STRFTIME
        gchar *date_format;
-#endif
 
        /* Filtering */
        GSList *fltlist;
index 0f7e8c0a594c683630b63ee8070fb33552af95c9..7a931019a5022a55f16e4f716a8a8146424a9add 100644 (file)
@@ -31,8 +31,8 @@
 #include "procheader.h"
 #include "procmsg.h"
 #include "codeconv.h"
-#include "utils.h"
 #include "prefs_common.h"
+#include "utils.h"
 
 #define BUFFSIZE       8192
 
@@ -524,35 +524,13 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
 
 void procheader_date_get_localtime(gchar *dest, gint len, const time_t timer)
 {
-#ifdef HAVE_STRFTIME
        struct tm *lt;
+       gchar *default_format = "%y/%m/%d(%a) %H:%M";
 
        lt = localtime(&timer);
 
        if (prefs_common.date_format)
                strftime(dest, len, prefs_common.date_format, lt);
        else
-               *dest = '\0';
-#else
-       static gchar *wdaystr = N_("SunMonTueWedThuFriSat");
-       static gchar *tr_wday = NULL;
-       struct tm *lt;
-       gint wdlen;
-       gchar *wday;
-
-       if (!tr_wday)
-               tr_wday = g_strdup(gettext(wdaystr));
-
-       lt = localtime(&timer);
-
-       wdlen = strlen(tr_wday) / 7;
-       if ((wday = alloca(wdlen + 1))) {
-               strncpy(wday, tr_wday + lt->tm_wday * wdlen, wdlen);
-               wday[wdlen] = '\0';
-       }
-
-       g_snprintf(dest, len, "%02d/%d/%d(%s) %02d:%02d",
-                  lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday,
-                  wday, lt->tm_hour, lt->tm_min);
-#endif
+               strftime(dest, len, default_format, lt);
 }