[banshee/gtk3] [widget] Fix LinearProgress widget for gtk3
- From: Olivier Dufour <dufoli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/gtk3] [widget] Fix LinearProgress widget for gtk3
- Date: Sun, 3 Jul 2011 16:00:14 +0000 (UTC)
commit 3c39461a93566041ca0e0b0184185a5f556758a4
Author: Olivier Dufour <olivier duff gmail com>
Date: Sun Jul 3 17:44:39 2011 +0200
[widget] Fix LinearProgress widget for gtk3
.../Banshee.Widgets/LinearProgress.cs | 24 +++++++++----------
1 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/src/Core/Banshee.Widgets/Banshee.Widgets/LinearProgress.cs b/src/Core/Banshee.Widgets/Banshee.Widgets/LinearProgress.cs
index b70730f..3931abd 100644
--- a/src/Core/Banshee.Widgets/Banshee.Widgets/LinearProgress.cs
+++ b/src/Core/Banshee.Widgets/Banshee.Widgets/LinearProgress.cs
@@ -35,7 +35,6 @@ namespace Banshee.Widgets
public class LinearProgress : Gtk.DrawingArea
{
private double fraction;
- private static Cairo.Context bar_gc = null;
public LinearProgress()
{
@@ -46,24 +45,23 @@ namespace Banshee.Widgets
protected override bool OnDrawn (Cairo.Context cr)
{
- if(bar_gc == null) {
- bar_gc = Gdk.CairoHelper.Create (GdkWindow);
- Gdk.Color color = Hyena.Gui.GtkUtilities.ColorBlend(Style.Background(StateType.Normal),
- Style.Foreground(StateType.Normal));
- bar_gc.Background = color;
- bar_gc.Foreground = color;
- }
-
- DrawGdk();
+ cr.Save ();
+ Gdk.RGBA color = Hyena.Gui.GtkUtilities.ColorBlend(StyleContext.GetBackgroundColor(StateFlags.Normal),
+ StyleContext.GetColor(StateFlags.Normal));
+ cr.SetSourceRGBA(color.Red, color.Green, color.Blue, color.Alpha);
+ DrawGdk(cr);
+ cr.Restore ();
return false;
}
- private void DrawGdk()
+ private void DrawGdk(Cairo.Context cr)
{
int bar_width = (int)((double)Allocation.Width * fraction - 3.0);
- GdkWindow.DrawRectangle(bar_gc, false, 0, 0, Allocation.Width - 1, Allocation.Height - 1);
+ cr.Rectangle(0, 0, Allocation.Width - 1, Allocation.Height - 1);
+ cr.Fill ();
if(bar_width > 0) {
- GdkWindow.DrawRectangle(bar_gc, true, 2, 2, bar_width, Allocation.Height - 4);
+ cr.Rectangle(2, 2, bar_width, Allocation.Height - 4);
+ cr.Fill ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]