Unless I'm misunderstanding the documentation. It seems that the ENABLED-P
slot in the button descriptor only gets evaluated when the specifier is
evaluated.
I am in the midst of writing all the test cases for XEmacs/GTK and first
off was making sure dynamically-enabled toolbar buttons worked. Guess
what, they don't work in XEmacs 21.1.10 either. :(
With this test function:
-------------------------------------------------------------------------------
(defvar gtk-torture-test-toolbar-open-active-p t)
(defvar gtk-torture-test-toolbar
'([toolbar-file-icon
(lambda ()
(setq gtk-torture-test-toolbar-open-active-p (not
gtk-torture-test-toolbar-open-active-p)))
gtk-torture-test-toolbar-open-active-p
"Open a file"]
[toolbar-folder-icon toolbar-dired t "Edit a directory"]
[toolbar-disk-icon toolbar-save t "Save buffer"]
[toolbar-printer-icon toolbar-print t "Print buffer"]
[toolbar-cut-icon toolbar-cut t "Kill region"]
[toolbar-copy-icon toolbar-copy t "Copy region"]
[toolbar-paste-icon toolbar-paste t "Paste from clipboard"]
[toolbar-undo-icon toolbar-undo t "Undo edit"]
[toolbar-spell-icon toolbar-ispell t "Check spelling"]
[toolbar-replace-icon toolbar-replace t "Search & Replace"]
[toolbar-mail-icon toolbar-mail t "Read mail"]
[toolbar-info-icon toolbar-info t "Info documentation"]
[toolbar-compile-icon toolbar-compile t "Start a compilation"]
[toolbar-debug-icon toolbar-debug t "Start a debugger"]
[toolbar-news-icon toolbar-news t "Read news"]
))
(defun gtk-torture-test-toolbar ()
(interactive)
(switch-to-buffer (get-buffer-create "Toolbar testing"))
(set-specifier default-toolbar gtk-torture-test-toolbar (current-buffer))
(set-specifier default-toolbar-visible-p t (current-buffer)))
-------------------------------------------------------------------------------
If you do M-x gtk-torture-test-toolbar, you will get a buffer with a
toolbar that looks normal, but if you click the 'open' button, I would have
expected the toolbar button to be immediately marked as disabled. But it
is not until you switch buffers to another buffer and then back to the
'Toolbar testing' buffer.
If this is the way things are meant to be, then the documentation in
default-toolbar needs to be updated to reflect this. It makes it sound
like this slot will get evaluated quite a bit.
Perhaps if there was a (set-toolbar-dirty-flag position) function... but
that is kind of ugly.
-Bill P.
Show replies by date