Skip to content

Commit ecf640f

Browse files
committed
add progress indicator
1 parent a3329de commit ecf640f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Backends/SystemUpdate.vala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {
2929
construct {
3030
current_state = {
3131
UP_TO_DATE,
32-
""
32+
"",
33+
0
3334
};
3435

3536
update_details = {
@@ -189,7 +190,7 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {
189190
}
190191

191192
private void progress_callback (Pk.Progress progress, Pk.ProgressType progress_type) {
192-
update_state (current_state.state, PkUtils.status_to_title (progress.status));
193+
update_state (current_state.state, PkUtils.status_to_title (progress.status), progress.percentage);
193194
}
194195

195196
private void send_error (string message) {
@@ -203,10 +204,11 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {
203204
update_state (ERROR, message);
204205
}
205206

206-
private void update_state (PkUtils.State state, string message = "") {
207+
private void update_state (PkUtils.State state, string message = "", uint percentage = 0) {
207208
current_state = {
208209
state,
209-
message
210+
message,
211+
percentage
210212
};
211213

212214
state_changed ();

src/Backends/UbuntuDrivers.vala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public class SettingsDaemon.Backends.UbuntuDrivers : Object {
2727
construct {
2828
current_state = {
2929
UP_TO_DATE,
30-
""
30+
"",
31+
0
3132
};
3233

3334
available_drivers = new HashTable<string, GenericArray<string>> (str_hash, str_equal);
@@ -277,7 +278,8 @@ public class SettingsDaemon.Backends.UbuntuDrivers : Object {
277278
private void update_state (PkUtils.State state, string message = "") {
278279
current_state = {
279280
state,
280-
message
281+
message,
282+
0
281283
};
282284

283285
state_changed ();

src/Utils/PkUtils.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace SettingsDaemon.PkUtils {
1111
public struct CurrentState {
1212
State state;
1313
string status;
14+
uint percentage;
1415
}
1516

1617
public static unowned string status_to_title (Pk.Status status) {

0 commit comments

Comments
 (0)