annotate lisp/w3/w3-prefs.el @ 186:24ac94803b48

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