summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2021-02-23 10:13:56 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2021-02-23 10:18:56 -0300
commit8246f0c0c319a7b32994947a00e5abb465f408a8 (patch)
tree19b4e69507cb10918fe0ac0d9353ed5500e04924
parentb813866a630d6f5c7144f32450a29e31c3fdef3e (diff)
downloadgnome-control-center-gbsneto/timezone.tar.gz
datetime: Use g_time_zone_new_identifiergbsneto/timezone
g_time_zone_new() is deprecated in favour of g_time_zone_new_identifier(). g_time_zone_new_identifier() returns NULL if no matching identifier is found, so warn and fallback to UTC in that case.
-rw-r--r--panels/datetime/cc-datetime-panel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 33a975941..8ce8b3664 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -518,7 +518,13 @@ location_changed_cb (CcDateTimePanel *self,
self->current_location = location;
- timezone = g_time_zone_new (location->zone);
+ timezone = g_time_zone_new_identifier (location->zone);
+ if (!timezone)
+ {
+ g_warning ("Could not find timezone \"%s\", using UTC instead", location->zone);
+ timezone = g_time_zone_new_utc ();
+ }
+
old_date = self->date;
self->date = g_date_time_to_timezone (old_date, timezone);
cc_time_editor_set_time (CC_TIME_EDITOR (self->time_editor),