This commit is contained in:
Hirnmoder
2025-01-31 07:50:50 +01:00
13 changed files with 791 additions and 443 deletions

View File

@@ -204,6 +204,10 @@ const Preferences = class {
let pageFineTune = this._builder.get_object('finetune');
window.add(pageFineTune);
this._builder.add_from_file(this._path + '/ui/SettingsDonation.ui');
let pageDonation = this._builder.get_object('donation');
window.add(pageDonation);
this._builder.add_from_file(this._path + '/ui/SettingsAbout.ui');
let pageAbout = this._builder.get_object('about');
window.add(pageAbout);
@@ -232,6 +236,19 @@ const Preferences = class {
this._leftbox_padding_timeout = 0;
this._addFormatValueCallbacks();
this._bindSettings();
let maybeGoToPage = () => {
let targetPageName = settings.get_string('target-prefs-page')
if (targetPageName) {
window.set_visible_page_name(targetPageName)
settings.set_string('target-prefs-page', '')
}
}
settings.connect('changed::target-prefs-page', maybeGoToPage);
maybeGoToPage();
}
/**
@@ -2212,6 +2229,31 @@ const Preferences = class {
);
});
// Donation panel
let revealDonateTimeout = 0;
let donationIconSwitch = this._builder.get_object('donation_icon_switch')
let donationRevealer = this._builder.get_object('donation_revealer');
let hiddenDonateIcon = !!this._settings.get_string('hide-donate-icon-unixtime')
this._builder.get_object('donation_logo').set_from_file(`${this._path}/img/dash-to-panel-logo-light.svg`)
this._builder.get_object('paypal_logo').set_from_file(`${this._path}/img/paypal.png`)
this._builder.get_object('stripe_logo').set_from_file(`${this._path}/img/stripe.png`)
this._builder.get_object('kofi_logo').set_from_file(`${this._path}/img/kofi.png`)
donationIconSwitch.set_active(hiddenDonateIcon)
donationRevealer.set_reveal_child(hiddenDonateIcon)
donationIconSwitch.connect('notify::active', (widget) =>
this._settings.set_string('hide-donate-icon-unixtime', widget.get_active() ? Date.now().toString() : '')
)
this.notebook.connect('notify::visible-page', () => {
clearTimeout(revealDonateTimeout)
if (this.notebook.visible_page_name == 'donation' && !donationRevealer.get_reveal_child())
revealDonateTimeout = setTimeout(() => donationRevealer.set_reveal_child(true), 10000)
})
}
_setPreviewTitlePosition() {