diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index 7908d369..22d2d594 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -29,7 +29,9 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { construct { current_state = { UP_TO_DATE, - "" + "", + 0, + 0 }; update_details = { @@ -189,7 +191,12 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { } private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) { - update_state (current_state.state, PkUtils.status_to_title (progress.status)); + update_state ( + current_state.state, + PkUtils.status_to_title (progress.status), + progress.percentage, + progress.download_size_remaining + ); } private void send_error (string message) { @@ -203,10 +210,17 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { update_state (ERROR, message); } - private void update_state (PkUtils.State state, string message = "") { + private void update_state ( + PkUtils.State state, + string message = "", + uint percentage = 0, + uint64 download_size_remaining = 0 + ) { current_state = { state, - message + message, + percentage, + download_size_remaining }; state_changed (); diff --git a/src/Backends/UbuntuDrivers.vala b/src/Backends/UbuntuDrivers.vala index e2f97d74..76bdfe3c 100644 --- a/src/Backends/UbuntuDrivers.vala +++ b/src/Backends/UbuntuDrivers.vala @@ -27,7 +27,9 @@ public class SettingsDaemon.Backends.UbuntuDrivers : Object { construct { current_state = { UP_TO_DATE, - "" + "", + 0, + 0 }; available_drivers = new HashTable> (str_hash, str_equal); @@ -260,7 +262,12 @@ public class SettingsDaemon.Backends.UbuntuDrivers : Object { } private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) { - update_state (current_state.state, PkUtils.status_to_title (progress.status)); + update_state ( + current_state.state, + PkUtils.status_to_title (progress.status), + progress.percentage, + progress.download_size_remaining + ); } private void send_error (string message) { @@ -274,10 +281,17 @@ public class SettingsDaemon.Backends.UbuntuDrivers : Object { update_state (ERROR, message); } - private void update_state (PkUtils.State state, string message = "") { + private void update_state ( + PkUtils.State state, + string message = "", + uint percentage = 0, + uint64 download_size_remaining = 0 + ) { current_state = { state, - message + message, + percentage, + download_size_remaining }; state_changed (); diff --git a/src/Utils/PkUtils.vala b/src/Utils/PkUtils.vala index c6e23e71..3c23cab2 100644 --- a/src/Utils/PkUtils.vala +++ b/src/Utils/PkUtils.vala @@ -11,6 +11,8 @@ namespace SettingsDaemon.PkUtils { public struct CurrentState { State state; string status; + uint percentage; + uint64 download_size_remaining; } public static unowned string status_to_title (Pk.Status status) {