Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a placeholder if no connection to the settings-daemon could be established #316

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Views/OperatingSystemView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ 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 ();
Expand Down Expand Up @@ -198,6 +199,17 @@ 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,
Expand All @@ -207,7 +219,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 (updates_grid);
updates_list.append (update_stack);
updates_list.append (automatic_updates_button);

updates_list.get_first_child ().focusable = false;
Expand Down Expand Up @@ -368,10 +380,13 @@ public class About.OperatingSystemView : Gtk.Box {
try {
current_state = yield update_proxy.get_current_state ();
} catch (Error e) {
update_stack.visible_child_name = "placeholder";
leolost2605 marked this conversation as resolved.
Show resolved Hide resolved
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) {
Expand Down
Loading