[Sawfish] [PATCH] apps-menu

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi All,

Sorry for the delay, but I got this bug fixed.  The problem was that the
xlockmore.desktop file didn't have a "Categories" key, rather it had a
"Category" key; which is not a supported key in the freedesktop.org
desktop file spec.  Normally this wouldn't be a problem, as if a
..desktop entry doesn't have a "Categories" key then it would be
exiled. In this case, apps-menu uses the key "Category" internally, and
had an erroneous check for it in the process that allowed this entry to
pass the exile-checks and crash when "Categories" was not found.  This
patch removes the erroneous check and for good measure renames the
internal "Category" values to "Saw-Category" to avoid any possible
confusion in the future.

( I appologize if this get's double posted, Ive been having some email issues here )

Cheers

--

matthew
diff --git a/lisp/sawfish/wm/ext/apps-menu.jl b/lisp/sawfish/wm/ext/apps-menu.jl
index a217f91..76c8eb4 100644
--- a/lisp/sawfish/wm/ext/apps-menu.jl
+++ b/lisp/sawfish/wm/ext/apps-menu.jl
@@ -346,9 +346,9 @@ with caution, file may be corrupt.\n"))
       (if (assoc "Categories" fdo-list)
 	  (rplacd (assoc "Categories" fdo-list) "Exile")
 	(setq fdo-list (append fdo-list (cons (cons "Categories" "Exile")))))
-      (if (assoc "Category" fdo-list)
-	  (rplacd (assoc "Category" fdo-list) "Exile")
-	(setq fdo-list (append fdo-list (cons (cons "Category" "Exile")))))
+      (if (assoc "Saw-Category" fdo-list)
+	  (rplacd (assoc "Saw-Category" fdo-list) "Exile")
+	(setq fdo-list (append fdo-list (cons (cons "Saw-Category" "Exile")))))
       ;; Set the Exec key if it does not exist
       (when (not (assoc "Exec" fdo-list))
 	(setq fdo-list (append fdo-list (list exile-cmd))))
@@ -363,8 +363,6 @@ with caution, file may be corrupt.\n"))
 exile it."
     (when fdo-list
       (if (or (and (not (assoc "Categories" fdo-list))
-		   (not (stringp (cdr (assoc "Categories" fdo-list))))
-		   (not (assoc "Category" fdo-list))
 		   (not (stringp (cdr (assoc "Categories" fdo-list)))))
 	      (not (assoc "Exec" fdo-list))
 	      (and (not (assoc "Name" fdo-list))
@@ -377,12 +375,12 @@ exile it."
   (define (fdo-double-check-category fdo-list)
     "Make sure the Category key is present and correctly asigned."
     (when fdo-list
-      (if (assoc "Category" fdo-list)
-	  (if (or (not (stringp (cdr (assoc "Category" fdo-list))))
-		  (equal "" (cdr (assoc "Category" fdo-list)))
-		  (not (stringp (cdr (assoc "Category" fdo-list)))))
-	      (rplacd (assoc "Category" fdo-list) "Exile"))
-	(append fdo-list (cons (cons "Category" "Exile")))))
+      (if (assoc "Saw-Category" fdo-list)
+	  (if (or (not (stringp (cdr (assoc "Saw-Category" fdo-list))))
+		  (equal "" (cdr (assoc "Saw-Category" fdo-list)))
+		  (not (stringp (cdr (assoc "Saw-Category" fdo-list)))))
+	      (rplacd (assoc "Saw-Category" fdo-list) "Exile"))
+	(append fdo-list (cons (cons "Saw-Category" "Exile")))))
     fdo-list)
 
   (define (determine-desktop-name fdo-list)
@@ -457,7 +455,7 @@ desktop-entry through `fdo-associate-categories'."
     "Return the desktop-file-list if the `Category' is of the
 Top-Level variety."
     (when fdol
-      (if (not (equal "Top-Level" (cdr (assoc "Category" fdol))))
+      (if (not (equal "Top-Level" (cdr (assoc "Saw-Category" fdol))))
 	  fdol)))
 
   (define (fdo-default-filter fdol)
@@ -512,7 +510,7 @@ of the categories of the original."
 		      (delete "" (string-split ";" category-string))))
 	    (when categories
 	      (append (list
-		       (append new-fdol (list (cons "Category" (car categories)))))
+		       (append new-fdol (list (cons "Saw-Category" (car categories)))))
 		      (loop (cdr categories)))))))))
 
   ;; Sawfish-menu generation
@@ -536,7 +534,7 @@ of the categories of the original."
     "Generate a menu entry to run the program specified in the the
 desktop file `desk-file'."
     (when (car fdo-list)
-      (cons (list (cdr (assoc "Category" (car fdo-list)))
+      (cons (list (cdr (assoc "Saw-Category" (car fdo-list)))
 		  (determine-desktop-name (car fdo-list))
 		  (determine-desktop-exec (car fdo-list)))
 	    (generate-menu-entry (cdr fdo-list)))))


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/