From 7ef186559335f0f82cf2985ada9151f2232d2c90 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 23 Feb 2011 15:31:18 -0600 Subject: don't have the map draw a highlight if no zone selected --- libmap/cc-timezone-map.c | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'libmap') 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; } -- cgit v1.2.3