Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-use-toolbar
@ 2005-11-08  8:08 Katsumi Yamaoka
  2005-11-10  6:32 ` gnus-use-toolbar Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2005-11-08  8:08 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

Hi,

I noticed the `gnus-use-toolbar' variable doesn't influence the
toolbars' appearance in XEmacs, tried to improve it, and gave up.
Though the attached patch might seem to have succeeded apparently,
the value `default' doesn't mean the `defalut-toolbar', which
should be customizable by the menu (Options->Display->Default
Toolbar Location).


[-- Attachment #2: Type: text/x-patch, Size: 4988 bytes --]

--- gnus-xmas.el~	2005-07-06 06:36:13 +0000
+++ gnus-xmas.el	2005-11-08 08:04:00 +0000
@@ -525,17 +525,45 @@
 
 ;;; The toolbar.
 
-(defcustom gnus-use-toolbar (if (featurep 'toolbar)
-				'default-toolbar
-			      nil)
-  "*If nil, do not use a toolbar.
-If it is non-nil, it must be a toolbar.  The five valid values are
-`default-toolbar', `top-toolbar', `bottom-toolbar',
-`right-toolbar', and `left-toolbar'."
-  :type '(choice (const default-toolbar)
-		 (const top-toolbar) (const bottom-toolbar)
-		 (const left-toolbar) (const right-toolbar)
+(defun gnus-xmas-update-toolbars ()
+  "Update the toolbars' appearance."
+  (when (and (not noninteractive)
+	     (featurep 'gnus-xmas))
+    (save-excursion
+      (dolist (buffer (buffer-list))
+	(set-buffer buffer)
+	(cond ((eq major-mode 'gnus-group-mode)
+	       (gnus-xmas-setup-group-toolbar))
+	      ((eq major-mode 'gnus-summary-mode)
+	       (gnus-xmas-setup-summary-toolbar)))))))
+
+(defcustom gnus-use-toolbar (if (featurep 'toolbar) 'default)
+  "*Position to display the toolbar.  Nil means do not use a toolbar.
+If it is non-nil, it should be one of the symbols `default', `top',
+`bottom', `right', and `left'.  `default' means to use the default
+toolbar, the rest mean to display the toolbar on the place which those
+names show."
+  :type '(choice (const default)
+		 (const top) (const bottom) (const left) (const right)
 		 (const :tag "no toolbar" nil))
+  :set (lambda (symbol value)
+	 (set-default symbol value)
+	 (gnus-xmas-update-toolbars))
+  :group 'gnus-xmas)
+
+(defcustom gnus-toolbar-thickness
+  (if (featurep 'toolbar)
+      (cons (specifier-instance default-toolbar-height)
+	    (specifier-instance default-toolbar-width)))
+  "*Cons of the height and the width specifying the thickness of a toolbar.
+The height is used for the toolbar displayed on the top or the bottom,
+the width is used for the toolbar displayed on the right or the left."
+  :type '(choice (cons :tag "height & width"
+		       (integer :tag "height") (integer :tag "width"))
+		 (const :tag "no toolbar" nil))
+  :set (lambda (symbol value)
+	 (set-default symbol value)
+	 (gnus-xmas-update-toolbars))
   :group 'gnus-xmas)
 
 (defvar gnus-group-toolbar
@@ -617,19 +645,52 @@
     [gnus-summary-exit gnus-summary-exit t "Exit this summary"])
   "The summary buffer mail toolbar.")
 
+(defun gnus-xmas-setup-toolbar (toolbar)
+  (when (featurep 'toolbar)
+    (let (bar)
+      (if (and gnus-use-toolbar
+	       (setq bar (intern-soft (format "%s-toolbar" gnus-use-toolbar)))
+	       (message-xmas-setup-toolbar toolbar nil "gnus"))
+	  (progn
+	    (set-specifier (symbol-value bar) toolbar (current-buffer))
+	    (dolist (bar (delq bar
+			       (delq (intern
+				      (format "%s-toolbar"
+					      (default-toolbar-position)))
+				     (list 'default-toolbar
+					   'top-toolbar 'bottom-toolbar
+					   'right-toolbar 'left-toolbar))))
+	      (set-specifier (symbol-value bar) nil (current-buffer)))
+	    (when (setq bar (cdr (assq gnus-use-toolbar
+				       '((default . default-toolbar-height)
+					 (top . top-toolbar-height)
+					 (bottom . bottom-toolbar-height)))))
+	      (set-specifier (symbol-value bar) (car gnus-toolbar-thickness)
+			     (current-buffer)))
+	    (when (setq bar (cdr (assq gnus-use-toolbar
+				       '((default . default-toolbar-width)
+					 (right . right-toolbar-width)
+					 (left . left-toolbar-width)))))
+	      (set-specifier (symbol-value bar) (cdr gnus-toolbar-thickness)
+			     (current-buffer))))
+	(set-specifier default-toolbar nil (current-buffer))
+	(set-specifier top-toolbar nil (current-buffer))
+	(set-specifier bottom-toolbar nil (current-buffer))
+	(set-specifier right-toolbar nil (current-buffer))
+	(set-specifier left-toolbar nil (current-buffer))))
+    (set-specifier default-toolbar-visible-p t (current-buffer))
+    (set-specifier top-toolbar-visible-p t (current-buffer))
+    (set-specifier bottom-toolbar-visible-p t (current-buffer))
+    (set-specifier right-toolbar-visible-p t (current-buffer))
+    (set-specifier left-toolbar-visible-p t (current-buffer))))
+
 (defun gnus-xmas-setup-group-toolbar ()
-  (and gnus-use-toolbar
-       (message-xmas-setup-toolbar gnus-group-toolbar nil "gnus")
-       (set-specifier (symbol-value gnus-use-toolbar)
-		      (cons (current-buffer) gnus-group-toolbar))))
+  (gnus-xmas-setup-toolbar gnus-group-toolbar))
 
 (defun gnus-xmas-setup-summary-toolbar ()
-  (let ((bar (if (gnus-news-group-p gnus-newsgroup-name)
-		 gnus-summary-toolbar gnus-summary-mail-toolbar)))
-    (and gnus-use-toolbar
-	 (message-xmas-setup-toolbar bar nil "gnus")
-	 (set-specifier (symbol-value gnus-use-toolbar)
-			(cons (current-buffer) bar)))))
+  (gnus-xmas-setup-toolbar (if (gnus-news-group-p gnus-newsgroup-name)
+			       gnus-summary-toolbar
+			     gnus-summary-mail-toolbar)))
 
 (defun gnus-xmas-mail-strip-quoted-names (address)
   "Protect mail-strip-quoted-names from nil input.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-use-toolbar
  2005-11-08  8:08 gnus-use-toolbar Katsumi Yamaoka
@ 2005-11-10  6:32 ` Katsumi Yamaoka
  2005-11-10 11:16   ` message-use-toolbar (was Re: gnus-use-toolbar) Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2005-11-10  6:32 UTC (permalink / raw)


>>>>> In <b4m3bm78sur.fsf@jpl.org> Katsumi Yamaoka wrote:

> I noticed the `gnus-use-toolbar' variable doesn't influence the
> toolbars' appearance in XEmacs, tried to improve it, and gave up.
> Though the attached patch might seem to have succeeded apparently,
> the value `default' doesn't mean the `defalut-toolbar', which
> should be customizable by the menu (Options->Display->Default
> Toolbar Location).

I've fixed it after all.  Try the CVS version and:

M-x customize-option RET gnus-use-toolbar RET




^ permalink raw reply	[flat|nested] 3+ messages in thread

* message-use-toolbar (was Re: gnus-use-toolbar)
  2005-11-10  6:32 ` gnus-use-toolbar Katsumi Yamaoka
@ 2005-11-10 11:16   ` Katsumi Yamaoka
  0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2005-11-10 11:16 UTC (permalink / raw)


>>>>> In <b4mfyq557xw.fsf@jpl.org> Katsumi Yamaoka wrote:

> I've fixed it after all.  Try the CVS version and:

> M-x customize-option RET gnus-use-toolbar RET

I've fixed `message-use-toolbar' as well.

If you don't get a toolbar on the message buffer, set
the `message-xmas-glyph-directory' variable explicitly to
the directory in which the files
message-help-up.xpm and message-spell-up.xpm
(or message-help-up.xbm and message-spell-up.xbm) exist.
Those files should be found in the Gnus XEmacs package.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-10 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-08  8:08 gnus-use-toolbar Katsumi Yamaoka
2005-11-10  6:32 ` gnus-use-toolbar Katsumi Yamaoka
2005-11-10 11:16   ` message-use-toolbar (was Re: gnus-use-toolbar) Katsumi Yamaoka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).