Skip to content

Commit

Permalink
Revert network monitor stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed May 15, 2024
1 parent c0fba99 commit bd82576
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/TaskModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Tasks.TaskModel : Object {
public delegate void TasksRemovedFunc (SList<ECal.ComponentId?> cids);

private Gee.Future<E.SourceRegistry> registry;
// private NetworkMonitor network_monitor;
private NetworkMonitor network_monitor;
private HashTable<string, ECal.Client> task_list_client;
private HashTable<ECal.Client, Gee.Collection<ECal.ClientView>> task_list_client_views;

Expand Down Expand Up @@ -133,15 +133,14 @@ public class Tasks.TaskModel : Object {
construct {
task_list_client = new HashTable<string, ECal.Client> (str_hash, str_equal);
task_list_client_views = new HashTable<ECal.Client, Gee.Collection<ECal.ClientView>> (direct_hash, direct_equal); // vala-lint=line-length
// Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
// network_monitor = NetworkMonitor.get_default ();
network_monitor = NetworkMonitor.get_default ();
}

public async void start () {
var promise = new Gee.Promise<E.SourceRegistry> ();
registry = promise.future;
yield init_registry (promise);
// network_monitor.network_changed.connect (network_changed);
network_monitor.network_changed.connect (network_changed);
}

private async void init_registry (Gee.Promise<E.SourceRegistry> promise) {
Expand Down Expand Up @@ -240,8 +239,7 @@ public class Tasks.TaskModel : Object {
}

private async bool refresh_collection (E.Source collection_source, Cancellable? cancellable = null) throws Error {
// if (network_monitor.network_available && registry.ready) {
if (registry.ready) {
if (network_monitor.network_available && registry.ready) {
debug ("Scheduling collection refresh '%s'…", collection_source.dup_display_name ());
return yield registry.value.refresh_backend (collection_source.dup_uid (), cancellable);
}
Expand All @@ -250,8 +248,7 @@ public class Tasks.TaskModel : Object {
}

public async bool refresh_task_list (E.Source task_list, Cancellable? cancellable = null) throws Error {
// if (network_monitor.network_available && task_list_client.contains (task_list.dup_uid ())) {
if (task_list_client.contains (task_list.dup_uid ())) {
if (network_monitor.network_available && task_list_client.contains (task_list.dup_uid ())) {
var client = task_list_client.get (task_list.dup_uid ());

if (client.check_refresh_supported ()) {
Expand Down

0 comments on commit bd82576

Please sign in to comment.