🔧 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
+9
View File
@@ -345,6 +345,7 @@ var PreferencesDialog = class PreferencesDialog {
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2000, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2000, () => {
this._showUpdateInfoTimeout = 0; this._showUpdateInfoTimeout = 0;
if (utils.isADW()) {
const toast = Adw.Toast.new(_('Burn-My-Windows has been updated!')); const toast = Adw.Toast.new(_('Burn-My-Windows has been updated!'));
toast.set_button_label(_('View Changelog')); toast.set_button_label(_('View Changelog'));
toast.set_action_name('prefs.changelog'); toast.set_action_name('prefs.changelog');
@@ -355,6 +356,14 @@ var PreferencesDialog = class PreferencesDialog {
() => this._settings.set_int('last-version', Me.metadata.version)); () => 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;
}); });
+33 -1
View File
@@ -37,8 +37,36 @@ 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="orientation">vertical</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>
<object class="GtkLabel">
<property name="label" translatable="yes">Burn-My-Windows has been updated!</property>
<property name="margin-start">6</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="update-info-button">
<property name="label" translatable="yes">View Changelog</property>
<property name="action-name">prefs.changelog</property>
</object>
</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="hscrollbar-policy">never</property>
<property name="vexpand">true</property>
<property name="child"> <property name="child">
<object class="GtkBox"> <object class="GtkBox">
@@ -68,6 +96,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
<property name="margin-top">6</property>
<child> <child>
<object class="GtkListBox" id="effects-group"> <object class="GtkListBox" id="effects-group">
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
@@ -82,6 +111,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object> </object>
</child> </child>
</object>
</child>
<child> <child>
<object class="GtkBox" id="profile-editor"> <object class="GtkBox" id="profile-editor">