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 1 commit
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
10 changes: 8 additions & 2 deletions appshell/appshell_extensions_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,21 @@ int32 ShowOpenDialog(bool allowMultipleSelection,
CefRefPtr<CefListValue>& selectedFiles)
{
GtkWidget *dialog;
const char* dialog_title = chooseDirectory ? "Open Directory" : "Open File";
// const char* dialog_title = chooseDirectory ? "Open Directory" : "Open File";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this line, since the caller provides the specific title.

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