* riece-toolbar.el (riece-toolbar-original-toolbar) [XEmacs]: New
authorueno <ueno>
Sat, 27 Aug 2005 00:30:21 +0000 (00:30 +0000)
committerueno <ueno>
Sat, 27 Aug 2005 00:30:21 +0000 (00:30 +0000)
variable.
(riece-unset-toolbar): New function.
(riece-toolbar-uninstall): Call riece-unset-toolbar.
(riece-toolbar-command-mode-hook): Renamed from
riece-toolbar-insinuate-in-command-buffer.

* riece-icon.el (riece-icon-enable): Update
mode-line-buffer-identification here.
(riece-icon-disable): Ditto.

lisp/ChangeLog
lisp/riece-icon.el
lisp/riece-toolbar.el

index c954052..5abeab8 100644 (file)
@@ -1,3 +1,18 @@
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-menu.el (riece-menu-uninstall): Call easy-menu-remove.
+
+       * riece-toolbar.el (riece-toolbar-original-toolbar) [XEmacs]: New
+       variable.
+       (riece-unset-toolbar): New function.
+       (riece-toolbar-uninstall): Call riece-unset-toolbar.
+       (riece-toolbar-command-mode-hook): Renamed from
+       riece-toolbar-insinuate-in-command-buffer.
+
+       * riece-icon.el (riece-icon-enable): Update
+       mode-line-buffer-identification here.
+       (riece-icon-disable): Ditto.
+
 2005-08-26  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-addon.el (riece-uninstall-addon): Update
index a417f91..e3232bd 100644 (file)
@@ -318,6 +318,25 @@ Modify whole identification by side effect."
       (add-hook 'riece-update-buffer-functions
                'riece-icon-update-channel-list-buffer t t)))
 
+(defun riece-icon-insinuate ()
+  (add-hook 'riece-user-list-mode-hook
+           'riece-icon-user-list-mode-hook)
+  (add-hook 'riece-channel-list-mode-hook
+           'riece-icon-channel-list-mode-hook))
+
+(defun riece-icon-uninstall ()
+  (remove-hook 'riece-user-list-mode-hook
+              'riece-icon-user-list-mode-hook)
+  (remove-hook 'riece-channel-list-mode-hook
+              'riece-icon-channel-list-mode-hook)
+  (save-excursion
+    (set-buffer riece-user-list-buffer)
+    (remove-hook 'riece-update-buffer-functions
+                'riece-icon-update-user-list-buffer)
+    (set-buffer riece-channel-list-buffer)
+    (remove-hook 'riece-update-buffer-functions
+                'riece-icon-update-user-list-buffer)))
+
 (defvar riece-icon-original-mode-line-buffer-identification nil)
 
 (defun riece-icon-update-mode-line-buffer-identification ()
@@ -332,40 +351,21 @@ Modify whole identification by side effect."
                   riece-mode-line-buffer-identification)))
        (setq buffers (cdr buffers))))))
 
-(defun riece-icon-insinuate ()
+(defun riece-icon-enable ()
   (setq riece-icon-original-mode-line-buffer-identification
        (symbol-function 'riece-mode-line-buffer-identification))
   (defalias 'riece-mode-line-buffer-identification
-    #'riece-icon-modeline-buffer-identification)
-  (riece-icon-update-mode-line-buffer-identification)
-  (add-hook 'riece-user-list-mode-hook
-           'riece-icon-user-list-mode-hook)
-  (add-hook 'riece-channel-list-mode-hook
-           'riece-icon-channel-list-mode-hook))
-
-(defun riece-icon-uninstall ()
-  (fset 'riece-mode-line-buffer-identification
-       riece-icon-original-mode-line-buffer-identification)
+    'riece-icon-modeline-buffer-identification)
   (riece-icon-update-mode-line-buffer-identification)
-  (save-excursion
-    (set-buffer riece-user-list-buffer)
-    (remove-hook 'riece-update-buffer-functions
-                'riece-icon-update-user-list-buffer)
-    (set-buffer riece-channel-list-buffer)
-    (remove-hook 'riece-update-buffer-functions
-                'riece-icon-update-user-list-buffer))
-  (remove-hook 'riece-user-list-mode-hook
-              'riece-icon-user-list-mode-hook)
-  (remove-hook 'riece-channel-list-mode-hook
-              'riece-icon-channel-list-mode-hook))
-
-(defun riece-icon-enable ()
   (setq riece-icon-enabled t)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel))
   (riece-emit-signal 'channel-list-changed))
 
 (defun riece-icon-disable ()
+  (fset 'riece-mode-line-buffer-identification
+       riece-icon-original-mode-line-buffer-identification)
+  (riece-icon-update-mode-line-buffer-identification)
   (setq riece-icon-enabled nil)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel))
index dcc104d..1335eca 100644 (file)
                              (symbol-name (car pointer)))))))
                (setq pointer (cdr pointer)))
              toolbar))
+         (defvar riece-toolbar-original-toolbar nil)
          (defun riece-set-toolbar (toolbar)
-           (set-specifier default-toolbar toolbar (current-buffer))))
+           (make-local-variable 'riece-toolbar-original-toolbar)
+           (setq riece-toolbar-original-toolbar
+                 (specifier-specs default-toolbar (current-buffer)))
+           (set-specifier default-toolbar toolbar (current-buffer)))
+         (defun riece-unset-toolbar ()
+           (set-specifier default-toolbar riece-toolbar-original-toolbar
+                          (current-buffer))
+           (kill-local-variable 'riece-toolbar-original-toolbar)))
       (defalias 'riece-make-toolbar-from-menu 'ignore)
-      (defalias 'riece-set-toolbar 'ignore))
+      (defalias 'riece-set-toolbar 'ignore)
+      (defalias 'riece-unset-toolbar 'ignore))
   (defun riece-make-toolbar-from-menu (items menu-items map)
     (let ((pointer items)
          (tool-bar-map (make-sparse-keymap)))
       tool-bar-map))
   (defun riece-set-toolbar (toolbar)
     (make-local-variable 'tool-bar-map)
-    (setq tool-bar-map toolbar)))
+    (setq tool-bar-map toolbar))
+  (defun riece-unset-toolbar ()
+    (kill-local-variable 'tool-bar-map)))
 
 (defvar riece-command-mode-map)
-(defun riece-toolbar-insinuate-in-command-buffer ()
+(defun riece-toolbar-command-mode-hook ()
   (riece-set-toolbar
    (riece-make-toolbar-from-menu
     riece-toolbar-items
 
 (defun riece-toolbar-insinuate ()
   (add-hook 'riece-command-mode-hook
-           'riece-toolbar-insinuate-in-command-buffer
+           'riece-toolbar-command-mode-hook
            t))
 
 (defun riece-toolbar-uninstall ()
   (remove-hook 'riece-command-mode-hook
-              'riece-toolbar-insinuate-in-command-buffer)
-  ;;FIXME: couldn't uninstall completely.
-  )
+              'riece-toolbar-command-mode-hook)
+  (with-current-buffer riece-command-buffer
+    (riece-unset-toolbar)))
 
 (provide 'riece-toolbar)