[sawfish] more apps-menu robustness
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] more apps-menu robustness
- Date: Tue, 27 Apr 2010 14:42:50 +0000 (UTC)
commit 5f4ae4ae224be87ffd6224ab7556e18e95b1561f
Author: Christopher Roy Bratusek <zanghar freenet de>
Date: Tue Apr 27 16:42:03 2010 +0200
more apps-menu robustness
ChangeLog | 6 ++++++
lisp/sawfish/wm/ext/apps-menu.jl | 18 +++++++++++++-----
man/news.texi | 5 ++++-
3 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8feef9c..b93a28f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
* configure.in: make xinerama an optional dependency
-- [modified patch from Gentoo]
+ * lisp/sawfish/wm/ext/apps-menu.jl: Allow whitespace and comments
+ at the beginning of .desktop files
+ and skip the file, if the first valid
+ line is not [Desktop Entry].
+ -- [Matthew Love/Teika Kazura]
+
2010-04-06 Teika Kazura <teika lavabit com>
* lisp/sawfish/wm/autoload.jl
* lisp/sawfish/wm/commands.jl
diff --git a/lisp/sawfish/wm/ext/apps-menu.jl b/lisp/sawfish/wm/ext/apps-menu.jl
index 19e1e8f..f731da9 100644
--- a/lisp/sawfish/wm/ext/apps-menu.jl
+++ b/lisp/sawfish/wm/ext/apps-menu.jl
@@ -82,17 +82,25 @@ set this to non-nil.")
;; fdo-desktop-file-parsing
+ (define (desktop-skip-line-p instring)
+ (or (eq (aref instring 0) ?#)
+ (eq (aref instring 0) ?\n)))
+
+ (define (check-if-desktop-stream instream)
+ (let ((line (read-line instream)))
+ (when line
+ (if (string= line "[Desktop Entry]\n")
+ 't
+ (when (desktop-skip-line-p line)
+ (check-if-desktop-stream instream))))))
+
(define (desktop-file-p directory-file)
(condition-case nil
(let ((this-file (open-file directory-file 'read)))
- (string= (read-line this-file) "[Desktop Entry]\n"))
+ (check-if-desktop-stream this-file))
;; unreadable -> return nil
(file-error)))
- (define (desktop-skip-line-p instring)
- (or (eq (aref instring 0) ?#)
- (eq (aref instring 0) ?\n)))
-
(define (desktop-group-p instring)
(eq (aref instring 0) ?\[))
diff --git a/man/news.texi b/man/news.texi
index a411553..8ee28c9 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -24,10 +24,13 @@ window, if that is too small [Fuchur]
@code{maximize-window-fullxinerama}, too, not just in maximize-window
[Nolan Leake]
- item More robustness in applications menu [Teika Kazura]
+ item More robustness in applications menu [Teika Kazura] [Matthew Love]
Before it broke for 'R' (statistics software), and whitespace handling
didn't follow the specification. Phony constants are removed, too.
+
+Allow whitespace and comments at the beginning of .desktop files and skip
+the file, if the first valid line is not [Desktop Entry].
@end itemize
@item New Features
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]