diff options
author | zhuyaliang <[email protected]> | 2019-06-11 10:44:58 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-14 12:05:04 +0200 |
commit | dddc42521483fe8f686050d8326c0720e6562046 (patch) | |
tree | 1f6b44022520557375747d5f8466df71180f22a4 /capplets/time-admin/src/time-zone.c | |
parent | 8f247df3e36d8c34baa31f1448db67c9028b2d9d (diff) | |
download | mate-control-center-dddc42521483fe8f686050d8326c0720e6562046.tar.bz2 mate-control-center-dddc42521483fe8f686050d8326c0720e6562046.tar.xz |
Display the correct time when selecting the time zone
Diffstat (limited to 'capplets/time-admin/src/time-zone.c')
-rw-r--r-- | capplets/time-admin/src/time-zone.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/capplets/time-admin/src/time-zone.c b/capplets/time-admin/src/time-zone.c index dfb86f3b..8f58e755 100644 --- a/capplets/time-admin/src/time-zone.c +++ b/capplets/time-admin/src/time-zone.c @@ -220,13 +220,6 @@ static GtkWidget *GetTimeZoneMap(TimeAdmin *ta) g_autoptr(GtkEntryCompletion) completion = NULL; map = (GtkWidget *) timezone_map_new (); - /* - g_signal_connect_object (map, - "location-changed", - G_CALLBACK (LocationChanged), - map, - G_CONNECT_SWAPPED); - */ g_signal_connect (map, "location-changed", G_CALLBACK (LocationChanged), @@ -269,6 +262,8 @@ static void update_timezone (TimezoneMap *map) { g_autofree gchar *bubble_text = NULL; + g_autoptr(GDateTime) current_date = NULL; + g_autoptr(GTimeZone) timezone = NULL; g_autofree gchar *city_country = NULL; g_autofree gchar *utc_label = NULL; g_autofree gchar *time_label = NULL; @@ -276,10 +271,13 @@ update_timezone (TimezoneMap *map) TzLocation *current_location; GDateTime *date; - date = g_date_time_new_now_local (); current_location = timezone_map_get_location (TIMEZONEMAP (map)); city_country = translated_city_name (current_location); + timezone = g_time_zone_new (current_location->zone); + current_date = g_date_time_new_now_local (); + date = g_date_time_to_timezone (current_date, timezone); + utc_label = g_date_time_format (date, _("UTC%:::z")); tz_desc = g_strdup_printf ( "%s (%s)", |