Skip to content
Open
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
10 changes: 9 additions & 1 deletion v3/pkg/application/linux_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ func alertDialogCallback(requestID C.uint, buttonIndex C.int) {
close(ch)
}

func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden bool, currentFolder, title string, action int, acceptLabel string, filters []FileFilter) (chan string, error) {
func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden bool, currentFile, currentFolder, title string, action int, acceptLabel string, filters []FileFilter) (chan string, error) {
requestID := nextDialogRequestID()
resultChan := make(chan string, 100)

Expand Down Expand Up @@ -1967,6 +1967,12 @@ func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden b
C.set_file_dialog_filters(dialog, filterStore)
}

if currentFile != "" {
cName := C.CString(currentFile)
C.gtk_file_dialog_set_initial_name(dialog, cName)
C.free(unsafe.Pointer(cName))
}

if currentFolder != "" {
cFolder := C.CString(currentFolder)
file := C.g_file_new_for_path(cFolder)
Expand Down Expand Up @@ -2026,6 +2032,7 @@ func runOpenFileDialog(dialog *OpenFileDialogStruct) (chan string, error) {
dialog.allowsMultipleSelection,
false, // createFolders not applicable for open
dialog.showHiddenFiles,
"",
dialog.directory,
dialog.title,
action,
Expand Down Expand Up @@ -2053,6 +2060,7 @@ func runSaveFileDialog(dialog *SaveFileDialogStruct) (chan string, error) {
false,
dialog.canCreateDirectories,
dialog.showHiddenFiles,
dialog.filename,
dialog.directory,
dialog.title,
1, // GTK_FILE_CHOOSER_ACTION_SAVE
Expand Down
Loading