datetime: Use g_time_zone_new_identifier
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.
This commit is contained in:
parent
75c3e11708
commit
6cc5bbd074
1 changed files with 7 additions and 1 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Reference in a new issue