[sawfish] Number widget can take optional initial value [Teika Kazura]



commit 2f6907ea87530a08d76ebadb31ced20220b2b09c
Author: chrisb <zanghar freenet de>
Date:   Sun Aug 30 14:49:52 2009 +0200

    Number widget can take optional initial value [Teika Kazura]

 lisp/sawfish/gtk/widget.jl |   16 +++++++++++-----
 man/news.texi              |    2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/lisp/sawfish/gtk/widget.jl b/lisp/sawfish/gtk/widget.jl
index 0854f43..046d290 100644
--- a/lisp/sawfish/gtk/widget.jl
+++ b/lisp/sawfish/gtk/widget.jl
@@ -61,9 +61,12 @@
 
   ;; predefined widget types are:
 
+  ;;	(choice SYMBOLS)
   ;;	(symbol OPTIONS...)
   ;;	(string)
-  ;;	(number [MIN [MAX]])
+  ;;	(number [MIN [MAX [INITIAL-VALUE]]]) ;; integer only
+  ;;	  The default of minimum is 0, max 65536,
+  ;;	  and initial value is the same as the min.
   ;;	(boolean [LABEL])
   ;;	(color)
   ;;	(font)
@@ -175,8 +178,8 @@
   (define (tooltip-split doc)
     (setq doc (_ doc))
     (if (string-match "\n\n\\s*" doc)
-	(cons (utf8-substring doc 0 (match-start))
-	      (utf8-substring doc (match-end)))
+	(cons (substring doc 0 (match-start))
+	      (substring doc (match-end)))
       (cons doc nil)))
 
   (define (tooltip-set widget tip-string #!optional (key "Foo"))
@@ -266,12 +269,15 @@
 
   (define-widget-type 'string make-string-item)
 
-  (define (make-number-item changed-callback #!optional minimum maximum)
+  (define (make-number-item changed-callback
+                            #!optional minimum maximum initial-value)
     ;; XXX backwards compat..
     (when (eq minimum 'nil) (setq minimum nil))
     (when (eq maximum 'nil) (setq maximum nil))
-    (let ((widget (gtk-spin-button-new-with-range (or minimum -65535)
+    (let ((widget (gtk-spin-button-new-with-range (or minimum 0)
 						  (or maximum 65535) 1)))
+      (when initial-value
+        (gtk-spin-button-set-value widget initial-value))
       (when changed-callback
 	(g-signal-connect
 	 widget "value-changed" (make-signal-callback changed-callback)))
diff --git a/man/news.texi b/man/news.texi
index 139ca34..109d4c4 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -90,7 +90,7 @@ they occurred between. For more detailed information see the
 
 @item Make sure window-type of docks/panels is dock [Timo Korvola]
 
- item Sawfish-Ui does now allow negative values in SpinButtons by default [Christopher Bratusek]
+ item Number widget can take optional initial value [Teika Kazura]
 
 @item Sawfish does now appear in KDE4s WM Selector [Christopher Bratusek]
 



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