[gnome-initial-setup/wjt/ci-fedora-31: 13/13] timezone: update files from gnome-control-center
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/wjt/ci-fedora-31: 13/13] timezone: update files from gnome-control-center
- Date: Sun, 19 Jan 2020 20:17:11 +0000 (UTC)
commit 0e42d6e0797ef6d1b453e2c04646a6d476f258f1
Author: Will Thompson <will willthompson co uk>
Date: Fri Jan 17 17:14:35 2020 +0000
timezone: update files from gnome-control-center
These were last synced in 2016. This updates various bits of timezone
data and corresponding images, and squashes many warnings when building
with more recent GLib.
gnome-initial-setup/pages/timezone/backward | 34 ++--
.../pages/timezone/cc-timezone-map.c | 206 +++++++++------------
.../pages/timezone/cc-timezone-map.h | 47 +----
gnome-initial-setup/pages/timezone/data/cc.png | Bin 52271 -> 51482 bytes
.../pages/timezone/data/timezone_-4.5.png | Bin 1900 -> 0 bytes
.../pages/timezone/data/timezone_-4.5_dim.png | Bin 1527 -> 0 bytes
.../pages/timezone/data/timezone_-4.png | Bin 15084 -> 16851 bytes
.../pages/timezone/data/timezone_-4_dim.png | Bin 9836 -> 9785 bytes
.../pages/timezone/data/timezone_5.5.png | Bin 6099 -> 5692 bytes
.../pages/timezone/data/timezone_5.5_dim.png | Bin 3405 -> 3471 bytes
.../pages/timezone/data/timezone_6.png | Bin 8441 -> 7654 bytes
.../pages/timezone/data/timezone_6_dim.png | Bin 4678 -> 4584 bytes
.../pages/timezone/data/timezone_8.5.png | Bin 2069 -> 0 bytes
.../pages/timezone/data/timezone_8.5_dim.png | Bin 1177 -> 0 bytes
.../pages/timezone/data/timezone_9.png | Bin 12608 -> 14366 bytes
.../pages/timezone/data/timezone_9_dim.png | Bin 8383 -> 8362 bytes
.../pages/timezone/datetime.gresource.xml | 4 -
.../pages/timezone/timedated1-interface.xml | 1 +
gnome-initial-setup/pages/timezone/tz.c | 38 ++--
gnome-initial-setup/pages/timezone/tz.h | 12 +-
20 files changed, 135 insertions(+), 207 deletions(-)
---
diff --git a/gnome-initial-setup/pages/timezone/backward b/gnome-initial-setup/pages/timezone/backward
index f1f95a8..8594be6 100644
--- a/gnome-initial-setup/pages/timezone/backward
+++ b/gnome-initial-setup/pages/timezone/backward
@@ -1,13 +1,12 @@
-# <pre>
-# @(#)backward 8.9
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
-Link Africa/Asmara Africa/Asmera
-Link Africa/Bamako Africa/Timbuktu
+# Link TARGET LINK-NAME
+Link Africa/Nairobi Africa/Asmera
+Link Africa/Abidjan Africa/Timbuktu
Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
Link America/Adak America/Atka
Link America/Argentina/Buenos_Aires America/Buenos_Aires
@@ -21,17 +20,25 @@ Link America/Argentina/Jujuy America/Jujuy
Link America/Indiana/Knox America/Knox_IN
Link America/Kentucky/Louisville America/Louisville
Link America/Argentina/Mendoza America/Mendoza
+Link America/Toronto America/Montreal
Link America/Rio_Branco America/Porto_Acre
Link America/Argentina/Cordoba America/Rosario
-Link America/St_Thomas America/Virgin
+Link America/Tijuana America/Santa_Isabel
+Link America/Denver America/Shiprock
+Link America/Port_of_Spain America/Virgin
+Link Pacific/Auckland Antarctica/South_Pole
Link Asia/Ashgabat Asia/Ashkhabad
-Link Asia/Chongqing Asia/Chungking
+Link Asia/Kolkata Asia/Calcutta
+Link Asia/Shanghai Asia/Chongqing
+Link Asia/Shanghai Asia/Chungking
Link Asia/Dhaka Asia/Dacca
+Link Asia/Shanghai Asia/Harbin
+Link Asia/Urumqi Asia/Kashgar
Link Asia/Kathmandu Asia/Katmandu
-Link Asia/Kolkata Asia/Calcutta
Link Asia/Macau Asia/Macao
-Link Asia/Jerusalem Asia/Tel_Aviv
+Link Asia/Yangon Asia/Rangoon
Link Asia/Ho_Chi_Minh Asia/Saigon
+Link Asia/Jerusalem Asia/Tel_Aviv
Link Asia/Thimphu Asia/Thimbu
Link Asia/Makassar Asia/Ujung_Pandang
Link Asia/Ulaanbaatar Asia/Ulan_Bator
@@ -54,7 +61,9 @@ Link America/Sao_Paulo Brazil/East
Link America/Manaus Brazil/West
Link America/Halifax Canada/Atlantic
Link America/Winnipeg Canada/Central
-Link America/Regina Canada/East-Saskatchewan
+# This line is commented out, as the name exceeded the 14-character limit
+# and was an unused misnomer.
+#Link America/Regina Canada/East-Saskatchewan
Link America/Toronto Canada/Eastern
Link America/Edmonton Canada/Mountain
Link America/St_Johns Canada/Newfoundland
@@ -89,10 +98,11 @@ Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link America/Denver Navajo
Link Asia/Shanghai PRC
+Link Pacific/Honolulu Pacific/Johnston
+Link Pacific/Pohnpei Pacific/Ponape
Link Pacific/Pago_Pago Pacific/Samoa
-Link Pacific/Chuuk Pacific/Yap
Link Pacific/Chuuk Pacific/Truk
-Link Pacific/Pohnpei Pacific/Ponape
+Link Pacific/Chuuk Pacific/Yap
Link Europe/Warsaw Poland
Link Europe/Lisbon Portugal
Link Asia/Taipei ROC
@@ -115,4 +125,4 @@ Link Pacific/Pago_Pago US/Samoa
Link Etc/UTC UTC
Link Etc/UTC Universal
Link Europe/Moscow W-SU
-Link Etc/UTC Zulu
+Link Etc/UTC Zulu
\ No newline at end of file
diff --git a/gnome-initial-setup/pages/timezone/cc-timezone-map.c
b/gnome-initial-setup/pages/timezone/cc-timezone-map.c
index 8b38c9e..3c813a6 100644
--- a/gnome-initial-setup/pages/timezone/cc-timezone-map.c
+++ b/gnome-initial-setup/pages/timezone/cc-timezone-map.c
@@ -26,11 +26,6 @@
#include <string.h>
#include "tz.h"
-G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
-
-#define TIMEZONE_MAP_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_MAP, CcTimezoneMapPrivate))
-
#define PIN_HOT_POINT_X 8
#define PIN_HOT_POINT_Y 15
@@ -45,8 +40,10 @@ typedef struct
guchar alpha;
} CcTimezoneMapOffset;
-struct _CcTimezoneMapPrivate
+struct _CcTimezoneMap
{
+ GtkWidget parent_instance;
+
GdkPixbuf *orig_background;
GdkPixbuf *orig_background_dim;
GdkPixbuf *orig_color_map;
@@ -66,6 +63,8 @@ struct _CcTimezoneMapPrivate
gchar *bubble_text;
};
+G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
+
enum
{
LOCATION_CHANGED,
@@ -122,21 +121,21 @@ static CcTimezoneMapOffset color_codes[] =
static void
cc_timezone_map_dispose (GObject *object)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
+ CcTimezoneMap *self = CC_TIMEZONE_MAP (object);
- g_clear_object (&priv->orig_background);
- g_clear_object (&priv->orig_background_dim);
- g_clear_object (&priv->orig_color_map);
- g_clear_object (&priv->background);
- g_clear_object (&priv->pin);
- g_clear_pointer (&priv->bubble_text, g_free);
+ g_clear_object (&self->orig_background);
+ g_clear_object (&self->orig_background_dim);
+ g_clear_object (&self->orig_color_map);
+ g_clear_object (&self->background);
+ g_clear_object (&self->pin);
+ g_clear_pointer (&self->bubble_text, g_free);
- if (priv->color_map)
+ if (self->color_map)
{
- g_clear_object (&priv->color_map);
+ g_clear_object (&self->color_map);
- priv->visible_map_pixels = NULL;
- priv->visible_map_rowstride = 0;
+ self->visible_map_pixels = NULL;
+ self->visible_map_rowstride = 0;
}
G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object);
@@ -145,14 +144,9 @@ cc_timezone_map_dispose (GObject *object)
static void
cc_timezone_map_finalize (GObject *object)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
-
- if (priv->tzdb)
- {
- tz_db_free (priv->tzdb);
- priv->tzdb = NULL;
- }
+ CcTimezoneMap *self = CC_TIMEZONE_MAP (object);
+ g_clear_pointer (&self->tzdb, tz_db_free);
G_OBJECT_CLASS (cc_timezone_map_parent_class)->finalize (object);
}
@@ -163,10 +157,10 @@ cc_timezone_map_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
gint size;
- size = gdk_pixbuf_get_width (priv->orig_background);
+ size = gdk_pixbuf_get_width (map->orig_background);
if (minimum != NULL)
*minimum = size;
@@ -179,10 +173,10 @@ cc_timezone_map_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
gint size;
- size = gdk_pixbuf_get_height (priv->orig_background);
+ size = gdk_pixbuf_get_height (map->orig_background);
if (minimum != NULL)
*minimum = size;
@@ -194,32 +188,32 @@ static void
cc_timezone_map_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
GdkPixbuf *pixbuf;
- if (priv->background)
- g_object_unref (priv->background);
+ if (map->background)
+ g_object_unref (map->background);
if (!gtk_widget_is_sensitive (widget))
- pixbuf = priv->orig_background_dim;
+ pixbuf = map->orig_background_dim;
else
- pixbuf = priv->orig_background;
+ pixbuf = map->orig_background;
- priv->background = gdk_pixbuf_scale_simple (pixbuf,
- allocation->width,
- allocation->height,
- GDK_INTERP_BILINEAR);
-
- if (priv->color_map)
- g_object_unref (priv->color_map);
-
- priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map,
+ map->background = gdk_pixbuf_scale_simple (pixbuf,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
- priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map);
- priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map);
+ if (map->color_map)
+ g_object_unref (map->color_map);
+
+ map->color_map = gdk_pixbuf_scale_simple (map->orig_color_map,
+ allocation->width,
+ allocation->height,
+ GDK_INTERP_BILINEAR);
+
+ map->visible_map_pixels = gdk_pixbuf_get_pixels (map->color_map);
+ map->visible_map_rowstride = gdk_pixbuf_get_rowstride (map->color_map);
GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->size_allocate (widget,
allocation);
@@ -301,7 +295,7 @@ draw_text_bubble (cairo_t *cr,
static const double margin_left = 24.0;
static const double margin_right = 24.0;
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
GtkAllocation alloc;
PangoLayout *layout;
PangoRectangle text_rect;
@@ -310,7 +304,7 @@ draw_text_bubble (cairo_t *cr,
double width;
double height;
- if (!priv->bubble_text)
+ if (!map->bubble_text)
return;
gtk_widget_get_allocation (widget, &alloc);
@@ -319,7 +313,7 @@ draw_text_bubble (cairo_t *cr,
/* Layout the text */
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
pango_layout_set_spacing (layout, 3);
- pango_layout_set_markup (layout, priv->bubble_text, -1);
+ pango_layout_set_markup (layout, map->bubble_text, -1);
pango_layout_get_pixel_extents (layout, NULL, &text_rect);
@@ -365,18 +359,18 @@ static gboolean
cc_timezone_map_draw (GtkWidget *widget,
cairo_t *cr)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
- GdkPixbuf *hilight, *orig_hilight;
+ CcTimezoneMap *map = CC_TIMEZONE_MAP (widget);
+ g_autoptr(GdkPixbuf) orig_hilight = NULL;
GtkAllocation alloc;
- gchar *file;
- GError *err = NULL;
+ g_autofree gchar *file = NULL;
+ g_autoptr(GError) err = NULL;
gdouble pointx, pointy;
char buf[16];
gtk_widget_get_allocation (widget, &alloc);
/* paint background */
- gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
+ gdk_cairo_set_source_pixbuf (cr, map->background, 0, 0);
cairo_paint (cr);
/* paint hilight */
@@ -384,52 +378,47 @@ cc_timezone_map_draw (GtkWidget *widget,
{
file = g_strdup_printf (DATETIME_RESOURCE_PATH "/timezone_%s.png",
g_ascii_formatd (buf, sizeof (buf),
- "%g", priv->selected_offset));
+ "%g", map->selected_offset));
}
else
{
file = g_strdup_printf (DATETIME_RESOURCE_PATH "/timezone_%s_dim.png",
g_ascii_formatd (buf, sizeof (buf),
- "%g", priv->selected_offset));
+ "%g", map->selected_offset));
}
orig_hilight = gdk_pixbuf_new_from_resource (file, &err);
- g_free (file);
- file = NULL;
if (!orig_hilight)
{
g_warning ("Could not load hilight: %s",
(err) ? err->message : "Unknown Error");
- if (err)
- g_clear_error (&err);
}
else
{
+ g_autoptr(GdkPixbuf) hilight = NULL;
hilight = gdk_pixbuf_scale_simple (orig_hilight, alloc.width,
alloc.height, GDK_INTERP_BILINEAR);
gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0);
cairo_paint (cr);
- g_object_unref (hilight);
- g_object_unref (orig_hilight);
}
- if (priv->location)
+ if (map->location)
{
- pointx = convert_longitude_to_x (priv->location->longitude, alloc.width);
- pointy = convert_latitude_to_y (priv->location->latitude, alloc.height);
+ pointx = convert_longitude_to_x (map->location->longitude, alloc.width);
+ pointy = convert_latitude_to_y (map->location->latitude, alloc.height);
pointx = CLAMP (floor (pointx), 0, alloc.width);
pointy = CLAMP (floor (pointy), 0, alloc.height);
draw_text_bubble (cr, widget, pointx, pointy);
- if (priv->pin)
+ if (map->pin)
{
- gdk_cairo_set_source_pixbuf (cr, priv->pin,
+ gdk_cairo_set_source_pixbuf (cr, map->pin,
pointx - PIN_HOT_POINT_X,
pointy - PIN_HOT_POINT_Y);
cairo_paint (cr);
@@ -443,7 +432,7 @@ static void
update_cursor (GtkWidget *widget)
{
GdkWindow *window;
- GdkCursor *cursor = NULL;
+ g_autoptr(GdkCursor) cursor = NULL;
if (!gtk_widget_get_realized (widget))
return;
@@ -457,9 +446,6 @@ update_cursor (GtkWidget *widget)
window = gtk_widget_get_window (widget);
gdk_window_set_cursor (window, cursor);
-
- if (cursor)
- g_object_unref (cursor);
}
static void
@@ -479,8 +465,6 @@ cc_timezone_map_class_init (CcTimezoneMapClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcTimezoneMapPrivate));
-
object_class->dispose = cc_timezone_map_dispose;
object_class->finalize = cc_timezone_map_finalize;
@@ -520,26 +504,22 @@ static void
set_location (CcTimezoneMap *map,
TzLocation *location)
{
- CcTimezoneMapPrivate *priv = map->priv;
- TzInfo *info;
+ g_autoptr(TzInfo) info = NULL;
- priv->location = location;
+ map->location = location;
- info = tz_info_from_location (priv->location);
+ info = tz_info_from_location (map->location);
- priv->selected_offset = tz_location_get_utc_offset (priv->location)
+ map->selected_offset = tz_location_get_utc_offset (map->location)
/ (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
- g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
-
- tz_info_free (info);
+ g_signal_emit (map, signals[LOCATION_CHANGED], 0, map->location);
}
static gboolean
-button_press_event (GtkWidget *widget,
+button_press_event (CcTimezoneMap *map,
GdkEventButton *event)
{
- CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
gint x, y;
guchar r, g, b, a;
guchar *pixels;
@@ -555,8 +535,8 @@ button_press_event (GtkWidget *widget,
y = event->y;
- rowstride = priv->visible_map_rowstride;
- pixels = priv->visible_map_pixels;
+ rowstride = map->visible_map_rowstride;
+ pixels = map->visible_map_pixels;
r = pixels[(rowstride * y + x * 4)];
g = pixels[(rowstride * y + x * 4) + 1];
@@ -569,17 +549,17 @@ button_press_event (GtkWidget *widget,
if (color_codes[i].red == r && color_codes[i].green == g
&& color_codes[i].blue == b && color_codes[i].alpha == a)
{
- priv->selected_offset = color_codes[i].offset;
+ map->selected_offset = color_codes[i].offset;
}
}
- gtk_widget_queue_draw (widget);
+ gtk_widget_queue_draw (GTK_WIDGET (map));
/* work out the co-ordinates */
- array = tz_get_locations (priv->tzdb);
+ array = tz_get_locations (map->tzdb);
- gtk_widget_get_allocation (widget, &alloc);
+ gtk_widget_get_allocation (GTK_WIDGET (map), &alloc);
width = alloc.width;
height = alloc.height;
@@ -601,7 +581,7 @@ button_press_event (GtkWidget *widget,
distances = g_list_sort (distances, (GCompareFunc) sort_locations);
- set_location (CC_TIMEZONE_MAP (widget), (TzLocation*) distances->data);
+ set_location (map, (TzLocation*) distances->data);
g_list_free (distances);
@@ -609,55 +589,51 @@ button_press_event (GtkWidget *widget,
}
static void
-cc_timezone_map_init (CcTimezoneMap *self)
+cc_timezone_map_init (CcTimezoneMap *map)
{
- CcTimezoneMapPrivate *priv;
GError *err = NULL;
- priv = self->priv = TIMEZONE_MAP_PRIVATE (self);
-
- priv->orig_background = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg.png",
- &err);
+ map->orig_background = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg.png",
+ &err);
- if (!priv->orig_background)
+ if (!map->orig_background)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->orig_background_dim = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg_dim.png",
- &err);
+ map->orig_background_dim = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg_dim.png",
+ &err);
- if (!priv->orig_background_dim)
+ if (!map->orig_background_dim)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->orig_color_map = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/cc.png",
- &err);
- if (!priv->orig_color_map)
+ map->orig_color_map = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/cc.png",
+ &err);
+ if (!map->orig_color_map)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->pin = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/pin.png",
- &err);
- if (!priv->pin)
+ map->pin = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/pin.png",
+ &err);
+ if (!map->pin)
{
g_warning ("Could not load pin icon: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
- priv->tzdb = tz_load_db ();
+ map->tzdb = tz_load_db ();
- g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
- NULL);
+ g_signal_connect_object (map, "button-press-event", G_CALLBACK (button_press_event), map,
G_CONNECT_SWAPPED);
}
CcTimezoneMap *
@@ -672,12 +648,12 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
{
GPtrArray *locations;
guint i;
- char *real_tz;
+ g_autofree gchar *real_tz = NULL;
gboolean ret;
- real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone);
+ real_tz = tz_info_get_clean_name (map->tzdb, timezone);
- locations = tz_get_locations (map->priv->tzdb);
+ locations = tz_get_locations (map->tzdb);
ret = FALSE;
for (i = 0; i < locations->len; i++)
@@ -695,8 +671,6 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
if (ret)
gtk_widget_queue_draw (GTK_WIDGET (map));
- g_free (real_tz);
-
return ret;
}
@@ -704,10 +678,8 @@ void
cc_timezone_map_set_bubble_text (CcTimezoneMap *map,
const gchar *text)
{
- CcTimezoneMapPrivate *priv = TIMEZONE_MAP_PRIVATE (map);
-
- g_free (priv->bubble_text);
- priv->bubble_text = g_strdup (text);
+ g_free (map->bubble_text);
+ map->bubble_text = g_strdup (text);
gtk_widget_queue_draw (GTK_WIDGET (map));
}
@@ -715,5 +687,5 @@ cc_timezone_map_set_bubble_text (CcTimezoneMap *map,
TzLocation *
cc_timezone_map_get_location (CcTimezoneMap *map)
{
- return map->priv->location;
+ return map->location;
}
diff --git a/gnome-initial-setup/pages/timezone/cc-timezone-map.h
b/gnome-initial-setup/pages/timezone/cc-timezone-map.h
index facf133..f4c99e5 100644
--- a/gnome-initial-setup/pages/timezone/cc-timezone-map.h
+++ b/gnome-initial-setup/pages/timezone/cc-timezone-map.h
@@ -18,54 +18,15 @@
*
*/
-
-#ifndef _CC_TIMEZONE_MAP_H
-#define _CC_TIMEZONE_MAP_H
+#pragma once
#include <gtk/gtk.h>
#include "tz.h"
G_BEGIN_DECLS
-#define CC_TYPE_TIMEZONE_MAP cc_timezone_map_get_type()
-
-#define CC_TIMEZONE_MAP(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMap))
-
-#define CC_TIMEZONE_MAP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
-
-#define CC_IS_TIMEZONE_MAP(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_TIMEZONE_MAP))
-
-#define CC_IS_TIMEZONE_MAP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_TIMEZONE_MAP))
-
-#define CC_TIMEZONE_MAP_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
-
-typedef struct _CcTimezoneMap CcTimezoneMap;
-typedef struct _CcTimezoneMapClass CcTimezoneMapClass;
-typedef struct _CcTimezoneMapPrivate CcTimezoneMapPrivate;
-
-struct _CcTimezoneMap
-{
- GtkWidget parent;
-
- CcTimezoneMapPrivate *priv;
-};
-
-struct _CcTimezoneMapClass
-{
- GtkWidgetClass parent_class;
-};
-
-GType cc_timezone_map_get_type (void) G_GNUC_CONST;
+#define CC_TYPE_TIMEZONE_MAP (cc_timezone_map_get_type ())
+G_DECLARE_FINAL_TYPE (CcTimezoneMap, cc_timezone_map, CC, TIMEZONE_MAP, GtkWidget)
CcTimezoneMap *cc_timezone_map_new (void);
@@ -76,5 +37,3 @@ void cc_timezone_map_set_bubble_text (CcTimezoneMap *map,
TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
G_END_DECLS
-
-#endif /* _CC_TIMEZONE_MAP_H */
diff --git a/gnome-initial-setup/pages/timezone/data/cc.png b/gnome-initial-setup/pages/timezone/data/cc.png
index 9984d23..e2eff2b 100644
Binary files a/gnome-initial-setup/pages/timezone/data/cc.png and
b/gnome-initial-setup/pages/timezone/data/cc.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_-4.png
b/gnome-initial-setup/pages/timezone/data/timezone_-4.png
index 4b5a431..a3a8dc1 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_-4.png and
b/gnome-initial-setup/pages/timezone/data/timezone_-4.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_-4_dim.png
b/gnome-initial-setup/pages/timezone/data/timezone_-4_dim.png
index 809ddf0..d3186c8 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_-4_dim.png and
b/gnome-initial-setup/pages/timezone/data/timezone_-4_dim.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_5.5.png
b/gnome-initial-setup/pages/timezone/data/timezone_5.5.png
index f904cc2..9b8f094 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_5.5.png and
b/gnome-initial-setup/pages/timezone/data/timezone_5.5.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_5.5_dim.png
b/gnome-initial-setup/pages/timezone/data/timezone_5.5_dim.png
index c598242..f7a475d 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_5.5_dim.png and
b/gnome-initial-setup/pages/timezone/data/timezone_5.5_dim.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_6.png
b/gnome-initial-setup/pages/timezone/data/timezone_6.png
index 460f9cf..41504fc 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_6.png and
b/gnome-initial-setup/pages/timezone/data/timezone_6.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_6_dim.png
b/gnome-initial-setup/pages/timezone/data/timezone_6_dim.png
index afcd2b3..e99f5fa 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_6_dim.png and
b/gnome-initial-setup/pages/timezone/data/timezone_6_dim.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_9.png
b/gnome-initial-setup/pages/timezone/data/timezone_9.png
index 65d2e46..4e2beda 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_9.png and
b/gnome-initial-setup/pages/timezone/data/timezone_9.png differ
diff --git a/gnome-initial-setup/pages/timezone/data/timezone_9_dim.png
b/gnome-initial-setup/pages/timezone/data/timezone_9_dim.png
index 8cbb2e7..ac47471 100644
Binary files a/gnome-initial-setup/pages/timezone/data/timezone_9_dim.png and
b/gnome-initial-setup/pages/timezone/data/timezone_9_dim.png differ
diff --git a/gnome-initial-setup/pages/timezone/datetime.gresource.xml
b/gnome-initial-setup/pages/timezone/datetime.gresource.xml
index 7081349..6445cce 100644
--- a/gnome-initial-setup/pages/timezone/datetime.gresource.xml
+++ b/gnome-initial-setup/pages/timezone/datetime.gresource.xml
@@ -48,8 +48,6 @@
<file alias="timezone_-4_dim.png">data/timezone_-4_dim.png</file>
<file alias="timezone_4.png">data/timezone_4.png</file>
<file alias="timezone_4_dim.png">data/timezone_4_dim.png</file>
- <file alias="timezone_-4.5.png">data/timezone_-4.5.png</file>
- <file alias="timezone_-4.5_dim.png">data/timezone_-4.5_dim.png</file>
<file alias="timezone_4.5.png">data/timezone_4.5.png</file>
<file alias="timezone_4.5_dim.png">data/timezone_4.5_dim.png</file>
<file alias="timezone_-5.png">data/timezone_-5.png</file>
@@ -76,8 +74,6 @@
<file alias="timezone_-8_dim.png">data/timezone_-8_dim.png</file>
<file alias="timezone_8.png">data/timezone_8.png</file>
<file alias="timezone_8_dim.png">data/timezone_8_dim.png</file>
- <file alias="timezone_8.5.png">data/timezone_8.5.png</file>
- <file alias="timezone_8.5_dim.png">data/timezone_8.5_dim.png</file>
<file alias="timezone_8.75.png">data/timezone_8.75.png</file>
<file alias="timezone_8.75_dim.png">data/timezone_8.75_dim.png</file>
<file alias="timezone_-9.png">data/timezone_-9.png</file>
diff --git a/gnome-initial-setup/pages/timezone/timedated1-interface.xml
b/gnome-initial-setup/pages/timezone/timedated1-interface.xml
index b035d10..3370e0e 100644
--- a/gnome-initial-setup/pages/timezone/timedated1-interface.xml
+++ b/gnome-initial-setup/pages/timezone/timedated1-interface.xml
@@ -4,6 +4,7 @@
<interface name="org.freedesktop.timedate1">
<property name="Timezone" type="s" access="read"/>
<property name="LocalRTC" type="b" access="read"/>
+ <property name="CanNTP" type="b" access="read"/>
<property name="NTP" type="b" access="read"/>
<method name="SetTime">
<arg name="usec_utc" type="x" direction="in"/>
diff --git a/gnome-initial-setup/pages/timezone/tz.c b/gnome-initial-setup/pages/timezone/tz.c
index d711867..6e96dd4 100644
--- a/gnome-initial-setup/pages/timezone/tz.c
+++ b/gnome-initial-setup/pages/timezone/tz.c
@@ -48,7 +48,7 @@ static void load_backward_tz (TzDB *tz_db);
TzDB *
tz_load_db (void)
{
- gchar *tz_data_file;
+ g_autofree gchar *tz_data_file = NULL;
TzDB *tz_db;
FILE *tzfile;
char buf[4096];
@@ -61,7 +61,6 @@ tz_load_db (void)
tzfile = fopen (tz_data_file, "r");
if (!tzfile) {
g_warning ("Could not open *%s*\n", tz_data_file);
- g_free (tz_data_file);
return NULL;
}
@@ -70,8 +69,10 @@ tz_load_db (void)
while (fgets (buf, sizeof(buf), tzfile))
{
- gchar **tmpstrarr;
- gchar *latstr, *lngstr, *p;
+ g_auto(GStrv) tmpstrarr = NULL;
+ g_autofree gchar *latstr = NULL;
+ g_autofree gchar *lngstr = NULL;
+ gchar *p;
TzLocation *loc;
if (*buf == '#') continue;
@@ -113,10 +114,6 @@ tz_load_db (void)
#endif
g_ptr_array_add (tz_db->locations, (gpointer) loc);
-
- g_free (latstr);
- g_free (lngstr);
- g_strfreev (tmpstrarr);
}
fclose (tzfile);
@@ -124,8 +121,6 @@ tz_load_db (void)
/* now sort by country */
sort_locations_by_country (tz_db->locations);
- g_free (tz_data_file);
-
/* Load up the hashtable of backward links */
load_backward_tz (tz_db);
@@ -189,12 +184,11 @@ tz_location_get_position (TzLocation *loc, double *longitude, double *latitude)
glong
tz_location_get_utc_offset (TzLocation *loc)
{
- TzInfo *tz_info;
+ g_autoptr(TzInfo) tz_info = NULL;
glong offset;
tz_info = tz_info_from_location (loc);
offset = tz_info->utc_offset;
- tz_info_free (tz_info);
return offset;
}
@@ -204,7 +198,7 @@ tz_info_from_location (TzLocation *loc)
TzInfo *tzinfo;
time_t curtime;
struct tm *curzone;
- gchar *tz_env_value;
+ g_autofree gchar *tz_env_value = NULL;
g_return_val_if_fail (loc != NULL, NULL);
g_return_val_if_fail (loc->zone != NULL, NULL);
@@ -244,8 +238,6 @@ tz_info_from_location (TzLocation *loc)
else
unsetenv ("TZ");
- g_free (tz_env_value);
-
return tzinfo;
}
@@ -295,14 +287,11 @@ compare_timezones (const char *a,
if (g_str_equal (a, b))
return TRUE;
if (strchr (b, '/') == NULL) {
- char *prefixed;
+ g_autofree gchar *prefixed = NULL;
prefixed = g_strdup_printf ("/%s", b);
- if (g_str_has_suffix (a, prefixed)) {
- g_free (prefixed);
+ if (g_str_has_suffix (a, prefixed))
return TRUE;
- }
- g_free (prefixed);
}
return FALSE;
@@ -428,8 +417,8 @@ sort_locations_by_country (GPtrArray *locations)
static void
load_backward_tz (TzDB *tz_db)
{
- char **lines;
- GBytes *bytes;
+ g_auto(GStrv) lines = NULL;
+ g_autoptr(GBytes) bytes = NULL;
const char *contents;
guint i;
@@ -440,11 +429,10 @@ load_backward_tz (TzDB *tz_db)
contents = (const char *) g_bytes_get_data (bytes, NULL);
lines = g_strsplit (contents, "\n", -1);
- g_bytes_unref (bytes);
for (i = 0; lines[i] != NULL; i++)
{
- char **items;
+ g_auto(GStrv) items = NULL;
guint j;
char *real, *alias;
@@ -477,8 +465,6 @@ load_backward_tz (TzDB *tz_db)
real = "Etc/GMT";
g_hash_table_insert (tz_db->backward, g_strdup (alias), g_strdup (real));
- g_strfreev (items);
}
- g_strfreev (lines);
}
diff --git a/gnome-initial-setup/pages/timezone/tz.h b/gnome-initial-setup/pages/timezone/tz.h
index 93905b3..a2376f8 100644
--- a/gnome-initial-setup/pages/timezone/tz.h
+++ b/gnome-initial-setup/pages/timezone/tz.h
@@ -21,12 +21,12 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-
-#ifndef _E_TZ_H
-#define _E_TZ_H
+#pragma once
#include <glib.h>
+G_BEGIN_DECLS
+
#ifndef __sun
# define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"
#else
@@ -85,4 +85,8 @@ gint tz_location_set_locally (TzLocation *loc);
TzInfo *tz_info_from_location (TzLocation *loc);
void tz_info_free (TzInfo *tz_info);
-#endif
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TzDB, tz_db_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TzInfo, tz_info_free)
+
+G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]