[girl] Add prototype code for zoomable map function
- From: Ole Aamot <ole src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [girl] Add prototype code for zoomable map function
- Date: Tue, 26 May 2015 11:29:28 +0000 (UTC)
commit ac9f74e7711d8c3d874ecd9852f1afa6474ab63a
Author: Ole Aamot <oka oka no>
Date: Tue May 26 13:27:53 2015 +0200
Add prototype code for zoomable map function
src/girl-stations-map.c | 741 +++++++++++++++++++++++++++++++++++++++++++++++
src/girl-stations-map.h | 110 +++++++
src/girl-tz.c | 512 ++++++++++++++++++++++++++++++++
src/girl-tz.h | 118 ++++++++
talk/girl-osdc-2015.tex | 4 +
5 files changed, 1485 insertions(+), 0 deletions(-)
---
diff --git a/src/girl-stations-map.c b/src/girl-stations-map.c
new file mode 100644
index 0000000..a401dba
--- /dev/null
+++ b/src/girl-stations-map.c
@@ -0,0 +1,741 @@
+/* $Id: girl.c,v 1.4 2002/10/04 20:20:30 oka Exp $
+ *
+ * GNOME Internet Radio Locator
+ *
+ * Copyright (C) 2015 Ole Aamot Software
+ *
+ * Author: Ole Aamot <oka oka no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+/*
+ * Essential parts of the source code below was based on
+ * gnome-control-center/panels/datetime/cc-timezone-map.c
+ *
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * Portions from Ubiquity, Copyright (C) 2009 Canonical Ltd.
+ * Written by Evan Dandrea <evand ubuntu com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include <math.h>
+#include <string.h>
+#include "girl-stations-map.h"
+#include "girl-tz.h"
+
+G_DEFINE_TYPE (GirlStationsMap, girl_stations_map, GTK_TYPE_WIDGET)
+
+#define GIRL_STATIONS_MAP_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIRL_TYPE_STATIONS_MAP, GirlStationsMapPrivate))
+
+#define PIN_HOT_POINT_X 8
+#define PIN_HOT_POINT_Y 15
+
+#define GIRL_RESOURCE_PATH "/org/gnome/girl"
+
+typedef struct
+{
+ gdouble offset;
+ guchar red;
+ guchar green;
+ guchar blue;
+ guchar alpha;
+} GirlStationsMapOffset;
+
+struct _GirlStationsMapPrivate
+{
+ GdkPixbuf *orig_background;
+ GdkPixbuf *orig_background_dim;
+ GdkPixbuf *orig_color_map;
+
+ GdkPixbuf *background;
+ GdkPixbuf *color_map;
+ GdkPixbuf *pin;
+
+ guchar *visible_map_pixels;
+ gint visible_map_rowstride;
+
+ gdouble selected_offset;
+
+ TzDB *tzdb;
+ TzLocation *location;
+
+ gchar *bubble_text;
+};
+
+enum
+{
+ LOCATION_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+
+static GirlStationsMapOffset color_codes[] =
+{
+ {-11.0, 43, 0, 0, 255 },
+ {-10.0, 85, 0, 0, 255 },
+ {-9.5, 102, 255, 0, 255 },
+ {-9.0, 128, 0, 0, 255 },
+ {-8.0, 170, 0, 0, 255 },
+ {-7.0, 212, 0, 0, 255 },
+ {-6.0, 255, 0, 1, 255 }, // north
+ {-6.0, 255, 0, 0, 255 }, // south
+ {-5.0, 255, 42, 42, 255 },
+ {-4.5, 192, 255, 0, 255 },
+ {-4.0, 255, 85, 85, 255 },
+ {-3.5, 0, 255, 0, 255 },
+ {-3.0, 255, 128, 128, 255 },
+ {-2.0, 255, 170, 170, 255 },
+ {-1.0, 255, 213, 213, 255 },
+ {0.0, 43, 17, 0, 255 },
+ {1.0, 85, 34, 0, 255 },
+ {2.0, 128, 51, 0, 255 },
+ {3.0, 170, 68, 0, 255 },
+ {3.5, 0, 255, 102, 255 },
+ {4.0, 212, 85, 0, 255 },
+ {4.5, 0, 204, 255, 255 },
+ {5.0, 255, 102, 0, 255 },
+ {5.5, 0, 102, 255, 255 },
+ {5.75, 0, 238, 207, 247 },
+ {6.0, 255, 127, 42, 255 },
+ {6.5, 204, 0, 254, 254 },
+ {7.0, 255, 153, 85, 255 },
+ {8.0, 255, 179, 128, 255 },
+ {9.0, 255, 204, 170, 255 },
+ {9.5, 170, 0, 68, 250 },
+ {10.0, 255, 230, 213, 255 },
+ {10.5, 212, 124, 21, 250 },
+ {11.0, 212, 170, 0, 255 },
+ {11.5, 249, 25, 87, 253 },
+ {12.0, 255, 204, 0, 255 },
+ {12.75, 254, 74, 100, 248 },
+ {13.0, 255, 85, 153, 250 },
+ {-100, 0, 0, 0, 0 }
+};
+
+
+static void
+girl_stations_map_dispose (GObject *object)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (object)->priv;
+
+ 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);
+
+ if (priv->color_map)
+ {
+ g_clear_object (&priv->color_map);
+
+ priv->visible_map_pixels = NULL;
+ priv->visible_map_rowstride = 0;
+ }
+
+ G_OBJECT_CLASS (girl_stations_map_parent_class)->dispose (object);
+}
+
+static void
+girl_stations_map_finalize (GObject *object)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (object)->priv;
+
+ if (priv->tzdb)
+ {
+ tz_db_free (priv->tzdb);
+ priv->tzdb = NULL;
+ }
+
+
+ G_OBJECT_CLASS (girl_stations_map_parent_class)->finalize (object);
+}
+
+/* GtkWidget functions */
+static void
+girl_stations_map_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ gint size;
+
+ size = gdk_pixbuf_get_width (priv->orig_background);
+
+ if (minimum != NULL)
+ *minimum = size;
+ if (natural != NULL)
+ *natural = size;
+}
+
+static void
+girl_stations_map_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ gint size;
+
+ size = gdk_pixbuf_get_height (priv->orig_background);
+
+ if (minimum != NULL)
+ *minimum = size;
+ if (natural != NULL)
+ *natural = size;
+}
+
+static void
+girl_stations_map_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ GdkPixbuf *pixbuf;
+
+ if (priv->background)
+ g_object_unref (priv->background);
+
+ if (!gtk_widget_is_sensitive (widget))
+ pixbuf = priv->orig_background_dim;
+ else
+ pixbuf = priv->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,
+ 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);
+
+ GTK_WIDGET_CLASS (girl_stations_map_parent_class)->size_allocate (widget,
+ allocation);
+}
+
+static void
+girl_stations_map_realize (GtkWidget *widget)
+{
+ GdkWindowAttr attr = { 0, };
+ GtkAllocation allocation;
+ GdkWindow *window;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gtk_widget_set_realized (widget, TRUE);
+
+ attr.window_type = GDK_WINDOW_CHILD;
+ attr.wclass = GDK_INPUT_OUTPUT;
+ attr.width = allocation.width;
+ attr.height = allocation.height;
+ attr.x = allocation.x;
+ attr.y = allocation.y;
+ attr.event_mask = gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
+
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr,
+ GDK_WA_X | GDK_WA_Y);
+
+ gdk_window_set_user_data (window, widget);
+ gtk_widget_set_window (widget, window);
+}
+
+
+static gdouble
+convert_longitude_to_x (gdouble longitude, gint map_width)
+{
+ const gdouble xdeg_offset = -6;
+ gdouble x;
+
+ x = (map_width * (180.0 + longitude) / 360.0)
+ + (map_width * xdeg_offset / 180.0);
+
+ return x;
+}
+
+static gdouble
+radians (gdouble degrees)
+{
+ return (degrees / 360.0) * G_PI * 2;
+}
+
+static gdouble
+convert_latitude_to_y (gdouble latitude, gdouble map_height)
+{
+ gdouble bottom_lat = -59;
+ gdouble top_lat = 81;
+ gdouble top_per, y, full_range, top_offset, map_range;
+
+ top_per = top_lat / 180.0;
+ y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude)));
+ full_range = 4.6068250867599998;
+ top_offset = full_range * top_per;
+ map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset);
+ y = fabs (y - top_offset);
+ y = y / map_range;
+ y = y * map_height;
+ return y;
+}
+
+static void
+draw_text_bubble (cairo_t *cr,
+ GtkWidget *widget,
+ gdouble pointx,
+ gdouble pointy)
+{
+ static const double corner_radius = 9.0;
+ static const double margin_top = 12.0;
+ static const double margin_bottom = 12.0;
+ static const double margin_left = 24.0;
+ static const double margin_right = 24.0;
+
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ GtkAllocation alloc;
+ PangoLayout *layout;
+ PangoRectangle text_rect;
+ double x;
+ double y;
+ double width;
+ double height;
+
+ if (!priv->bubble_text)
+ return;
+
+ gtk_widget_get_allocation (widget, &alloc);
+ layout = gtk_widget_create_pango_layout (widget, NULL);
+
+ /* 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_get_pixel_extents (layout, NULL, &text_rect);
+
+ /* Calculate the bubble size based on the text layout size */
+ width = text_rect.width + margin_left + margin_right;
+ height = text_rect.height + margin_top + margin_bottom;
+
+ if (pointx < alloc.width / 2)
+ x = pointx + 25;
+ else
+ x = pointx - width - 25;
+
+ y = pointy - height / 2;
+
+ /* Make sure it fits in the visible area */
+ x = CLAMP (x, 0, alloc.width - width);
+ y = CLAMP (y, 0, alloc.height - height);
+
+ cairo_save (cr);
+ cairo_translate (cr, x, y);
+
+ /* Draw the bubble */
+ cairo_new_sub_path (cr);
+ cairo_arc (cr, width - corner_radius, corner_radius, corner_radius, radians (-90), radians (0));
+ cairo_arc (cr, width - corner_radius, height - corner_radius, corner_radius, radians (0), radians (90));
+ cairo_arc (cr, corner_radius, height - corner_radius, corner_radius, radians (90), radians (180));
+ cairo_arc (cr, corner_radius, corner_radius, corner_radius, radians (180), radians (270));
+ cairo_close_path (cr);
+
+ cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 0.7);
+ cairo_fill (cr);
+
+ /* And finally draw the text */
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_move_to (cr, margin_left, margin_top);
+ pango_cairo_show_layout (cr, layout);
+
+ g_object_unref (layout);
+ cairo_restore (cr);
+}
+
+static gboolean
+girl_stations_map_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ GdkPixbuf *hilight, *orig_hilight;
+ GtkAllocation alloc;
+ gchar *file;
+ GError *err = NULL;
+ gdouble pointx, pointy;
+ char buf[16];
+ const char *fmt;
+
+ gtk_widget_get_allocation (widget, &alloc);
+
+ /* paint background */
+ gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
+ cairo_paint (cr);
+
+ /* paint hilight */
+ if (gtk_widget_is_sensitive (widget))
+ fmt = GIRL_RESOURCE_PATH "/timezone_%s.png";
+ else
+ fmt = GIRL_RESOURCE_PATH "/timezone_%s_dim.png";
+
+ file = g_strdup_printf (fmt,
+ g_ascii_formatd (buf, sizeof (buf),
+ "%g", priv->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
+ {
+
+ 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)
+ {
+ pointx = convert_longitude_to_x (priv->location->longitude, alloc.width);
+ pointy = convert_latitude_to_y (priv->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)
+ {
+ gdk_cairo_set_source_pixbuf (cr, priv->pin,
+ pointx - PIN_HOT_POINT_X,
+ pointy - PIN_HOT_POINT_Y);
+ cairo_paint (cr);
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+update_cursor (GtkWidget *widget)
+{
+ GdkWindow *window;
+ GdkCursor *cursor = NULL;
+
+ if (!gtk_widget_get_realized (widget))
+ return;
+
+ if (gtk_widget_is_sensitive (widget))
+ {
+ GdkDisplay *display;
+ display = gtk_widget_get_display (widget);
+ cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+ }
+
+ window = gtk_widget_get_window (widget);
+ gdk_window_set_cursor (window, cursor);
+
+ if (cursor)
+ g_object_unref (cursor);
+}
+
+#if 0
+static void
+girl_stations_map_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags prev_state)
+{
+ update_cursor (widget);
+
+ if (GTK_WIDGET_CLASS (girl_stations_map_parent_class)->state_flags_changed)
+ GTK_WIDGET_CLASS (girl_stations_map_parent_class)->state_flags_changed (widget, prev_state);
+}
+#endif
+
+static void
+girl_stations_map_class_init (GirlStationsMapClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GirlStationsMapPrivate));
+
+ object_class->dispose = girl_stations_map_dispose;
+ object_class->finalize = girl_stations_map_finalize;
+
+ /* widget_class->get_preferred_width = girl_stations_map_get_preferred_width; */
+ /* widget_class->get_preferred_height = girl_stations_map_get_preferred_height; */
+ /* widget_class->size_allocate = girl_stations_map_size_allocate; */
+ /* widget_class->realize = girl_stations_map_realize; */
+ /* widget_class->draw = girl_stations_map_draw; */
+ /* widget_class->state_flags_changed = girl_stations_map_state_flags_changed; */
+
+ signals[LOCATION_CHANGED] = g_signal_new ("location-changed",
+ GIRL_TYPE_STATIONS_MAP,
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+}
+
+
+static gint
+sort_locations (TzLocation *a,
+ TzLocation *b)
+{
+ if (a->dist > b->dist)
+ return 1;
+
+ if (a->dist < b->dist)
+ return -1;
+
+ return 0;
+}
+
+static void
+set_location (GirlStationsMap *map,
+ TzLocation *location)
+{
+ GirlStationsMapPrivate *priv = map->priv;
+ TzInfo *info;
+
+ priv->location = location;
+
+ info = tz_info_from_location (priv->location);
+
+ priv->selected_offset = tz_location_get_utc_offset (priv->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);
+}
+
+static gboolean
+button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP (widget)->priv;
+ gint x, y;
+ guchar r, g, b, a;
+ guchar *pixels;
+ gint rowstride;
+ gint i;
+
+ const GPtrArray *array;
+ gint width, height;
+ GList *distances = NULL;
+ GtkAllocation alloc;
+
+ x = event->x;
+ y = event->y;
+
+
+ rowstride = priv->visible_map_rowstride;
+ pixels = priv->visible_map_pixels;
+
+ r = pixels[(rowstride * y + x * 4)];
+ g = pixels[(rowstride * y + x * 4) + 1];
+ b = pixels[(rowstride * y + x * 4) + 2];
+ a = pixels[(rowstride * y + x * 4) + 3];
+
+
+ for (i = 0; color_codes[i].offset != -100; i++)
+ {
+ 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;
+ }
+ }
+
+ gtk_widget_queue_draw (widget);
+
+ /* work out the co-ordinates */
+
+ array = tz_get_locations (priv->tzdb);
+
+ gtk_widget_get_allocation (widget, &alloc);
+ width = alloc.width;
+ height = alloc.height;
+
+ for (i = 0; i < array->len; i++)
+ {
+ gdouble pointx, pointy, dx, dy;
+ TzLocation *loc = array->pdata[i];
+
+ pointx = convert_longitude_to_x (loc->longitude, width);
+ pointy = convert_latitude_to_y (loc->latitude, height);
+
+ dx = pointx - x;
+ dy = pointy - y;
+
+ loc->dist = dx * dx + dy * dy;
+ distances = g_list_prepend (distances, loc);
+
+ }
+ distances = g_list_sort (distances, (GCompareFunc) sort_locations);
+
+
+ set_location (GIRL_STATIONS_MAP (widget), (TzLocation*) distances->data);
+
+ g_list_free (distances);
+
+ return TRUE;
+}
+
+static void
+girl_stations_map_init (GirlStationsMap *self)
+{
+ GirlStationsMapPrivate *priv;
+ GError *err = NULL;
+
+ priv = self->priv = GIRL_STATIONS_MAP_PRIVATE (self);
+
+ priv->orig_background = gdk_pixbuf_new_from_resource (GIRL_RESOURCE_PATH "/bg.png", &err);
+
+ if (!priv->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 (GIRL_RESOURCE_PATH "/bg_dim.png",
+ &err);
+
+ if (!priv->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 (GIRL_RESOURCE_PATH "/cc.png",
+ &err);
+ if (!priv->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 (GIRL_RESOURCE_PATH "/pin.png",
+ &err);
+ if (!priv->pin)
+ {
+ g_warning ("Could not load pin icon: %s",
+ (err) ? err->message : "Unknown error");
+ g_clear_error (&err);
+ }
+
+ priv->tzdb = tz_load_db ();
+
+ g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
+ NULL);
+}
+
+GirlStationsMap *
+girl_stations_map_new (void)
+{
+ return g_object_new (GIRL_TYPE_STATIONS_MAP, NULL);
+}
+
+gboolean
+girl_stations_map_set_location (GirlStationsMap *map,
+ const gchar *timezone)
+{
+ GPtrArray *locations;
+ guint i;
+ char *real_tz;
+ gboolean ret;
+
+ real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone);
+
+ locations = tz_get_locations (map->priv->tzdb);
+ ret = FALSE;
+
+ for (i = 0; i < locations->len; i++)
+ {
+ TzLocation *loc = locations->pdata[i];
+
+ if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone))
+ {
+ set_location (map, loc);
+ ret = TRUE;
+ break;
+ }
+ }
+
+ if (ret)
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+
+ g_free (real_tz);
+
+ return ret;
+}
+
+void
+girl_stations_map_set_bubble_text (GirlStationsMap *map,
+ const gchar *text)
+{
+ GirlStationsMapPrivate *priv = GIRL_STATIONS_MAP_PRIVATE (map);
+
+ g_free (priv->bubble_text);
+ priv->bubble_text = g_strdup (text);
+
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+}
+
+TzLocation *
+girl_stations_map_get_location (GirlStationsMap *map)
+{
+ return map->priv->location;
+}
diff --git a/src/girl-stations-map.h b/src/girl-stations-map.h
new file mode 100644
index 0000000..87652ee
--- /dev/null
+++ b/src/girl-stations-map.h
@@ -0,0 +1,110 @@
+/* $Id: girl.c,v 1.4 2002/10/04 20:20:30 oka Exp $
+ *
+ * GNOME Internet Radio Locator
+ *
+ * Copyright (C) 2015 Ole Aamot Software
+ *
+ * Author: Ole Aamot <oka oka no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+/*
+ * Essential parts of the source code below was based on
+ * gnome-control-center/panels/datetime/cc-timezone-map.h
+ *
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+
+#ifndef _GIRL_STATIONS_MAP_H
+#define _GIRL_STATIONS_MAP_H
+
+#include <gtk/gtk.h>
+#include <gtk/gtkenums.h>
+
+#include "girl-tz.h"
+
+G_BEGIN_DECLS
+
+#define GIRL_TYPE_STATIONS_MAP girl_stations_map_get_type()
+
+#define GIRL_STATIONS_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GIRL_TYPE_STATIONS_MAP, GirlStationsMap))
+
+#define GIRL_STATIONS_MAP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GIRL_TYPE_STATIONS_MAP, GirlStationsMapClass))
+
+#define GIRL_IS_STATIONS_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GIRL_TYPE_STATIONS_MAP))
+
+#define GIRL_IS_STATIONS_MAP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GIRL_TYPE_STATIONS_MAP))
+
+#define GIRL_STATIONS_MAP_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GIRL_TYPE_STATIONS_MAP, GirlStationsMapClass))
+
+typedef struct _GirlStationsMap GirlStationsMap;
+typedef struct _GirlStationsMapClass GirlStationsMapClass;
+typedef struct _GirlStationsMapPrivate GirlStationsMapPrivate;
+
+struct _GirlStationsMap
+{
+ GtkWidget parent;
+
+ GirlStationsMapPrivate *priv;
+};
+
+struct _GirlStationsMapClass
+{
+ GtkWidgetClass parent_class;
+};
+
+GType girl_stations_map_get_type (void) G_GNUC_CONST;
+
+GirlStationsMap *girl_stations_map_new (void);
+
+gboolean girl_stations_map_set_location (GirlStationsMap *map,
+ const gchar *timezone);
+void girl_stations_map_set_bubble_text (GirlStationsMap *map,
+ const gchar *text);
+
+TzLocation *girl_stations_map_get_location (GirlStationsMap *map);
+
+G_END_DECLS
+
+#endif /* _GIRL_STATIONS_MAP_H */
diff --git a/src/girl-tz.c b/src/girl-tz.c
new file mode 100644
index 0000000..b208963
--- /dev/null
+++ b/src/girl-tz.c
@@ -0,0 +1,512 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* $Id: girl.c,v 1.4 2002/10/04 20:20:30 oka Exp $
+ *
+ * GNOME Internet Radio Locator
+ *
+ * Copyright (C) 2015 Ole Aamot Software
+ *
+ * Author: Ole Aamot <oka oka no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+/*
+ * Essential parts of the source code below was based on
+ * gnome-control-center/panels/datetime/tz.c
+ *
+ */
+
+/* Generic timezone utilities.
+ *
+ * Copyright (C) 2000-2001 Ximian, Inc.
+ *
+ * Authors: Hans Petter Jansson <hpj ximian com>
+ *
+ * Largely based on Michael Fulbright's work on Anaconda.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+#include "girl-tz.h"
+
+
+/* Forward declarations for private functions */
+
+static float convert_pos (gchar *pos, int digits);
+static int compare_country_names (const void *a, const void *b);
+static void sort_locations_by_country (GPtrArray *locations);
+static gchar * tz_data_file_get (void);
+static void load_backward_tz (TzDB *tz_db);
+
+/* ---------------- *
+ * Public interface *
+ * ---------------- */
+TzDB *
+tz_load_db (void)
+{
+ gchar *tz_data_file;
+ TzDB *tz_db;
+ FILE *tzfile;
+ char buf[4096];
+
+ tz_data_file = tz_data_file_get ();
+ if (!tz_data_file) {
+ g_warning ("Could not get the TimeZone data file name");
+ return NULL;
+ }
+ 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;
+ }
+
+ tz_db = g_new0 (TzDB, 1);
+ tz_db->locations = g_ptr_array_new ();
+
+ while (fgets (buf, sizeof(buf), tzfile))
+ {
+ gchar **tmpstrarr;
+ gchar *latstr, *lngstr, *p;
+ TzLocation *loc;
+
+ if (*buf == '#') continue;
+
+ g_strchomp(buf);
+ tmpstrarr = g_strsplit(buf,"\t", 6);
+
+ latstr = g_strdup (tmpstrarr[1]);
+ p = latstr + 1;
+ while (*p != '-' && *p != '+') p++;
+ lngstr = g_strdup (p);
+ *p = '\0';
+
+ loc = g_new0 (TzLocation, 1);
+ loc->country = g_strdup (tmpstrarr[0]);
+ loc->zone = g_strdup (tmpstrarr[2]);
+ loc->latitude = convert_pos (latstr, 2);
+ loc->longitude = convert_pos (lngstr, 3);
+
+#ifdef __sun
+ if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4])
+ loc->comment = g_strdup (tmpstrarr[4]);
+
+ if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !islower(loc->zone)) {
+ TzLocation *locgrp;
+
+ /* duplicate entry */
+ locgrp = g_new0 (TzLocation, 1);
+ locgrp->country = g_strdup (tmpstrarr[0]);
+ locgrp->zone = g_strdup (tmpstrarr[3]);
+ locgrp->latitude = convert_pos (latstr, 2);
+ locgrp->longitude = convert_pos (lngstr, 3);
+ locgrp->comment = (tmpstrarr[4]) ? g_strdup (tmpstrarr[4]) : NULL;
+
+ g_ptr_array_add (tz_db->locations, (gpointer) locgrp);
+ }
+#else
+ loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL;
+#endif
+
+ g_ptr_array_add (tz_db->locations, (gpointer) loc);
+
+ g_free (latstr);
+ g_free (lngstr);
+ g_strfreev (tmpstrarr);
+ }
+
+ fclose (tzfile);
+
+ /* 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);
+
+ return tz_db;
+}
+
+static void
+tz_location_free (TzLocation *loc)
+{
+ g_free (loc->country);
+ g_free (loc->zone);
+ g_free (loc->comment);
+
+ g_free (loc);
+}
+
+void
+tz_db_free (TzDB *db)
+{
+ g_ptr_array_foreach (db->locations, (GFunc) tz_location_free, NULL);
+ g_ptr_array_free (db->locations, TRUE);
+ g_hash_table_destroy (db->backward);
+ g_free (db);
+}
+
+GPtrArray *
+tz_get_locations (TzDB *db)
+{
+ return db->locations;
+}
+
+
+gchar *
+tz_location_get_country (TzLocation *loc)
+{
+ return loc->country;
+}
+
+
+gchar *
+tz_location_get_zone (TzLocation *loc)
+{
+ return loc->zone;
+}
+
+
+gchar *
+tz_location_get_comment (TzLocation *loc)
+{
+ return loc->comment;
+}
+
+
+void
+tz_location_get_position (TzLocation *loc, double *longitude, double *latitude)
+{
+ *longitude = loc->longitude;
+ *latitude = loc->latitude;
+}
+
+glong
+tz_location_get_utc_offset (TzLocation *loc)
+{
+ TzInfo *tz_info;
+ glong offset;
+
+ tz_info = tz_info_from_location (loc);
+ offset = tz_info->utc_offset;
+ tz_info_free (tz_info);
+ return offset;
+}
+
+TzInfo *
+tz_info_from_location (TzLocation *loc)
+{
+ TzInfo *tzinfo;
+ time_t curtime;
+ struct tm *curzone;
+ gchar *tz_env_value;
+
+ g_return_val_if_fail (loc != NULL, NULL);
+ g_return_val_if_fail (loc->zone != NULL, NULL);
+
+ tz_env_value = g_strdup (getenv ("TZ"));
+ setenv ("TZ", loc->zone, 1);
+
+#if 0
+ tzset ();
+#endif
+ tzinfo = g_new0 (TzInfo, 1);
+
+ curtime = time (NULL);
+ curzone = localtime (&curtime);
+
+#ifndef __sun
+ /* Currently this solution doesnt seem to work - I get that */
+ /* America/Phoenix uses daylight savings, which is wrong */
+ tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
+ if (curzone->tm_isdst)
+ tzinfo->tzname_daylight =
+ g_strdup (&curzone->tm_zone[curzone->tm_isdst]);
+ else
+ tzinfo->tzname_daylight = NULL;
+
+ tzinfo->utc_offset = curzone->tm_gmtoff;
+#else
+ tzinfo->tzname_normal = NULL;
+ tzinfo->tzname_daylight = NULL;
+ tzinfo->utc_offset = 0;
+#endif
+
+ tzinfo->daylight = curzone->tm_isdst;
+
+ if (tz_env_value)
+ setenv ("TZ", tz_env_value, 1);
+ else
+ unsetenv ("TZ");
+
+ g_free (tz_env_value);
+
+ return tzinfo;
+}
+
+
+void
+tz_info_free (TzInfo *tzinfo)
+{
+ g_return_if_fail (tzinfo != NULL);
+
+ if (tzinfo->tzname_normal) g_free (tzinfo->tzname_normal);
+ if (tzinfo->tzname_daylight) g_free (tzinfo->tzname_daylight);
+ g_free (tzinfo);
+}
+
+struct {
+ const char *orig;
+ const char *dest;
+} aliases[] = {
+ { "Asia/Istanbul", "Europe/Istanbul" }, /* Istanbul is in both Europe and Asia */
+ { "Europe/Nicosia", "Asia/Nicosia" }, /* Ditto */
+ { "EET", "Europe/Istanbul" }, /* Same tz as the 2 above */
+ { "HST", "Pacific/Honolulu" },
+ { "WET", "Europe/Brussels" }, /* Other name for the mainland Europe tz */
+ { "CET", "Europe/Brussels" }, /* ditto */
+ { "MET", "Europe/Brussels" },
+ { "Etc/Zulu", "Etc/GMT" },
+ { "Etc/UTC", "Etc/GMT" },
+ { "GMT", "Etc/GMT" },
+ { "Greenwich", "Etc/GMT" },
+ { "Etc/UCT", "Etc/GMT" },
+ { "Etc/GMT0", "Etc/GMT" },
+ { "Etc/GMT+0", "Etc/GMT" },
+ { "Etc/GMT-0", "Etc/GMT" },
+ { "Etc/Universal", "Etc/GMT" },
+ { "PST8PDT", "America/Los_Angeles" }, /* Other name for the Atlantic tz */
+ { "EST", "America/New_York" }, /* Other name for the Eastern tz */
+ { "EST5EDT", "America/New_York" }, /* ditto */
+ { "CST6CDT", "America/Chicago" }, /* Other name for the Central tz */
+ { "MST", "America/Denver" }, /* Other name for the mountain tz */
+ { "MST7MDT", "America/Denver" }, /* ditto */
+};
+
+static gboolean
+compare_timezones (const char *a,
+ const char *b)
+{
+ if (g_str_equal (a, b))
+ return TRUE;
+ if (strchr (b, '/') == NULL) {
+ char *prefixed;
+
+ prefixed = g_strdup_printf ("/%s", b);
+ if (g_str_has_suffix (a, prefixed)) {
+ g_free (prefixed);
+ return TRUE;
+ }
+ g_free (prefixed);
+ }
+
+ return FALSE;
+}
+
+char *
+tz_info_get_clean_name (TzDB *tz_db,
+ const char *tz)
+{
+ char *ret;
+ const char *timezone;
+ guint i;
+ gboolean replaced;
+
+ /* Remove useless prefixes */
+ if (g_str_has_prefix (tz, "right/"))
+ tz = tz + strlen ("right/");
+ else if (g_str_has_prefix (tz, "posix/"))
+ tz = tz + strlen ("posix/");
+
+ /* Here start the crazies */
+ replaced = FALSE;
+
+ for (i = 0; i < G_N_ELEMENTS (aliases); i++) {
+ if (compare_timezones (tz, aliases[i].orig)) {
+ replaced = TRUE;
+ timezone = aliases[i].dest;
+ break;
+ }
+ }
+
+ /* Try again! */
+ if (!replaced) {
+ /* Ignore crazy solar times from the '80s */
+ if (g_str_has_prefix (tz, "Asia/Riyadh") ||
+ g_str_has_prefix (tz, "Mideast/Riyadh")) {
+ timezone = "Asia/Riyadh";
+ replaced = TRUE;
+ }
+ }
+
+ if (!replaced)
+ timezone = tz;
+
+ ret = g_hash_table_lookup (tz_db->backward, timezone);
+ if (ret == NULL)
+ return g_strdup (timezone);
+ return g_strdup (ret);
+}
+
+/* ----------------- *
+ * Private functions *
+ * ----------------- */
+
+static gchar *
+tz_data_file_get (void)
+{
+ gchar *file;
+
+ file = g_strdup (TZ_DATA_FILE);
+
+ return file;
+}
+
+static float
+convert_pos (gchar *pos, int digits)
+{
+ gchar whole[10];
+ gchar *fraction;
+ gint i;
+ float t1, t2;
+
+ if (!pos || strlen(pos) < 4 || digits > 9) return 0.0;
+
+ for (i = 0; i < digits + 1; i++) whole[i] = pos[i];
+ whole[i] = '\0';
+ fraction = pos + digits + 1;
+
+ t1 = g_strtod (whole, NULL);
+ t2 = g_strtod (fraction, NULL);
+
+ if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction));
+ else return t1 - t2/pow (10.0, strlen(fraction));
+}
+
+
+#if 0
+
+/* Currently not working */
+static void
+free_tzdata (TzLocation *tz)
+{
+
+ if (tz->country)
+ g_free(tz->country);
+ if (tz->zone)
+ g_free(tz->zone);
+ if (tz->comment)
+ g_free(tz->comment);
+
+ g_free(tz);
+}
+#endif
+
+
+static int
+compare_country_names (const void *a, const void *b)
+{
+ const TzLocation *tza = * (TzLocation **) a;
+ const TzLocation *tzb = * (TzLocation **) b;
+
+ return strcmp (tza->zone, tzb->zone);
+}
+
+
+static void
+sort_locations_by_country (GPtrArray *locations)
+{
+ qsort (locations->pdata, locations->len, sizeof (gpointer),
+ compare_country_names);
+}
+
+static void
+load_backward_tz (TzDB *tz_db)
+{
+ GError *error = NULL;
+ char **lines, *contents;
+ guint i;
+
+ tz_db->backward = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+ if (g_file_get_contents (GIRL_DATADIR "/stations/backward", &contents, NULL, &error) == FALSE)
+ {
+ g_warning ("Failed to load 'backward' file: %s", error->message);
+ return;
+ }
+ lines = g_strsplit (contents, "\n", -1);
+ g_free (contents);
+ for (i = 0; lines[i] != NULL; i++)
+ {
+ char **items;
+ guint j;
+ char *real, *alias;
+
+ if (g_ascii_strncasecmp (lines[i], "Link\t", 5) != 0)
+ continue;
+
+ items = g_strsplit (lines[i], "\t", -1);
+ real = NULL;
+ alias = NULL;
+ /* Skip the "Link<tab>" part */
+ for (j = 1; items[j] != NULL; j++)
+ {
+ if (items[j][0] == '\0')
+ continue;
+ if (real == NULL)
+ {
+ real = items[j];
+ continue;
+ }
+ alias = items[j];
+ break;
+ }
+
+ if (real == NULL || alias == NULL)
+ g_warning ("Could not parse line: %s", lines[i]);
+
+ /* We don't need more than one name for it */
+ if (g_str_equal (real, "Etc/UTC") ||
+ g_str_equal (real, "Etc/UCT"))
+ 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/src/girl-tz.h b/src/girl-tz.h
new file mode 100644
index 0000000..f1f7a67
--- /dev/null
+++ b/src/girl-tz.h
@@ -0,0 +1,118 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* $Id: girl.c,v 1.4 2002/10/04 20:20:30 oka Exp $
+ *
+ * GNOME Internet Radio Locator
+ *
+ * Copyright (C) 2015 Ole Aamot Software
+ *
+ * Author: Ole Aamot <oka oka no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+/*
+ * Essential parts of the source code below was based on
+ * gnome-control-center/panels/datetime/tz.h
+ *
+ */
+
+/* Generic timezone utilities.
+ *
+ * Copyright (C) 2000-2001 Ximian, Inc.
+ *
+ * Authors: Hans Petter Jansson <hpj ximian com>
+ *
+ * Largely based on Michael Fulbright's work on Anaconda.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _E_TZ_H
+#define _E_TZ_H
+
+#include <glib.h>
+
+#ifndef __sun
+# define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"
+#else
+# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
+#endif
+
+typedef struct _TzDB TzDB;
+typedef struct _TzLocation TzLocation;
+typedef struct _TzInfo TzInfo;
+
+
+struct _TzDB
+{
+ GPtrArray *locations;
+ GHashTable *backward;
+};
+
+struct _TzLocation
+{
+ gchar *country;
+ gdouble latitude;
+ gdouble longitude;
+ gchar *zone;
+ gchar *comment;
+
+ gdouble dist; /* distance to clicked point for comparison */
+};
+
+/* see the glibc info page information on time zone information */
+/* tzname_normal is the default name for the timezone */
+/* tzname_daylight is the name of the zone when in daylight savings */
+/* utc_offset is offset in seconds from utc */
+/* daylight if non-zero then location obeys daylight savings */
+
+struct _TzInfo
+{
+ gchar *tzname_normal;
+ gchar *tzname_daylight;
+ glong utc_offset;
+ gint daylight;
+};
+
+
+TzDB *tz_load_db (void);
+void tz_db_free (TzDB *db);
+char * tz_info_get_clean_name (TzDB *tz_db,
+ const char *tz);
+GPtrArray *tz_get_locations (TzDB *db);
+void tz_location_get_position (TzLocation *loc,
+ double *longitude, double *latitude);
+char *tz_location_get_country (TzLocation *loc);
+gchar *tz_location_get_zone (TzLocation *loc);
+gchar *tz_location_get_comment (TzLocation *loc);
+glong tz_location_get_utc_offset (TzLocation *loc);
+gint tz_location_set_locally (TzLocation *loc);
+TzInfo *tz_info_from_location (TzLocation *loc);
+void tz_info_free (TzInfo *tz_info);
+
+#endif
diff --git a/talk/girl-osdc-2015.tex b/talk/girl-osdc-2015.tex
index 96f2a89..fb53380 100644
--- a/talk/girl-osdc-2015.tex
+++ b/talk/girl-osdc-2015.tex
@@ -442,4 +442,8 @@ The audio codecs in usage among the supported 76 radio stations are:
\end{list2}
\end{list1}
+\slide{\LaTeX{} source code for this presentation}
+
+\url{https://git.gnome.org/browse/girl/plain/talk/girl-osdc-2015.tex}
+
\end{document}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]