11/*
22 * SPDX-License-Identifier: GPL-3.0-or-later
3- * SPDX-FileCopyrightText: 2021-2023 elementary, Inc. (https://elementary.io)
3+ * SPDX-FileCopyrightText: 2021-2025 elementary, Inc. (https://elementary.io)
44 *
55 * Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
66 */
77
8- public class About.FirmwareReleaseView : Gtk . Box {
8+ public class About.FirmwareReleaseView : Adw . NavigationPage {
99 public signal void update (Fwupd .Device device , Fwupd .Release release );
1010
1111 private Fwupd . Device device;
@@ -22,29 +22,22 @@ public class About.FirmwareReleaseView : Gtk.Box {
2222 private Gtk . Label vendor_value_label;
2323 private Gtk . Label size_value_label;
2424 private Gtk . Label install_duration_value_label;
25- private Adw . Leaflet ? deck;
2625
2726 construct {
2827 var back_button = new Gtk .Button .with_label (_(" All Updates" )) {
29- halign = START ,
30- margin_top = 6 ,
31- margin_end = 6 ,
32- margin_bottom = 6 ,
33- margin_start = 6 ,
28+ action_name = " navigation.pop" ,
29+ halign = START
3430 };
3531 back_button. add_css_class (Granite . STYLE_CLASS_BACK_BUTTON );
3632
3733 title_label = new Gtk .Label (" " ) {
3834 ellipsize = END ,
3935 use_markup = true
4036 };
37+ title_label. add_css_class (" title" );
4138
4239 update_button = new Gtk .Button .with_label (" " ) {
4340 halign = END ,
44- margin_top = 6 ,
45- margin_end = 6 ,
46- margin_bottom = 6 ,
47- margin_start = 6 ,
4841 sensitive = false
4942 };
5043 update_button. add_css_class (Granite . STYLE_CLASS_SUGGESTED_ACTION );
@@ -53,12 +46,13 @@ public class About.FirmwareReleaseView : Gtk.Box {
5346 child = update_button
5447 };
5548
56- var header_box = new Gtk .CenterBox () {
49+ var header_bar = new Gtk .HeaderBar () {
5750 hexpand = true ,
58- start_widget = back_button,
59- center_widget = title_label,
60- end_widget = update_button_revealer
51+ show_title_buttons = false ,
52+ title_widget = title_label
6153 };
54+ header_bar. pack_start (back_button);
55+ header_bar. pack_end (update_button_revealer);
6256
6357 summary_label = new Gtk .Label (" " ) {
6458 halign = START ,
@@ -151,20 +145,20 @@ public class About.FirmwareReleaseView : Gtk.Box {
151145 stack.add_child (placeholder );
152146 stack.add_child (scrolled_window );
153147
154- orientation = VERTICAL ;
155- add_css_class ( Granite . STYLE_CLASS_VIEW );
156- append ( header_box );
157- append ( new Gtk . Separator ( HORIZONTAL )) ;
158- append ( stack );
148+ var toolbarview = new Adw . ToolbarView () {
149+ content = stack,
150+ top_bar_style = RAISED_BORDER
151+ } ;
152+ toolbarview.add_top_bar ( header_bar );
159153
160- back_button.clicked.connect (() => {
161- go_back ();
162- });
154+ child = toolbarview;
163155
164156 update_button.clicked.connect (() => {
165- go_back ( );
157+ activate_action ( " navigation.pop " , null );
166158 update (device, release);
167159 });
160+
161+ bind_property ("title ", title_label , "label ");
168162 }
169163
170164 public void update_view (Fwupd . Device device, Fwupd . Release ? release) {
@@ -173,7 +167,7 @@ public class About.FirmwareReleaseView : Gtk.Box {
173167
174168 var device_name = device. get_name ();
175169
176- title_label . label = " <b> %s </b> " . printf ( device_name) ;
170+ title = device_name;
177171 update_button_revealer. reveal_child = release != null ;
178172
179173 if (release == null ) {
@@ -233,12 +227,4 @@ public class About.FirmwareReleaseView : Gtk.Box {
233227 ). printf (duration_minutes);
234228 }
235229 }
236-
237- private void go_back () {
238- if (deck == null ) {
239- deck = (Adw . Leaflet ) get_ancestor (typeof (Adw . Leaflet ));
240- }
241-
242- deck. navigate (BACK );
243- }
244230}
0 commit comments