File: clist.scm

package info (click to toggle)
guile-gtk-1.2 0.31-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,544 kB
  • ctags: 2,413
  • sloc: sh: 11,073; ansic: 3,380; lisp: 1,058; makefile: 106
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)