Bugzilla – Attachment 69818 Details for
Bug 130787
Calendar starts on Monday instead of Sunday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
gtk2-130787-calendar-week-start.diff
gtk2-130787-calendar-week-start.diff (text/x-patch), 1.53 KB, created by
Michal Marek
on 2006-02-22 15:38:20 UTC
(
hide
)
Description:
gtk2-130787-calendar-week-start.diff
Filename:
MIME Type:
Creator:
Michal Marek
Created:
2006-02-22 15:38:20 UTC
Size:
1.53 KB
patch
obsolete
>--- gtk/gtkcalendar.c >+++ gtk/gtkcalendar.c >@@ -29,6 +29,9 @@ > * GTK+ at ftp://ftp.gtk.org/pub/gtk/. > */ > >+/* for strptime() */ >+#define _XOPEN_SOURCE >+ > #include <config.h> > > #ifdef HAVE_SYS_TIME_H >@@ -704,12 +707,39 @@ > first_weekday = langinfo[0]; > langinfo = nl_langinfo (_NL_TIME_WEEK_1STDAY); > week_origin = GPOINTER_TO_INT (langinfo); >- if (week_origin == 19971130) /* Sunday */ >- week_1stday = 0; >- else if (week_origin == 19971201) /* Monday */ >- week_1stday = 1; >- else >- g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n"); >+ switch (week_origin) { >+ case 19971130: /* Sunday */ >+ week_1stday = 0; >+ break; >+ case 19971201: /* Monday */ >+ case 19971202: >+ case 19971203: >+ case 19971204: >+ case 19971205: >+ case 19971206: /* Saturday */ >+ week_1stday = week_origin - 19971200; >+ break; >+ default: { >+ /* glibc's localedef doesn't normalize week-1stday, so we can get >+ * fi. 19971208 meaning the same as 19971201, etc. */ >+#ifdef _XOPEN_SOURCE >+ char buf[9]; >+ char *ptr; >+ struct tm tm; >+ g_snprintf(buf, sizeof(buf), "%u", week_origin); >+ ptr = strptime(buf, "%Y%m%d", &tm); >+ if (!ptr || *ptr != '\0') { >+ g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n"); >+ week_1stday = 0; >+ break; >+ } >+ week_1stday = tm.tm_wday; >+#else >+ g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n"); >+ week_1stday = 0; >+#endif >+ } >+ } > > priv->week_start = (week_1stday + first_weekday - 1) % 7; > #else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 130787
: 69818