Fixed redrawing causing corruption of background.
[stockwidget] / lib-stock-home-widget.c
index 8f8d5cb..3ee9f82 100644 (file)
@@ -46,7 +46,7 @@ OnClickRefresh(GtkWidget *widget, GdkEventButton *event, StockPluginContext *psC
                                        psContext->psSettings->ppszTickers[0],fPrice,pszColour,fChange,szTime);
 
                        gtk_label_set_markup(GTK_LABEL(psContext->psLabel),szBuffer);
-                       gtk_widget_queue_draw(GTK_WIDGET(psContext->psLabel));
+                       gtk_widget_queue_draw(GTK_WIDGET(psContext->psParent));
                }
                /*
                  If it fails, leave the old price as the user can see the timestamp
@@ -286,7 +286,7 @@ static GtkWidget *stock_create_gui(gchar                            *pszStockLabel,
        eventbox = gtk_event_box_new();
 
        gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox),FALSE);
-       gtk_container_set_border_width(GTK_CONTAINER(eventbox),3);
+       gtk_container_set_border_width(GTK_CONTAINER(eventbox),10);
 
        gtk_container_add(GTK_CONTAINER(eventbox),label);
 
@@ -364,6 +364,7 @@ stock_plugin_init (StockPlugin *desktop_plugin)
        
        psContext->hSG          = hSG;
        psContext->nTimerID = -1;
+       psContext->psParent = GTK_WIDGET(desktop_plugin);
 
        /* Assign private data to plugin */
        desktop_plugin->context = psContext;
@@ -428,15 +429,10 @@ cairo_rounded_rectangle(cairo_t *cr,
 static gboolean
 stock_plugin_expose(GtkWidget* widget, GdkEventExpose *event)
 {
-       PangoLayout*                            layout;
-       PangoFontDescription*           desc;
-       cairo_t*                                        cr;
-       int                                                     width  = 0;
-       int                                                     height = 0;
-
-       GdkRectangle *psRect;
-
-       StockPluginContext *psContext = STOCK_HOME_PLUGIN(widget)->context;
+       cairo_t*                         cr;
+       int                                      width  = 0;
+       int                                      height = 0;
+       GdkRectangle            *psRect;
        
        cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
 
@@ -448,7 +444,11 @@ stock_plugin_expose(GtkWidget* widget, GdkEventExpose *event)
        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_destroy(cr);
@@ -459,10 +459,8 @@ static void
 stock_plugin_class_init (StockPluginClass *klass)
 {
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-       #if 1
        widget_class->realize                   = stock_plugin_realize;
        widget_class->expose_event              = stock_plugin_expose;
-       #endif
        G_OBJECT_CLASS(klass)->finalize = stock_plugin_finalize;
 }