File: widget-dialog.jl

package info (click to toggle)
sawfish 1%3A1.3.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,636 kB
  • ctags: 1,327
  • sloc: lisp: 22,765; ansic: 15,810; sh: 10,203; makefile: 675; perl: 19
file content (49 lines) | stat: -rw-r--r-- 1,602 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#| nokogiri-widget-dialog.jl -- simple dialogs from widgets

   $Id: widget-dialog.jl,v 1.7 2003/01/12 20:30:43 jsh Exp $

   Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>

   This file is part of sawfish.

   sawfish is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   sawfish is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with sawfish; see the file COPYING.  If not, write to
   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|#

(define-structure sawfish.gtk.widget-dialog

    (export widget-dialog)

    (open rep
	  gui.gtk-2.gtk
	  sawfish.gtk.stock
	  sawfish.gtk.widget)

  (define (widget-dialog title spec callback
			 #!optional initial-value main-window)

    (let* ((widget (make-widget spec))
	   (vbox (gtk-vbox-new nil box-spacing))
	   (hbox (gtk-hbox-new nil 0)))

      (when initial-value
	(widget-set widget initial-value))

      (gtk-box-pack-start hbox (gtk-label-new title))
      (gtk-container-add vbox hbox)
      (gtk-container-add vbox (widget-gtk-widget widget))
      (gtk-widget-show-all vbox)
      (simple-dialog title vbox
		     (lambda () (callback (widget-ref widget)))
		     main-window))))