From xemacs-m  Fri Jul 11 20:02:04 1997
Received: from news.smart.net (jmiller@max1p90.smart.net [206.97.127.90])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id UAA25976
	for <xemacs-beta@xemacs.org>; Fri, 11 Jul 1997 20:02:02 -0500 (CDT)
Received: (from jmiller@localhost)
          by news.smart.net (8.8.4/8.8.4)
	  id VAA07197; Fri, 11 Jul 1997 21:05:16 -0400
Date: Fri, 11 Jul 1997 21:05:16 -0400
Message-Id: <199707120105.VAA07197@news.smart.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Jeff Miller <jmiller@smart.net>
To: xemacs-beta@xemacs.org
Subject: Re: toolbar stuff
In-Reply-To: <199707111231.IAA01805@news.smart.net>
References: <199707110322.XAA32432@news.smart.net>
	<m2oh8az28z.fsf@altair.xemacs.org>
	<199707110409.AAA32589@news.smart.net>
	<m2afjuyxng.fsf@altair.xemacs.org>
	<199707111231.IAA01805@news.smart.net>
X-Mailer: VM 6.32 under 20.3 "Helsinki" XEmacs  Lucid (beta12)
Reply-to: jmiller@smart.net
X-Face: &vGrMZ?Q&W5~yiCR_#hat=$tgJrK`J=2$se?0Nu9I3G|I<2-\:82zx>kz=l8(yw)G1i&0"D
 <nv_e$^;,ftG6@Hn"did"G5i=X_-Z3Y

>>>>> "JM" == Jeff Miller <jmiller@smart.net> writes:

JM>  When I woke up this a.m., I realized a potential stubling block for
JM>  users of these new functions.  The toolbar-add-item is only going to
JM>  work right if the button information already exists in the toolbar
JM>  button-list, ie. the stuff that gets setup in init-x-toolbar in
JM>  x-toolbar.el..

JM>  I'll see what I can come up with to make this easier too.

Here's a patch to x-toolbar.el that should help out.  Basically, it just
makes the the stuff in init-x-toolbar more generic.  You specify a list of 
associative lists and an optional dir.   

so in theory now, you could set up something like:
(setq my-button [toolbar-foo-icon foo t "bleep"]

(toolbar-add-item-data '((toolbar-foo-icon . "my-cool-icon")) "my-icon-dir")
(toolbar-add-item  toolbar-foo-icon  5)

and it should put your icon on the toolbar.

You'll need to redump if you want to try it out.

--- lisp/x11/x-toolbar-orig.el	Fri Jul 11 18:34:04 1997
+++ lisp/x11/x-toolbar.el	Fri Jul 11 20:46:04 1997
@@ -342,9 +342,17 @@
     (toolbar-news-icon     . "news")))
 
 (defun init-x-toolbar ()
+  (toolbar-add-item-data init-x-toolbar-list )
+  ;; do this now because errors will occur if the icon symbols
+  ;; are not initted
+  (set-specifier default-toolbar initial-toolbar-spec))
+  
+(defun toolbar-add-item-data ( icon-list &optional icon-dir )
+  (if (eq icon-dir nil)
+      (setq icon-dir toolbar-icon-directory))
   (mapcar
    (lambda (cons)
-     (let ((prefix (expand-file-name (cdr cons) toolbar-icon-directory)))
+     (let ((prefix (expand-file-name (cdr cons)  icon-dir)))
        (set (car cons)
 	    (if (featurep 'xpm)
 		(toolbar-make-button-list
@@ -359,11 +367,9 @@
 	       (concat prefix "-dn.xbm")
 	       (concat prefix "-xx.xbm")
 	       )))))
-   init-x-toolbar-list)
-  ;; do this now because errors will occur if the icon symbols
-  ;; are not initted
-  (set-specifier default-toolbar initial-toolbar-spec))
-  
+   icon-list  )
+  )
+
 (defvar initial-toolbar-spec
   '(;;[toolbar-last-win-icon	pop-window-configuration
     ;;(frame-property (selected-frame)

