Prettied it up a bit.
[stockwidget] / lib-stock-home-widget.c
index 3ee9f82..14a2b81 100644 (file)
@@ -407,6 +407,8 @@ cairo_rounded_rectangle(cairo_t *cr,
                                                double height,
                                                double corner_div)
 {
+       cairo_pattern_t *pat;
+       
        double          aspect            = 1.0;
        double          corner_radius = height / corner_div;
        double          radius            = corner_radius / aspect;
@@ -419,10 +421,15 @@ cairo_rounded_rectangle(cairo_t *cr,
        cairo_arc (cr, x + radius, y + radius, radius, 180 * degrees, 270 * degrees);
        cairo_close_path (cr);
 
-       cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.25);
+       pat = cairo_pattern_create_linear(0.0, 0.0, 0.0, height);
+
+       cairo_pattern_add_color_stop_rgba(pat,0.0, 0.8, 0.8, 0.8, 0.7);
+       cairo_pattern_add_color_stop_rgba(pat,1.0, 0.0, 0.0, 0.0, 0.7);
+
+       cairo_set_source(cr,pat);
        cairo_fill_preserve (cr);
-       cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
-       cairo_set_line_width (cr, 1.0);
+
+       cairo_set_line_width (cr, 0.0);
        cairo_stroke (cr);
 }
 
@@ -430,28 +437,12 @@ static gboolean
 stock_plugin_expose(GtkWidget* widget, GdkEventExpose *event)
 {
        cairo_t*                         cr;
-       int                                      width  = 0;
-       int                                      height = 0;
-       GdkRectangle            *psRect;
        
        cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
-
-       psRect = &event->area;
-
-       width = psRect->width;
-       height = psRect->height;
-
-       DebugOut(("X: %d Y: %d Width: %d Height %d",psRect->x,psRect->y,psRect->width,psRect->height));
-       
-       cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.5);
-       #if 1
-       cairo_rounded_rectangle(cr, 0, 0, width, height, 10.0);
-       #else
-       cairo_rectangle(cr, 0, 0, width, height);
-       #endif
-       cairo_fill(cr);
        
+       cairo_rounded_rectangle(cr, 0, 0, event->area.width, event->area.height, 10.0);
        cairo_destroy(cr);
+       
        return GTK_WIDGET_CLASS(stock_plugin_parent_class)->expose_event(widget, event);
 }