From xemacs-m  Mon Sep 22 13:09:59 1997
Received: from urn.math.sc.edu (urn.math.sc.edu [129.252.12.10])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id NAA05921
	for <xemacs-beta@xemacs.org>; Mon, 22 Sep 1997 13:09:58 -0500 (CDT)
Received: (from rossini@localhost)
	by urn.math.sc.edu (8.8.5/8.8.5) id OAA05423;
	Mon, 22 Sep 1997 14:10:01 -0400 (EDT)
To: XEmacs Beta List <xemacs-beta@xemacs.org>
Subject: [PATCH] x-toolbar.el, safe beginners version of Mail/News icons.  Was: XEmacs 20.3-beta21 "Bern" is released
References: <m2sov4pezr.fsf@altair.xemacs.org>
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: multipart/mixed;
 boundary="Multipart_Mon_Sep_22_14:10:00_1997-1"
Content-Transfer-Encoding: 7bit
From: Anthony Rossini <rossini@stat.sc.edu>
Date: 22 Sep 1997 14:10:01 -0400
In-Reply-To: SL Baur's message of "17 Sep 1997 00:38:00 -0700"
Message-ID: <wncafh543uu.fsf@urn.math.sc.edu>
Lines: 156
X-Mailer: Gnus v5.5/XEmacs 20.3(beta23) - "Sarajevo"
X-Face:  -<j)glPpyMxjjYa%o`Fl{cZ`VPI-#@E3@_s,TY%)xt`pIu^@MS+d9}>JZ8Fs2;tGK&eaV#.
 U#%d52]n51?][w92.tu+>13)STQ<hSb<b4ZL..rXV*s"Q=otWH?q*M"M|L|O!-[dHa)vx!@i2#+8l~
 fR]Pl&IMU=8";|)Sq-|;x#p]HL~oERC+JI


--Multipart_Mon_Sep_22_14:10:00_1997-1
Content-Type: text/plain; charset=US-ASCII

>>>>> "Steve" == SL Baur <steve@xemacs.org> writes:

    Steve> IMPORTANT: I haven't received a fix for the News/Mail icons
    Steve> on the toolbar.  They will be installed as soon as Tony (or
    Steve> somebody) writes it.  If you do not wish these icons to go
    Steve> away (and have not already customized your toolbar) you
    Steve> might consider backing out the patch to x-toolbar.el.  At
    Steve> any rate the icons are still present in the tarballs, and
    Steve> the XEmacs glyphs are still initialized at dump time.

Here's a patch to x-toolbar.el to make it print a message if Mail and
News aren't configured yet.  I used the other examples of
customization in the file to figure out the code (one of these days
I'll have to really learn it).  There is probably a cleaner and better 
way, I'm a slash-and-hack programmer, not a decent coder.

If you've configured your toolbar already, this shouldn't affect
anything.

best,

-- 
-tony (Anthony Rossini)	           Statistics Dept., U South Carolina
rossini@stat.sc.edu	           Columbia, SC 29208
http://www.stat.sc.edu/~rossini/   803-777-3578(O) 803-777-4048 (fax)  
        "'Bother,' said Pooh, as Cthulhu rose up and ate him."



--Multipart_Mon_Sep_22_14:10:00_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="tool-patch"
Content-Transfer-Encoding: 7bit

--- x-toolbar.el.original	Wed Sep 17 01:19:50 1997
+++ x-toolbar.el	Mon Sep 22 13:38:14 1997
@@ -40,6 +40,22 @@
   "Configure XEmacs Toolbar functions and properties"
   :group 'environment)
 
+
+(defun toolbar-not-configured-message ()
+  (interactive)
+  (message "Toolbar item MUST be configured, first."))
+
+(defcustom toolbar-item-not-configured-function 'toolbar-not-configured-message
+  "*Function to call when News or Mail are not configured yet."
+  :type '(radio (function-item toolbar-not-configured-message)
+                (function :tag "Other"))
+  :group 'toolbar)
+
+(defun toolbar-item-not-configured ()
+  (interactive)
+  (call-interactively toolbar-item-not-configured-function))
+
+
 (defcustom toolbar-open-function 'find-file
   "*Function to call when the open icon is selected."
   :type '(radio (function-item find-file)
@@ -168,7 +184,8 @@
   (apply 'call-process process nil 0 nil args))
 
 (defcustom toolbar-mail-commands-alist
-  `((vm		. vm)
+  `((item-not-configured . toolbar-item-not-configured)
+    (vm		. vm)
     (gnus	. gnus-no-server)
     (rmail	. rmail)
     (mh		. mh-rmail)
@@ -183,13 +200,13 @@
   :type '(repeat (cons (symbol :tag "Mailer") (function :tag "Start with")))
   :group 'toolbar)
 
-(defcustom toolbar-mail-reader 'vm
+(defcustom toolbar-mail-reader 'item-not-configured
   "*Mail reader toolbar will invoke.
 The legal values are the keys from `toolbar-mail-command-alist', which should
 be used to add new mail readers.
 
-Mail readers known by default are vm, gnus, rmail, mh, pine, elm, mutt,
-exmh and netscape."
+Mail readers known by default are item-not-configured, vm, gnus,
+rmail, mh, pine, elm, mutt, exmh and netscape."
   :type '(symbol :validate (lambda (wid)
 			     (if (assq (widget-value wid) toolbar-mail-commands-alist)
 				 nil
@@ -258,7 +275,8 @@
 ;;
 
 (defcustom toolbar-news-commands-alist
-  `((gnus	. gnus)			; M-x all-hail-gnus
+  `((item-not-configured . toolbar-item-not-configured)
+    (gnus	. toolbar-gnus)			; M-x all-hail-gnus
     (rn		. (toolbar-external "xterm" "-e" "rn"))
     (nn		. (toolbar-external "xterm" "-e" "nn"))
     (trn	. (toolbar-external "xterm" "-e" "trn"))
@@ -273,13 +291,13 @@
   :type '(repeat (cons (symbol :tag "Reader") (sexp :tag "Start with")))
   :group 'toolbar)
 
-(defcustom toolbar-news-reader 'gnus
+(defcustom toolbar-news-reader 'item-not-configured
   "*News reader toolbar will invoke.
 The legal values are the keys from `toolbar-news-command-alist', which should
 be used to add new news readers.
 
-Newsreaders known by default are gnus, rn, nn, trn, xrn, slrn, pine and
-netscape."
+Newsreaders known by default are item-not-configured, gnus, rn, nn,
+trn, xrn, slrn, pine and netscape."
   :type '(symbol :validate (lambda (wid)
 			     (if (assq (widget-value wid) toolbar-news-commands-alist)
 				 nil
@@ -298,7 +316,7 @@
 (defvar toolbar-news-frame-properties nil
   "The properties of the frame in which news is displayed.")
 
-(defun toolbar-news ()
+(defun toolbar-gnus ()
   "Run Gnus in a separate frame."
   (interactive)
   (when (or (not toolbar-news-frame)
@@ -318,6 +336,14 @@
   (select-frame toolbar-news-frame)
   (raise-frame toolbar-news-frame))
 
+(defun toolbar-news ()
+  "Run News (in a separate frame??)."
+  (interactive)
+  (let ((command (assq toolbar-news-reader toolbar-news-commands-alist)))
+    (if (not command)
+	(error "Unknown news reader %s" toolbar-news-reader))
+    (funcall (cdr command))))
+
 (defvar toolbar-last-win-icon nil "A `last-win' icon set.")
 (defvar toolbar-next-win-icon nil "A `next-win' icon set.")
 (defvar toolbar-file-icon     nil "A `file' icon set.")
@@ -412,11 +438,11 @@
     [toolbar-undo-icon		toolbar-undo	t	"Undo edit"]
     [toolbar-spell-icon		toolbar-ispell	t	"Spellcheck"]
     [toolbar-replace-icon	toolbar-replace	t	"Replace text"]
-    ;; [toolbar-mail-icon		toolbar-mail	t	"Mail"]
+    [toolbar-mail-icon		toolbar-mail	t	"Mail"]
     [toolbar-info-icon		toolbar-info	t	"Information"]
     [toolbar-compile-icon	toolbar-compile	t	"Compile"]
     [toolbar-debug-icon		toolbar-debug	t	"Debug"]
-    ;; [toolbar-news-icon		toolbar-news	t	"News"]
+    [toolbar-news-icon		toolbar-news	t	"News"]
 )
   "The initial toolbar for a buffer.")
 

--Multipart_Mon_Sep_22_14:10:00_1997-1--

