From e04ae0c06cda6b16095cec1860f79accf398cf68 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 17:40:12 +0100 Subject: [PATCH 01/21] Implement SystemUpdates prototype --- meson.build | 1 + src/Application.vala | 8 ++ src/Backends/SystemUpdate/SystemUpdate.vala | 107 ++++++++++++++++++++ src/meson.build | 2 + 4 files changed, 118 insertions(+) create mode 100644 src/Backends/SystemUpdate/SystemUpdate.vala diff --git a/meson.build b/meson.build index 8b3a5ed6..28b576b4 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ fwupd_dep = dependency('fwupd') gio_dep = dependency ('gio-2.0') glib_dep = dependency('glib-2.0') granite_dep = dependency('granite', version: '>= 5.3.0') +pk_dep = dependency('packagekit-glib2') i18n = import('i18n') gettext_name = meson.project_name() diff --git a/src/Application.vala b/src/Application.vala index 09855167..3b1dc594 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -64,6 +64,14 @@ public sealed class SettingsDaemon.Application : Gtk.Application { hold (); } + protected override bool dbus_register (DBusConnection connection, string object_path) throws Error { + base.dbus_register (connection, object_path); + + connection.register_object (object_path, new Backends.SystemUpdate ()); + + return true; + } + private async void setup_accounts_services () { unowned GLib.DBusConnection connection; string path; diff --git a/src/Backends/SystemUpdate/SystemUpdate.vala b/src/Backends/SystemUpdate/SystemUpdate.vala new file mode 100644 index 00000000..b7b5407c --- /dev/null +++ b/src/Backends/SystemUpdate/SystemUpdate.vala @@ -0,0 +1,107 @@ +[DBus (name="io.elementary.settings_daemon.SystemUpdate")] +public class SettingsDaemon.Backends.SystemUpdate : Object { + public enum State { + UP_TO_DATE, + CHECKING, + AVAILABLE, + DOWNLOADING, + RESTART_REQUIRED + } + + public struct CurrentState { + State state; + int progress; + } + + public struct UpdateDetails { + string[] packages; + int size; + } + + public signal void state_changed (); + + public CurrentState current_state { get; private set; } + public UpdateDetails update_details { get; private set; default = UpdateDetails (); } + + private Pk.Task task; + private Pk.PackageSack? available_updates = null; + + construct { + current_state = { + UP_TO_DATE, + 0 + }; + + task = new Pk.Task () { + only_download = true + }; + check_for_updates.begin (); + } + + private async void check_for_updates (bool force = false) { + if (current_state.state != UP_TO_DATE && !force) { + return; + } + + update_state (CHECKING); + + try { + available_updates = (yield task.get_updates_async (Pk.Filter.NONE, null, () => {})).get_package_sack (); + + if (available_updates == null || available_updates.get_size () == 0) { + update_state (UP_TO_DATE); + return; + } + + string[] package_names = {}; + + foreach (var package in available_updates.get_array ()) { + package_names += package.get_name (); + } + + update_details = { + package_names, + 0 + }; + + update_state (AVAILABLE); + } catch (Error e) { + warning ("Failed to get available updates: %s", e.message); + update_state (UP_TO_DATE); + } + } + + public async void update () throws DBusError, IOError { + if (current_state.state != AVAILABLE) { + return; + } + + update_state (DOWNLOADING, 0); + + try { + var result = yield task.update_packages_async (available_updates.get_ids (), null, (progress, progress_type) => { + if (progress_type == PERCENTAGE) { + update_state (DOWNLOADING, progress.percentage); + } + }); + + Pk.offline_trigger (REBOOT); + + update_state (RESTART_REQUIRED, 0); + } catch (Error e) { + warning ("Failed to get available updates: %s", e.message); + + //This will also flush any already downloaded updates and disable the offline trigger + check_for_updates.begin (true); + } + } + + private void update_state (State state, int progress = 0) { + current_state = { + state, + progress + }; + + state_changed (); + } +} \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 9c05e9a7..f655b621 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,6 +7,7 @@ sources = files( 'Backends/MouseSettings.vala', 'Backends/NightLightSettings.vala', 'Backends/PrefersColorSchemeSettings.vala', + 'Backends/SystemUpdate/SystemUpdate.vala', 'Utils/SunriseSunsetCalculator.vala', ) @@ -21,6 +22,7 @@ executable( granite_dep, libgeoclue_dep, m_dep, + pk_dep ], install: true, ) From 51f2a731c50eac0d829c0fb0ba3390ef8fd44227 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 18:07:20 +0100 Subject: [PATCH 02/21] Add notifications --- src/Application.vala | 9 ++++++ src/Backends/SystemUpdate/SystemUpdate.vala | 32 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Application.vala b/src/Application.vala index 3b1dc594..209440df 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -4,6 +4,9 @@ */ public sealed class SettingsDaemon.Application : Gtk.Application { + public const string ACTION_PREFIX = "app."; + public const string SHOW_UPDATES_ACTION = "show-udpates"; + private AccountsService accounts_service; private Pantheon.AccountsService pantheon_service; private DisplayManager.AccountsService display_manager_service; @@ -60,6 +63,12 @@ public sealed class SettingsDaemon.Application : Gtk.Application { show_firmware_updates_action.activate.connect (show_firmware_updates); add_action (show_firmware_updates_action); + var show_updates_action = new GLib.SimpleAction (SHOW_UPDATES_ACTION, null); + show_updates_action.activate.connect (() => { + message ("SHOW UPDATES"); + }); + add_action (show_updates_action); + setup_accounts_services.begin (); hold (); } diff --git a/src/Backends/SystemUpdate/SystemUpdate.vala b/src/Backends/SystemUpdate/SystemUpdate.vala index b7b5407c..9a8affde 100644 --- a/src/Backends/SystemUpdate/SystemUpdate.vala +++ b/src/Backends/SystemUpdate/SystemUpdate.vala @@ -25,6 +25,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { private Pk.Task task; private Pk.PackageSack? available_updates = null; + private Error? last_error = null; construct { current_state = { @@ -35,6 +36,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { task = new Pk.Task () { only_download = true }; + check_for_updates.begin (); } @@ -45,6 +47,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (CHECKING); + try { + yield task.refresh_cache_async (false, null, () => {}); + } catch (Error e) { + warning ("Failed to refresh cache: %s", e.message); + } + try { available_updates = (yield task.get_updates_async (Pk.Filter.NONE, null, () => {})).get_package_sack (); @@ -64,6 +72,16 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { 0 }; + string title = ngettext ("Update Available", "Updates Available", available_updates.get_size ()); + string body = ngettext ("%u update is available for your system", "%u updates are available for your system", available_updates.get_size ()).printf (available_updates.get_size ()); + + var notification = new Notification (title); + notification.set_body (body); + notification.set_icon (new ThemedIcon ("software-update-available")); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); + + GLib.Application.get_default ().send_notification (null, notification); + update_state (AVAILABLE); } catch (Error e) { warning ("Failed to get available updates: %s", e.message); @@ -89,7 +107,19 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (RESTART_REQUIRED, 0); } catch (Error e) { - warning ("Failed to get available updates: %s", e.message); + critical ("Failed to download available updates: %s", e.message); + + string title = _("Update failed"); + string body = _("An Error occured while trying to update your system"); + + var notification = new Notification (title); + notification.set_body (body); + notification.set_icon (new ThemedIcon ("dialog-error")); + notification.add_button (_("Show details"), Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); + + GLib.Application.get_default ().send_notification (null, notification); + + last_error = e; //This will also flush any already downloaded updates and disable the offline trigger check_for_updates.begin (true); From 5eb65a21ce7e94f48e8e48e0e0606685b91e7cf7 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 19:12:35 +0100 Subject: [PATCH 03/21] Some updates --- .../{SystemUpdate => }/SystemUpdate.vala | 19 ++++++++++++++++--- src/meson.build | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) rename src/Backends/{SystemUpdate => }/SystemUpdate.vala (90%) diff --git a/src/Backends/SystemUpdate/SystemUpdate.vala b/src/Backends/SystemUpdate.vala similarity index 90% rename from src/Backends/SystemUpdate/SystemUpdate.vala rename to src/Backends/SystemUpdate.vala index 9a8affde..6ed553ec 100644 --- a/src/Backends/SystemUpdate/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -20,8 +20,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public signal void state_changed (); - public CurrentState current_state { get; private set; } - public UpdateDetails update_details { get; private set; default = UpdateDetails (); } + private CurrentState current_state; + private UpdateDetails update_details; private Pk.Task task; private Pk.PackageSack? available_updates = null; @@ -33,6 +33,11 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { 0 }; + update_details = { + {}, + 0 + }; + task = new Pk.Task () { only_download = true }; @@ -40,7 +45,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { check_for_updates.begin (); } - private async void check_for_updates (bool force = false) { + public async void check_for_updates (bool force = false) { if (current_state.state != UP_TO_DATE && !force) { return; } @@ -134,4 +139,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { state_changed (); } + + public async CurrentState get_current_state () throws DBusError, IOError { + return current_state; + } + + public async UpdateDetails get_update_details () throws DBusError, IOError { + return update_details; + } } \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index f655b621..b35eed56 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,7 +7,7 @@ sources = files( 'Backends/MouseSettings.vala', 'Backends/NightLightSettings.vala', 'Backends/PrefersColorSchemeSettings.vala', - 'Backends/SystemUpdate/SystemUpdate.vala', + 'Backends/SystemUpdate.vala', 'Utils/SunriseSunsetCalculator.vala', ) From bd2f0709a8d0c48f57d95d1cbd88f198af8c80d7 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 19:28:59 +0100 Subject: [PATCH 04/21] Update progress display --- src/Backends/SystemUpdate.vala | 112 ++++++++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 14 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 6ed553ec..458c86c6 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -1,3 +1,10 @@ +/* + * Copyright 2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Authored by: Leonhard Kargl + */ + [DBus (name="io.elementary.settings_daemon.SystemUpdate")] public class SettingsDaemon.Backends.SystemUpdate : Object { public enum State { @@ -10,7 +17,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public struct CurrentState { State state; - int progress; + string status; } public struct UpdateDetails { @@ -30,7 +37,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { construct { current_state = { UP_TO_DATE, - 0 + "" }; update_details = { @@ -53,13 +60,13 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (CHECKING); try { - yield task.refresh_cache_async (false, null, () => {}); + yield task.refresh_cache_async (false, null, progress_callback); } catch (Error e) { warning ("Failed to refresh cache: %s", e.message); } try { - available_updates = (yield task.get_updates_async (Pk.Filter.NONE, null, () => {})).get_package_sack (); + available_updates = (yield task.get_updates_async (Pk.Filter.NONE, null, progress_callback)).get_package_sack (); if (available_updates == null || available_updates.get_size () == 0) { update_state (UP_TO_DATE); @@ -99,18 +106,14 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { return; } - update_state (DOWNLOADING, 0); + update_state (DOWNLOADING); try { - var result = yield task.update_packages_async (available_updates.get_ids (), null, (progress, progress_type) => { - if (progress_type == PERCENTAGE) { - update_state (DOWNLOADING, progress.percentage); - } - }); + var result = yield task.update_packages_async (available_updates.get_ids (), null, progress_callback); Pk.offline_trigger (REBOOT); - update_state (RESTART_REQUIRED, 0); + update_state (RESTART_REQUIRED); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); @@ -131,15 +134,96 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } } - private void update_state (State state, int progress = 0) { + private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) { + update_state (current_state.state, status_to_title (progress.status)); + } + + private void update_state (State state, string message = "") { current_state = { state, - progress + message }; state_changed (); } + private unowned string status_to_title (Pk.Status status) { + // From https://github.com/elementary/appcenter/blob/master/src/Core/ChangeInformation.vala#L51 + switch (status) { + case Pk.Status.SETUP: + return _("Starting"); + case Pk.Status.WAIT: + return _("Waiting"); + case Pk.Status.RUNNING: + return _("Running"); + case Pk.Status.QUERY: + return _("Querying"); + case Pk.Status.INFO: + return _("Getting information"); + case Pk.Status.REMOVE: + return _("Removing packages"); + case Pk.Status.DOWNLOAD: + return _("Downloading"); + case Pk.Status.REFRESH_CACHE: + return _("Refreshing software list"); + case Pk.Status.UPDATE: + return _("Installing updates"); + case Pk.Status.CLEANUP: + return _("Cleaning up packages"); + case Pk.Status.OBSOLETE: + return _("Obsoleting packages"); + case Pk.Status.DEP_RESOLVE: + return _("Resolving dependencies"); + case Pk.Status.SIG_CHECK: + return _("Checking signatures"); + case Pk.Status.TEST_COMMIT: + return _("Testing changes"); + case Pk.Status.COMMIT: + return _("Committing changes"); + case Pk.Status.REQUEST: + return _("Requesting data"); + case Pk.Status.FINISHED: + return _("Finished"); + case Pk.Status.CANCEL: + return _("Cancelling"); + case Pk.Status.DOWNLOAD_REPOSITORY: + return _("Downloading repository information"); + case Pk.Status.DOWNLOAD_PACKAGELIST: + return _("Downloading list of packages"); + case Pk.Status.DOWNLOAD_FILELIST: + return _("Downloading file lists"); + case Pk.Status.DOWNLOAD_CHANGELOG: + return _("Downloading lists of changes"); + case Pk.Status.DOWNLOAD_GROUP: + return _("Downloading groups"); + case Pk.Status.DOWNLOAD_UPDATEINFO: + return _("Downloading update information"); + case Pk.Status.REPACKAGING: + return _("Repackaging files"); + case Pk.Status.LOADING_CACHE: + return _("Loading cache"); + case Pk.Status.SCAN_APPLICATIONS: + return _("Scanning applications"); + case Pk.Status.GENERATE_PACKAGE_LIST: + return _("Generating package lists"); + case Pk.Status.WAITING_FOR_LOCK: + return _("Waiting for package manager lock"); + case Pk.Status.WAITING_FOR_AUTH: + return _("Waiting for authentication"); + case Pk.Status.SCAN_PROCESS_LIST: + return _("Updating running applications"); + case Pk.Status.CHECK_EXECUTABLE_FILES: + return _("Checking applications in use"); + case Pk.Status.CHECK_LIBRARIES: + return _("Checking libraries in use"); + case Pk.Status.COPY_FILES: + return _("Copying files"); + case Pk.Status.INSTALL: + default: + return _("Installing"); + } + } + public async CurrentState get_current_state () throws DBusError, IOError { return current_state; } @@ -147,4 +231,4 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public async UpdateDetails get_update_details () throws DBusError, IOError { return update_details; } -} \ No newline at end of file +} From 9a3be931ecee2a55421d27ec226788dc9afbf56b Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 19:33:33 +0100 Subject: [PATCH 05/21] Update ci --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6248756a..7c0577d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libaccountsservice-dev libdbus-1-dev libgranite-dev libgeoclue-2-dev libfwupd-dev meson valac + apt install -y libaccountsservice-dev libdbus-1-dev libgranite-dev libgeoclue-2-dev libfwupd-dev libpackagekit-glib2-dev meson valac - name: Build env: DESTDIR: out From 4d352f399e163ae2195c352c4bcd215ff8d2cff1 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 22:25:41 +0100 Subject: [PATCH 06/21] Add timer --- data/io.elementary.settings-daemon.gschema.xml | 8 ++++++++ src/Backends/SystemUpdate.vala | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/data/io.elementary.settings-daemon.gschema.xml b/data/io.elementary.settings-daemon.gschema.xml index 8ff68a1a..d22d0101 100644 --- a/data/io.elementary.settings-daemon.gschema.xml +++ b/data/io.elementary.settings-daemon.gschema.xml @@ -70,4 +70,12 @@ The day for calendars to use as the first day of the week + + + + 86400 + How often to check for updates + How often to check for updates in seconds. + + diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 458c86c6..35e80d49 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -27,6 +27,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public signal void state_changed (); + private static Settings settings; + + static construct { + settings = new GLib.Settings ("io.elementary.settings-daemon.system-updates"); + } + private CurrentState current_state; private UpdateDetails update_details; @@ -50,10 +56,15 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { }; check_for_updates.begin (); + + Timeout.add_seconds ((uint) settings.get_int64 ("refresh-interval"), () => { + check_for_updates.begin (); + return Source.CONTINUE; + }); } - public async void check_for_updates (bool force = false) { - if (current_state.state != UP_TO_DATE && !force) { + public async void check_for_updates (bool force = false) throws DBusError, IOError { + if (current_state.state != UP_TO_DATE && current_state.state != AVAILABLE && !force) { return; } @@ -109,7 +120,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (DOWNLOADING); try { - var result = yield task.update_packages_async (available_updates.get_ids (), null, progress_callback); + yield task.update_packages_async (available_updates.get_ids (), null, progress_callback); Pk.offline_trigger (REBOOT); From d915a0244e79baa3cd7dfe15991e952e2ed87c49 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 22:54:43 +0100 Subject: [PATCH 07/21] Add error dialog --- src/Application.vala | 10 ++++++++- src/Backends/SystemUpdate.vala | 37 +++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 209440df..0ccbf7ff 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -6,6 +6,7 @@ public sealed class SettingsDaemon.Application : Gtk.Application { public const string ACTION_PREFIX = "app."; public const string SHOW_UPDATES_ACTION = "show-udpates"; + public const string SHOW_UPDATES_ERROR_ACTION = "show-udpates-error"; private AccountsService accounts_service; private Pantheon.AccountsService pantheon_service; @@ -20,6 +21,8 @@ public sealed class SettingsDaemon.Application : Gtk.Application { private Backends.Housekeeping housekeeping; + private Backends.SystemUpdate system_update; + private const string FDO_ACCOUNTS_NAME = "org.freedesktop.Accounts"; private const string FDO_ACCOUNTS_PATH = "/org/freedesktop/Accounts"; @@ -69,6 +72,10 @@ public sealed class SettingsDaemon.Application : Gtk.Application { }); add_action (show_updates_action); + var show_updates_error_action = new GLib.SimpleAction (SHOW_UPDATES_ERROR_ACTION, null); + show_updates_error_action.activate.connect (system_update.show_error_details); + add_action (show_updates_error_action); + setup_accounts_services.begin (); hold (); } @@ -76,7 +83,8 @@ public sealed class SettingsDaemon.Application : Gtk.Application { protected override bool dbus_register (DBusConnection connection, string object_path) throws Error { base.dbus_register (connection, object_path); - connection.register_object (object_path, new Backends.SystemUpdate ()); + system_update = new Backends.SystemUpdate (); + connection.register_object (object_path, system_update); return true; } diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 35e80d49..2bf0714a 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -124,6 +124,15 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { Pk.offline_trigger (REBOOT); + string title = _("Restart Required"); + string body = _("Please restart your system to finalize updates"); + + var notification = new Notification (title); + notification.set_body (body); + notification.set_icon (new ThemedIcon ("system-reboot")); + + GLib.Application.get_default ().send_notification (null, notification); + update_state (RESTART_REQUIRED); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); @@ -134,7 +143,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { var notification = new Notification (title); notification.set_body (body); notification.set_icon (new ThemedIcon ("dialog-error")); - notification.add_button (_("Show details"), Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ERROR_ACTION); GLib.Application.get_default ().send_notification (null, notification); @@ -145,6 +154,32 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } } + [DBus (visible=false)] + public void show_error_details () { + if (last_error == null) { + return; + } + + var message_dialog = new Granite.MessageDialog ( + _("Failed to download updates"), + _("This may have been caused by sideloaded or manually compiled software, a third-party software source, or a package manager error. Manually refreshing updates may resolve the issue."), + new ThemedIcon ("dialog-error") + ); + message_dialog.add_button (_("Refresh Updates"), Gtk.ResponseType.ACCEPT); + + message_dialog.show_error_details (last_error.message); + + message_dialog.response.connect ((response_type) => { + if (response_type == Gtk.ResponseType.ACCEPT) { + check_for_updates.begin (true); + } + + message_dialog.destroy (); + }); + + message_dialog.present (); + } + private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) { update_state (current_state.state, status_to_title (progress.status)); } From e69ee663c90620cfbdf6ae3227d9d20bf9bac0db Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 22:58:27 +0100 Subject: [PATCH 08/21] Inform the user better --- src/Application.vala | 1 + src/Backends/SystemUpdate.vala | 22 +++++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 0ccbf7ff..cbddb3dc 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -68,6 +68,7 @@ public sealed class SettingsDaemon.Application : Gtk.Application { var show_updates_action = new GLib.SimpleAction (SHOW_UPDATES_ACTION, null); show_updates_action.activate.connect (() => { + //TODO: settings uri for updates? message ("SHOW UPDATES"); }); add_action (show_updates_action); diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 2bf0714a..226c71bd 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -95,11 +95,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { 0 }; - string title = ngettext ("Update Available", "Updates Available", available_updates.get_size ()); - string body = ngettext ("%u update is available for your system", "%u updates are available for your system", available_updates.get_size ()).printf (available_updates.get_size ()); - - var notification = new Notification (title); - notification.set_body (body); + var notification = new Notification (_("Update Available")); + notification.set_body (_("A system update is available")); notification.set_icon (new ThemedIcon ("software-update-available")); notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); @@ -124,12 +121,10 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { Pk.offline_trigger (REBOOT); - string title = _("Restart Required"); - string body = _("Please restart your system to finalize updates"); - - var notification = new Notification (title); - notification.set_body (body); + var notification = new Notification (_("Restart Required")); + notification.set_body (_("Please restart your system to finalize updates")); notification.set_icon (new ThemedIcon ("system-reboot")); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); GLib.Application.get_default ().send_notification (null, notification); @@ -137,11 +132,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } catch (Error e) { critical ("Failed to download available updates: %s", e.message); - string title = _("Update failed"); - string body = _("An Error occured while trying to update your system"); - - var notification = new Notification (title); - notification.set_body (body); + var notification = new Notification (_("Update failed")); + notification.set_body (_("An Error occured while trying to update your system")); notification.set_icon (new ThemedIcon ("dialog-error")); notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ERROR_ACTION); From 39e90c316799478ecb95d6f5f0982df1ed333e39 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 23:16:47 +0100 Subject: [PATCH 09/21] Misc comments --- src/Backends/SystemUpdate.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 226c71bd..38ff063b 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -92,7 +92,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_details = { package_names, - 0 + 0 //FIXME: Is there a way to get update size from PackageKit }; var notification = new Notification (_("Update Available")); @@ -141,7 +141,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { last_error = e; - //This will also flush any already downloaded updates and disable the offline trigger + //This will also flush any already downloaded updates and disable the offline trigger (I think) check_for_updates.begin (true); } } From f545fed2dfa9ebc84b2fce7c20c3c1d994c92b53 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 23:23:46 +0100 Subject: [PATCH 10/21] Allow cancelling --- src/Backends/SystemUpdate.vala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 38ff063b..7c80e488 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -38,6 +38,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { private Pk.Task task; private Pk.PackageSack? available_updates = null; + private GLib.Cancellable cancellable; private Error? last_error = null; construct { @@ -55,6 +56,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { only_download = true }; + cancellable = new GLib.Cancellable (); + check_for_updates.begin (); Timeout.add_seconds ((uint) settings.get_int64 ("refresh-interval"), () => { @@ -71,7 +74,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (CHECKING); try { - yield task.refresh_cache_async (false, null, progress_callback); + yield task.refresh_cache_async (force, null, progress_callback); } catch (Error e) { warning ("Failed to refresh cache: %s", e.message); } @@ -114,10 +117,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { return; } + cancellable.reset (); + update_state (DOWNLOADING); try { - yield task.update_packages_async (available_updates.get_ids (), null, progress_callback); + yield task.update_packages_async (available_updates.get_ids (), cancellable, progress_callback); Pk.offline_trigger (REBOOT); @@ -129,6 +134,9 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { GLib.Application.get_default ().send_notification (null, notification); update_state (RESTART_REQUIRED); + } catch (IOError.CANCELLED e) { + debug ("Updates were cancelled"); + check_for_updates.begin (true); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); @@ -146,6 +154,10 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } } + public void cancel () throws DBusError, IOError { + cancellable.cancel (); + } + [DBus (visible=false)] public void show_error_details () { if (last_error == null) { From 025e0b0b21b9318642859382e5222cb73c6ed4fd Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 23:54:16 +0100 Subject: [PATCH 11/21] Fix typo --- src/Application.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index cbddb3dc..886d5b11 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -5,8 +5,8 @@ public sealed class SettingsDaemon.Application : Gtk.Application { public const string ACTION_PREFIX = "app."; - public const string SHOW_UPDATES_ACTION = "show-udpates"; - public const string SHOW_UPDATES_ERROR_ACTION = "show-udpates-error"; + public const string SHOW_UPDATES_ACTION = "show-updates"; + public const string SHOW_UPDATES_ERROR_ACTION = "show-updates-error"; private AccountsService accounts_service; private Pantheon.AccountsService pantheon_service; From e8ef52e301454667d3f28b4ea7794b99c5175f96 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Mon, 22 Jan 2024 23:58:14 +0100 Subject: [PATCH 12/21] Add last refresh time --- data/io.elementary.settings-daemon.gschema.xml | 5 +++++ src/Backends/SystemUpdate.vala | 2 ++ 2 files changed, 7 insertions(+) diff --git a/data/io.elementary.settings-daemon.gschema.xml b/data/io.elementary.settings-daemon.gschema.xml index d22d0101..6beaca49 100644 --- a/data/io.elementary.settings-daemon.gschema.xml +++ b/data/io.elementary.settings-daemon.gschema.xml @@ -72,6 +72,11 @@ + + 0 + When updates were last refreshed + When the cache was last refreshed and checked for updates in unix utc. + 86400 How often to check for updates diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 7c80e488..0ea5f637 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -82,6 +82,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { try { available_updates = (yield task.get_updates_async (Pk.Filter.NONE, null, progress_callback)).get_package_sack (); + settings.set_int64 ("last-refresh-time", new DateTime.now_utc ().to_unix ()); + if (available_updates == null || available_updates.get_size () == 0) { update_state (UP_TO_DATE); return; From 96d74cc1f01919c400f7e80c85a29d4d30366b6a Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 00:26:09 +0100 Subject: [PATCH 13/21] Move error handling to system settings --- src/Application.vala | 10 +-------- src/Backends/SystemUpdate.vala | 37 ++++------------------------------ 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 886d5b11..9d019ec1 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -6,7 +6,6 @@ public sealed class SettingsDaemon.Application : Gtk.Application { public const string ACTION_PREFIX = "app."; public const string SHOW_UPDATES_ACTION = "show-updates"; - public const string SHOW_UPDATES_ERROR_ACTION = "show-updates-error"; private AccountsService accounts_service; private Pantheon.AccountsService pantheon_service; @@ -21,8 +20,6 @@ public sealed class SettingsDaemon.Application : Gtk.Application { private Backends.Housekeeping housekeeping; - private Backends.SystemUpdate system_update; - private const string FDO_ACCOUNTS_NAME = "org.freedesktop.Accounts"; private const string FDO_ACCOUNTS_PATH = "/org/freedesktop/Accounts"; @@ -73,10 +70,6 @@ public sealed class SettingsDaemon.Application : Gtk.Application { }); add_action (show_updates_action); - var show_updates_error_action = new GLib.SimpleAction (SHOW_UPDATES_ERROR_ACTION, null); - show_updates_error_action.activate.connect (system_update.show_error_details); - add_action (show_updates_error_action); - setup_accounts_services.begin (); hold (); } @@ -84,8 +77,7 @@ public sealed class SettingsDaemon.Application : Gtk.Application { protected override bool dbus_register (DBusConnection connection, string object_path) throws Error { base.dbus_register (connection, object_path); - system_update = new Backends.SystemUpdate (); - connection.register_object (object_path, system_update); + connection.register_object (object_path, new Backends.SystemUpdate ()); return true; } diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 0ea5f637..ca921630 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -12,7 +12,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { CHECKING, AVAILABLE, DOWNLOADING, - RESTART_REQUIRED + RESTART_REQUIRED, + ERROR } public struct CurrentState { @@ -39,7 +40,6 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { private Pk.Task task; private Pk.PackageSack? available_updates = null; private GLib.Cancellable cancellable; - private Error? last_error = null; construct { current_state = { @@ -145,14 +145,11 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { var notification = new Notification (_("Update failed")); notification.set_body (_("An Error occured while trying to update your system")); notification.set_icon (new ThemedIcon ("dialog-error")); - notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ERROR_ACTION); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); GLib.Application.get_default ().send_notification (null, notification); - last_error = e; - - //This will also flush any already downloaded updates and disable the offline trigger (I think) - check_for_updates.begin (true); + update_state (ERROR, e.message); } } @@ -160,32 +157,6 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { cancellable.cancel (); } - [DBus (visible=false)] - public void show_error_details () { - if (last_error == null) { - return; - } - - var message_dialog = new Granite.MessageDialog ( - _("Failed to download updates"), - _("This may have been caused by sideloaded or manually compiled software, a third-party software source, or a package manager error. Manually refreshing updates may resolve the issue."), - new ThemedIcon ("dialog-error") - ); - message_dialog.add_button (_("Refresh Updates"), Gtk.ResponseType.ACCEPT); - - message_dialog.show_error_details (last_error.message); - - message_dialog.response.connect ((response_type) => { - if (response_type == Gtk.ResponseType.ACCEPT) { - check_for_updates.begin (true); - } - - message_dialog.destroy (); - }); - - message_dialog.present (); - } - private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) { update_state (current_state.state, status_to_title (progress.status)); } From d53ed054db9193b776245b35421bc42c6049a821 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 00:44:15 +0100 Subject: [PATCH 14/21] Cleanup --- src/Backends/SystemUpdate.vala | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index ca921630..d89640ed 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -28,11 +28,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public signal void state_changed (); - private static Settings settings; - - static construct { - settings = new GLib.Settings ("io.elementary.settings-daemon.system-updates"); - } + private static Settings settings = new GLib.Settings ("io.elementary.settings-daemon.system-updates"); private CurrentState current_state; private UpdateDetails update_details; From eab902da17f3a2fea277ddd5bb8d9e97eed2666d Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 00:47:10 +0100 Subject: [PATCH 15/21] Don't always notify --- src/Backends/SystemUpdate.vala | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index d89640ed..6285051f 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -54,15 +54,15 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { cancellable = new GLib.Cancellable (); - check_for_updates.begin (); + check_for_updates.begin (false, true); Timeout.add_seconds ((uint) settings.get_int64 ("refresh-interval"), () => { - check_for_updates.begin (); + check_for_updates.begin (false, true); return Source.CONTINUE; }); } - public async void check_for_updates (bool force = false) throws DBusError, IOError { + public async void check_for_updates (bool force, bool notify) throws DBusError, IOError { if (current_state.state != UP_TO_DATE && current_state.state != AVAILABLE && !force) { return; } @@ -96,12 +96,14 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { 0 //FIXME: Is there a way to get update size from PackageKit }; - var notification = new Notification (_("Update Available")); - notification.set_body (_("A system update is available")); - notification.set_icon (new ThemedIcon ("software-update-available")); - notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); + if (notify) { + var notification = new Notification (_("Update Available")); + notification.set_body (_("A system update is available")); + notification.set_icon (new ThemedIcon ("software-update-available")); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); - GLib.Application.get_default ().send_notification (null, notification); + GLib.Application.get_default ().send_notification (null, notification); + } update_state (AVAILABLE); } catch (Error e) { @@ -134,7 +136,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (RESTART_REQUIRED); } catch (IOError.CANCELLED e) { debug ("Updates were cancelled"); - check_for_updates.begin (true); + check_for_updates.begin (true, false); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); From 36a24586acd3a0aa86afd1aa283938129f97d68a Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 19:37:49 +0100 Subject: [PATCH 16/21] Fix cancelling throwing errors --- src/Backends/SystemUpdate.vala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 6285051f..12fd7d7c 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -122,7 +122,13 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (DOWNLOADING); try { - yield task.update_packages_async (available_updates.get_ids (), cancellable, progress_callback); + var results = yield task.update_packages_async (available_updates.get_ids (), cancellable, progress_callback); + + if (results.get_exit_code () == CANCELLED) { + debug ("Updates were cancelled"); + check_for_updates.begin (true, false); + return; + } Pk.offline_trigger (REBOOT); @@ -134,9 +140,6 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { GLib.Application.get_default ().send_notification (null, notification); update_state (RESTART_REQUIRED); - } catch (IOError.CANCELLED e) { - debug ("Updates were cancelled"); - check_for_updates.begin (true, false); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); From 0174d0a92b55ca2c7ec79dd5abf3d644fb3415cf Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 19:43:42 +0100 Subject: [PATCH 17/21] Send error if offline update failed --- src/Backends/SystemUpdate.vala | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 12fd7d7c..ab0deee8 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -54,6 +54,16 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { cancellable = new GLib.Cancellable (); + try { + var last_offline_results = Pk.offline_get_results (); + + if (last_offline_results.get_exit_code () != SUCCESS && last_offline_results.get_error_code () != null) { + send_error (last_offline_results.get_error_code ().details); + } + } catch (Error e) { + warning ("Couldn't determine last offline results: %s", e.message); + } + check_for_updates.begin (false, true); Timeout.add_seconds ((uint) settings.get_int64 ("refresh-interval"), () => { @@ -142,15 +152,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (RESTART_REQUIRED); } catch (Error e) { critical ("Failed to download available updates: %s", e.message); - - var notification = new Notification (_("Update failed")); - notification.set_body (_("An Error occured while trying to update your system")); - notification.set_icon (new ThemedIcon ("dialog-error")); - notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); - - GLib.Application.get_default ().send_notification (null, notification); - - update_state (ERROR, e.message); + send_error (e.message); } } @@ -162,6 +164,17 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (current_state.state, status_to_title (progress.status)); } + private void send_error (string message) { + var notification = new Notification (_("Update failed")); + notification.set_body (_("An Error occured while trying to update your system")); + notification.set_icon (new ThemedIcon ("dialog-error")); + notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); + + GLib.Application.get_default ().send_notification (null, notification); + + update_state (ERROR, message); + } + private void update_state (State state, string message = "") { current_state = { state, From eb21759c71e0a1dcf2cdfe3f62589540127d68f6 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 19:47:02 +0100 Subject: [PATCH 18/21] Launch settings uri --- src/Application.vala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 9d019ec1..1efb885e 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -65,8 +65,7 @@ public sealed class SettingsDaemon.Application : Gtk.Application { var show_updates_action = new GLib.SimpleAction (SHOW_UPDATES_ACTION, null); show_updates_action.activate.connect (() => { - //TODO: settings uri for updates? - message ("SHOW UPDATES"); + GLib.AppInfo.launch_default_for_uri_async.begin ("settings://about/os", null); }); add_action (show_updates_action); From 5a99dc54259aaf0e23dd12ac0f0f289fba311c91 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 19:50:30 +0100 Subject: [PATCH 19/21] Update notifications --- src/Backends/SystemUpdate.vala | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index ab0deee8..f1e32474 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -26,6 +26,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { int size; } + private const string NOTIFICATION_ID = "system-update"; + public signal void state_changed (); private static Settings settings = new GLib.Settings ("io.elementary.settings-daemon.system-updates"); @@ -107,12 +109,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { }; if (notify) { - var notification = new Notification (_("Update Available")); + var notification = new Notification (_("Update available")); notification.set_body (_("A system update is available")); notification.set_icon (new ThemedIcon ("software-update-available")); notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); - GLib.Application.get_default ().send_notification (null, notification); + GLib.Application.get_default ().send_notification (NOTIFICATION_ID, notification); } update_state (AVAILABLE); @@ -142,12 +144,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { Pk.offline_trigger (REBOOT); - var notification = new Notification (_("Restart Required")); + var notification = new Notification (_("Restart required")); notification.set_body (_("Please restart your system to finalize updates")); notification.set_icon (new ThemedIcon ("system-reboot")); notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); - GLib.Application.get_default ().send_notification (null, notification); + GLib.Application.get_default ().send_notification (NOTIFICATION_ID, notification); update_state (RESTART_REQUIRED); } catch (Error e) { @@ -165,12 +167,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } private void send_error (string message) { - var notification = new Notification (_("Update failed")); - notification.set_body (_("An Error occured while trying to update your system")); + var notification = new Notification (_("System updates couldn't be installed")); + notification.set_body (_("An error occured while trying to update your system")); notification.set_icon (new ThemedIcon ("dialog-error")); notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION); - GLib.Application.get_default ().send_notification (null, notification); + GLib.Application.get_default ().send_notification (NOTIFICATION_ID, notification); update_state (ERROR, message); } From 9b058f12e1da5a930dacf425124c1dcd8ba62108 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 23 Jan 2024 19:56:27 +0100 Subject: [PATCH 20/21] Keep it SystemUpdate instead of SystemUpdates everywhere --- data/io.elementary.settings-daemon.gschema.xml | 2 +- src/Backends/SystemUpdate.vala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/io.elementary.settings-daemon.gschema.xml b/data/io.elementary.settings-daemon.gschema.xml index 6beaca49..12aa9c28 100644 --- a/data/io.elementary.settings-daemon.gschema.xml +++ b/data/io.elementary.settings-daemon.gschema.xml @@ -71,7 +71,7 @@ - + 0 When updates were last refreshed diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index f1e32474..72783828 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -30,7 +30,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { public signal void state_changed (); - private static Settings settings = new GLib.Settings ("io.elementary.settings-daemon.system-updates"); + private static Settings settings = new GLib.Settings ("io.elementary.settings-daemon.system-update"); private CurrentState current_state; private UpdateDetails update_details; From a1e2969f518db99b67085569757993564d8b9af9 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Wed, 24 Jan 2024 20:57:38 +0100 Subject: [PATCH 21/21] Update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c3e552b1..4fd8defd 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ You'll need the following dependencies: * libfwupd-dev * libgeoclue-2-dev * libgranite-dev +* libpackagekit-glib2-deb * meson * valac