Skip to content

Commit

Permalink
Added links section to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Aug 20, 2023
1 parent dbd00d5 commit a788ff9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions extension/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

//Main imports
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk';
import Adw from 'gi://Adw';
import GObject from 'gi://GObject';

Expand Down Expand Up @@ -67,6 +68,26 @@ class PrefsPage extends Adw.PreferencesPage {
});
}

addLinks(groupName, linksInfo) {
//Setup and add links group to window
let linksGroup = new Adw.PreferencesGroup();
linksGroup.set_title(groupName);
this.add(linksGroup);

linksInfo.forEach((linkInfo) => {
let linkButton = new Gtk.LinkButton({
uri: linkInfo[1]
});

let linkEntryRow = new Adw.ActionRow({
title: linkInfo[0],
activatable_widget: linkButton
});

linksGroup.add(linkEntryRow);
});
}

_updateEnabledSettings() {
/*
- If quick settings are enabled, disable 'move-icon-setting' option
Expand Down Expand Up @@ -117,6 +138,15 @@ export default class PrivacyPreferences extends ExtensionPreferences {
//Create settings page from info
let settingsPage = new PrefsPage(pageInfo, groupsInfo, settingsInfo, this.getSettings());

//Define and add links
let linksInfo = [
//Translated title, link
[_("Report an issue"), "https://github.com/stuarthayhurst/privacy-menu-extension/issues"],
[_("Donate via GitHub"), "https://github.com/sponsors/stuarthayhurst"],
[_("Donate via PayPal"), "https://www.paypal.me/stuartahayhurst"]
];
settingsPage.addLinks(_("Links"), linksInfo);

//Add the pages to the window, enable searching
window.add(settingsPage);
window.set_search_enabled(true);
Expand Down

0 comments on commit a788ff9

Please sign in to comment.