aboutsummaryrefslogtreecommitdiff
path: root/libmap/cc-timezone-map.c
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-02-23 15:26:49 -0600
committerMichael Terry <mike@mterry.name>2011-02-23 15:26:49 -0600
commitad847471eee3e68c27505af6a35245f9e3f7f532 (patch)
treea1abaf775ed076242984452795e5dbd56f10423a /libmap/cc-timezone-map.c
parente2fa62d9ad271f26f2a8e4d9297190e0250bb967 (diff)
downloadayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.tar.gz
ayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.tar.bz2
ayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.zip
add geonames watermark
Diffstat (limited to 'libmap/cc-timezone-map.c')
-rw-r--r--libmap/cc-timezone-map.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c
index 7647925..5ece1c2 100644
--- a/libmap/cc-timezone-map.c
+++ b/libmap/cc-timezone-map.c
@@ -60,6 +60,8 @@ struct _CcTimezoneMapPrivate
gdouble selected_offset;
+ gchar *watermark;
+
TzDB *tzdb;
TzLocation *location;
GHashTable *alias_db;
@@ -574,6 +576,12 @@ cc_timezone_map_dispose (GObject *object)
priv->alias_db = NULL;
}
+ if (priv->watermark)
+ {
+ g_free (priv->watermark);
+ priv->watermark = NULL;
+ }
+
G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object);
}
@@ -822,6 +830,18 @@ cc_timezone_map_draw (GtkWidget *widget,
g_object_unref (pin);
}
+ if (priv->watermark) {
+ cairo_text_extents_t extent;
+ cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_set_font_size(cr, 12.0);
+ cairo_set_source_rgba(cr, 1, 1, 1, 0.5);
+ cairo_text_extents(cr, priv->watermark, &extent);
+ cairo_move_to(cr, alloc.width - extent.x_advance + extent.x_bearing - 5,
+ alloc.height - extent.height - extent.y_bearing - 5);
+ cairo_show_text(cr, priv->watermark);
+ cairo_stroke(cr);
+ }
+
return TRUE;
}
@@ -1150,6 +1170,16 @@ cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map, gdouble lon, gdouble
}
}
+void
+cc_timezone_map_set_watermark (CcTimezoneMap *map, const gchar * watermark)
+{
+ if (map->priv->watermark)
+ g_free (map->priv->watermark);
+
+ map->priv->watermark = g_strdup (watermark);
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+}
+
TzLocation *
cc_timezone_map_get_location (CcTimezoneMap *map)
{