Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Support initialDirectory and title in Linux' showOpenDialog #496

Merged
merged 2 commits into from
Jan 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions appshell/appshell_extensions_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,20 @@ int32 ShowOpenDialog(bool allowMultipleSelection,
CefRefPtr<CefListValue>& selectedFiles)
{
GtkWidget *dialog;
const char* dialog_title = chooseDirectory ? "Open Directory" : "Open File";
GtkFileChooserAction file_or_directory = chooseDirectory ? GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER : GTK_FILE_CHOOSER_ACTION_OPEN ;
dialog = gtk_file_chooser_dialog_new (dialog_title,
dialog = gtk_file_chooser_dialog_new (title.c_str(),
NULL,
file_or_directory,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);

if (!initialDirectory.empty())
{
ExtensionString folderURI = std::string("file:///") + initialDirectory;
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), folderURI.c_str());
}

if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
char *filename;
Expand Down