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 #314 from adobe/irichter/showSaveDialogLinux
Browse files Browse the repository at this point in the history
- added implementation for ShowSaveDialog on Linux
  • Loading branch information
jasonsanjose committed Aug 26, 2013
2 parents 6c28945 + 233ac40 commit a7871db
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion appshell/appshell_extensions_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,33 @@ int32 ShowSaveDialog(ExtensionString title,
ExtensionString proposedNewFilename,
ExtensionString& newFilePath)
{
// TODO
GtkWidget *openSaveDialog;

openSaveDialog = gtk_file_chooser_dialog_new(title.c_str(),
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);

gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (openSaveDialog), TRUE);
if (!initialDirectory.empty())
{
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (openSaveDialog), proposedNewFilename.c_str());

ExtensionString folderURI = std::string("file:///") + initialDirectory;
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (openSaveDialog), folderURI.c_str());
}

if (gtk_dialog_run (GTK_DIALOG (openSaveDialog)) == GTK_RESPONSE_ACCEPT)
{
char* filePath;
filePath = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (openSaveDialog));
newFilePath = filePath;
g_free (filePath);
}

gtk_widget_destroy (openSaveDialog);
return NO_ERROR;
}

Expand Down

0 comments on commit a7871db

Please sign in to comment.