* gnus-util.el (gnus-tool-bar-update): New function.
authorReiner Steib <Reiner.Steib@gmx.de>
Wed, 8 Mar 2006 14:41:02 +0000 (14:41 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Wed, 8 Mar 2006 14:41:02 +0000 (14:41 +0000)
* gnus-group.el (gnus-group-update-tool-bar): New variable.
(gnus-group-insert-group-line): Add gnus-tool-bar-update.

* gnus-topic.el (gnus-topic-prepare-topic): Add gnus-tool-bar-update.

lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus-topic.el
lisp/gnus-util.el

index 170540d..8beda19 100644 (file)
@@ -1,5 +1,12 @@
 2006-03-08  Reiner Steib  <Reiner.Steib@gmx.de>
 
+       * gnus-util.el (gnus-tool-bar-update): New function.
+
+       * gnus-group.el (gnus-group-update-tool-bar): New variable.
+       (gnus-group-insert-group-line): Add gnus-tool-bar-update.
+
+       * gnus-topic.el (gnus-topic-prepare-topic): Add gnus-tool-bar-update.
+
        * gnus-group.el (gnus-group-redraw-when-idle)
        (gnus-group-redraw-check): Remove.
        (gnus-group-make-tool-bar): Remove gnus-group-redraw-check.
index 9eb4625..d748d4d 100644 (file)
@@ -1506,6 +1506,18 @@ if it is a string, only list groups matching REGEXP."
                (gnus-range-difference (list active) (gnus-info-read info))
                seen))))))
 
+(defcustom gnus-group-update-tool-bar
+  (and (not (featurep 'xemacs))
+       (boundp 'tool-bar-mode)
+       tool-bar-mode
+       ;; Using `redraw-frame' (see `gnus-tool-bar-update') in Emacs 21 might
+       ;; be confusing, so maybe we shouldn't call it by default.
+       (fboundp 'force-window-update))
+  "Force updating the group buffer tool bar."
+  :group 'gnus-group
+  :version "22.1"
+  :type 'boolean)
+
 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
                                                    gnus-tmp-marked number
                                                    gnus-tmp-method)
@@ -1570,8 +1582,10 @@ if it is a string, only list groups matching REGEXP."
          (if (member gnus-tmp-group gnus-group-marked)
              gnus-process-mark ? ))
         (buffer-read-only nil)
+        beg end
         header gnus-tmp-header)        ; passed as parameter to user-funcs.
     (beginning-of-line)
+    (setq beg (point))
     (gnus-add-text-properties
      (point)
      (prog1 (1+ (point))
@@ -1586,6 +1600,12 @@ if it is a string, only list groups matching REGEXP."
                  gnus-marked ,gnus-tmp-marked-mark
                  gnus-indentation ,gnus-group-indentation
                  gnus-level ,gnus-tmp-level))
+    (setq end (point))
+    (when gnus-group-update-tool-bar
+      (gnus-put-text-property beg end 'point-entered
+                             'gnus-tool-bar-update)
+      (gnus-put-text-property beg end 'point-left
+                             'gnus-tool-bar-update))
     (forward-line -1)
     (when (inline (gnus-visual-p 'group-highlight 'highlight))
       (gnus-run-hooks 'gnus-group-update-hook))
index fcabe1a..8a873e9 100644 (file)
@@ -584,6 +584,11 @@ articles in the topic and its subtopics."
        (not (eq (nth 2 type) 'hidden))
        level all-entries unread))
     (gnus-topic-update-unreads (car type) unread)
+    (when gnus-group-update-tool-bar
+      (gnus-put-text-property beg end 'point-entered
+                             'gnus-tool-bar-update)
+      (gnus-put-text-property beg end 'point-left
+                             'gnus-tool-bar-update))
     (goto-char end)
     unread))
 
index d034f2c..615563d 100644 (file)
@@ -1432,6 +1432,23 @@ Return nil otherwise."
                                 display))
              display)))))
 
+(defun gnus-tool-bar-update (&rest ignore)
+  "Update the tool bar."
+  (when (and (boundp 'tool-bar-mode)
+            tool-bar-mode)
+    (let* ((args nil)
+          (func (cond ((featurep 'xemacs)
+                       'ignore)
+                      ((fboundp 'tool-bar-update)
+                       'tool-bar-update)
+                      ((fboundp 'force-window-update)
+                       'force-window-update)
+                      ((fboundp 'redraw-frame)
+                       (setq args (list (selected-frame)))
+                       'redraw-frame)
+                      (t 'ignore))))
+      (apply func args))))
+
 ;; Fixme: This has only one use (in gnus-agent), which isn't worthwhile.
 (defmacro gnus-mapcar (function seq1 &rest seqs2_n)
   "Apply FUNCTION to each element of the sequences, and make a list of the results.