annotate lisp/w3/w3-prefs.el @ 44:8d2a9b52c682 r19-15prefinal

Import from CVS: tag r19-15prefinal
author cvs
date Mon, 13 Aug 2007 08:55:10 +0200
parents c53a95d3c46d
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; w3-prefs.el --- Preferences panels for Emacs-W3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
3 ;; Created: 1997/03/21 15:52:22
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
4 ;; Version: 1.23
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: hypermedia, preferences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;;
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
11 ;;; This file is part of GNU Emacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; You should have received a copy of the GNU General Public License
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
26 ;;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Preferences panels for Emacs-W3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (require 'w3-vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'w3-keyword)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
34 (require 'w3-toolbar)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
35 (eval-and-compile
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
36 (require 'w3-widget))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defvar w3-preferences-panel-begin-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defvar w3-preferences-panel-end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar w3-preferences-panels '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (appearance . "Appearance")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (images . "Images")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (cookies . "HTTP Cookies")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (hooks . "Various Hooks")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (compatibility . "Compatibility")
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
46 (proxy . "Proxy")
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
47 (privacy . "Privacy")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (defun w3-preferences-generic-variable-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (set (widget-get widget 'variable) (widget-value widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (error (message "Invalid or incomplete data..."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defun w3-preferences-restore-variables (vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (let ((temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (while vars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq temp (intern (format "w3-preferences-temp-%s" (car vars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (set (car vars) (symbol-value temp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (setq vars (cdr vars)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (defun w3-preferences-create-temp-variables (vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (let ((temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (while vars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq temp (intern (format "w3-preferences-temp-%s" (car vars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (set (make-local-variable temp) (symbol-value (car vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (setq vars (cdr vars)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;; Appearance of the frame / pages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun w3-preferences-init-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (let ((vars '(w3-toolbar-orientation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 w3-use-menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 w3-honor-stylesheets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 w3-default-stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 w3-default-homepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 w3-toolbar-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (set (make-local-variable 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (and w3-default-homepage t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (w3-preferences-create-temp-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defun w3-preferences-create-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; First the toolbars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (widget-insert "\nToolbars\n--------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (widget-insert "\tShow Toolbars as:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (widget-create 'radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 :value (symbol-value 'w3-preferences-temp-w3-toolbar-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 :notify 'w3-preferences-generic-variable-callback
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
92 :format "%v"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (list 'item :format "%t\t" :tag "Pictures" :value 'pictures)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (list 'item :format "%t\t" :tag "Text" :value 'text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (list 'item :format "%t" :tag "Both" :value 'both))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 'variable 'w3-preferences-temp-w3-toolbar-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (widget-insert "\n\tToolbars appear on ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (widget-create 'choice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 :value (symbol-value 'w3-preferences-temp-w3-toolbar-orientation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 :format "%v"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 :tag "Toolbar Position"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (list 'choice-item :format "%[%t%]" :tag "XEmacs Default" :value 'default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (list 'choice-item :format "%[%t%]" :tag "Top" :value 'top)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (list 'choice-item :format "%[%t%]" :tag "Bottom" :value 'bottom)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (list 'choice-item :format "%[%t%]" :tag "Right" :value 'right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (list 'choice-item :format "%[%t%]" :tag "Left" :value 'left)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (list 'choice-item :format "%[%t%]" :tag "No Toolbar" :value 'none))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 'variable 'w3-preferences-temp-w3-toolbar-orientation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (widget-insert " side of window.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; Home page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (widget-insert "\nStartup\n--------\n\tBrowser starts with:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 'radio
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
118 :format "%v"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 :value (symbol-value 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (list 'item :format "%t\t" :tag "Blank Page" :value nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (list 'item :format "%t" :tag "Home Page Location" :value t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 'variable 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (widget-insert "\n\t\tURL: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (widget-create
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
127 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 :value (or (symbol-value 'w3-preferences-temp-w3-default-homepage) "None")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 :notify 'w3-preferences-generic-variable-callback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 'variable 'w3-preferences-temp-w3-default-homepage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;; Stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (widget-insert "\nStyle\n--------\n\tDefault stylesheet:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 'file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 :value (or (symbol-value 'w3-preferences-temp-w3-default-stylesheet) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 :must-match t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 :notify 'w3-preferences-generic-variable-callback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 'variable 'w3-preferences-temp-w3-default-stylesheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (widget-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (defun w3-preferences-save-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (let ((vars '(w3-toolbar-orientation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 w3-use-menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 w3-honor-stylesheets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 w3-default-stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 w3-toolbar-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (if (symbol-value 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq vars (cons 'w3-default-homepage vars))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (setq w3-default-homepage nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (w3-preferences-restore-variables vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (w3-toolbar-make-buttons)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;;; The images panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (defun w3-preferences-init-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (let ((vars '(w3-delay-image-loads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 w3-image-mappings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (w3-preferences-create-temp-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (defun w3-preferences-create-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 'checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 :value (symbol-value 'w3-preferences-temp-w3-delay-image-loads))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 'variable 'w3-preferences-temp-w3-delay-image-loads)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (widget-insert " Delay Image Loads\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (defun w3-preferences-save-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (let ((vars '(w3-delay-image-loads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 w3-image-mappings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (w3-preferences-restore-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;;; The cookies panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (defun w3-preferences-init-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (let ((cookies url-cookie-storage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (secure-cookies url-cookie-secure-storage))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (defun w3-preferences-create-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (widget-insert "\n\t\tSorry, not yet implemented.\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (defun w3-preferences-save-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;; The hooks panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (defvar w3-preferences-hooks-variables
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
202 '(w3-load-hook
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 w3-mode-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 w3-preferences-cancel-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 w3-preferences-default-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 w3-preferences-ok-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 w3-preferences-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 w3-source-file-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (defun w3-preferences-init-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (w3-preferences-create-temp-variables w3-preferences-hooks-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defun w3-preferences-create-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (let ((todo w3-preferences-hooks-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (pt nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (doc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (setq cur (car todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 todo (cdr todo)
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
222 doc (documentation-property cur 'variable-documentation))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (if (string-match "^\\*" doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (setq doc (substring doc 1 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (setq pt (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (widget-insert "\n" (symbol-name cur) " - " doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (fill-region-as-paragraph pt (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (setq cur (intern (format "w3-preferences-temp-%s" cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 'sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 :value (or (symbol-value cur) "nil"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 'variable cur))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (defun w3-preferences-save-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (w3-preferences-restore-variables w3-preferences-hooks-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;;; The compatibility panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (defvar w3-preferences-compatibility-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (w3-netscape-compatible-comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 . "Allow Netscape compatible comments")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (w3-user-colors-take-precedence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 . "Ignore netscape document color control")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (url-honor-refresh-requests
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 . "Allow Netscape `Client Pull'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "A list of variables that the preferences compability pane knows about.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (defun w3-preferences-init-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (w3-preferences-create-temp-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (mapcar 'car w3-preferences-compatibility-variables))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (defun w3-preferences-create-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (while compat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (setq cur (car compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 compat (cdr compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 var (intern (format "w3-preferences-temp-%s" (car cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (widget-create 'checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 :value (symbol-value var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 'variable var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (widget-insert " " (cdr cur) "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (defun w3-preferences-save-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (w3-preferences-restore-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (mapcar 'car w3-preferences-compatibility-variables)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;; The proxy configuration panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (defun w3-preferences-init-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (port-var nil)
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
291 (host nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
292 (port nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
293 (proxy-entry nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
300 proxy-entry (cdr-safe (assoc (downcase proxy) url-proxy-services)))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
301 (if (and proxy-entry (string-match "\\(.*\\):\\([0-9]+\\)" proxy-entry))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
302 (setq host (match-string 1 proxy-entry)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
303 port (match-string 2 proxy-entry))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
304 (setq host proxy-entry
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
305 port nil))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
306 (set (make-local-variable host-var) (or host ""))
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
307 (set (make-local-variable port-var) (or port ""))))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
308 (set (make-local-variable 'w3-preferences-temp-no-proxy)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
309 (cdr-safe (assoc "no_proxy" url-proxy-services))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (defun w3-preferences-create-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (urlobj nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 port-var (intern (format "w3-%s-proxy-port" (downcase proxy))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (widget-insert (format "%10s Proxy: " proxy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (widget-put
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
325 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 :size 20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 :value (format "%-20s" (symbol-value host-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 'variable host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (widget-insert " Port: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (widget-put
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
333 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 :size 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 :value (format "%5s" (symbol-value port-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 'variable port-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (widget-insert "\n\n"))
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
340 (widget-insert " No proxy: ")
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
341 (widget-put
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
342 (widget-create 'editable-field
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
343 :size 40
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
344 :value-face 'underline
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
345 :notify 'w3-preferences-generic-variable-callback
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
346 :value (or (symbol-value 'w3-preferences-temp-no-proxy) ""))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
347 'variable 'w3-preferences-temp-no-proxy)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (defun w3-preferences-save-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (urlobj nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (host nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (port nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (new-proxy-services nil))
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
359 (if (/= 0 (length (symbol-value 'w3-preferences-temp-no-proxy)))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
360 (setq new-proxy-services (cons
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
361 (cons
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
362 "no_proxy"
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
363 (symbol-value 'w3-preferences-temp-no-proxy))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
364 new-proxy-services)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 urlobj (url-generic-parse-url
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (assoc (downcase proxy) url-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 host (symbol-value host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 port (symbol-value port-var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (if (and host (/= 0 (length host)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq new-proxy-services (cons (cons (downcase proxy)
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
377 (format "%s:%s" host
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (or port "80")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 new-proxy-services))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq url-proxy-services new-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
383 ;;; Privacy panel
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
384 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
385
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
386 (defsubst w3-preferences-privacy-bits-sort (bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
387 (sort bits (function (lambda (a b)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
388 (memq b (memq a '(email os lastloc agent cookie)))))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
389
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
390 (defvar url-valid-privacy-levels
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
391 '((paranoid . (email os lastloc agent cookie))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
392 (high . (email lastloc))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
393 (low . (lastloc))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
394 (none . nil)))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
395
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
396 (defvar w3-preferences-privacy-bit-widgets nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
397 (defvar w3-preferences-privacy-level-widget nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
398 (defvar w3-preferences-temp-url-privacy-level nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
399 ;; darnit i just noticed the checklist widget, this should probably be
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
400 ;; reimplemented with that instead of checkboxes, but i've almost finished.
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
401 (defun w3-preferences-privacy-bit-callback (widget &rest ignore)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
402 (let ((privacy-bits (if (listp w3-preferences-temp-url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
403 w3-preferences-temp-url-privacy-level
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
404 (copy-list (cdr-safe (assq w3-preferences-temp-url-privacy-level url-valid-privacy-levels)))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
405 (bit (widget-get widget 'bit))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
406 (val (widget-value widget)))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
407 (if val
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
408 (setq privacy-bits (delq bit privacy-bits))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
409 (setq privacy-bits (w3-preferences-privacy-bits-sort (cons bit (delq bit privacy-bits)))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
410 (setq w3-preferences-temp-url-privacy-level
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
411 (or (car (rassoc privacy-bits url-valid-privacy-levels))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
412 privacy-bits))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
413 (widget-value-set w3-preferences-privacy-level-widget
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
414 (if (listp w3-preferences-temp-url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
415 'custom
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
416 w3-preferences-temp-url-privacy-level))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
417 ))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
418
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
419
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
420 (defun w3-preferences-privacy-level-callback (widget &rest ignore)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
421 (let* ((val (widget-value widget))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
422 (privacy-bits (cdr-safe (assq val url-valid-privacy-levels))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
423 (if (eq val 'custom) nil
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
424 (setq w3-preferences-temp-url-privacy-level val)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
425 (mapcar (function (lambda (bit)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
426 (widget-value-set (cdr bit)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
427 (not (memq (car bit)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
428 privacy-bits)))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
429 w3-preferences-privacy-bit-widgets))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
430 ))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
431
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
432 (defun w3-preferences-init-privacy-panel ()
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
433 (w3-preferences-create-temp-variables '(url-privacy-level
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
434 url-cookie-confirmation))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
435 (setq w3-preferences-privacy-bit-widgets nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
436 (setq w3-preferences-privacy-level-widget nil))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
437
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
438 (defsubst w3-preferences-create-privacy-bit-widget (bit bit-text current-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
439 (let ((bit-widget (widget-create
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
440 'checkbox
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
441 :value (not (memq bit current-bits))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
442 :notify 'w3-preferences-privacy-bit-callback
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
443 )))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
444 (widget-put bit-widget 'bit bit)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
445 (setq w3-preferences-privacy-bit-widgets (cons (cons bit bit-widget)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
446 w3-preferences-privacy-bit-widgets))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
447 (widget-insert " " bit-text "\n")))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
448
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
449
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
450 (defun w3-preferences-create-privacy-panel ()
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
451 (let ((privacy-bits (if (listp url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
452 url-privacy-level
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
453 (cdr-safe (assq url-privacy-level url-valid-privacy-levels)))))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
454 (widget-insert "\n")
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
455 (widget-insert "General Privacy Level: ")
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
456 ;;; XXX something is weird with case folding in the following widget if you
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
457 ;;; type an option in lower case it accepts it but doesn't do anything
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
458 (setq w3-preferences-privacy-level-widget
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
459 (widget-create
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
460 'choice
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
461 :value (if (listp w3-preferences-temp-url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
462 'custom
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
463 w3-preferences-temp-url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
464 :notify 'w3-preferences-privacy-level-callback
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
465 :format "%v"
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
466 :tag "Privacy Level"
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
467 (list 'choice-item :format "%[%t%]" :tag "Paranoid" :value 'paranoid)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
468 (list 'choice-item :format "%[%t%]" :tag "High" :value 'high)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
469 (list 'choice-item :format "%[%t%]" :tag "Low" :value 'low)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
470 (list 'choice-item :format "%[%t%]" :tag "None" :value 'none)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
471 (list 'choice-item :format "%[%t%]" :tag "Custom" :value 'custom)))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
472 (widget-put w3-preferences-privacy-level-widget 'variable 'w3-preferences-temp-url-privacy-level)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
473
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
474 (widget-insert "\n(controls the options below)\n\nSend the following information with each request:\n")
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
475 (setq w3-preferences-privacy-bit-widgets nil)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
476 (w3-preferences-create-privacy-bit-widget 'email "E-mail address" privacy-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
477 (w3-preferences-create-privacy-bit-widget 'lastloc "Last location visited" privacy-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
478 (w3-preferences-create-privacy-bit-widget 'os "Operating system information" privacy-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
479 (w3-preferences-create-privacy-bit-widget 'agent "User agent information" privacy-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
480 (w3-preferences-create-privacy-bit-widget 'cookie "Accept cookies" privacy-bits)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
481 (widget-insert " ")
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
482 (widget-put
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
483 (widget-create
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
484 'checkbox
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
485 :value (symbol-value 'w3-preferences-temp-url-cookie-confirmation)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
486 :notify 'w3-preferences-generic-variable-callback)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
487 'variable 'w3-preferences-temp-url-cookie-confirmation)
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
488 (widget-insert " Ask before accepting cookies\n"))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
489 (widget-setup))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
490
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
491 (defun w3-preferences-save-privacy-panel ()
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
492 (w3-preferences-restore-variables '(url-privacy-level
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
493 url-cookie-confirmation))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
494 (url-setup-privacy-info))
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
495
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
496 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (defun w3-preferences-create-panel (panel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (let ((func (intern (format "w3-preferences-create-%s-panel" panel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (inhibit-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (delete-region w3-preferences-panel-begin-marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 w3-preferences-panel-end-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (funcall func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (insert (format "You should be seeing %s right now.\n" panel))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (set-marker-insertion-type w3-preferences-panel-end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (widget-forward 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun w3-preferences-notify (widget widget-ignore &optional event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (let* ((glyph (and event w3-running-xemacs (event-glyph event)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
518 (x (and glyph (widget-glyphp glyph) (event-glyph-x-pixel event)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
519 (y (and glyph (widget-glyphp glyph) (event-glyph-y-pixel event)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (map (widget-get widget 'usemap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (value (widget-value widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (if (and map x y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (setq value (w3-point-in-map (vector x y) map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (if value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (w3-preferences-create-panel value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defun w3-preferences-save-options ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (w3-menu-save-options))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (defun w3-preferences-ok-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (run-hooks 'w3-preferences-ok-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (setq func (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (format "w3-preferences-save-%s-panel" (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (funcall func)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (w3-preferences-save-options)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (message "Options saved")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (kill-buffer (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (defun w3-preferences-reset-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (setq func (intern (format "w3-preferences-init-%s-panel"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (if (and func (fboundp func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (defun w3-preferences-cancel-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (if (not (funcall url-confirmation-func "Cancel and lose all changes? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (error "Not cancelled!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (run-hooks 'w3-preferences-cancel-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (defun w3-preferences-reset-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (run-hooks 'w3-preferences-default-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (w3-preferences-create-panel (caar w3-preferences-panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (defvar w3-preferences-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 "*Hooks to be run before setting up the preferences buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (defvar w3-preferences-cancel-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 "*Hooks to be run when cancelling the preferences (Cancel was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (defvar w3-preferences-default-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 "*Hooks to be run when resetting preference defaults (Defaults was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (defvar w3-preferences-ok-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 "*Hooks to be run before saving the preferences (OK was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (defun w3-preferences-init-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (let ((todo w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (setq func (intern (format "w3-preferences-init-%s-panel" (caar todo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 todo (cdr todo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (and (fboundp func) (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
588 ;;###autoload
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (defun w3-preferences-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (let* ((prefs-buffer (get-buffer-create "W3 Preferences"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (widget nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (window-conf (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (set-buffer prefs-buffer)
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
597 (set (make-local-variable 'widget-push-button-gui) nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (w3-preferences-init-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (set-window-buffer (selected-window) prefs-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (make-local-variable 'widget-field-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (setq w3-preferences-panel-begin-marker (make-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 w3-preferences-panel-end-marker (make-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (set-marker-insertion-type w3-preferences-panel-begin-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (use-local-map widget-keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (run-hooks 'w3-preferences-setup-hook)
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
608 (setq widget (apply 'widget-create 'menu-choice
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
609 :tag "Panel"
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
610 :notify 'w3-preferences-notify
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
611 :value 'appearance
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
612 (mapcar
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
613 (function
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
614 (lambda (x)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
615 (list 'choice-item
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
616 :format "%[%t%]"
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
617 :tag (cdr x)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
618 :value (car x))))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
619 w3-preferences-panels)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (insert "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (set-marker w3-preferences-panel-begin-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (w3-preferences-create-panel (caar w3-preferences-panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (widget-insert "\n\n")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
627 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 :notify 'w3-preferences-ok-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 :value "Ok")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (widget-insert " ")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
631 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 :notify 'w3-preferences-cancel-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 :value "Cancel")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (widget-insert " ")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
635 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 :notify 'w3-preferences-reset-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 :value "Reset")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (center-region (point-min) w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (center-region w3-preferences-panel-end-marker (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (provide 'w3-prefs)