Re: [Patch] apps-menu filtering



Jeremy Hankins <nowan nowan org> writes:

> This works for me, thanks!  One thing, though: would it make sense to
> split the entries (for the categories) before the filter is run?  That
> would simplify modifying categories, since you'd use "equal" instead of
> "string-match", and just set a new Category rather than string-replace.
> That'd mean that the filters would run after
> fdo-associate-categories-filter, would that cause problems?

Just to be clear, I was thinking of something like this:

  (define (split-desktop-entry ent)
    "Split a desktop entry into several entries, each containing one
of the categories of the original."
    (let ((new-ent (filter (lambda (i)
                             (not (string= "Categories" (car i))))
                           ent)))
      (let loop ((categories
                  (delete "" (string-split ";"
                                           (cdr (assoc "Categories" ent))))))
           (when categories
             (append
              (list 
               (append new-ent (list (cons "Category" (car categories)))))
              (loop (cdr categories))))))) 

> The only other thing is that it might make sense to run fdo-check-exile
> (or something similar) after filtering, to catch errors in users'
> filters.  E.g., if I set the category to something silly (e.g., "") that
> currently just wipes out that entry, without producing any kind of
> warning message to help me track down the problem.
>
> Thanks!

-- 
Jeremy Hankins <nowan nowan org>


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