MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / NFD_OpenDialogN

Function NFD_OpenDialogN

extern/nfd/nfd_gtk.cpp:413–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413nfdresult_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
445nfdresult_t NFD_OpenDialogMultipleN(const nfdpathset_t** outPaths,
446 const nfdnfilteritem_t* filterList,

Callers

nothing calls this directly

Calls 3

RunDialogWithFocusFunction · 0.85
AddFiltersToDialogFunction · 0.70
SetDefaultPathFunction · 0.70

Tested by

no test coverage detected