gui icon indicating copy to clipboard operation
gui copied to clipboard

get-file works differently on windows and linux

Open idealist1508 opened this issue 4 years ago • 4 comments

To Reproduce please run following code on Linux and on Windows.

#lang racket
(require racket/gui/base)

(get-file)
  • On Windows you can create a new folder, on Linux you cannot.
  • On Windows you can select a not existing file, on Linux you cannot.

I think get-file should behave on Linux the same as it does on Windows now.

idealist1508 avatar Jul 12 '21 19:07 idealist1508

The first of these is the create-folders property on the dialog: https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#GtkFileChooser--create-folders I don't think the Gtk FileChooser dialog offers an option for the second issue.

samth avatar Jul 12 '21 20:07 samth

I suspect this is related to https://github.com/alex-hhh/ActivityLog2/issues/71, which I originally misunderstood -- I assumed that the dialogs work the same on all platforms, but this is not the case and the actual problem in ActivityLog2 is that new databases cannot be created on Linux platforms.

Given that get-file and put-file default to the platform specific file dialog, I don't think this is really a bug in racket gui. I reopened the above issue and we'll need to find a solution for ActivityLog2 (there are some problems with using put-file though)...

alex-hhh avatar Jul 13 '21 02:07 alex-hhh

If we use the parameter action with a value GTK_FILE_CHOOSER_ACTION_SAVE and the parameter second_button_text with a value Open in gtk-file-chooser-dialog-new(), then the dialog should behave as on Windows.

idealist1508 avatar Jul 13 '21 05:07 idealist1508

It works if i change https://github.com/racket/gui/blob/60779260137da324a7b1a905396a86012733892d/gui-lib/mred/private/wx/gtk/filedialog.rkt#L68 to [else 'save])

idealist1508 avatar Jul 13 '21 06:07 idealist1508