| 411 | } |
| 412 | |
| 413 | nfdresult_t NFD_OpenDialogN(nfdnchar_t** outPath, |
| 414 | const nfdnfilteritem_t* filterList, |
| 415 | nfdfiltersize_t filterCount, |
| 416 | const nfdnchar_t* defaultPath) { |
| 417 | GtkWidget* widget = gtk_file_chooser_dialog_new("Open File", |
| 418 | nullptr, |
| 419 | GTK_FILE_CHOOSER_ACTION_OPEN, |
| 420 | "_Cancel", |
| 421 | GTK_RESPONSE_CANCEL, |
| 422 | "_Open", |
| 423 | GTK_RESPONSE_ACCEPT, |
| 424 | nullptr); |
| 425 | |
| 426 | // guard to destroy the widget when returning from this function |
| 427 | Widget_Guard widgetGuard(widget); |
| 428 | |
| 429 | /* Build the filter list */ |
| 430 | AddFiltersToDialog(GTK_FILE_CHOOSER(widget), filterList, filterCount); |
| 431 | |
| 432 | /* Set the default path */ |
| 433 | SetDefaultPath(GTK_FILE_CHOOSER(widget), defaultPath); |
| 434 | |
| 435 | if (RunDialogWithFocus(GTK_DIALOG(widget)) == GTK_RESPONSE_ACCEPT) { |
| 436 | // write out the file name |
| 437 | *outPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); |
| 438 | |
| 439 | return NFD_OKAY; |
| 440 | } else { |
| 441 | return NFD_CANCEL; |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | nfdresult_t NFD_OpenDialogMultipleN(const nfdpathset_t** outPaths, |
| 446 | const nfdnfilteritem_t* filterList, |
nothing calls this directly
no test coverage detected