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

Commit

Permalink
Merge pull request #496 from MarcelGerber/linux-open-dialog
Browse files Browse the repository at this point in the history
Support initialDirectory and title in Linux' showOpenDialog
  • Loading branch information
ingorichter committed Jan 8, 2015
2 parents d9b1cae + 2dc15d8 commit 89977a9
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 89977a9

Please sign in to comment.