From 65c68a7f91055668d37c63395f36bbda334d3339 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Wed, 3 Apr 2024 12:01:20 +0200 Subject: [PATCH] Use existing widgets --- src/Views/OperatingSystemView.vala | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index 0f79a399..f40024ca 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -33,7 +33,6 @@ public class About.OperatingSystemView : Gtk.Box { private Gtk.Label updates_description; private Gtk.Revealer details_button_revealer; private Gtk.Stack button_stack; - private Gtk.Stack update_stack; construct { var style_provider = new Gtk.CssProvider (); @@ -199,17 +198,6 @@ public class About.OperatingSystemView : Gtk.Box { updates_grid.attach (button_stack, 2, 0, 1, 2); updates_grid.attach (details_button_revealer, 1, 2, 2); - var no_daemon_connection_placeholder = new Granite.Placeholder (_("System updates not available")) { - description = _("Couldn't connect to the backend. Try logging out to resolve the issue."), - icon = new ThemedIcon ("dialog-error") - }; - - update_stack = new Gtk.Stack () { - vhomogeneous = false - }; - update_stack.add_named (no_daemon_connection_placeholder, "placeholder"); - update_stack.add_named (updates_grid, "grid"); - var updates_list = new Gtk.ListBox () { margin_bottom = 12, margin_top = 12, @@ -219,7 +207,7 @@ public class About.OperatingSystemView : Gtk.Box { }; updates_list.add_css_class ("boxed-list"); updates_list.add_css_class (Granite.STYLE_CLASS_RICH_LIST); - updates_list.append (update_stack); + updates_list.append (updates_grid); updates_list.append (automatic_updates_button); updates_list.get_first_child ().focusable = false; @@ -380,13 +368,15 @@ public class About.OperatingSystemView : Gtk.Box { try { current_state = yield update_proxy.get_current_state (); } catch (Error e) { - update_stack.visible_child_name = "placeholder"; + updates_image.icon_name = "dialog-error"; + updates_title.label = _("System updates not available"); + updates_description.label = _("Couldn't connect to the backend. Try logging out to resolve the issue."); + button_stack.visible_child_name = "blank"; + critical ("Failed to get current state from Updates Backend: %s", e.message); return; } - update_stack.visible_child_name = "grid"; - details_button_revealer.reveal_child = current_state.state == AVAILABLE || current_state.state == ERROR; switch (current_state.state) {