File: clist.scm

package info (click to toggle)
gnome-guile 1.0.1.cvs.19991112-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,324 kB
  • ctags: 1,045
  • sloc: sh: 10,304; ansic: 4,160; lisp: 1,655; makefile: 294
file content (29 lines) | stat: -rw-r--r-- 792 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
(use-modules (gtk gtk))

(define titles #("name" "uid" "gid" "passwd" "gecos" "home" "shell"))

(define window (gtk-window-new 'toplevel))
(define scrolled-window (gtk-scrolled-window-new))
(define clist (gtk-clist-new-with-titles titles))
(gtk-container-add window scrolled-window)
(gtk-container-add scrolled-window clist)

(let loop ((pw (getpwent)))
  (cond (pw
	 (gtk-clist-append clist
			   (vector (passwd:name pw)
				   (number->string (passwd:uid pw))
				   (number->string (passwd:gid pw))
				   (passwd:passwd pw)
				   (passwd:gecos pw)
				   (passwd:dir pw)
				   (passwd:shell pw)))
	 (loop (getpwent)))))

(do ((i 0 (1+ i)))
    ((>= i (vector-length titles)))
  (gtk-clist-set-column-auto-resize clist i #t))

(gtk-widget-show-all window)

(gtk-standalone-main window)