(gnus-offline-menu): New variable.
authorczkmt <czkmt>
Sat, 11 Sep 1999 19:30:33 +0000 (19:30 +0000)
committerczkmt <czkmt>
Sat, 11 Sep 1999 19:30:33 +0000 (19:30 +0000)
(gnus-offline-get-menu-items): New function.
(gnus-offline-define-menu-on-miee): Use it.
(gnus-offline-define-menu-on-agent): Ditto.

lisp/gnus-offline.el

index 11e7ed4..e0e0eb6 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-offline.el --- To process mail & news at offline environment.
-;;; $Id: gnus-offline.el,v 1.1.2.5.2.36.4.5 1999-09-03 15:42:54 czkmt Exp $
+;;; $Id: gnus-offline.el,v 1.1.2.5.2.36.4.6 1999-09-11 19:30:33 czkmt Exp $
 
 ;;; Copyright (C) 1998 Tatsuya Ichikawa
 ;;;                    Yukihiro Ito
@@ -278,7 +278,18 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
     (empting-spool-6 . "Sending messages in spool ... done.")
     (interval-time-1 . "Interval time (now %d minutes) : ")
     (interval-time-2 . "Retrieving message logic by timer is disabled.")
-    (interval-time-3 . "Interval time set to %d minutes")))
+    (interval-time-3 . "Interval time set to %d minutes")
+    (menu-miee-1 . "Post news in spool")
+    (menu-miee-2 . "Send mails in spool")
+    (menu-miee-3 . "Message Offline")
+    (menu-miee-4 . "Message Online")
+    (menu-1 . "Toggle articles to fetch")
+    (menu-2 . "Toggle online/offline send mail")
+    (menu-3 . "Toggle auto hangup")
+    (menu-4 . "Expire articles")
+    (menu-5 . "Set interval time")
+    (menu-6 . "Hang up Line.")
+    (menu-7 . "Customize options...")))
 
 (defvar gnus-offline-resource-ja
   '((error-check-1
@@ -311,7 +322,20 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
     (interval-time-2 . "\e$B<+F0Aw<u?.5!G=$r\e(B \e$B%*%U\e(B \e$B$K$7$^$7$?!#\e(B")
     (interval-time-3 . "\e$B<+F0Aw<u?.$N4V3V$r\e(B %d \e$BJ,$K@_Dj$7$^$7$?!#\e(B")))
 
-(defvar gnus-offline-resource-ja_complete gnus-offline-resource-ja)
+(defvar gnus-offline-resource-ja_complete
+  (append
+   gnus-offline-resource-ja
+   '((menu-miee-1 . "Spool \e$B$K$"$k5-;v$NAw?.\e(B")
+     (menu-miee-2 . "Spool \e$B$K$"$k\e(B Mail \e$B$NAw?.\e(B")
+     (menu-miee-3 . "Offline \e$B>uBV$X\e(B")
+     (menu-miee-4 . "Online \e$B>uBV$X\e(B")
+     (menu-1 . "\e$B<hF@5-;v<oN`$NJQ99\e(B")
+     (menu-2 . "Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B")
+     (menu-3 . "\e$B<+F0@ZCG$N@ZBX$(\e(B")
+     (menu-4 . "\e$B<hF@:Q5-;v$r>C$9\e(B")
+     (menu-5 . "\e$B5-;v<hF@4V3V;~4V$N@_Dj\e(B")
+     (menu-6 . "\e$B2s@~$N@ZCG\e(B")
+     (menu-7 . "\e$B%W%m%Q%F%#\e(B..."))))
 
 ;;; Functions
 
@@ -754,11 +778,11 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
 (defun gnus-offline-agent-expire ()
   "*Expire expirable article on News group."
   (interactive)
-  (when gnus-offline-agent-automatic-expire
-    (let ((gnus-agent-expire-all (if (eq 0 gnus-agent-expire-days)
-                                    nil
-                                  gnus-agent-expire-all)))
-      (gnus-agent-expire))))
+  (and gnus-offline-agent-automatic-expire
+       (if (eq 0 gnus-agent-expire-days)
+          (let (gnus-agent-expire-all)
+            (gnus-agent-expire))
+        (gnus-agent-expire))))
 ;;
 ;; Menu.
 ;;
@@ -807,63 +831,46 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
                          gnus-group-toolbar))))))
 ;;
 ;;
+(defun gnus-offline-get-menu-items (list)
+  (mapcar
+   #'(lambda (el)
+       (if (listp el)
+          (apply
+           'vector
+           (cons (gnus-offline-get-message (car el)) (cdr el)))
+        el))
+   list))
+
+(defvar gnus-offline-menu
+  (gnus-offline-get-menu-items
+   '((menu-1 gnus-offline-toggle-articles-to-fetch t)
+     (menu-2 gnus-offline-toggle-on/off-send-mail t)
+     (menu-3 gnus-offline-toggle-auto-hangup t)
+     "----"
+     (menu-4 gnus-offline-agent-expire
+            (eq gnus-offline-news-fetch-method 'nnagent))
+     (menu-5 gnus-offline-set-interval-time t)
+     "----"
+     (menu-6 gnus-offline-set-unplugged-state gnus-offline-connected)
+     "----"
+     (menu-7 gnus-ofsetup-customize t))))
+
 (defun gnus-offline-define-menu-on-miee ()
   "*Set and change menu bar on MIEE menu."
-  (let ((menu
-        (if (string= gnus-offline-lang "ja_complete")
-            (easy-menu-change
-             nil
-             "Miee"
-             '(
-               ["Spool \e$B$K$"$k5-;v$NAw?.\e(B" news-spool-post t]
-               ["Spool \e$B$K$"$k\e(B Mail \e$B$NAw?.\e(B" mail-spool-send t]
-               "----"
-               ["Offline \e$B>uBV$X\e(B" message-offline-state
-                (not message-offline-state)]
-               ["Online \e$B>uBV$X\e(B" message-online-state message-offline-state]
-               "----"
-               ("Gnus Offline"
-                ["\e$B<hF@5-;v<oN`$NJQ99\e(B" gnus-offline-toggle-articles-to-fetch t]
-                ["Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B"
-                 gnus-offline-toggle-on/off-send-mail t]
-                ["\e$B<+F0@ZCG$N@ZBX$(\e(B" gnus-offline-toggle-auto-hangup t]
-                "----"
-                ["\e$B<hF@:Q5-;v$r>C$9\e(B" gnus-offline-agent-expire
-                 (eq gnus-offline-news-fetch-method 'nnagent)]
-                ["\e$B5-;v<hF@4V3V;~4V$N@_Dj\e(B" gnus-offline-set-interval-time t]
-                "----"
-                ["\e$B2s@~$N@ZCG\e(B" gnus-offline-set-unplugged-state
-                 gnus-offline-connected]
-                "----"
-                ["\e$B%W%m%Q%F%#\e(B..." gnus-ofsetup-customize t])
-               ))
-          (easy-menu-change
-           nil
-           "Miee"
-           '(
-             ["Post news in spool" news-spool-post t]
-             ["Send mails in spool" mail-spool-send t]
-             "----"
-             ["Message Offline" message-offline-state
-              (not message-offline-state)]
-             ["Message Online" message-online-state message-offline-state]
-             "----"
-             ("Gnus Offline"
-              ["Toggle articles to fetch"
-               gnus-offline-toggle-articles-to-fetch t]
-              ["Toggle online/offline send mail"
-               gnus-offline-toggle-on/off-send-mail t]
-              ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
-              "----"
-              ["Expire articles" gnus-offline-agent-expire
-               (eq gnus-offline-news-fetch-method 'nnagent)]
-              ["Set interval time" gnus-offline-set-interval-time t]
-              "----"
-              ["Hang up Line." gnus-offline-set-unplugged-state
-               gnus-offline-connected]
-              "----"
-              ["Customize options..." gnus-ofsetup-customize t]
-              ))))))
+  (let ((miee-menu
+        (gnus-offline-get-menu-items
+         '((menu-miee-1 news-spool-post t)
+           (menu-miee-2 mail-spool-send t)
+           "----"
+           (menu-miee-3 message-offline-state (not message-offline-state))
+           (menu-miee-4 message-online-state message-offline-state)
+           "----")))
+       menu)
+    (setq menu
+         (easy-menu-change
+          nil "Miee"
+          (append miee-menu
+                  (list (cons "Gnus Offline" gnus-offline-menu)))))
     (and (featurep 'xemacs)
         (easy-menu-add menu))))
 ;;
@@ -871,37 +878,9 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
 ;;
 (defun gnus-offline-define-menu-on-agent ()
   "*Set menu bar on OFFLINE menu."
-  (easy-menu-define 
-   gnus-offline-menu-on-agent
-   gnus-group-mode-map
-   "Gnus offline Menu"
-   (if (string= gnus-offline-lang "ja_complete")
-       '("Offline"
-        ["\e$B<hF@5-;v<oN`$NJQ99\e(B" gnus-offline-toggle-articles-to-fetch t]
-        ["Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B" gnus-offline-toggle-on/off-send-mail
-         t]
-        ["\e$B<+F0@ZCG$N@ZBX$(\e(B" gnus-offline-toggle-auto-hangup t]
-        "----"
-        ["\e$B<hF@:Q5-;v$r>C$9\e(B" gnus-offline-agent-expire
-         (eq gnus-offline-news-fetch-method 'nnagent)]
-        ["\e$B5-;v<hF@4V3V;~4V$N@_Dj\e(B" gnus-offline-set-interval-time t]
-        "----"
-        ["\e$B2s@~$N@ZCG\e(B" gnus-offline-set-unplugged-state gnus-offline-connected]
-        "----"
-        ["\e$B%W%m%Q%F%#\e(B..." gnus-ofsetup-customize t])
-     '("Offline"
-       ["Toggle articles to fetch" gnus-offline-toggle-articles-to-fetch t]
-       ["Toggle online/offline send mail" gnus-offline-toggle-on/off-send-mail
-       t]
-       ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
-       "----"
-       ["Expire articles" gnus-offline-agent-expire
-       (eq gnus-offline-news-fetch-method 'nnagent)]
-       ["Set interval time" gnus-offline-set-interval-time t]
-       "----"
-       ["Hang up Line." gnus-offline-set-unplugged-state gnus-offline-connected]
-       "----"
-       ["Customize options..." gnus-ofsetup-customize t])))
+  (easy-menu-define
+   gnus-offline-menu-on-agent gnus-group-mode-map "Gnus offline Menu"
+   (cons "Offline" gnus-offline-menu))
   (and (featurep 'xemacs)
        (easy-menu-add gnus-offline-menu-on-agent)))
 ;;
@@ -909,7 +888,7 @@ Please check your .emacs or .gnus.el to work nnspool fine.")
 ;;
 (defvar gnus-offline-popup-menu nil)
 (defun gnus-offline-popup-menu (event)
-  "Popup menu for Gnus offline."
+  "Popup menu for Gnus Offline."
   (interactive "e")
   (unless gnus-offline-popup-menu
     (setq gnus-offline-popup-menu