Package: gtk

Function gtk-file-filter-add-custom

Lambda List

gtk-file-filter-add-custom (filter needed func)

Arguments

filter -- a gtk-file-filter object
needed -- bitfield of gtk-file-filter-flags flags indicating the information that the custom filter function needs
func -- callback function, if the function returns true, then the file will be displayed

Details

Adds rule to a filter that allows files based on a custom callback function. The bitfield needed which is passed in provides information about what sorts of information that the filter function needs. This allows GTK+ to avoid retrieving expensive information when it is not needed by the filter.

Example

(defun custom-file-filter (filter-info)
  ;; Select files with upcase characters in the display name
  (let ((display-name (gtk-file-filter-info-display-name filter-info)))
    (string= display-name
             (string-upcase display-name))))
...
(let ((filter-custom (gtk-file-filter-new)))
  ;; Add a custom file filter
  (setf (gtk-file-filter-name filter-custom) "Custom Filter")
  (gtk-file-filter-add-custom filter-custom
                              :display-name
                              #'custom-file-filter)
  (gtk-file-chooser-add-filter chooser filter-custom)
  ... )    
 

See also

2021-1-29