summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dialog_unix.go5
-rw-r--r--dialog_windows.c1
2 files changed, 4 insertions, 2 deletions
diff --git a/dialog_unix.go b/dialog_unix.go
index 158d11b..777dfb1 100644
--- a/dialog_unix.go
+++ b/dialog_unix.go
@@ -27,7 +27,8 @@ func (w *window) openFile(f func(filename string)) {
window := (*C.GtkWindow)(unsafe.Pointer(widget))
dialog := (*C.GtkDialog)(unsafe.Pointer(widget))
fc := (*C.GtkFileChooser)(unsafe.Pointer(widget))
- C.gtk_file_chooser_set_local_only(fc, C.FALSE)
+ // non-local filenames are relevant mainly to GIO where we can open *anything*, not to Go os.File; see https://twitter.com/braket/status/506142849654870016
+ C.gtk_file_chooser_set_local_only(fc, C.TRUE)
C.gtk_file_chooser_set_select_multiple(fc, C.FALSE)
C.gtk_file_chooser_set_show_hidden(fc, C.TRUE)
C.gtk_window_set_modal(window, C.TRUE)
@@ -49,7 +50,7 @@ func our_openfile_response_callback(dialog *C.GtkDialog, response C.gint, data C
}
filename := C.gtk_file_chooser_get_filename((*C.GtkFileChooser)(unsafe.Pointer(dialog)))
if filename == nil {
- panic("[DEBUG TODO] chosen filename NULL")
+ panic("chosen filename NULL in OpenFile()")
}
realfilename := fromgstr(filename)
C.g_free(C.gpointer(unsafe.Pointer(filename)))
diff --git a/dialog_windows.c b/dialog_windows.c
index f8ef687..90ee642 100644
--- a/dialog_windows.c
+++ b/dialog_windows.c
@@ -29,6 +29,7 @@ static DWORD WINAPI doOpenFile(LPVOID data)
ofn.lpstrInitialDir = NULL; // let system decide
ofn.lpstrTitle = NULL; // let system decide
// TODO OFN_SHAREAWARE?
+ // better question: TODO keep networking?
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_FORCESHOWHIDDEN | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_NOCHANGEDIR | OFN_NODEREFERENCELINKS | OFN_NOTESTFILECREATE | OFN_PATHMUSTEXIST;
if (GetOpenFileNameW(&ofn) == FALSE) {
err = CommDlgExtendedError();