diff --git a/src/TaskModel.vala b/src/TaskModel.vala index 388b94eda..0c62cdb38 100644 --- a/src/TaskModel.vala +++ b/src/TaskModel.vala @@ -36,7 +36,7 @@ public class Tasks.TaskModel : Object { public delegate void TasksRemovedFunc (SList cids); private Gee.Future registry; - // private NetworkMonitor network_monitor; + private NetworkMonitor network_monitor; private HashTable task_list_client; private HashTable> task_list_client_views; @@ -133,15 +133,14 @@ public class Tasks.TaskModel : Object { construct { task_list_client = new HashTable (str_hash, str_equal); task_list_client_views = new HashTable> (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 (); 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 promise) { @@ -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); } @@ -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 ()) {