Gtk2::E...rectory(3)
π Gtk2::Ex::Dialogs::ChooseDirectory π
okay bestie, welcome to the Gtk2::Ex::Dialogs::ChooseDirectory page from the User Contributed Perl Documentation manual π this one's a little Perl module that pops up a directory picker, and honestly? she's iconic for it.
β¨ NAME β¨
Gtk2::Ex::Dialogs::ChooseDirectory β Provides a file selection dialog. (yes bestie, a file selection dialog, that's literally what the original says, no I will not be editing the official description, that's a crime π«Ά)
πΈ SYNOPSIS πΈ
use Gtk2::Ex::Dialogs::ChooseDirectory ( destroy_with_parent => TRUE,
modal => TRUE );
# do some stuff like creating your app's main $window then,
# to ensure that all messages use the right parent, set it:
$Gtk2::Ex::Dialogs::ChooseDirectory::parent_window = $window;
# now popup a new dialog for selecting an existing directory
my $dir = select Gtk2::Ex::Dialogs::ChooseDirectory ( "/path/to/somewhere" );
# ok, now we need to create a new directory (doesn't actually make
# the directory), returns a dir that does not exist.
my $dir = create Gtk2::Ex::Dialogs::ChooseDirectory ( "/path/to/somewhere" );
no cap, that's the whole vibe right there. you use it with your options, you set the parent window so all your dialogs know who their mother is, then you select or create. that's it. slay. π
π¦ DESCRIPTION π¦
okay so this module gives you a simple file chooser api that wraps Gtk2::FileChooser objectively. the whole mission statement β the ~objective~, if you will β is a simple way to prompt a user to open or save a file. periodt. π
it's giving "I'm the friend who handles the boring GTK2 boilerplate so you don't have to." lowkey obsessed.
β¨ OPTIONS β¨
bestie, listen. all public methods (and like, the entire class too, she's generous like that) support the following options:
title => STRINGβ the text string that becomes the title of the dialog window. defaults to either"Select"or"Create"depending on the action context β she picks based on the vibe of what you're doing β¨path => STRINGβ the path to a file or directory you wanna initialize the dialog with. defaults to the current working directory, which honestly is a very reasonable default, we respect her for it.parent_window => Gtk2::Windowβ a reference to your main application window. the mother of the operation, if you will πdestroy_with_parent => BOOLβ so when theparent_windowgets destroyed... what do we do? defaults toFALSE. that's the whole description, bestie, the manpage is not elaborating and neither am I πmodal => BOOLβ does this dialog make theparent_windowfreeze while the dialog exists? defaults toFALSE. (frozen parent window is giving "girl you are NOT going anywhere until you pick a directory") π§must_exist => BOOLβ the end-user must supply a path to an existing file or directory. and if they hand over a non-existant path? the dialog gets respawned until an existing file is chosen. she will not let it go. defaults toFALSE. π
side note: non-existant is spelled exactly like that in the original and I am NOT touching it, that's a relic, that's history, that's protected π
π PUBLIC METHODS π
OBJECT = new ( OPTIONS | PATH )
create a Gtk2::FileChooserDialog with the options you gave her and show it to the end-user. once the user has selected a directory, return only the path to the directoy and clean up. π§
and in the special case of being passed only one argument? all options get set to defaults and that one lonely argument gets used as the path argument. main character energy for a single string fr fr.
directoy is also spelled exactly like that in the original. we love her, typos and all. π«Ά
RESPONSE = ask_to_select ( OPTIONS | PATH )
supports all the same arguments as new(). this creates a new Gtk2::Ex::Dialogs::ChooseDirectory with some specific defaults, and returns the user's response. and if you give her only one argument, it gets used as the path option. same deal as always, bestie. β
RESPONSE = ask_to_create ( OPTIONS | PATH )
supports all the same arguments as new() too. creates a new Gtk2::Ex::Dialogs::ChooseDirectory with some specific defaults, and returns the user's response. one argument only? guess what β path option. π
π SEE ALSO π
go read these, they're her friends and they're all slaying in their own lanes:
Gtk2::FileChooserGtk2::FileChooserDialogGtk2::Ex::DialogsGtk2::Ex::Dialogs::ChooseDirectoryGtk2::Ex::Dialogs::ChooseFileGtk2::Ex::Dialogs::ChoosePreviewFileGtk2::Ex::Dialogs::ErrorMsgGtk2::Ex::Dialogs::MessageGtk2::Ex::Dialogs::Question
π BUGS π
found a bug? please report any bugs to the mailing list. that's it, that's the instruction, go tell the list, they're lovely, they'll listen π«Ά
π MAILING LIST π
http://opendoorsoftware.com/lists/gtk2-ex-list
gtk2-ex-list@opendoorsoftware.com
the group chat, essentially. π¬
π AUTHORS π
- Kevin C. Krinke,
<kckrinke@opendoorsoftware.com> - James Greenhalgh,
<jgreenhalgh@opendoorsoftware.com>
two icons. we stan. π
π COPYRIGHT AND LICENSE π
Gtk2::Ex::Dialogs::ChooseDirectory - Provides a directory selection dialog.
Copyright (C) 2005 Open Door Software Inc. <ods@opendoorsoftware.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
important bestie warning: that WITHOUT ANY WARRANTY line is not a joke, it is literally the license talking. no warranty, no promises, no "it'll definitely work," that's the deal. read your licenses, they're doing numbers for a reason π
and that's the page!! this one came out of the perl v5.42.0 manual, dated 2025-07-25, and yes she's still serving directory-picker realness all this time later. go pick a folder, bestie, you've earned it πβ¨π¦π
π¦ where this page comes from
- fedora 43: perl-Gtk2-Ex-Dialogs 0.11-49.fc43 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms