🔧 Port update notification to GTK4

This commit is contained in:
Simon Schneegans
2023-02-08 06:14:57 +01:00
parent 26e7f6bb00
commit 3c7849cc1a
2 changed files with 80 additions and 39 deletions
+19 -10
View File
@@ -345,16 +345,25 @@ var PreferencesDialog = class PreferencesDialog {
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2000, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2000, () => {
this._showUpdateInfoTimeout = 0; this._showUpdateInfoTimeout = 0;
const toast = Adw.Toast.new(_('Burn-My-Windows has been updated!')); if (utils.isADW()) {
toast.set_button_label(_('View Changelog')); const toast = Adw.Toast.new(_('Burn-My-Windows has been updated!'));
toast.set_action_name('prefs.changelog'); toast.set_button_label(_('View Changelog'));
toast.set_timeout(0); toast.set_action_name('prefs.changelog');
toast.set_timeout(0);
toast.connect(
'dismissed', toast.connect(
() => this._settings.set_int('last-version', Me.metadata.version)); 'dismissed',
() => this._settings.set_int('last-version', Me.metadata.version));
window.add_toast(toast);
window.add_toast(toast);
}else {
const infoBar = this._builder.get_object("update-info");
infoBar.connect("response", i => {
this._settings.set_int('last-version', Me.metadata.version);
i.set_revealed(false);
});
infoBar.set_revealed(true);
}
return false; return false;
}); });
+61 -29
View File
@@ -37,50 +37,82 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="transition-type">over-down-up</property> <property name="transition-type">over-down-up</property>
<child> <child>
<object class="GtkScrolledWindow" id="effect-editor"> <object class="GtkBox" id="effect-editor">
<property name="hscrollbar-policy">never</property> <property name="orientation">vertical</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="spacing">5</property>
<child>
<object class="GtkInfoBar" id="update-info">
<property name="message-type">info</property>
<property name="revealed">false</property>
<property name="show-close-button">true</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" translatable="yes">Effect Settings</property> <property name="label" translatable="yes">Burn-My-Windows has been updated!</property>
<property name="halign">start</property> <property name="margin-start">6</property>
<style>
<class name="heading" />
</style>
</object> </object>
</child> </child>
<child type="action">
<child> <object class="GtkButton" id="update-info-button">
<object class="GtkLabel"> <property name="label" translatable="yes">View Changelog</property>
<property name="label" translatable="yes">If multiple are selected, one is chosen randomly.</property> <property name="action-name">prefs.changelog</property>
<property name="halign">start</property>
</object> </object>
</child> </child>
<action-widgets>
<action-widget response="-1">update-info-button</action-widget>
</action-widgets>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="vexpand">true</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="spacing">5</property>
<child>
<object class="GtkFrame">
<child> <child>
<object class="GtkListBox" id="effects-group"> <object class="GtkLabel">
<property name="selection-mode">none</property> <property name="label" translatable="yes">Effect Settings</property>
<property name="halign">start</property>
<style>
<class name="heading" />
</style>
</object> </object>
</child> </child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">If multiple are selected, one is chosen randomly.</property>
<property name="halign">start</property>
</object>
</child>
<child>
<object class="GtkFrame">
<property name="margin-top">6</property>
<child>
<object class="GtkListBox" id="effects-group">
<property name="selection-mode">none</property>
</object>
</child>
</object>
</child>
</object> </object>
</child>
</property>
</object> </object>
</child>
</property>
</object> </object>
</child> </child>
<child> <child>