Skip to content

Commit

Permalink
Fix issues regarding progress display of ongoing syncs
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Oct 14, 2023
1 parent aa86eb8 commit f0b7e84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
14 changes: 8 additions & 6 deletions src/Core/Module.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ public abstract class Syncher.Module : Object {
construct {
cancellable = new Cancellable ();

notify["progress"].connect (() => {
if (progress == 0) {
cancellable.reset ();
}
});

fatal_error.connect ((msg, details) => {
var app = (Application) GLib.Application.get_default ();

Expand All @@ -32,6 +26,14 @@ public abstract class Syncher.Module : Object {

app.send_notification (null, notification);
});

var syncher_service = SyncherService.get_default ();
syncher_service.notify["working"].connect (() => {
if (!syncher_service.working) {
progress = 0;
cancellable.reset ();
}
});
}

public abstract async void import (File file);
Expand Down
8 changes: 4 additions & 4 deletions src/Core/SyncherService.vala
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public class Syncher.SyncherService : Object {
});

fatal_error.connect ((step, msg) => warning ("An error occured during %s: %s", step.to_string (), msg));

modules.append (new DconfModule ());
modules.append (new RepoModule ());
modules.append (new AppModule ());
}

public void setup_saved_synchronization () {
Expand All @@ -57,6 +53,10 @@ public class Syncher.SyncherService : Object {
var dir = File.new_for_uri (saved_location);
setup_synchronization (dir);
}

modules.append (new DconfModule ());
modules.append (new RepoModule ());
modules.append (new AppModule ());
}

public void setup_synchronization (File dir) {
Expand Down
6 changes: 3 additions & 3 deletions src/ProgressWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ public class Syncher.ProgressWidget : Object {
}

private void update_progress () {
progress_bar.fraction = (double) module.progress / 100;

if (stack.visible_child_name == "fatal") {
if (stack.visible_child_name == "fatal" || stack.visible_child_name == "image") {
return;
}

progress_bar.fraction = (double) module.progress / 100;

if (module.progress == 100) {
stack.set_visible_child_name ("image");
} else if (module.progress > 0) {
Expand Down

0 comments on commit f0b7e84

Please sign in to comment.