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

Function NFD_PickFolderN

extern/nfd/nfd_gtk.cpp:537–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537nfdresult_t NFD_PickFolderN(nfdnchar_t** outPath, const nfdnchar_t* defaultPath) {
538 GtkWidget* widget = gtk_file_chooser_dialog_new("Select folder",
539 nullptr,
540 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
541 "_Cancel",
542 GTK_RESPONSE_CANCEL,
543 "_Select",
544 GTK_RESPONSE_ACCEPT,
545 nullptr);
546
547 // guard to destroy the widget when returning from this function
548 Widget_Guard widgetGuard(widget);
549
550 /* Set the default path */
551 SetDefaultPath(GTK_FILE_CHOOSER(widget), defaultPath);
552
553 if (RunDialogWithFocus(GTK_DIALOG(widget)) == GTK_RESPONSE_ACCEPT) {
554 // write out the file name
555 *outPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
556
557 return NFD_OKAY;
558 } else {
559 return NFD_CANCEL;
560 }
561}
562
563nfdresult_t NFD_PathSet_GetCount(const nfdpathset_t* pathSet, nfdpathsetsize_t* count) {
564 assert(pathSet);

Callers

nothing calls this directly

Calls 2

RunDialogWithFocusFunction · 0.85
SetDefaultPathFunction · 0.70

Tested by

no test coverage detected