From cbc7a7cd54130c3f68565a6738e5471807f43df5 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Thu, 24 Mar 2011 08:26:53 -0500 Subject: make map look insensitive if it is --- libmap/cc-timezone-map.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libmap') diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c index ec12c84..8e4a5b8 100644 --- a/libmap/cc-timezone-map.c +++ b/libmap/cc-timezone-map.c @@ -788,6 +788,13 @@ cc_timezone_map_draw (GtkWidget *widget, } if (!priv->location) { + /* Check if insensitive */ + if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) { + cairo_set_source_rgba(cr, 1, 1, 1, 0.5); + cairo_rectangle(cr, 0, 0, alloc.width, alloc.height); + cairo_fill(cr); + } + return TRUE; } @@ -840,6 +847,13 @@ cc_timezone_map_draw (GtkWidget *widget, g_object_unref (pin); } + /* Check if insensitive */ + if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) { + cairo_set_source_rgba(cr, 1, 1, 1, 0.5); + cairo_rectangle(cr, 0, 0, alloc.width, alloc.height); + cairo_fill(cr); + } + return TRUE; } -- cgit v1.2.3 From 143f495ab94cb006954c036cf29079cbb49d584b Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Tue, 29 Mar 2011 12:14:40 -0400 Subject: use background color for insensitive map --- libmap/cc-timezone-map.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'libmap') diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c index 8e4a5b8..7b7d704 100644 --- a/libmap/cc-timezone-map.c +++ b/libmap/cc-timezone-map.c @@ -766,13 +766,23 @@ cc_timezone_map_draw (GtkWidget *widget, gchar *file; GError *err = NULL; gdouble pointx, pointy; + gdouble alpha = 1.0; + GtkStyle *style; char buf[16]; gtk_widget_get_allocation (widget, &alloc); + style = gtk_widget_get_style (widget); + + /* Check if insensitive */ + if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) + alpha = 0.5; + /* paint background */ - gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); + gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]); cairo_paint (cr); + gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); + cairo_paint_with_alpha (cr, alpha); /* paint watermark */ if (priv->watermark) { @@ -788,13 +798,6 @@ cc_timezone_map_draw (GtkWidget *widget, } if (!priv->location) { - /* Check if insensitive */ - if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) { - cairo_set_source_rgba(cr, 1, 1, 1, 0.5); - cairo_rectangle(cr, 0, 0, alloc.width, alloc.height); - cairo_fill(cr); - } - return TRUE; } @@ -820,7 +823,7 @@ cc_timezone_map_draw (GtkWidget *widget, alloc.height, GDK_INTERP_BILINEAR); gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0); - cairo_paint (cr); + cairo_paint_with_alpha (cr, alpha); g_object_unref (hilight); g_object_unref (orig_hilight); } @@ -843,17 +846,10 @@ cc_timezone_map_draw (GtkWidget *widget, if (pin) { gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); - cairo_paint (cr); + cairo_paint_with_alpha (cr, alpha); g_object_unref (pin); } - /* Check if insensitive */ - if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) { - cairo_set_source_rgba(cr, 1, 1, 1, 0.5); - cairo_rectangle(cr, 0, 0, alloc.width, alloc.height); - cairo_fill(cr); - } - return TRUE; } -- cgit v1.2.3