Package: gtk
Interface gtk:file-chooser
Superclassesgobject:object, common-lisp:standard-object, common-lisp:t Documented SubclassesDirect SlotsDetails      The gtk:file-chooser interface is an interface that can be
    implemented by file selection widgets.  
  The main widgets that implement this interface are the  gtk:file-chooser-widget and gtk:file-chooser-dialog widgets.  You do not need to write a widget that implements the gtk:file-chooser
  interface unless you are trying to adapt an existing file selector to expose
  a standard programming interface. The gtk:file-chooser interface allows for shortcuts to various places in the filesystem. In the default implementation these are displayed in the left pane. It may be a bit confusing at first that these shortcuts come from various sources and in various flavours, so lets explain the terminology here: 
 File Names and EncodingsWhen the user is finished selecting files in a gtk:file-chooser widget, the program can get the selected filenames as g:file objects.Examples
(defun create-file-chooser-dialog (parent)
  (let ((filter-all (gtk:file-filter-new))
        (filter-picture (gtk:file-filter-new))
        (dialog (gtk:file-chooser-dialog-new "File Chooser Dialog"
                                             parent
                                             :open
                                             "Open" 100
                                             "Cancel" :cancel)))
    (setf (gtk:window-modal dialog) t)
    (g:signal-connect dialog "response"
                      (lambda (dialog response)
                        (format t "  Response is ~a~%" response)
                        (unless (eq :cancel
                                    (gtk:response-type-keyword response))
                          (format t "Selected file is ~a~%"
                                  (gtk:file-chooser-namestring dialog)))
                        (gtk:window-destroy dialog)))
    ;; Add a file filter
    (setf (gtk:file-filter-name filter-all) "All Files")
    (gtk:file-filter-add-pattern filter-all "*")
    (gtk:file-chooser-add-filter dialog filter-all)
    ;; Add a second file filter for pictures
    (setf (gtk:file-filter-name filter-picture) "All Pictures")
    (gtk:file-filter-add-pixbuf-formats filter-picture)
    (gtk:file-chooser-add-filter dialog filter-picture)
    ;; Present the dialog
    (gtk:window-present dialog)))        Warning | Slot Access Functions
 Inherited Slot Access FunctionsSee also | 
2025-07-25