MCPcopy
hub / github.com/Schneegans/Burn-My-Windows / bindColorButton

Method bindColorButton

prefs.js:619–649  ·  view source on GitHub ↗
(settingsKey)

Source from the content-addressed store, hash-verified

617 // is not available yet, we need to do the color conversion manually. It also binds the
618 // corresponding reset button.
619 bindColorButton(settingsKey) {
620
621 const button = this._builder.get_object(settingsKey);
622
623 if (button) {
624
625 // Update the settings when the color is modified.
626 if (!button._isConnected) {
627 button.connect('color-set', () => {
628 this.getProfileSettings().set_string(settingsKey,
629 button.get_rgba().to_string());
630 });
631
632 button._isConnected = true;
633 }
634
635 // Update the button state when the settings change.
636 const settingSignalHandler = () => {
637 const rgba = new Gdk.RGBA();
638 rgba.parse(this.getProfileSettings().get_string(settingsKey));
639 button.rgba = rgba;
640 };
641
642 this._connectProfileSetting('changed::' + settingsKey, settingSignalHandler);
643
644 // Initialize the button with the state in the settings.
645 settingSignalHandler();
646 }
647
648 this._bindResetButton(settingsKey);
649 }
650
651 // ----------------------------------------------------------------------- private stuff
652

Callers 14

bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80
bindPreferencesMethod · 0.80

Calls 3

getProfileSettingsMethod · 0.95
_bindResetButtonMethod · 0.95

Tested by

no test coverage detected