From f9436b63f1f7de08f8c2c97878c183495bb3c6f6 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 24 Aug 2017 23:24:04 +0200 Subject: connection: keep-alive pings, act upon connection change (VPN) --- libdino/src/dbus/network_manager.vala | 22 ++++++++++++++++++++++ .../src/dbus/network_manager_dbus_properties.vala | 14 ++++++++++++++ libdino/src/dbus/networkmanager.vala | 22 ---------------------- 3 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 libdino/src/dbus/network_manager.vala create mode 100644 libdino/src/dbus/network_manager_dbus_properties.vala delete mode 100644 libdino/src/dbus/networkmanager.vala (limited to 'libdino/src/dbus') diff --git a/libdino/src/dbus/network_manager.vala b/libdino/src/dbus/network_manager.vala new file mode 100644 index 00000000..be9fb42b --- /dev/null +++ b/libdino/src/dbus/network_manager.vala @@ -0,0 +1,22 @@ +namespace Dino { + +[DBus (name = "org.freedesktop.NetworkManager")] +public interface NetworkManager : Object { + + public const int CONNECTED_GLOBAL = 70; + + public abstract uint32 State {owned get;} + public signal void StateChanged(uint32 state); +} + +public static NetworkManager? get_network_manager() { + NetworkManager? nm = null; + try { + nm = Bus.get_proxy_sync(BusType.SYSTEM, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager"); + } catch (IOError e) { + stderr.printf ("%s\n", e.message); + } + return nm; +} + +} diff --git a/libdino/src/dbus/network_manager_dbus_properties.vala b/libdino/src/dbus/network_manager_dbus_properties.vala new file mode 100644 index 00000000..37cf76cb --- /dev/null +++ b/libdino/src/dbus/network_manager_dbus_properties.vala @@ -0,0 +1,14 @@ +[DBus (name = "org.freedesktop.DBus.Properties")] +public interface NetworkManagerDBusProperties : GLib.Object { + public signal void properties_changed(string iface, HashTable changed, string[] invalidated); +} + +public static NetworkManagerDBusProperties? get_dbus_properties() { + NetworkManagerDBusProperties? dbus_properties = null; + try { + dbus_properties = Bus.get_proxy_sync(BusType.SYSTEM, "org.freedesktop.DBus.Properties", "/org/freedesktop/NetworkManager"); + } catch (IOError e) { + stderr.printf("%s\n", e.message); + } + return dbus_properties; +} diff --git a/libdino/src/dbus/networkmanager.vala b/libdino/src/dbus/networkmanager.vala deleted file mode 100644 index be9fb42b..00000000 --- a/libdino/src/dbus/networkmanager.vala +++ /dev/null @@ -1,22 +0,0 @@ -namespace Dino { - -[DBus (name = "org.freedesktop.NetworkManager")] -public interface NetworkManager : Object { - - public const int CONNECTED_GLOBAL = 70; - - public abstract uint32 State {owned get;} - public signal void StateChanged(uint32 state); -} - -public static NetworkManager? get_network_manager() { - NetworkManager? nm = null; - try { - nm = Bus.get_proxy_sync(BusType.SYSTEM, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager"); - } catch (IOError e) { - stderr.printf ("%s\n", e.message); - } - return nm; -} - -} -- cgit v1.2.3-70-g09d2