From f8a3c7731c9dd60a3f79e982c9a8c610be4166f4 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Wed, 27 Jul 2016 12:19:56 +0800 Subject: [PATCH] date-chooser: don't reimplement get_first_weekday Function calendar_get_week_start do the same things with the same code as function get_first_weekday, so it is better to remove calendar_get_week_start and switch all the use of calendar_get_week_start to get_first_weekday. This also fixes build problems on non-glibc systems because get_first_weekday provides fallback for non-glibc systems. https://bugzilla.gnome.org/show_bug.cgi?id=769140 --- src/gcal-date-chooser.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/gcal-date-chooser.c b/src/gcal-date-chooser.c index ad6764d6..c0d4396c 100644 --- a/src/gcal-date-chooser.c +++ b/src/gcal-date-chooser.c @@ -327,29 +327,6 @@ calendar_update_selected_day (GcalDateChooser *self) } } -static gint -calendar_get_week_start (void) -{ - union { unsigned int word; char *string; } langinfo; - gint week_1stday = 0; - gint first_weekday = 1; - guint week_origin; - - langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY); - first_weekday = langinfo.string[0]; - langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY); - week_origin = langinfo.word; - - 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."); - - return (week_1stday + first_weekday - 1) % 7; -} - static void day_selected_cb (GcalDateChooserDay *d, GcalDateChooser *self) @@ -577,7 +554,7 @@ gcal_date_chooser_init (GcalDateChooser *self) self->date = g_date_time_new_now_local (); g_date_time_get_ymd (self->date, &self->this_year, NULL, NULL); - self->week_start = calendar_get_week_start (); + self->week_start = get_first_weekday (); gtk_widget_init_template (GTK_WIDGET (self));