Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customtitle #44

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
21 changes: 20 additions & 1 deletion src/include/nfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,42 @@ typedef enum {

/* nfd_<targetplatform>.c */

/* single file open dialog */
/* single file open dialog */
nfdresult_t NFD_OpenDialogTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath );

nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath );

/* multiple file open dialog */
nfdresult_t NFD_OpenDialogMultipleTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdpathset_t *outPaths );

nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdpathset_t *outPaths );

/* save dialog */
nfdresult_t NFD_SaveDialogTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath );

nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath );


/* select folder dialog */
nfdresult_t NFD_PickFolderTitled( const nfdchar_t *title,
const nfdchar_t *defaultPath,
nfdchar_t **outPath);

nfdresult_t NFD_PickFolder( const nfdchar_t *defaultPath,
nfdchar_t **outPath);

Expand Down
47 changes: 41 additions & 6 deletions src/nfd_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ static void WaitForCleanup(void)
nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
return NFD_OpenDialogTitled("Open file", filterList,
defaultPath, outPath );
}

nfdresult_t NFD_OpenDialogTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
GtkWidget *dialog;
nfdresult_t result;
Expand All @@ -178,7 +187,7 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
return NFD_ERROR;
}

dialog = gtk_file_chooser_dialog_new( "Open File",
dialog = gtk_file_chooser_dialog_new( title,
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
Expand Down Expand Up @@ -221,10 +230,18 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
return result;
}


nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdpathset_t *outPaths )
{
return NFD_OpenDialogMultipleTitled( "Open Files", filterList,
defaultPath, outPaths);
}

nfdresult_t NFD_OpenDialogMultipleTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdpathset_t *outPaths )
{
GtkWidget *dialog;
nfdresult_t result;
Expand All @@ -235,7 +252,7 @@ nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
return NFD_ERROR;
}

dialog = gtk_file_chooser_dialog_new( "Open Files",
dialog = gtk_file_chooser_dialog_new( title,
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
Expand Down Expand Up @@ -272,6 +289,15 @@ nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
return NFD_SaveDialogTitled("Save File", filterList,
defaultPath, outPath);
}

nfdresult_t NFD_SaveDialogTitled( const nfdchar_t *title,
const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
GtkWidget *dialog;
nfdresult_t result;
Expand All @@ -282,7 +308,7 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
return NFD_ERROR;
}

dialog = gtk_file_chooser_dialog_new( "Save File",
dialog = gtk_file_chooser_dialog_new( title,
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Cancel", GTK_RESPONSE_CANCEL,
Expand Down Expand Up @@ -326,7 +352,16 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
}

nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath,
nfdchar_t **outPath)
nfdchar_t **outPath)
{
return NFD_PickFolderTitled( "Select folder", defaultPath, outPath);
}



nfdresult_t NFD_PickFolderTitled( const nfdchar_t *title,
const nfdchar_t *defaultPath,
nfdchar_t **outPath)
{
GtkWidget *dialog;
nfdresult_t result;
Expand All @@ -337,7 +372,7 @@ nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath,
return NFD_ERROR;
}

dialog = gtk_file_chooser_dialog_new( "Select folder",
dialog = gtk_file_chooser_dialog_new( title,
NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
"_Cancel", GTK_RESPONSE_CANCEL,
Expand Down