[sawfish] When configurator is executed and Sawfish WM is not run, prints a message window. No care is taken f



commit 4156ae62418ec8ece6224ee0166786561b7c2384
Author: Teika kazura <teika lavabit com>
Date:   Sat Aug 21 08:04:03 2010 +0900

    When configurator is executed and Sawfish WM is not run, prints a message window.
    No care is taken for its appearance.

 lisp/sawfish/cfg/shell.jl |   29 +++++++++++++++++++++++++----
 man/news.texi             |    6 ++++++
 2 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/lisp/sawfish/cfg/shell.jl b/lisp/sawfish/cfg/shell.jl
index 4656b6f..1446baf 100644
--- a/lisp/sawfish/cfg/shell.jl
+++ b/lisp/sawfish/cfg/shell.jl
@@ -20,9 +20,7 @@
 
 (define-structure sawfish.cfg.shell
 
-    (export initialize-shell
-	    destroy-shell
-	    run-shell)
+    (export run-shell)
 
     (open rep
 	  gui.gtk-2.gtk
@@ -38,7 +36,8 @@
 	  sawfish.cfg.slot
 	  sawfish.cfg.apply
 	  sawfish.cfg.layout
-	  sawfish.cfg.config)
+	  sawfish.cfg.config
+	  sawfish.cfg.wm)
 
   (defvar *nokogiri-flatten-groups* nil)
   (defvar *nokogiri-single-level* nil)
@@ -264,7 +263,29 @@
 	    (gtk-container-remove slot-box-widget w))
 	  (gtk-container-get-children slot-box-widget)))
 
+  (define (sawfish-absent)
+    ;; Prints error and never returns.
+    (let ((window (gtk-window-new 'toplevel))
+	  (vbox (gtk-vbox-new nil box-spacing))
+	  (label (gtk-label-new "Sawfish configurator needs a running Sawfish. Aborting."))
+	  (button (stock-button 'ok))
+	  (func (lambda () (throw 'quit 1))))
+      (g-signal-connect window "delete_event" func)
+      (gtk-container-add window vbox)
+      (g-signal-connect button "clicked" func)
+      (gtk-container-add vbox label)
+      (gtk-container-add vbox button)
+
+      (gtk-widget-show-all window)
+
+      (setq interrupt-mode 'exit)
+      (recursive-edit)
+      (throw 'quit 1)))
+
   (define (run-shell)
+    (condition-case nil
+	(wm-locale-dir)
+      (error (sawfish-absent)))
     (when (get-command-line-option "--help")
       (write standard-output "\
 usage: sawfish-config [OPTIONS...]\n
diff --git a/man/news.texi b/man/news.texi
index 6169485..bd26195 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -145,6 +145,12 @@ printed to standard error.
 prevents it from (accidently) immediately disappearing.
 [Christopher Bratusek]
 
+ item Configurator invocation without running Sawfish [Teika Kazura]
+
+If you run the configurator but the Sawfish window manager is absent,
+then an alert window is displayed before abortion. The appearance is
+poor, though.
+
 @item Module @code{3d-hack} is not autoloaded anymore.
 
 @item Doc improvements



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