[sawfish: 4/6] Poweroff refinements.



commit bc5ce41d25d291795e5412f76135fc091832b7b7
Author: Teika kazura <teika lavabit com>
Date:   Thu Dec 10 18:31:49 2009 +0900

    Poweroff refinements.
    Describes the option if you want poweroff menu.
    Option "extra-session-menu" is renamed to 'want-poweroff-menu'.

 OPTIONS                                   |    3 ++
 lisp/sawfish/wm/integration/gnome.jl      |    2 +-
 lisp/sawfish/wm/integration/kde.jl        |    2 +-
 lisp/sawfish/wm/integration/standalone.jl |   37 +++++++++++++++--------------
 lisp/sawfish/wm/user.jl                   |    4 +-
 man/news.texi                             |    8 +++---
 6 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/OPTIONS b/OPTIONS
index acfe930..012079b 100644
--- a/OPTIONS
+++ b/OPTIONS
@@ -190,6 +190,9 @@
 ;; (define-special-variable apps-menu-alphabetize 't
 ;;   "Sort the apps menu alphabetically.")
 
+;; (define-special-variable want-poweroff-menu t
+;;   "Add poweroff menu if you don't use GNOME / KDE.")
+
 ;; window placement options
 
 ;;  (define-special-variable place-window-mode 'top-left
diff --git a/lisp/sawfish/wm/integration/gnome.jl b/lisp/sawfish/wm/integration/gnome.jl
index 37011a3..36879ac 100644
--- a/lisp/sawfish/wm/integration/gnome.jl
+++ b/lisp/sawfish/wm/integration/gnome.jl
@@ -30,7 +30,7 @@
 
   (define-structure-alias gnome-int sawfish.wm.integration.gnome)
 
-  (define-special-variable extra-session-menu nil)
+  (define-special-variable want-poweroff-menu nil)
 
   ;; invoke the GNOME terminal instead of xterm
   (unless (variable-customized-p 'xterm-program)
diff --git a/lisp/sawfish/wm/integration/kde.jl b/lisp/sawfish/wm/integration/kde.jl
index 57e616c..2980393 100644
--- a/lisp/sawfish/wm/integration/kde.jl
+++ b/lisp/sawfish/wm/integration/kde.jl
@@ -30,7 +30,7 @@
 
   (define-structure-alias kde-int sawfish.wm.integration.kde)
 
-  (define-special-variable extra-session-menu nil)
+  (define-special-variable want-poweroff-menu nil)
 
   ;; invoke the KDE terminal instead of xterm
   (unless (variable-customized-p 'xterm-program)
diff --git a/lisp/sawfish/wm/integration/standalone.jl b/lisp/sawfish/wm/integration/standalone.jl
index 69dd103..6cd04f9 100644
--- a/lisp/sawfish/wm/integration/standalone.jl
+++ b/lisp/sawfish/wm/integration/standalone.jl
@@ -1,6 +1,6 @@
-;; standalone.jl
+;; standalone.jl - For those who don't have GNOME / KDE
 
-;; Copyright (C) 2000 John Harper <john dcs warwick ac uk>
+;; Copyright (C) 2009 Christopher Roy Bratusek <zanghar freenet de>
 
 ;; This file is part of sawfish.
 
@@ -20,7 +20,7 @@
 
 (define-structure sawfish.wm.integration.standalone
 
-  (export add-extra-session-menu)
+  (export add-poweroff-menu)
 
   (open rep
         rep.system
@@ -30,18 +30,19 @@
 
   (define-structure-alias standalone-int sawfish.wm.integration.standalone)
 
-  (defvar extra-session-menu t)
-
-  (define (add-extra-session-menu)
-    (if extra-session-menu
-      (let ((menu (assoc (_ "Sessi_on") root-menu)))
-        (when menu
-          (nconc menu `(()
-                        (,(_ "_Reboot System")
-                         (poweroff 'reboot))
-                        (,(_ "_Shutdown System")
-                         (poweroff 'halt))
-                        (,(_ "S_uspend System")
-                         (poweroff 'suspend))
-                        (,(_ "_Hibernate System")
-                         (poweroff 'hibernate)))))))))
+  (defvar want-poweroff-menu t
+    "Add poweroff menu if you don't use GNOME / KDE.")
+
+  (define (add-poweroff-menu)
+    "Add poweroff related menu items to Session sub-menu."
+    (let ((menu (assoc (_ "Sessi_on") root-menu)))
+      (when menu
+	(nconc menu `(()
+		      (,(_ "_Reboot System")
+		       (poweroff 'reboot))
+		      (,(_ "_Shutdown System")
+		       (poweroff 'halt))
+		      (,(_ "S_uspend System")
+		       (poweroff 'suspend))
+		      (,(_ "_Hibernate System")
+		       (poweroff 'hibernate))))))))
diff --git a/lisp/sawfish/wm/user.jl b/lisp/sawfish/wm/user.jl
index ca232e4..30a3dc9 100644
--- a/lisp/sawfish/wm/user.jl
+++ b/lisp/sawfish/wm/user.jl
@@ -124,8 +124,8 @@
   (if use-custom-font-color
       (update-frame-font-color))
 
-  (if extra-session-menu
-    (add-extra-session-menu))
+  (if want-poweroff-menu
+      (add-poweroff-menu))
 
   ;; use a default theme if none given
   (unless (or batch-mode default-frame-style)
diff --git a/man/news.texi b/man/news.texi
index 11a0825..dd03005 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -294,10 +294,10 @@ Unless set by user, konsole and konqueror are used for user options
 
 @item Poweroff from menu
 
-Added poweroff commands in menu for non KDE/GNOME users.
-They are reboot, halt, suspend and hibernate. The used shell commands
-can be set from configurator, under ``Misc'' -> ``External
-Applications''.
+Added poweroff commands in menu for non KDE/GNOME users.  They are
+reboot, halt, suspend and hibernate. The used shell commands can be
+set from configurator, under ``Misc'' -> ``External Applications''. If
+you don't want it, set @code{want-poweroff-menu} to nil.
 
 User needs the appropriate privilege. For a way to do so, see
 @xref{FAQ}, ``Shutdown privilege'' section.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]