aboutsummaryrefslogtreecommitdiff
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
parente2fa62d9ad271f26f2a8e4d9297190e0250bb967 (diff)
downloadayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.tar.gz
ayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.tar.bz2
ayatana-indicator-datetime-ad847471eee3e68c27505af6a35245f9e3f7f532.zip
add geonames watermark
-rw-r--r--libmap/README2
-rw-r--r--libmap/cc-timezone-map.c30
-rw-r--r--libmap/cc-timezone-map.h2
-rw-r--r--src/datetime-prefs.c2
4 files changed, 35 insertions, 1 deletions
diff --git a/libmap/README b/libmap/README
index c83c6d8..6766b42 100644
--- a/libmap/README
+++ b/libmap/README
@@ -2,4 +2,4 @@ This static library is a copied version of the code in GNOME 3.0's control cente
Ideally in the future, we can have all three packages using the same code. But for now, for time reasons (hah), it's just a copy.
-To update this copy, put newer versions of the code and data files in place; then fix up any GTK3-isms and add cc_timezone_map_set_coords and friends.
+To update this copy, put newer versions of the code and data files in place; then fix up any GTK3-isms and add cc_timezone_map_set_coords and friends. And the watermark.
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)
{
diff --git a/libmap/cc-timezone-map.h b/libmap/cc-timezone-map.h
index 8de986d..ace1107 100644
--- a/libmap/cc-timezone-map.h
+++ b/libmap/cc-timezone-map.h
@@ -70,6 +70,8 @@ GType cc_timezone_map_get_type (void) G_GNUC_CONST;
CcTimezoneMap *cc_timezone_map_new (void);
+void cc_timezone_map_set_watermark (CcTimezoneMap * map,
+ const gchar * watermark);
void cc_timezone_map_set_timezone (CcTimezoneMap *map,
const gchar *timezone);
void cc_timezone_map_set_coords (CcTimezoneMap *map,
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 3f5e5e6..fbadd27 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -494,6 +494,8 @@ create_dialog (void)
/* Add map */
tzmap = cc_timezone_map_new ();
gtk_container_add (GTK_CONTAINER (WIG ("mapBox")), GTK_WIDGET (tzmap));
+ /* Fufill the CC by Attribution license requirements for the Geonames lookup */
+ cc_timezone_map_set_watermark (tzmap, "Geonames.org");
/* And completion entry */
TimezoneCompletion * completion = timezone_completion_new ();