xwem-devel
[Top][All Lists]
Advanced

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

[XWEM]: [PATCH] See what happens when you forget to go to bed...


From: Steve Youngs
Subject: [XWEM]: [PATCH] See what happens when you forget to go to bed...
Date: Tue, 30 Nov 2004 05:27:30 +1000
User-agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux)

Summary:

xwem-desktop.el 

        - a bit cleaner way of doing `xwem-desktop-save'.

xwem-weather.el
 
        - don't differentiate between Celsius and Fahrenheit for
          adding the degree symbol. (25°C is just as valid as 80°F)

          Evgeny, this patch doesn't implement 25°C/80°F (still
          couldn't figure out how), but that is definitely the way it
          should be.
 
        - add a new function `xwem-weather-remove' to cleanly remove
          the weather OSD (including the itimer)

        - use `xwem-weather-remove' in the popup menu.  The brute
          force "destroy" method was signaling huge warnings whenever
          it was called and the actual OSD and the itimer weren't
          killed either.  Bad Bad Bad.

xwem-framei.el

        - replace the defface's with something that actually works.
          Be warned, when it comes to colour-coordination, I suck.
          Feel free to change the colours.


--- ./lisp/xwem-desktop.el.orig 2004-11-29 09:51:00.000000000 +1000
+++ ./lisp/xwem-desktop.el      2004-11-30 02:36:20.000000000 +1000
@@ -124,21 +124,15 @@
   (xwem-interactive "FSave xwem desktop to: ")
   (unless file
     (setq file (expand-file-name "xwem-desktop.el" xwem-dir)))
-
-  (let* ((find-file-hooks nil)          ; omit autoinsert and others
-         (buf (find-file-noselect file)))
-    (with-current-buffer buf
-      (erase-buffer buf)
-      (insert (format ";;; %s --- Desktop configuration for XWEM.\n"
-                      (file-name-nondirectory file)))
-      (insert "\n")
-      (insert ";; NOTE: This file is automatically generated by 
xwem-desktop\n")
-      (insert "\n")
-      (mapc 'xwem-desktop-save-element xwem-desktop-goals)
-      (insert "\n")
-      (insert (format ";;; %s ends here\n" (file-name-nondirectory file)))
-      (save-buffer)
-    )))
+  (with-temp-buffer
+    (erase-buffer)
+    (insert 
+     (format ";;; %s --- Desktop configuration for XWEM.\n"
+            (file-name-nondirectory file))
+     "\n;; NOTE: This file is automatically generated by xwem-desktop\n\n")
+    (mapc 'xwem-desktop-save-element xwem-desktop-goals)
+    (insert (format "\n;;; %s ends here\n" (file-name-nondirectory file)))
+    (write-region (point-min) (point-max) file)))
 
 ;;;###autoload(autoload 'xwem-desktop-load "xwem-desktop" nil t)
 (define-xwem-command xwem-desktop-load (&optional file)
--- ./dockapp/xwem-weather.el.orig      2004-11-29 12:01:36.000000000 +1000
+++ ./dockapp/xwem-weather.el   2004-11-30 03:03:09.000000000 +1000
@@ -203,7 +203,7 @@
     (erase-buffer)
     (insert-file-contents-literally xwem-weather-data-file)
     (goto-char (point-min))
-    (re-search-forward "^Temperature: \\(-?[0-9]+ F\\) (\\(-?[0-9]+\\) C)" nil 
t)
+    (re-search-forward "^Temperature: \\(-?[0-9]+\\) F (\\(-?[0-9]+\\) C)" nil 
t)
     (let ((temp-f (match-string 1))
           (temp-c (match-string 2)))
       (if (eq xwem-weather-temperature-format 'celsius)
@@ -224,12 +224,10 @@
     (xwem-osd-set-width xwem-weather-osd we-width)
     (xwem-osd-set-height xwem-weather-osd height)
     (xwem-osd-text xwem-weather-osd text)
-
-    (when (eq xwem-weather-temperature-format 'celsius)
-      (xwem-osd-arc-add xwem-weather-osd
-                        (make-X-Arc :x (- we-width 6) :y 0
-                                    :width 3 :height 3
-                                    :angle1 0 :angle2 360)))))
+    (xwem-osd-arc-add xwem-weather-osd
+                     (make-X-Arc :x (- we-width 6) :y 0
+                                 :width 3 :height 3
+                                 :angle1 0 :angle2 360))))
 
 (define-xwem-command xwem-weather-update ()
   "*Update the weather OSD."
@@ -240,25 +238,30 @@
     (xwem-weather-display-text (xwem-weather-get-temp))))
 
 (define-xwem-command xwem-weather-show-details ()
-  "doc string"
+  "*Show the details of the current weather information."
   (interactive)
   (xwem-help-display "weather"
    (insert-file-contents xwem-weather-data-file)))
 
+(define-xwem-command xwem-weather-remove ()
+  "*Remove the weather OSD."
+  (xwem-interactive)
+  (when (xwem-osd-p xwem-weather-osd)
+    (xwem-osd-destroy xwem-weather-osd))
+  (when (itimerp (get-itimer "xwem-weather-itimer"))
+    (delete-itimer (get-itimer "xwem-weather-itimer"))))
+
 (define-xwem-command xwem-weather-popup-menu ()
   "Popup weather menu."
   (xwem-interactive)
-  
   (unless (button-event-p xwem-last-event)
     (error 'xwem-error "`xwem-weather-popup-menu' must be bound to mouse 
event"))
-
-  (let ((wwin (X-Event-win xwem-last-xevent)))
-    (xwem-popup-menu
-     (list "Weather"
-           (vector "Show details" 'xwem-weather-show-details)
-           (vector "Update" 'xwem-weather-update)
-           "---"
-           (vector "Destroy" `(XDestroyWindow (xwem-dpy) ,wwin))))))
+  (xwem-popup-menu
+   (list "Weather"
+        (vector "Show details" 'xwem-weather-show-details)
+        (vector "Update" 'xwem-weather-update)
+        "---"
+        (vector "Remove" 'xwem-weather-remove))))
 
 (defvar xwem-weather-osd-keymap
   (let ((map (make-sparse-keymap 'xwem-weather-osd-keymap)))
--- ./dockapp/xwem-framei.el.orig       2004-11-30 03:42:25.000000000 +1000
+++ ./dockapp/xwem-framei.el    2004-11-30 03:42:01.000000000 +1000
@@ -67,11 +67,12 @@
   :group 'xwem-framei)
 
 (defface xwem-framei-face
-  `(((destop) (:foreground "green2" :size 28 :family "helvetica"))
-    ((embedded-desktop) (:foreground "green2" :size 28 :family "helvetica"))
-    ((dedicated) (:foreground "green2" :size 24 :family "fixed"))
-    (t (:foreground "green2" :size 28 :family "helvetica")))
-  "*Face used to draw frame number."
+  '((((class color) (background dark))
+     (:foreground "blanchedalmond" :size 48 :family "helvetica"))
+    (((class color) (background light))
+     (:foreground "green2" :size 48 :family "helvetica"))
+    (t (:bold t :size 48)))
+  "Face used to draw frame number."
   :group 'xwem-framei)
 
 (defcustom xwem-framei-select-face-function 'xwem-framei-default-sff
@@ -204,10 +205,9 @@
   "Keymap used for framei osd.")
 
 (defface xwem-framei-dockapp-face
-  `(((desktop) (:foreground "magenta4" :bold t))
-    ((embedded-desktop) (:foreground "magenta4"))
-    ((dedicated) (:foreground "yellowgreen"))
-    (t (:foreground "magenta4" :bold t)))
+  '((((class color) (background dark)) (:foreground "magenta4" :bold t))
+    (((class color) (background light)) (:foreground "blue4" :bold t))
+    (t (:bold t)))
   "Face used to draw in framei dockapp."
   :group 'xwem-faces)
 


-- 
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
|                   Te audire no possum.                   |
|             Musa sapientum fixa est in aure.             |
|----------------------------------<address@hidden>---|

Attachment: pgp4IV0ntKuKY.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]