linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.57k stars 745 forks source link

Applet settings widget `filechooser` set as "folderchooser" gives wrong UI scheme #12374

Open guillaume-mueller opened 2 months ago

guillaume-mueller commented 2 months ago

Distribution

Mint 22

Package version

6.2.9

Graphics hardware in use

No response

Frequency

Always

Bug description

An applet settings widget filechooser set with "select-dir": true to be a "folderchooser" has its value still prefixed with the file:// URI scheme.

MWE: settings-schema.json:

{
    "folderchooser": {
        "type": "filechooser",
        "select-dir": true,
        "default": "",
        "description": "Folder chooser"
    }
}

applet.js:

const Applet = imports.ui.applet;
const AppletSettings = imports.ui.settings.AppletSettings;
const Main = imports.ui.main;

class ThisApplet extends Applet.TextApplet {
    constructor(metadata, orientation, panel_height, instance_id) {
        super(orientation, panel_height, instance_id);

        this.set_applet_label("Open settings...");

        const settings = new AppletSettings(this, metadata.uuid, instance_id);

        settings.bind('folderchooser', null, (uri) => {
            Main.notify(metadata.uuid, uri);
        });
    }
}

function main(metadata, orientation, panel_height, instance_id) {
    return new ThisApplet(metadata, orientation, panel_height, instance_id);
}

Steps to reproduce

  1. Download this ZIP containing the mentioned MWE as a complete applet and put its contained folder in ~/.local/share/cinnamon/applets.

  2. Open the Applets window, add the applet and open its settings window.

  3. Modify the "folderchooser" choice and read the URI shown in the notification.

Expected behavior

The URI put in the filechooser's value should be prefixed with the directory:// URI scheme.

Additional information

No response