From de501fba668fd4b914469f20035c4962be2e019f Mon Sep 17 00:00:00 2001 From: byquanton <32410361+byquanton@users.noreply.github.com> Date: Wed, 15 Jan 2025 21:36:40 +0100 Subject: [PATCH] Drop NetworkMonitor class, because it is no longer needed --- src/MainWindow.vala | 9 ++++---- src/Services/NetworkMonitor.vala | 38 -------------------------------- src/meson.build | 2 +- 3 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 src/Services/NetworkMonitor.vala diff --git a/src/MainWindow.vala b/src/MainWindow.vala index a6bf672f5..08b59cd5b 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -201,11 +201,12 @@ public class MainWindow : Adw.ApplicationWindow { return GLib.Source.REMOVE; }); - Services.NetworkMonitor.instance ().network_changed.connect (() => { - foreach (Objects.Source source in Services.Store.instance ().sources) { + var network_monitor = GLib.NetworkMonitor.get_default (); + network_monitor.network_changed.connect (() => { + foreach (Objects.Source source in Services.Store.instance ().sources) { source.run_server (); - } - }); + } + }); }); var granite_settings = Granite.Settings.get_default (); diff --git a/src/Services/NetworkMonitor.vala b/src/Services/NetworkMonitor.vala deleted file mode 100644 index 50f86c910..000000000 --- a/src/Services/NetworkMonitor.vala +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright © 2024 Alain M. (https://github.com/alainm23/planify) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -* Authored by: Alain M. -*/ - -public class Services.NetworkMonitor : GLib.Object { - static GLib.Once _instance; - public static unowned Services.NetworkMonitor instance () { - return _instance.once (() => { - return new Services.NetworkMonitor (); - }); - } - - public signal void network_changed (); - - construct { - var network_monitor = GLib.NetworkMonitor.get_default (); - network_monitor.network_changed.connect (() => { - network_changed (); - }); - } -} diff --git a/src/meson.build b/src/meson.build index 513cd79f1..115cd4648 100644 --- a/src/meson.build +++ b/src/meson.build @@ -20,7 +20,6 @@ sources = files( 'Services/DBusServer.vala', 'Services/Backups.vala', 'Services/MigrateFromPlanner.vala', - 'Services/NetworkMonitor.vala', 'Services/CalendarEvents/CalendarEvents.vala', 'Services/CalendarEvents/DateIterator.vala', @@ -115,3 +114,4 @@ executable( dependencies: deps, install: true ) +