11/*
22 * SPDX-License-Identifier: GPL-3.0-or-later
3- * SPDX-FileCopyrightText: 2017-2023 elementary, Inc. (https://elementary.io)
3+ * SPDX-FileCopyrightText: 2017-2026 elementary, Inc. (https://elementary.io)
44 */
55
66public class VariantWidget : Gtk .Frame {
@@ -11,7 +11,6 @@ public class VariantWidget : Gtk.Frame {
1111
1212 public signal void going_to_main ();
1313
14- private Gtk . Box variant_box;
1514 private Adw . NavigationView navigation_view;
1615 private Adw . NavigationPage variant_page;
1716
@@ -29,47 +28,43 @@ public class VariantWidget : Gtk.Frame {
2928
3029 var main_page = new Adw .NavigationPage (main_scrolled, main_title);
3130
32- variant_listbox = new Gtk .ListBox ();
33- variant_listbox. activate_on_single_click = false ;
31+ variant_listbox = new Gtk .ListBox () {
32+ activate_on_single_click = false
33+ };
3434
3535 var variant_scrolled = new Gtk .ScrolledWindow () {
3636 child = variant_listbox,
3737 hscrollbar_policy = NEVER ,
3838 vexpand = true
3939 };
4040
41- var back_button = new Gtk .Button .with_label (main_page. title) {
42- halign = START ,
43- margin_top = 6 ,
44- margin_end = 6 ,
45- margin_bottom = 6 ,
46- margin_start = 6
41+ var back_button = new Granite .BackButton (main_page. title) {
42+ halign = START
4743 };
48- back_button. add_css_class (Granite . STYLE_CLASS_BACK_BUTTON );
4944
5045 var variant_title = new Gtk .Label (" " ) {
5146 hexpand = true ,
5247 justify = CENTER ,
53- margin_end = 6 ,
54- margin_start = 6 ,
5548 mnemonic_widget = variant_listbox,
5649 wrap = true
5750 };
5851 variant_title. add_css_class (Granite . STYLE_CLASS_H4_LABEL );
5952
60- var header_box = new Gtk .CenterBox () {
61- start_widget = back_button ,
62- center_widget = variant_title ,
63- hexpand = true
53+ var header_box = new Gtk .HeaderBar () {
54+ hexpand = true ,
55+ show_title_buttons = false ,
56+ title_widget = variant_title
6457 };
58+ header_box. pack_start (back_button);
6559
66- variant_box = new Gtk .Box (VERTICAL , 0 );
67- variant_box. add_css_class (Granite . STYLE_CLASS_VIEW );
68- variant_box. append (header_box);
69- variant_box. append (new Gtk .Separator (Gtk . Orientation . HORIZONTAL ));
70- variant_box. append (variant_scrolled);
60+ var toolbarview = new Adw .ToolbarView () {
61+ content = variant_scrolled,
62+ top_bar_style = RAISED_BORDER
63+ };
64+ toolbarview. add_top_bar (header_box);
65+ toolbarview. add_css_class (Granite . STYLE_CLASS_VIEW );
7166
72- variant_page = new Adw .NavigationPage (variant_box , " " );
67+ variant_page = new Adw .NavigationPage (toolbarview , " " );
7368
7469 navigation_view = new Adw .NavigationView ();
7570 navigation_view. add (main_page);
0 commit comments