[sawfish] use GtkColorButton instead of GtkPreview



commit 79c5a3e2000904d18f1ea2f699963a74b5590e56
Author: chrisb <zanghar freenet de>
Date:   Fri Jul 3 17:24:42 2009 +0200

    use GtkColorButton instead of GtkPreview

 ChangeLog                         |    3 +++
 lisp/sawfish/gtk/color-preview.jl |   18 +++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2db575f..d77cf08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
 	bump rep-gtk requirement to 0.90.0, therefore bumped gtk+ requirement
 	to 2.12.0
 
+	* lisp/sawfish/gtk/color-preview.jl: use GtkColorButton instead of
+	GtkPreview (for rep-gtk 0.90.0)
+
 2009-07-02  Christopher Bratusek <zanghar freenet de>
 	* po/*
 	* configure.in: de-intltoolize sawfish ... is breaking current
diff --git a/lisp/sawfish/gtk/color-preview.jl b/lisp/sawfish/gtk/color-preview.jl
index f83120e..20eb9bc 100644
--- a/lisp/sawfish/gtk/color-preview.jl
+++ b/lisp/sawfish/gtk/color-preview.jl
@@ -32,7 +32,7 @@
   (defconst color-preview-width 28)
   (defconst color-preview-height 16)
 
-  (define (set-preview-color preview color)
+  (define (set-preview-color color-button color)
     (let ((buf (make-string (* color-preview-width 3))))
       (let ((red (quotient (gdk-color-red color) 256))
 	    (green (quotient (gdk-color-green color) 256))
@@ -43,24 +43,24 @@
 	  (aset buf (1+ (* i 3)) green)
 	  (aset buf (+ 2 (* i 3)) blue)))
       (do ((i 0 (1+ i)))
-	  ((= i color-preview-height))
-	(gtk-preview-draw-row preview buf 0 i color-preview-width))))
+	  ((= i color-preview-height)))))
+
+;; XXX Fixme: Use a Vbox as container instead of another Button
 
   (define (button-new-with-color color-name)
     (let ((button (gtk-button-new))
-	  (preview (gtk-preview-new 'color))
+	  (color-button (gtk-color-button-new 'color))
 	  (color (and color-name (gdk-color-parse-interp color-name))))
-      (gtk-preview-size preview color-preview-width color-preview-height)
       (when color
-	(set-preview-color preview color))
-      (gtk-container-add button preview)
+	(gtk-color-button-set-color color-button color))
+      (gtk-container-add button color-button)
       button))
 
   (define (set-button-color button color-name)
     (let ((color (and color-name (gdk-color-parse-interp color-name))))
       (when color
 	(mapc (lambda (w)
-		(when (gtk-preview-p w)
-		  (set-preview-color w color)
+		(when (gtk-color-button-p w)
+		  (gtk-color-button-set-color w color)
 		  (gtk-widget-draw-interp w)))
 	      (gtk-container-get-children button))))))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]