Gtk2::FileChooser(3)
π Gtk2::FileChooser π
okay so bestie, meet Gtk2::FileChooser β the Perl wrapper for GtkFileChooser π. And yes, this page lives in the User Contributed Perl Documentation section, so you know it's got that community-maintained glow β¨. It's giving "let the user pick a file, but make it cute and effortless" energy, and honestly? Iconic. Periodt.
π HIERARCHY π
Glib::Interface
+----Gtk2::FileChooser
she inherits from Glib::Interface, as she should π
β¨ METHODS β¨
filechooseraction = $chooser->get_action$chooser->set_action ($action)β grab or set the action, and it's aGtk2::FileChooserAction, no cap$action(Gtk2::FileChooserAction)
$chooser->add_filter ($filter)β toss another filter in the mix$filter(Gtk2::FileFilter)
$chooser->add_shortcut_folder ($folder)β shortlist a folder for quick access$folder(string)
$chooser->add_shortcut_folder_uri ($folder)β same vibe, but with a URI$folder(string)
boolean = $chooser->get_create_foldersβ returns a boolean π¦- Since: gtk+ 2.18
$chooser->set_create_folders ($create_folders)β takes a boolean$create_folders(boolean)- Since: gtk+ 2.18
string = $chooser->get_current_folderβ hands you back a stringboolean = $chooser->set_current_folder ($filename)β and this one gives you a boolean$filename(string)
string = $chooser->get_current_folder_uriβ string, bestieboolean = $chooser->set_current_folder_uri ($uri)β boolean result$uri(string)
$chooser->set_current_name ($name)β set the current name, simple as$name(string)
boolean = $chooser->get_do_overwrite_confirmationβ a boolean, naturally- Since: gtk+ 2.8
$chooser->set_do_overwrite_confirmation ($do_overwrite_confirmation)β takes a boolean$do_overwrite_confirmation(boolean)- Since: gtk+ 2.8
widget = $chooser->get_extra_widgetβ returns a widget π$chooser->set_extra_widget ($extra_widget)β and this one takes one$extra_widget(Gtk2::Widget)
string = $chooser->get_filenameβ string outboolean = $chooser->set_filename ($filename)β boolean back$filename(string)
list = $chooser->get_filenamesβ you get a whole list, obsessed πfilefilter = $chooser->get_filterβ returns aGtk2::FileFilter$chooser->set_filter ($filter)β sets one$filter(Gtk2::FileFilter)
list = $chooser->list_filtersβ a list, as promisedlist = $chooser->list_shortcut_folder_urisβ also a listlist = $chooser->list_shortcut_foldersβ also also a listboolean = $chooser->get_local_onlyβ boolean incoming$chooser->set_local_only ($files_only)β takes a boolean$files_only(boolean)
localized file name = $file_chooser->get_preview_filenameβ returns a localized file name, fancy fr frstring = $file_chooser->get_preview_uriβ returns a stringboolean = $chooser->get_preview_widget_activeβ boolean$chooser->set_preview_widget_active ($active)β takes a boolean$active(boolean)
widget = $chooser->get_preview_widgetβ widget out$chooser->set_preview_widget ($preview_widget)β widget in$preview_widget(Gtk2::Widget)
$chooser->remove_filter ($filter)β yeet that filter out of there$filter(Gtk2::FileFilter)
$chooser->remove_shortcut_folder ($folder)β remove a shortcut folder$folder(string)
$chooser->remove_shortcut_folder_uri ($folder)β remove a shortcut folder, URI edition$folder(string)
$chooser->select_allβ select literally everything, main character energy β¨boolean = $chooser->select_filename ($filename)β boolean result$filename(string)
boolean = $chooser->get_select_multipleβ boolean$chooser->set_select_multiple ($select_multiple)β takes a boolean$select_multiple(boolean)
boolean = $chooser->select_uri ($uri)β boolean$uri(string)
boolean = $chooser->get_show_hiddenβ boolean- Since: gtk+ 2.6
$chooser->set_show_hidden ($show_hidden)β takes a boolean$show_hidden(boolean)- Since: gtk+ 2.6
$chooser->unselect_allβ undo all that selecting π«Ά$chooser->unselect_filename ($filename)β unselect one file by name$filename(string)
$chooser->unselect_uri ($uri)β unselect one by URI$uri(string)
string = $chooser->get_uriβ string outboolean = $chooser->set_uri ($uri)β boolean back$uri(string)
list = $chooser->get_urisβ a list of URIs, slayboolean = $chooser->get_use_preview_labelβ boolean$chooser->set_use_preview_label ($use_label)β takes a boolean$use_label(boolean)
π PROPERTIES π
'action'βGtk2::FileChooserAction : default "open" : readable / writable / private / static-nick / static-blurbβ The type of operation that the file selector is performing'create-folders'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether a file chooser not in open mode will offer the user to create new folders.'do-overwrite-confirmation'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether a file chooser in save mode will present an overwrite confirmation dialog if necessary.'extra-widget'βGtk2::Widget : default undef : readable / writable / private / static-nick / static-blurbβ Application supplied widget for extra options.'file-system-backend'βstring : default undef : writable / construct-only / private / static-nick / static-blurbβ Name of file system backend to use'filter'βGtk2::FileFilter : default undef : readable / writable / private / static-nick / static-blurbβ The current filter for selecting which files are displayed'local-only'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether the selected file(s) should be limited to local file: URLs'preview-widget'βGtk2::Widget : default undef : readable / writable / private / static-nick / static-blurbβ Application supplied widget for custom previews.'preview-widget-active'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether the application supplied widget for custom previews should be shown.'select-multiple'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether to allow multiple files to be selected'show-hidden'βboolean : default false : readable / writable / private / static-nick / static-blurbβ Whether the hidden files and folders should be displayed'use-preview-label'βboolean : default true : readable / writable / private / static-nick / static-blurbβ Whether to display a stock label with the name of the previewed file.
π₯ SIGNALS π₯
Gtk2::FileChooserConfirmation = confirm-overwrite (Gtk2::FileChooser)current-folder-changed (Gtk2::FileChooser)file-activated (Gtk2::FileChooser)selection-changed (Gtk2::FileChooser)update-preview (Gtk2::FileChooser)
π ENUMS AND FLAGS π
enum Gtk2::FileChooserAction
'open'/GTK_FILE_CHOOSER_ACTION_OPEN'save'/GTK_FILE_CHOOSER_ACTION_SAVE'select-folder'/GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER'create-folder'/GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
enum Gtk2::FileChooserConfirmation
'confirm'/GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM'accept-filename'/GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME'select-again'/GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN
enum Gtk2::FileChooserError
'nonexistent'/GTK_FILE_CHOOSER_ERROR_NONEXISTENT'bad-filename'/GTK_FILE_CHOOSER_ERROR_BAD_FILENAME'already-exists'/GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS'incomplete-hostname'/GTK_FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME
π¦ SEE ALSO π¦
Gtk2Glib::Interface
πΈ COPYRIGHT πΈ
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
ok that's the whole page bestie, every flag, every property, every signal, nothing skipped, we ate and left no crumbs π
this was perl v5.42.0, dated 2025-07-25, and it's the Gtk2::FileChooser(3) page signing off π«Ά stay hydrated, read your docs, mwah π
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms