diff options
author | Michael Terry <mike@mterry.name> | 2011-02-23 15:31:18 -0600 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-02-23 15:31:18 -0600 |
commit | 7ef186559335f0f82cf2985ada9151f2232d2c90 (patch) | |
tree | f28de4df52690df5e424b5534e37d47db1393107 /libmap | |
parent | ad847471eee3e68c27505af6a35245f9e3f7f532 (diff) | |
download | ayatana-indicator-datetime-7ef186559335f0f82cf2985ada9151f2232d2c90.tar.gz ayatana-indicator-datetime-7ef186559335f0f82cf2985ada9151f2232d2c90.tar.bz2 ayatana-indicator-datetime-7ef186559335f0f82cf2985ada9151f2232d2c90.zip |
don't have the map draw a highlight if no zone selected
Diffstat (limited to 'libmap')
-rw-r--r-- | libmap/cc-timezone-map.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c index 5ece1c2..ec12c84 100644 --- a/libmap/cc-timezone-map.c +++ b/libmap/cc-timezone-map.c @@ -774,6 +774,23 @@ cc_timezone_map_draw (GtkWidget *widget, gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); cairo_paint (cr); + /* paint watermark */ + 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); + } + + if (!priv->location) { + return TRUE; + } + /* paint hilight */ file = g_strdup_printf (DATADIR "/timezone_%s.png", g_ascii_formatd (buf, sizeof (buf), @@ -810,38 +827,19 @@ cc_timezone_map_draw (GtkWidget *widget, g_clear_error (&err); } - if (priv->location) - { - pointx = convert_longtitude_to_x (priv->location->longitude, alloc.width); - pointy = convert_latitude_to_y (priv->location->latitude, alloc.height); - - if (pointy > alloc.height) - pointy = alloc.height; + pointx = convert_longtitude_to_x (priv->location->longitude, alloc.width); + pointy = convert_latitude_to_y (priv->location->latitude, alloc.height); - if (pin) - { - gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); - cairo_paint (cr); - } - } + if (pointy > alloc.height) + pointy = alloc.height; if (pin) { + gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); + cairo_paint (cr); 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; } |