utils: Use ISO weekday numbering for 'get_first_weekday' function

Change the 'get_first_weekday' function to number the weekdays
Monday(1)-Sunday(7) like ISO does. Change the function name to reflect
that. Add tests for different locales, although the tests depend on
system-installed locales.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/822>
This commit is contained in:
mindonwarp
2026-09-26 17:22:00 +00:00
committed by Marge Bot
parent a0a6ae2a2c
commit acd8fbaf69
8 changed files with 74 additions and 25 deletions
+3 -3
View File
@@ -116,7 +116,7 @@ set_week_start_day_from_variant (GcalContext *self,
/* find the actual 'default' from locale */
if (weekday->value == G_DESKTOP_WEEKDAY_DEFAULT)
weekday = g_enum_get_value (g_type_class_get (G_DESKTOP_TYPE_WEEKDAY), gcal_util_get_first_weekday ());
weekday = g_enum_get_value (g_type_class_get (G_DESKTOP_TYPE_WEEKDAY), gcal_util_get_first_weekday_iso ());
if (self->week_start_day == weekday->value)
return;
@@ -391,7 +391,7 @@ gcal_context_class_init (GcalContextClass *klass)
properties[PROP_WEEK_START_DAY] =
g_param_spec_enum ("week-start-day", NULL, NULL,
G_DESKTOP_TYPE_WEEKDAY, gcal_util_get_first_weekday (),
G_DESKTOP_TYPE_WEEKDAY, gcal_util_get_first_weekday_iso (),
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
@@ -535,7 +535,7 @@ gcal_context_get_time_format (GcalContext *self)
GDesktopWeekday
gcal_context_get_week_start_day (GcalContext *self)
{
g_return_val_if_fail (GCAL_IS_CONTEXT (self), gcal_util_get_first_weekday ());
g_return_val_if_fail (GCAL_IS_CONTEXT (self), gcal_util_get_first_weekday_iso ());
return self->week_start_day;
}