Skip to content

Applet settings: binding to a timechooser or datechooser is sensitive to any setting #13151

@guillaume-mueller

Description

@guillaume-mueller

Distribution

Mint 22.2

Package version

6.4.8

Graphics hardware in use

No response

Frequency

Always

Bug description

In an applet, using a timechooser or datechooser setting via settings-schema.json then binding a JS callback to it via the method AppletSettings.bind makes the callback being called when any setting changes.

Steps to reproduce

  • Unzip test@bug.zip content in ~/.local/share/cinnamon/applets, which consists essentially in:
    • settings-schema.json:
      {
          "switch": {
              "type": "switch",
              // …
          },
          "timechooser": {
              "type": "timechooser",
              // …
          },
          "datechooser": {
              "type": "datechooser",
              // …
          }
      }
    • applet.js:
      const Applet = imports.ui.applet;
      const {AppletSettings} = imports.ui.settings;
      
      class ThisApplet extends Applet.TextApplet {
          constructor(metadata, orientation, panel_height, instance_id) {
              super(orientation, panel_height, instance_id);
      
              // …
      
              const settings = new AppletSettings(this, metadata.uuid, instance_id);
              settings.bind('timechooser', "", () => global.logError("timechooser changed"));
              settings.bind('datechooser', "", () => global.logError("datechooser changed"));
          }
      }
      
      // …
  • Open Looking Glass logs (Alt+F2 then type lg).
  • Add the applet via the Applets menu.
  • Open its settings window.
  • Modify the switch setting and note that it triggers the messages timechooser changed and datechooser changed in the Looking Glass logs.

Expected behavior

The callback should be called only when the specific setting changes and not any other.

Additional information

I tested a few other settings such as soundfilechooser, fontchooser and keybinding and they didn't produce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions