Skip to content

Commit

Permalink
New Option: Omit notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
celiopy committed Nov 21, 2024
1 parent dd23400 commit 592c0d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ export default class AccentColorExtension extends Extension {
}

async _checkForUpdates() {
if (! this._settings.get_boolean('notify-about-releases'))
return;

try {
const latestVersion = await fetchLatestVersion();
if (latestVersion) {
Expand Down
14 changes: 14 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ export default class AccentColorExtensionPrefs extends ExtensionPreferences {
downloadButton.connect('clicked', () => {
this.handleDownload(window, versionLabel, progressBar);
});

// Add new row for notifications
const notificationRow = new Adw.SwitchRow({
title: _('New Release Notifications'),
subtitle: _('Enable or disable notifications about new releases'),
active: window._settings.get_boolean('notify-about-releases'),
});

// Connect the switch state change to save the setting
notificationRow.connect('notify::active', () => {
window._settings.set_boolean('notify-about-releases', notificationRow.get_active());
});

group.add(notificationRow);
}

async handleDownload(window, versionLabel, progressBar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
</description>
</key>

<!-- Notifications -->
<key name="notify-about-releases" type="b">
<default>true</default>
<summary>Notifications about releases</summary>
<description>
Get notified when there is new releases to be downloaded
</description>
</key>

<!-- The current version of the Adwaita-Colors theme installed by the extension -->
<key name="accent-color" type="s">
<default>"blue"</default>
Expand Down

0 comments on commit 592c0d6

Please sign in to comment.