mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Lower donation timeout and have switch disabled instead of hidden
gh-2259
This commit is contained in:
27
src/prefs.js
27
src/prefs.js
@@ -3650,11 +3650,7 @@ const Preferences = class {
|
||||
|
||||
let revealDonateTimeout = 0
|
||||
let donationIconSwitch = this._builder.get_object('donation_icon_switch')
|
||||
let donationRevealer = this._builder.get_object('donation_revealer')
|
||||
let donationCountdown = this._builder.get_object('donation_countdown')
|
||||
let donationCountdownLabel = this._builder.get_object(
|
||||
'donation_countdown_label',
|
||||
)
|
||||
let donationSpinner = this._builder.get_object('donation_spinner')
|
||||
let hiddenDonateIcon = !!this._settings.get_string(
|
||||
'hide-donate-icon-unixtime',
|
||||
)
|
||||
@@ -3673,8 +3669,8 @@ const Preferences = class {
|
||||
.set_from_file(`${this._path}/img/kofi.png`)
|
||||
|
||||
donationIconSwitch.set_active(hiddenDonateIcon)
|
||||
donationRevealer.set_reveal_child(hiddenDonateIcon)
|
||||
donationCountdown.set_visible(!hiddenDonateIcon)
|
||||
donationIconSwitch.set_sensitive(hiddenDonateIcon)
|
||||
donationSpinner.set_visible(!hiddenDonateIcon)
|
||||
|
||||
donationIconSwitch.connect('notify::active', (widget) =>
|
||||
this._settings.set_string(
|
||||
@@ -3689,23 +3685,16 @@ const Preferences = class {
|
||||
revealDonateTimeout = 0
|
||||
}
|
||||
|
||||
if (
|
||||
this.notebook.visible_page_name == 'donation' &&
|
||||
!donationRevealer.get_reveal_child()
|
||||
) {
|
||||
let secs = 20
|
||||
|
||||
donationCountdownLabel.set_label(secs.toString())
|
||||
if (this.notebook.visible_page_name == 'donation' && !hiddenDonateIcon) {
|
||||
let secs = 5
|
||||
|
||||
revealDonateTimeout = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
1000,
|
||||
() => {
|
||||
donationCountdownLabel.set_label((--secs).toString())
|
||||
|
||||
if (secs < 1) {
|
||||
donationRevealer.set_reveal_child(true)
|
||||
donationCountdown.set_visible(false)
|
||||
if (--secs < 1) {
|
||||
donationIconSwitch.set_sensitive(true)
|
||||
donationSpinner.set_visible(false)
|
||||
revealDonateTimeout = 0
|
||||
|
||||
return GLib.SOURCE_REMOVE
|
||||
|
||||
@@ -138,29 +138,10 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="donation_countdown">
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="donation_spinner">
|
||||
<property name="halign">end</property>
|
||||
<property name="opacity">0.3</property>
|
||||
<property name="spinning">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="donation_countdown_label">
|
||||
<attributes>
|
||||
<attribute name="size" value="8000"/>
|
||||
<attribute name="style" value="italic"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="donation_revealer">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">start</property>
|
||||
@@ -177,13 +158,20 @@ If you like, you can now hide the donate icon</span></property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="donation_icon_switch">
|
||||
<property name="halign">end</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="donation_spinner">
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="opacity">0.3</property>
|
||||
<property name="spinning">True</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user