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

SystemUpdate: Get last refresh time directly from Settings Daemon instead of via GSettings #358

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/DBus/SystemUpdate.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ public interface SystemUpdate : Object {
public abstract async void cancel () throws DBusError, IOError;
public abstract async void check_for_updates (bool force, bool notify) throws DBusError, IOError;
public abstract async void update () throws DBusError, IOError;
public abstract async int64 get_last_refresh_time () throws DBusError, IOError;
}
20 changes: 13 additions & 7 deletions src/Views/OperatingSystemView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/

public class About.OperatingSystemView : Gtk.Box {
private static Settings update_settings = new Settings ("io.elementary.settings-daemon.system-update");

private static string _bug_url;
private static string bug_url {
get {
Expand Down Expand Up @@ -510,11 +508,19 @@ public class About.OperatingSystemView : Gtk.Box {
case UP_TO_DATE:
updates_image.icon_name = "process-completed";
updates_title.label = _("Up To Date");
updates_description.label = _("Last checked %s").printf (
Granite.DateTime.get_relative_datetime (
new DateTime.from_unix_utc (update_settings.get_int64 ("last-refresh-time"))
)
);

try {
var last_refresh_time = yield update_proxy.get_last_refresh_time ();
updates_description.label = _("Last checked %s").printf (
Granite.DateTime.get_relative_datetime (
new DateTime.from_unix_utc (last_refresh_time)
)
);
} catch (Error e) {
critical ("Failed to get last refresh time from Updates Backend: %s", e.message);
updates_description.label = _("Last checked unknown");
}

button_stack.visible_child_name = "refresh";
break;
case CHECKING:
Expand Down
Loading