Getting started tutorial

Hi, its my first time here. I am doing the newcomers tutorial and I found a little bug in the saving files section using Vala language.

https://developer.gnome.org/documentation/tutorials/beginners/getting_started/saving_files.html

The code in the image is wrong because it isn’t an arrow function:

filechooser.response.connect ((dialog, response) {

The correct code woulde be:

private void save_file_dialog (Variant? parameter) {
            var filechooser = new Gtk.FileChooserNative ("Save File As",
                                                         this,
                                                         Gtk.FileChooserAction.SAVE,
                                                         "_Save",
                                                         "_Cancel");

            filechooser.response.connect ((dialog, response) => {
                if (response == Gtk.ResponseType.ACCEPT) {
                    File file = filechooser.get_file ();
                    this.save_file (file);
                }
            });
            filechooser.show ();
        }

Thanks for reporting the typo! The source for that page is here: source/tutorials/beginners/getting_started/saving_files.rst · main · Teams / Documentation / developer-www · GitLab. Can you do a MR to improve the documentation?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.