Merge branch 'nm-gtk4'

Adds support for GTK 4.  Two versions of the UI are built as shared
objects, the plugin dynamically loads and instantiates the appropriate one
based on the determined GTK version.

Closes strongswan/strongswan#961
This commit is contained in:
Tobias Brunner 2022-05-16 14:40:42 +02:00
commit 846201a686
15 changed files with 1080 additions and 516 deletions

View File

@ -11,3 +11,7 @@ config.guess.cdbs-orig
config.sub.cdbs-orig
NetworkManager-strongswan.metainfo.xml
NetworkManager-strongswan.pot
properties/nm-strongswan-resources.c
properties/nm-strongswan-resources.h
properties/gtk4/nm-strongswan-dialog.ui
properties/gtk4/nm-strongswan-resources.c

View File

@ -11,23 +11,6 @@ metainfo_DATA = $(metainfo_in_files:.xml.in=.xml)
metainfo_in_files = NetworkManager-strongswan.metainfo.xml.in
@INTLTOOL_XML_RULE@
if WITH_LIBNM_GLIB
# Install a file with full path to plugins for an old gnome-shell
# https://bugzilla.gnome.org/show_bug.cgi?id=693590
install-data-hook:
mkdir -p $(DESTDIR)$(sysconfdir)/NetworkManager/VPN
sed -e "1s|^|# This file is obsoleted by a file in $(nmvpnservicedir)\n\n|" \
-e 's|[@]NM_LIBEXECDIR[@]|$(nm_libexecdir)|g' \
-e 's|[@]NM_PLUGINDIR[@]|$(nm_plugindir)|g' \
-e 's|[@]NM_PLUGINDIR_ABS[@]|$(nm_plugindir)|g' \
-e 's|[@]CHARON[@]|$(charon)|' \
<$(srcdir)/nm-strongswan-service.name.in \
>$(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-strongswan-service.name
uninstall-hook:
rm -f $(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-strongswan-service.name
endif
nm-strongswan-service.name: $(srcdir)/nm-strongswan-service.name.in
$(AM_V_GEN) \
sed -e 's|[@]NM_LIBEXECDIR[@]|$(nm_libexecdir)|' \

View File

@ -1,3 +1,9 @@
NetworkManager-strongswan-1.6.0
-------------------------------
- Support for GTK 4
- Removed libnm-glib compatibility
NetworkManager-strongswan-1.5.2
-------------------------------

View File

@ -1,6 +1,6 @@
AC_PREREQ(2.52)
AC_INIT(NetworkManager-strongswan, 1.5.2, info@strongswan.org, NetworkManager-strongswan)
AC_INIT(NetworkManager-strongswan, 1.6.0, info@strongswan.org, NetworkManager-strongswan)
AM_INIT_AUTOMAKE([subdir-objects])
AM_MAINTAINER_MODE
@ -15,6 +15,7 @@ AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
dnl
dnl Required headers
@ -36,6 +37,9 @@ AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(select socket uname)
AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
GETTEXT_PACKAGE=NetworkManager-strongswan
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
@ -67,35 +71,28 @@ AC_ARG_ENABLE(
AS_HELP_STRING([--enable-nm-absolute-paths],[use absolute paths for NM plugins in the .name file])
)
AC_ARG_WITH(
[libnm-glib],
AS_HELP_STRING([--without-libnm-glib], [build NetworkManager-strongswan without libnm-glib compatibility]),
[with_libnm_glib=no],
[with_libnm_glib=yes]
[gtk4],
AS_HELP_STRING([--with-gtk4], [build NetworkManager-strongswan with libnma-gtk4 support]),
[], [with_gtk4=no]
)
AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)
AM_CONDITIONAL(WITH_GTK4, test "$with_gtk4" != no)
PKG_CHECK_MODULES(LIBNM, libnm >= 1.1.0)
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
PKG_CHECK_MODULES(LIBNMA, libnma >= 1.1.0)
if test x"$with_libnm_glib" != xno; then
PKG_CHECK_MODULES(LIBNM_GLIB, NetworkManager >= 1.1.0 libnm-util libnm-glib libnm-glib-vpn)
PKG_CHECK_MODULES(LIBNM_GTK, libnm-gtk >= 1.1.0)
if test -z "$nm_libexecdir"; then
nm_libexecdir=$($PKG_CONFIG --variable=libgnome_serverdir NetworkManager)
fi
if test -z "$nm_plugindir"; then
nm_plugindir=$($PKG_CONFIG --variable=plugindir NetworkManager)
fi
else
if test -z "$nm_libexecdir"; then
nm_libexecdir=$($PKG_CONFIG --variable=exec_prefix libnm)/lib/NetworkManager
fi
if test -z "$nm_plugindir"; then
nm_plugindir=$($PKG_CONFIG --variable=libdir libnm)/NetworkManager
fi
if test x"$with_gtk4" != xno; then
PKG_CHECK_MODULES(GTK4, gtk4 >= 4.0)
PKG_CHECK_MODULES(LIBNMA_GTK4, libnma-gtk4 >= 1.8.33)
fi
if test -z "$nm_libexecdir"; then
nm_libexecdir=$($PKG_CONFIG --variable=exec_prefix libnm)/lib/NetworkManager
fi
if test -z "$nm_plugindir"; then
nm_plugindir=$($PKG_CONFIG --variable=libdir libnm)/NetworkManager
fi
AC_SUBST(nm_libexecdir)

View File

@ -8,5 +8,4 @@ plugin=@NM_PLUGINDIR@/libnm-vpn-plugin-strongswan.so
[GNOME]
auth-dialog=@NM_LIBEXECDIR@/nm-strongswan-auth-dialog
properties=@NM_PLUGINDIR_ABS@/libnm-strongswan-properties
supports-external-ui-mode=true

View File

@ -1,5 +1,6 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
properties/nm-strongswan-plugin.c
properties/nm-strongswan.c
[type: gettext/glade]properties/nm-strongswan-dialog.ui
auth-dialog/main.c

View File

@ -0,0 +1 @@
properties/gtk4/nm-strongswan-dialog.ui

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: NetworkManager-strongswan\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-18 18:12+0200\n"
"POT-Creation-Date: 2022-04-20 17:19+0200\n"
"PO-Revision-Date: 2019-12-18 17:10+0100\n"
"Last-Translator: Tobias Brunner\n"
"Language-Team: de <info@strongswan.org>\n"
@ -17,59 +17,99 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../properties/nm-strongswan.c:43
#: ../properties/nm-strongswan-plugin.c:36
msgid "IPsec/IKEv2 (strongswan)"
msgstr "IPsec/IKEv2 (strongswan)"
#: ../properties/nm-strongswan.c:44
#: ../properties/nm-strongswan-plugin.c:37
msgid "IPsec with the IKEv2 key exchange protocol."
msgstr "IPsec mit dem IKEv2 Protokoll."
#: ../properties/nm-strongswan.c:367
#: ../properties/nm-strongswan-plugin.c:80
#, c-format
msgid "unable to determine plugin path: %s"
msgstr "Plugin-Pfad konnte nicht ermittelt werden: %s"
#: ../properties/nm-strongswan-plugin.c:93
#, c-format
msgid "missing plugin file '%s'"
msgstr "Plugin-Datei '%s' fehlt"
#: ../properties/nm-strongswan-plugin.c:98
#, c-format
msgid "unable to load editor plugin: %s"
msgstr "Laden des Editor-Plugins fehlgeschlagen: %s"
#: ../properties/nm-strongswan-plugin.c:108
#, c-format
msgid "cannot load factory %s from plugin: %s"
msgstr "Factory %s konnte nicht aus Plugin geladen werden: %s"
#: ../properties/nm-strongswan-plugin.c:124
msgid "unknown error creating editor instance"
msgstr "Unbekannter Fehler beim Erstellen der Editor-Instanz"
#: ../properties/nm-strongswan.c:255
msgid "(None)"
msgstr "(Nicht festgelegt)"
#: ../properties/nm-strongswan.c:420
msgid "EAP (Username/Password)"
msgstr "EAP (Benutzername/Passwort)"
#: ../properties/nm-strongswan.c:368
#: ../properties/nm-strongswan.c:421
msgid "Certificate"
msgstr "Zertifikat"
#: ../properties/nm-strongswan.c:369
#: ../properties/nm-strongswan.c:422
msgid "EAP-TLS"
msgstr "EAP-TLS"
#: ../properties/nm-strongswan.c:370
#: ../properties/nm-strongswan.c:423
msgid "Pre-shared key"
msgstr "Pre-shared Key"
#: ../properties/nm-strongswan.c:396
#: ../properties/nm-strongswan.c:449
msgid "Certificate/private key"
msgstr "Zertifikat/Privater Schlüssel"
#: ../properties/nm-strongswan.c:397
#: ../properties/nm-strongswan.c:450
msgid "Certificate/ssh-agent"
msgstr "Zertifikat/ssh-agent"
#: ../properties/nm-strongswan.c:398
#: ../properties/nm-strongswan.c:451
msgid "Smartcard"
msgstr "Smartcard"
#: ../properties/nm-strongswan-dialog.ui.h:1
msgid "Choose a server or CA certificate…"
msgstr "Server- oder CA-Zertifikat auswählen…"
#: ../properties/nm-strongswan-dialog.ui.h:2
msgid "_Cancel"
msgstr "Abbre_chen"
#: ../properties/nm-strongswan-dialog.ui.h:3
msgid "_Select"
msgstr "_Auswählen"
#: ../properties/nm-strongswan-dialog.ui.h:4
msgid "<b>Server</b>"
msgstr "<b>Server</b>"
#: ../properties/nm-strongswan-dialog.ui.h:2
#: ../properties/nm-strongswan-dialog.ui.h:5
msgid "_Address:"
msgstr "_Adresse:"
#: ../properties/nm-strongswan-dialog.ui.h:3
#: ../properties/nm-strongswan-dialog.ui.h:6
msgid "An IP address or hostname of the VPN server."
msgstr "Eine IP-Adresse oder ein Hostname des VPN Servers."
#: ../properties/nm-strongswan-dialog.ui.h:4
#: ../properties/nm-strongswan-dialog.ui.h:7
msgid "C_ertificate:"
msgstr "Z_ertifikat:"
#: ../properties/nm-strongswan-dialog.ui.h:5
#: ../properties/nm-strongswan-dialog.ui.h:8
msgid ""
"Server or CA certificate to use for server authentication. If none is "
"specified, pre-installed CA certificates are used."
@ -77,11 +117,11 @@ msgstr ""
"Server- oder CA-Zertifikat für die Authentisierung des Servers. Ohne Angabe "
"eines Zertifikates werden die CA-Zertifikate des Systems verwendet."
#: ../properties/nm-strongswan-dialog.ui.h:6
#: ../properties/nm-strongswan-dialog.ui.h:9
msgid "_Identity:"
msgstr "_Identität:"
#: ../properties/nm-strongswan-dialog.ui.h:7
#: ../properties/nm-strongswan-dialog.ui.h:10
msgid ""
"Defaults to the server address or the server certificate's subject DN (if "
"configured). Custom values are explicitly sent to the server and enforced "
@ -91,35 +131,35 @@ msgstr ""
"Zertifikats (falls konfiguriert). Eigene Werte werden explizit an den Server "
"gesendet und während der Authentifizierung erzwungen."
#: ../properties/nm-strongswan-dialog.ui.h:8
#: ../properties/nm-strongswan-dialog.ui.h:11
msgid "(Defaults to address or certificate subject)"
msgstr "(Standardwert ist die Adresse oder die Zertifikats-Identität)"
#: ../properties/nm-strongswan-dialog.ui.h:9
#: ../properties/nm-strongswan-dialog.ui.h:12
msgid "<b>Client</b>"
msgstr "<b>Client</b>"
#: ../properties/nm-strongswan-dialog.ui.h:10
#: ../properties/nm-strongswan-dialog.ui.h:13
msgid "Au_thentication:"
msgstr "Au_thentisierung:"
#: ../properties/nm-strongswan-dialog.ui.h:11
#: ../properties/nm-strongswan-dialog.ui.h:14
msgid "Ce_rtificate:"
msgstr "Ze_rtifikat:"
#: ../properties/nm-strongswan-dialog.ui.h:12
#: ../properties/nm-strongswan-dialog.ui.h:15
msgid "Certificate _file:"
msgstr "Z_ertifikatsdatei:"
#: ../properties/nm-strongswan-dialog.ui.h:13
#: ../properties/nm-strongswan-dialog.ui.h:16
msgid "Client certificate to use for client authentication."
msgstr "Zertifikat des Clients für dessen Authentisierung."
#: ../properties/nm-strongswan-dialog.ui.h:14
#: ../properties/nm-strongswan-dialog.ui.h:17
msgid "Private _key:"
msgstr "Privater _Schlüssel:"
#: ../properties/nm-strongswan-dialog.ui.h:15
#: ../properties/nm-strongswan-dialog.ui.h:18
msgid ""
"Private key to use for client authentication. This key has to match the "
"certificates public key and may be encrypted."
@ -127,21 +167,21 @@ msgstr ""
"Privater Schlüssel für die Authentisierung des Clients. Dieser Schlüssel "
"muss zum konfigurierten Zertifikat passen und kann verschlüsselt sein."
#: ../properties/nm-strongswan-dialog.ui.h:16
#: ../properties/nm-strongswan-dialog.ui.h:19
msgid "_Username:"
msgstr "_Benutzername:"
#: ../properties/nm-strongswan-dialog.ui.h:17
#: ../properties/nm-strongswan-dialog.ui.h:20
msgid ""
"The username (EAP identity) to use for authentication against the server."
msgstr ""
"Benutzername/EAP-Identität für die Authentisierung gegenüber dem Server."
#: ../properties/nm-strongswan-dialog.ui.h:18
#: ../properties/nm-strongswan-dialog.ui.h:21
msgid "_Password:"
msgstr "_Passwort:"
#: ../properties/nm-strongswan-dialog.ui.h:19
#: ../properties/nm-strongswan-dialog.ui.h:22
msgid ""
"The password to use for authentication against the server (min. 20 "
"characters for PSKs)."
@ -149,19 +189,19 @@ msgstr ""
"Das Passwort für die Authentisierung gegenüber dem Server (min. 20 Zeichen "
"für PSKs)."
#: ../properties/nm-strongswan-dialog.ui.h:20
#: ../properties/nm-strongswan-dialog.ui.h:23
msgid "(Use icon to change password storage policy)"
msgstr "(Icon verwenden, um Passwort-Richtlinie zu ändern)"
#: ../properties/nm-strongswan-dialog.ui.h:21
#: ../properties/nm-strongswan-dialog.ui.h:24
msgid "_Show password"
msgstr "Passwort _anzeigen"
#: ../properties/nm-strongswan-dialog.ui.h:22
#: ../properties/nm-strongswan-dialog.ui.h:25
msgid "I_dentity:"
msgstr "I_dentität:"
#: ../properties/nm-strongswan-dialog.ui.h:23
#: ../properties/nm-strongswan-dialog.ui.h:26
msgid ""
"Defaults to the username (EAP), the client certificate's subject DN "
"(certificate/EAP-TLS), or the IP address (PSK). Custom values may be used if "
@ -171,15 +211,15 @@ msgstr ""
"Zertifikats (Zertifikat/EAP-TLS) oder die IP-Adresse (PSK). Eigene Werte "
"können verwendet werden, falls der Server diese erwartet/benötigt."
#: ../properties/nm-strongswan-dialog.ui.h:24
#: ../properties/nm-strongswan-dialog.ui.h:27
msgid "(Defaults to username, certificate subject or IP address)"
msgstr "(Standardwert ist der Benutzername, die Zertifikats-ID oder die IP)"
#: ../properties/nm-strongswan-dialog.ui.h:25
#: ../properties/nm-strongswan-dialog.ui.h:28
msgid "Request an _inner IP address"
msgstr "_Innere IP-Adresse beziehen"
#: ../properties/nm-strongswan-dialog.ui.h:26
#: ../properties/nm-strongswan-dialog.ui.h:29
msgid ""
"The server may provide addresses from a pool to use for communication in the "
"VPN. Check to request such an address."
@ -188,11 +228,11 @@ msgstr ""
"Kommunikation im dahinterliegenden Netz verwenden kann. Aktivieren, um eine "
"solche Adresse zu beziehen."
#: ../properties/nm-strongswan-dialog.ui.h:27
#: ../properties/nm-strongswan-dialog.ui.h:30
msgid "En_force UDP encapsulation"
msgstr "Erzwingen einer zusätzlichen Einbettung der Datenpakete in _UDP"
#: ../properties/nm-strongswan-dialog.ui.h:28
#: ../properties/nm-strongswan-dialog.ui.h:31
msgid ""
"Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT "
"situation is detected might help in such cases."
@ -201,11 +241,11 @@ msgstr ""
"erzwingen einer zustzlichen Einbettung in UDP, auch wenn kein NAT-Router "
"detektiert wurde, kann in solchen Situationen hilfreich sein."
#: ../properties/nm-strongswan-dialog.ui.h:29
#: ../properties/nm-strongswan-dialog.ui.h:32
msgid "Use IP c_ompression"
msgstr "IP-Pakete k_omprimieren"
#: ../properties/nm-strongswan-dialog.ui.h:30
#: ../properties/nm-strongswan-dialog.ui.h:33
msgid ""
"IPComp compresses raw IP packets before they get encrypted. This saves some "
"bandwidth, but uses more processing power."
@ -213,11 +253,11 @@ msgstr ""
"IPComp komprimiert IP-Pakete, bevor sie verschlüsselt werden. Diese Option "
"kann Bandbreite sparen, benötigt jedoch zusätzliche Rechenleistung."
#: ../properties/nm-strongswan-dialog.ui.h:31
#: ../properties/nm-strongswan-dialog.ui.h:34
msgid "Server _port:"
msgstr "Server-_Port:"
#: ../properties/nm-strongswan-dialog.ui.h:32
#: ../properties/nm-strongswan-dialog.ui.h:35
msgid ""
"Custom server port to connect to. Defaults to UDP port 500, which is "
"followed by a switch to port 4500 after the first exchange."
@ -225,38 +265,46 @@ msgstr ""
"Server-Port zu dem verbunden wird. Ohne Konfiguration wird UDP-Port 500 "
"verwendet, mit einem Wechsel auf Port 4500 nach der ersten Nachricht."
#: ../properties/nm-strongswan-dialog.ui.h:33
#: ../properties/nm-strongswan-dialog.ui.h:36
msgid "(Defaults to UDP 500/4500)"
msgstr "(Standardwert ist UDP 500/4500)"
#: ../properties/nm-strongswan-dialog.ui.h:34
#: ../properties/nm-strongswan-dialog.ui.h:37
msgid "Options"
msgstr "Optionen"
#: ../properties/nm-strongswan-dialog.ui.h:35
#: ../properties/nm-strongswan-dialog.ui.h:38
msgid "_Enable custom algorithm proposals"
msgstr "_Eigene Algorithmen verwenden"
#: ../properties/nm-strongswan-dialog.ui.h:36
#: ../properties/nm-strongswan-dialog.ui.h:39
msgid "_IKE:"
msgstr "_IKE:"
#: ../properties/nm-strongswan-dialog.ui.h:37
#: ../properties/nm-strongswan-dialog.ui.h:40
msgid "A list of proposals for IKE separated by \";\""
msgstr "Eine Liste von Proposals für IKE getrennt mit \";\""
#: ../properties/nm-strongswan-dialog.ui.h:38
#: ../properties/nm-strongswan-dialog.ui.h:41
msgid "_ESP:"
msgstr "_ESP:"
#: ../properties/nm-strongswan-dialog.ui.h:39
#: ../properties/nm-strongswan-dialog.ui.h:42
msgid "A list of proposals for ESP separated by \";\""
msgstr "Eine Liste von Proposals für ESP getrennt mit \";\""
#: ../properties/nm-strongswan-dialog.ui.h:40
#: ../properties/nm-strongswan-dialog.ui.h:43
msgid "Algorithms"
msgstr "Algorithmen"
#: ../properties/nm-strongswan-dialog.ui.h:44
msgid "Choose a client certificate…"
msgstr "Client-Zertifikat auswählen…"
#: ../properties/nm-strongswan-dialog.ui.h:45
msgid "Choose a private key…"
msgstr "Privaten Schlüssel auswählen…"
#: ../auth-dialog/main.c:137
#, c-format
msgid "EAP password required to establish VPN connection '%s'."

View File

@ -1,50 +1,107 @@
nm_plugin_LTLIBRARIES = libnm-vpn-plugin-strongswan.la
nm_plugin_LTLIBRARIES = \
libnm-vpn-plugin-strongswan.la \
libnm-vpn-plugin-strongswan-editor.la
if WITH_LIBNM_GLIB
nm_plugin_LTLIBRARIES += libnm-strongswan-properties.la
if WITH_GTK4
nm_plugin_LTLIBRARIES += \
libnm-gtk4-vpn-plugin-strongswan-editor.la
endif
nm-strongswan-resources.h: nm-strongswan-dialog.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir) \
--generate-header --internal
nm-strongswan-resources.c: nm-strongswan-dialog.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/nm-strongswan-dialog.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir) \
--generate-source --internal
gtk4/nm-strongswan-resources.c: nm-strongswan-dialog.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/nm-strongswan-dialog.gresource.xml|sed "s,^$(srcdir)/,$(builddir)/gtk4/,")
@mkdir -p $(builddir)/gtk4
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ \
--sourcedir=$(srcdir)/gtk4 --sourcedir=$(builddir)/gtk4 \
--generate-source --internal
gtk4/%.ui: %.ui
@mkdir -p $(builddir)/gtk4
gtk4-builder-tool simplify --3to4 $< | grep -v 'border-width\|can-default\|has-default' >$@
libnm_vpn_plugin_strongswan_la_SOURCES = \
nm-strongswan-plugin.c \
nm-strongswan-plugin.h
nodist_libnm_vpn_plugin_strongswan_editor_la_SOURCES = \
nm-strongswan-resources.c \
nm-strongswan-resources.h
libnm_vpn_plugin_strongswan_editor_la_SOURCES = \
nm-strongswan.c \
nm-strongswan.h
libnm_strongswan_properties_la_SOURCES = \
$(libnm_vpn_plugin_strongswan_la_SOURCES)
nodist_libnm_gtk4_vpn_plugin_strongswan_editor_la_SOURCES = \
gtk4/nm-strongswan-resources.c \
nm-strongswan-resources.h
uidir = $(datadir)/gnome-vpn-properties/strongswan
ui_DATA = nm-strongswan-dialog.ui
libnm_gtk4_vpn_plugin_strongswan_editor_la_SOURCES = \
$(libnm_vpn_plugin_strongswan_editor_la_SOURCES)
common_CFLAGS = \
$(GTK_CFLAGS) \
-DUIDIR=\""$(uidir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED
libnm_vpn_plugin_strongswan_la_CFLAGS = \
$(LIBNM_CFLAGS) \
$(common_CFLAGS)
libnm_vpn_plugin_strongswan_editor_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBNM_CFLAGS) \
$(LIBNMA_CFLAGS) \
$(common_CFLAGS)
libnm_strongswan_properties_la_CFLAGS = \
-DNM_STRONGSWAN_OLD \
$(LIBNM_GTK_CFLAGS) \
$(LIBNM_GLIB_CFLAGS) \
libnm_gtk4_vpn_plugin_strongswan_editor_la_CFLAGS = \
$(GTK4_CFLAGS) \
$(LIBNM_CFLAGS) \
$(LIBNMA_GTK4_CFLAGS) \
$(common_CFLAGS)
libnm_vpn_plugin_strongswan_la_LIBADD = \
$(LIBNM_LIBS) \
$(DL_LIBS)
libnm_vpn_plugin_strongswan_editor_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNMA_LIBS) \
$(LIBNM_LIBS)
libnm_strongswan_properties_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNM_GTK_LIBS) \
$(LIBNM_GLIB_LIBS)
libnm_gtk4_vpn_plugin_strongswan_editor_la_LIBADD = \
$(GTK4_LIBS) \
$(LIBNMA_GTK4_LIBS) \
$(LIBNM_LIBS)
libnm_vpn_plugin_strongswan_la_LDFLAGS = \
-avoid-version
libnm_strongswan_properties_la_LDFLAGS = \
$(libnm_vpn_plugin_strongswan_la_LDFLAGS)
libnm_vpn_plugin_strongswan_editor_la_LDFLAGS = \
-avoid-version
EXTRA_DIST = $(ui_DATA)
libnm_gtk4_vpn_plugin_strongswan_editor_la_LDFLAGS = \
-avoid-version
BUILT_SOURCES = \
nm-strongswan-resources.c \
nm-strongswan-resources.h
if WITH_GTK4
BUILT_SOURCES += \
gtk4/nm-strongswan-resources.c
endif
CLEANFILES = \
nm-strongswan-resources.c \
nm-strongswan-resources.h \
gtk4/nm-strongswan-resources.c \
gtk4/nm-strongswan-dialog.ui
EXTRA_DIST = \
nm-strongswan-dialog.ui \
nm-strongswan-dialog.gresource.xml

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/freedesktop/NetworkManager/strongswan">
<file preprocess="xml-stripblanks">nm-strongswan-dialog.ui</file>
</gresource>
</gresources>

View File

@ -1,25 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.38.2, not compatible anymore -->
<interface>
<requires lib="gtk+" version="3.2"/>
<requires lib="gtk+" version="3.10"/>
<object class="GtkFileChooserDialog" id="certificate-chooser">
<property name="can-focus">False</property>
<property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">False</property>
<child type="title">
<object class="GtkLabel">
<property name="label" translatable="yes">Choose a server or CA certificate…</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="certificate-chooser-cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="certificate-chooser-accept">
<property name="label" translatable="yes">_Select</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<style>
<class name="default"/>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="position">1</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">certificate-chooser-cancel</action-widget>
<action-widget response="-3">certificate-chooser-accept</action-widget>
</action-widgets>
</object>
<object class="GtkBox" id="strongswan-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="can-focus">False</property>
<property name="border-width">12</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="gateway-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="gateway-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Server&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="use-markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
@ -29,91 +82,118 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<property name="can-focus">False</property>
<property name="margin-left">12</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkLabel" id="address-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Address:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="address-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">An IP address or hostname of the VPN server.</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">An IP address or hostname of the VPN server.</property>
<property name="hexpand">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="certificate-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">C_ertificate:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="certificate-button">
<object class="GtkButton" id="certificate-button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Server or CA certificate to use for server authentication. If none is specified, pre-installed CA certificates are used.</property>
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Server or CA certificate to use for server authentication. If none is specified, pre-installed CA certificates are used.</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="certificate-button-label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">document-open-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="remote-identity-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Identity:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="remote-identity-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Defaults to the server address or the server certificate's subject DN (if configured). Custom values are explicitly sent to the server and enforced during authentication.</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Defaults to the server address or the server certificate's subject DN (if configured). Custom values are explicitly sent to the server and enforced during authentication.</property>
<property name="hexpand">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">(Defaults to address or certificate subject)</property>
<property name="placeholder-text" translatable="yes">(Defaults to address or certificate subject)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
@ -133,15 +213,15 @@
<child>
<object class="GtkBox" id="client-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="client-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Client&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="use-markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
@ -151,208 +231,263 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=8 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<property name="can-focus">False</property>
<property name="margin-left">12</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkLabel" id="method-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Au_thentication:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="method-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="cert-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Ce_rtificate:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="cert-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="usercert-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Certificate _file:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="usercert-button">
<object class="GtkButton" id="usercert-button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Client certificate to use for client authentication.</property>
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Client certificate to use for client authentication.</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="usercert-button-label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">document-open-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="userkey-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Private _key:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="userkey-button">
<object class="GtkButton" id="userkey-button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Private key to use for client authentication. This key has to match the certificates public key and may be encrypted.</property>
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Private key to use for client authentication. This key has to match the certificates public key and may be encrypted.</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="userkey-button-label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">document-open-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="user-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Username:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="user-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">The username (EAP identity) to use for authentication against the server.</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">The username (EAP identity) to use for authentication against the server.</property>
<property name="hexpand">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="passwd-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="passwd-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">The password to use for authentication against the server (min. 20 characters for PSKs).</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">The password to use for authentication against the server (min. 20 characters for PSKs).</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">(Use icon to change password storage policy)</property>
<property name="placeholder-text" translatable="yes">(Use icon to change password storage policy)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="passwd-show">
<property name="label" translatable="yes">_Show password</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="local-identity-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">I_dentity:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="local-identity-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Defaults to the username (EAP), the client certificate's subject DN (certificate/EAP-TLS), or the IP address (PSK). Custom values may be used if expected/required by the server.</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Defaults to the username (EAP), the client certificate's subject DN (certificate/EAP-TLS), or the IP address (PSK). Custom values may be used if expected/required by the server.</property>
<property name="hexpand">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">(Defaults to username, certificate subject or IP address)</property>
<property name="placeholder-text" translatable="yes">(Defaults to username, certificate subject or IP address)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
@ -375,25 +510,25 @@
<child>
<object class="GtkNotebook" id="options_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tab_pos">left</property>
<property name="can-focus">True</property>
<property name="tab-pos">left</property>
<child>
<object class="GtkBox" id="options-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="margin">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="virtual-check">
<property name="label" translatable="yes">Request an _inner IP address</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">The server may provide addresses from a pool to use for communication in the VPN. Check to request such an address.</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">The server may provide addresses from a pool to use for communication in the VPN. Check to request such an address.</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -405,11 +540,11 @@
<object class="GtkCheckButton" id="encap-check">
<property name="label" translatable="yes">En_force UDP encapsulation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases.</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases.</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -421,11 +556,11 @@
<object class="GtkCheckButton" id="ipcomp-check">
<property name="label" translatable="yes">Use IP c_ompression</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">IPComp compresses raw IP packets before they get encrypted. This saves some bandwidth, but uses more processing power.</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">IPComp compresses raw IP packets before they get encrypted. This saves some bandwidth, but uses more processing power.</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -434,39 +569,38 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkLabel" id="server-port-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Server _port:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="server-port-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Custom server port to connect to. Defaults to UDP port 500, which is followed by a switch to port 4500 after the first exchange.</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Custom server port to connect to. Defaults to UDP port 500, which is followed by a switch to port 4500 after the first exchange.</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">(Defaults to UDP 500/4500)</property>
<property name="invisible-char">•</property>
<property name="placeholder-text" translatable="yes">(Defaults to UDP 500/4500)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
@ -481,29 +615,29 @@
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Options</property>
</object>
<packing>
<property name="tab_fill">False</property>
<property name="tab-fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="proposals-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="margin">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="proposal-check">
<property name="label" translatable="yes">_Enable custom algorithm proposals</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -512,66 +646,63 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=2 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkLabel" id="ike-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_IKE:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="ike-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A list of proposals for IKE separated by ";"</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">A list of proposals for IKE separated by ";"</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="invisible-char">•</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="esp-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_ESP:</property>
<property name="use_underline">True</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="esp-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A list of proposals for ESP separated by ";"</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">A list of proposals for ESP separated by ";"</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="invisible-char">•</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
@ -589,12 +720,12 @@
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Algorithms</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
<property name="tab-fill">False</property>
</packing>
</child>
<child>
@ -611,4 +742,110 @@
</packing>
</child>
</object>
<object class="GtkFileChooserDialog" id="usercert-chooser">
<property name="can-focus">False</property>
<property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">False</property>
<child type="title">
<object class="GtkLabel">
<property name="label" translatable="yes">Choose a client certificate…</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="usercert-chooser-cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="usercert-chooser-accept">
<property name="label" translatable="yes">_Select</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<style>
<class name="default"/>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="position">1</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">usercert-chooser-cancel</action-widget>
<action-widget response="-3">usercert-chooser-accept</action-widget>
</action-widgets>
</object>
<object class="GtkFileChooserDialog" id="userkey-chooser">
<property name="can-focus">False</property>
<property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">False</property>
<child type="title">
<object class="GtkLabel">
<property name="label" translatable="yes">Choose a private key…</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="userkey-chooser-cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="userkey-chooser-accept">
<property name="label" translatable="yes">_Select</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<style>
<class name="default"/>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="position">1</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">userkey-chooser-cancel</action-widget>
<action-widget response="-3">userkey-chooser-accept</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -0,0 +1,218 @@
/*
* Copyright (C) 2013-2020 Tobias Brunner
* Copyright (C) 2008 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
* Copyright (C) 2015 Lubomir Rintel
* Copyright (C) 2005 David Zeuthen
* Copyright (C) 2005-2008 Dan Williams
*
* Based on NetworkManager's vpnc plugin
*
* 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 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <dlfcn.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <NetworkManager.h>
#include "nm-strongswan-plugin.h"
#define STRONGSWAN_PLUGIN_NAME _("IPsec/IKEv2 (strongswan)")
#define STRONGSWAN_PLUGIN_DESC _("IPsec with the IKEv2 key exchange protocol.")
#define STRONGSWAN_PLUGIN_SERVICE "org.freedesktop.NetworkManager.strongswan"
#define STRONGSWAN_EDITOR_GTK3 "libnm-vpn-plugin-strongswan-editor.so"
#define STRONGSWAN_EDITOR_GTK4 "libnm-gtk4-vpn-plugin-strongswan-editor.so"
#define STRONGSWAN_EDITOR_FACTORY "strongswan_editor_new"
/************** plugin class **************/
enum {
PROP_0,
PROP_NAME,
PROP_DESC,
PROP_SERVICE
};
static void strongswan_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class);
G_DEFINE_TYPE_EXTENDED (StrongswanPluginUi, strongswan_plugin_ui, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR_PLUGIN,
strongswan_plugin_ui_interface_init))
static NMVpnEditor *
get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
{
static struct {
NMVpnEditor *(*factory)(NMConnection*, GError**);
void *dl_module;
char *file;
} cache = {};
NMVpnEditor *editor;
char *file;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (!error || !*error, NULL);
/* check for a GTK3-only symbol to decide which editor to load */
if (dlsym(RTLD_DEFAULT, "gtk_container_add"))
{
file = STRONGSWAN_EDITOR_GTK3;
}
else
{
file = STRONGSWAN_EDITOR_GTK4;
}
if (cache.factory)
{ /* we can't switch GTK versions */
g_return_val_if_fail (cache.file && !strcmp(cache.file, file), NULL);
}
else
{
Dl_info plugin_info;
void *dl_module;
char *module_path = NULL;
char *dirname = NULL;
NMVpnEditor *(*factory)(NMConnection*, GError**);
if (!dladdr(get_editor, &plugin_info))
{
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
_("unable to determine plugin path: %s"), dlerror());
return NULL;
}
dirname = g_path_get_dirname (plugin_info.dli_fname);
module_path = g_build_filename (dirname, file, NULL);
g_free(dirname);
dl_module = dlopen(module_path, RTLD_LAZY | RTLD_LOCAL);
if (!dl_module)
{
if (!g_file_test (module_path, G_FILE_TEST_EXISTS))
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT,
_("missing plugin file '%s'"), module_path);
g_free(module_path);
return NULL;
}
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
_("unable to load editor plugin: %s"), dlerror ());
g_free(module_path);
return NULL;
}
g_free(module_path);
factory = dlsym (dl_module, STRONGSWAN_EDITOR_FACTORY);
if (!factory)
{
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
_("cannot load factory %s from plugin: %s"),
STRONGSWAN_EDITOR_FACTORY, dlerror ());
dlclose (dl_module);
return NULL;
}
cache.factory = factory;
cache.dl_module = dl_module;
cache.file = strdup(file);
}
editor = cache.factory (connection, error);
if (!editor)
{
if (error && !*error)
{
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_FAILED,
_("unknown error creating editor instance"));
return NULL;
}
return NULL;
}
g_return_val_if_fail (NM_IS_VPN_EDITOR (editor), NULL);
return editor;
}
static guint32
get_capabilities (NMVpnEditorPlugin *iface)
{
return NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6;
}
static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, STRONGSWAN_PLUGIN_NAME);
break;
case PROP_DESC:
g_value_set_string (value, STRONGSWAN_PLUGIN_DESC);
break;
case PROP_SERVICE:
g_value_set_string (value, STRONGSWAN_PLUGIN_SERVICE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
strongswan_plugin_ui_class_init (StrongswanPluginUiClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
object_class->get_property = get_property;
g_object_class_override_property (object_class,
PROP_NAME,
NM_VPN_EDITOR_PLUGIN_NAME);
g_object_class_override_property (object_class,
PROP_DESC,
NM_VPN_EDITOR_PLUGIN_DESCRIPTION);
g_object_class_override_property (object_class,
PROP_SERVICE,
NM_VPN_EDITOR_PLUGIN_SERVICE);
}
static void
strongswan_plugin_ui_init (StrongswanPluginUi *plugin)
{
}
static void
strongswan_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class)
{
/* interface implementation */
iface_class->get_editor = get_editor;
iface_class->get_capabilities = get_capabilities;
/* TODO: implement delete_connection to purge associated secrets */
}
G_MODULE_EXPORT NMVpnEditorPlugin *
nm_vpn_editor_plugin_factory (GError **error)
{
g_return_val_if_fail (!error || !*error, NULL);
return g_object_new (STRONGSWAN_TYPE_PLUGIN_UI, NULL);
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2008 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
* Copyright (C) 2008 Dan Williams
*
* Based on NetworkManager's vpnc plugin
*
* 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 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#ifndef _NM_STRONGSWAN_PLUGIN_H_
#define _NM_STRONGSWAN_PLUGIN_H_
#include <glib-object.h>
#define STRONGSWAN_TYPE_PLUGIN_UI (strongswan_plugin_ui_get_type ())
#define STRONGSWAN_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUi))
#define STRONGSWAN_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass))
#define STRONGSWAN_IS_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI))
#define STRONGSWAN_IS_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI))
#define STRONGSWAN_PLUGIN_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass))
typedef struct _StrongswanPluginUi StrongswanPluginUi;
typedef struct _StrongswanPluginUiClass StrongswanPluginUiClass;
struct _StrongswanPluginUi {
GObject parent;
};
struct _StrongswanPluginUiClass {
GObjectClass parent;
};
GType strongswan_plugin_ui_get_type (void);
#endif /* _NM_STRONGSWAN_PLUGIN_H_ */

View File

@ -27,38 +27,29 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#ifdef NM_STRONGSWAN_OLD
#define NM_VPN_LIBNM_COMPAT
#include <nm-vpn-plugin-ui-interface.h>
#include <nm-setting-vpn.h>
#include <nm-setting-connection.h>
#include <nm-ui-utils.h>
#else
#include <NetworkManager.h>
#include <nma-ui-utils.h>
#endif
#include "nm-strongswan.h"
#define STRONGSWAN_PLUGIN_NAME _("IPsec/IKEv2 (strongswan)")
#define STRONGSWAN_PLUGIN_DESC _("IPsec with the IKEv2 key exchange protocol.")
#define STRONGSWAN_PLUGIN_SERVICE "org.freedesktop.NetworkManager.strongswan"
#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan"
#define NM_DBUS_PATH_STRONGSWAN "/org/freedesktop/NetworkManager/strongswan"
#define STRONGSWAN_UI_RESOURCE NM_DBUS_PATH_STRONGSWAN "/nm-strongswan-dialog.ui"
/************** plugin class **************/
enum {
PROP_0,
PROP_NAME,
PROP_DESC,
PROP_SERVICE
};
static void strongswan_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class);
G_DEFINE_TYPE_EXTENDED (StrongswanPluginUi, strongswan_plugin_ui, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR_PLUGIN,
strongswan_plugin_ui_interface_init))
#if !GTK_CHECK_VERSION(4,0,0)
typedef void GtkRoot;
#define gtk_editable_set_text(editable, text) gtk_entry_set_text(GTK_ENTRY(editable), (text))
#define gtk_editable_get_text(editable) gtk_entry_get_text(GTK_ENTRY(editable))
#define gtk_check_button_get_active(button) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))
#define gtk_check_button_set_active(button, active) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active)
#define gtk_widget_get_root(widget) gtk_widget_get_toplevel(widget)
#define gtk_window_set_hide_on_close(window, hide) \
G_STMT_START { \
G_STATIC_ASSERT (hide); \
g_signal_connect_swapped (G_OBJECT (window), "delete-event", \
G_CALLBACK (gtk_widget_hide_on_delete), window); \
} G_STMT_END
#endif
/************** UI widget class **************/
@ -119,7 +110,7 @@ check_validity (StrongswanPluginUiWidget *self, GError **error)
char *str;
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str)) {
g_set_error (error,
STRONGSWAN_PLUGIN_UI_ERROR,
@ -137,7 +128,7 @@ check_validity (StrongswanPluginUiWidget *self, GError **error)
{
case NM_SETTING_SECRET_FLAG_NONE:
case NM_SETTING_SECRET_FLAG_AGENT_OWNED:
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str) < 20) {
g_set_error (error,
STRONGSWAN_PLUGIN_UI_ERROR,
@ -246,7 +237,7 @@ show_toggled_cb (GtkCheckButton *button, StrongswanPluginUiWidget *self)
GtkWidget *widget;
gboolean visible;
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (button));
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "passwd-entry"));
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
@ -256,11 +247,64 @@ static void
toggle_proposal_cb(GtkCheckButton *button, StrongswanPluginUiWidget *self)
{
StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
gboolean visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
gboolean visible = gtk_check_button_get_active(GTK_CHECK_BUTTON(button));
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(priv->builder, "ike-entry")), visible);
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(priv->builder, "esp-entry")), visible);
}
static void
chooser_button_update_file (GtkLabel *label, GFile *file)
{
char *basename = NULL;
if (file)
basename = g_file_get_basename (file);
if (basename)
{
gtk_label_set_label (label, basename);
g_free (basename);
}
else
{
gtk_label_set_label (label, _("(None)"));
}
}
static void
chooser_button_update (GtkLabel *label, GtkFileChooser *chooser)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (chooser));
chooser_button_update_file (label, file);
g_clear_object (&file);
}
static void
chooser_response_cb (GtkDialog *chooser, gint response_id, gpointer user_data)
{
GtkLabel *label = GTK_LABEL (user_data);
if (response_id == GTK_RESPONSE_ACCEPT)
{
chooser_button_update (label, GTK_FILE_CHOOSER (chooser));
}
gtk_widget_hide (GTK_WIDGET (chooser));
}
static void
chooser_show_cb (GtkWidget *parent, GtkWidget *widget)
{
GtkRoot *root;
root = gtk_widget_get_root (parent);
g_return_if_fail (GTK_IS_WINDOW (root));
gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (root));
gtk_widget_show (widget);
}
static void
password_storage_changed_cb (GObject *entry, GParamSpec *pspec, gpointer user_data)
{
@ -291,7 +335,7 @@ init_password_icon (StrongswanPluginUiWidget *self, NMSettingVpn *settings,
nm_setting_get_secret_flags (NM_SETTING (settings), secret_key, &pw_flags, NULL);
}
value = gtk_entry_get_text (GTK_ENTRY (entry));
value = gtk_editable_get_text (GTK_EDITABLE (entry));
if ((!value || !*value) && (pw_flags == NM_SETTING_SECRET_FLAG_NONE))
{
nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
@ -302,6 +346,32 @@ init_password_icon (StrongswanPluginUiWidget *self, NMSettingVpn *settings,
G_CALLBACK (password_storage_changed_cb), self);
}
static void
init_chooser (GtkBuilder *builder, NMSettingVpn *settings, const char *setting,
const char *chooser, const char *button, const char *label_name)
{
GtkWidget *widget;
GtkLabel *label;
GFile *file = NULL;
const char *value;
widget = GTK_WIDGET (gtk_builder_get_object (builder, chooser));
label = GTK_LABEL (gtk_builder_get_object (builder, label_name));
gtk_window_set_hide_on_close (GTK_WINDOW(widget), TRUE);
value = nm_setting_vpn_get_data_item (settings, setting);
if (value)
{
file = g_file_new_for_path (value);
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (widget), file, NULL);
}
g_signal_connect (G_OBJECT (widget), "response",
G_CALLBACK (chooser_response_cb), label);
g_signal_connect (gtk_builder_get_object (builder, button),
"clicked", G_CALLBACK (chooser_show_cb), widget);
chooser_button_update_file (label, file);
g_clear_object (&file);
}
static gboolean
init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError **error)
{
@ -317,25 +387,22 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
value = nm_setting_vpn_get_data_item (settings, "address");
if (value)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "certificate-button"));
value = nm_setting_vpn_get_data_item (settings, "certificate");
if (value)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
init_chooser (priv->builder, settings, "certificate", "certificate-chooser",
"certificate-button", "certificate-button-label");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remote-identity-entry"));
value = nm_setting_vpn_get_data_item (settings, "remote-identity");
if (value)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "server-port-entry"));
value = nm_setting_vpn_get_data_item (settings, "server-port");
if (value)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "local-identity-entry"));
@ -344,14 +411,14 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
if (!value && method && g_strcmp0 (method, "psk") == 0)
value = nm_setting_vpn_get_data_item (settings, "user");
if (value)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry"));
value = nm_setting_vpn_get_data_item (settings, "user");
/* PSK auth now uses local identity, see above */
if (value && method && g_strcmp0 (method, "psk") != 0)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "passwd-show"));
@ -359,7 +426,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "passwd-entry"));
value = nm_setting_vpn_get_secret (settings, "password");
if (value)
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
init_password_icon (self, settings, "password", "passwd-entry");
@ -420,23 +487,17 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
update_sensitive (priv);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button"));
value = nm_setting_vpn_get_data_item (settings, "usercert");
if (value)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
init_chooser (priv->builder, settings, "usercert", "usercert-chooser",
"usercert-button", "usercert-button-label");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button"));
value = nm_setting_vpn_get_data_item (settings, "userkey");
if (value)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
init_chooser (priv->builder, settings, "userkey", "userkey-chooser",
"userkey-button", "userkey-button-label");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "virtual-check"));
value = nm_setting_vpn_get_data_item (settings, "virtual");
if (value && strcmp(value, "yes") == 0)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
gtk_check_button_set_active(GTK_CHECK_BUTTON(widget), TRUE);
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
@ -444,7 +505,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
value = nm_setting_vpn_get_data_item (settings, "encap");
if (value && strcmp(value, "yes") == 0)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
gtk_check_button_set_active(GTK_CHECK_BUTTON(widget), TRUE);
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
@ -452,14 +513,14 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
value = nm_setting_vpn_get_data_item (settings, "ipcomp");
if (value && strcmp(value, "yes") == 0)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
gtk_check_button_set_active(GTK_CHECK_BUTTON(widget), TRUE);
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "proposal-check"));
value = nm_setting_vpn_get_data_item(settings, "proposal");
if (value && strcmp(value, "yes") == 0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
gtk_check_button_set_active(GTK_CHECK_BUTTON(widget), TRUE);
else
toggle_proposal_cb(GTK_CHECK_BUTTON(widget), self);
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (toggle_proposal_cb), self);
@ -469,7 +530,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
if (value)
{
value = g_strdelimit (g_strdup (value), ";", ',');
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_free ((char*)value);
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
@ -479,7 +540,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
if (value)
{
value = g_strdelimit (g_strdup (value), ";", ',');
gtk_entry_set_text (GTK_ENTRY (widget), value);
gtk_editable_set_text (GTK_EDITABLE (widget), value);
g_free ((char*)value);
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
@ -513,7 +574,7 @@ save_password_and_flags (NMSettingVpn *settings, GtkBuilder *builder,
case NM_SETTING_SECRET_FLAG_NONE:
/* FALL */
case NM_SETTING_SECRET_FLAG_AGENT_OWNED:
password = gtk_entry_get_text (GTK_ENTRY (entry));
password = gtk_editable_get_text (GTK_EDITABLE (entry));
if (password && strlen (password))
{
nm_setting_vpn_add_secret (settings, secret_key, password);
@ -527,19 +588,24 @@ save_password_and_flags (NMSettingVpn *settings, GtkBuilder *builder,
nm_setting_set_secret_flags (NM_SETTING (settings), secret_key, flags, NULL);
}
static void
save_file_chooser (NMSettingVpn *settings, GtkBuilder *builder,
const char *name, const char *key)
{
GtkWidget *chooser;
char *str;
GFile *file;
char *str = NULL;
chooser = GTK_WIDGET (gtk_builder_get_object (builder, name));
str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
if (str) {
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (chooser));
if (file) {
str = g_file_get_path (file);
}
if (str && strlen(str)) {
nm_setting_vpn_add_data_item (settings, key, str);
}
g_free (str);
g_clear_object (&file);
}
static void
@ -550,7 +616,7 @@ save_entry (NMSettingVpn *settings, GtkBuilder *builder,
const char *str;
entry = GTK_WIDGET (gtk_builder_get_object (builder, name));
str = (char *) gtk_entry_get_text (GTK_ENTRY (entry));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (entry));
if (str && strlen (str)) {
nm_setting_vpn_add_data_item (settings, key, str);
}
@ -586,10 +652,10 @@ save_cert (NMSettingVpn *settings, GtkBuilder *builder)
nm_setting_vpn_add_data_item (settings, "cert-source", str);
if (cert) {
save_file_chooser (settings, builder, "usercert-button", "usercert");
save_file_chooser (settings, builder, "usercert-chooser", "usercert");
}
if (key) {
save_file_chooser (settings, builder, "userkey-button", "userkey");
save_file_chooser (settings, builder, "userkey-chooser", "userkey");
}
}
@ -613,7 +679,7 @@ update_connection (NMVpnEditor *iface,
NM_DBUS_SERVICE_STRONGSWAN, NULL);
save_entry (settings, priv->builder, "address-entry", "address");
save_file_chooser (settings, priv->builder, "certificate-button", "certificate");
save_file_chooser (settings, priv->builder, "certificate-chooser", "certificate");
save_entry (settings, priv->builder, "remote-identity-entry", "remote-identity");
save_entry (settings, priv->builder, "server-port-entry", "server-port");
save_entry (settings, priv->builder, "local-identity-entry", "local-identity");
@ -644,23 +710,23 @@ update_connection (NMVpnEditor *iface,
nm_setting_vpn_add_data_item (settings, "method", str);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "virtual-check"));
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
active = gtk_check_button_get_active(GTK_CHECK_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "virtual", active ? "yes" : "no");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encap-check"));
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
active = gtk_check_button_get_active(GTK_CHECK_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "encap", active ? "yes" : "no");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ipcomp-check"));
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
active = gtk_check_button_get_active(GTK_CHECK_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "ipcomp", active ? "yes" : "no");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "proposal-check"));
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
active = gtk_check_button_get_active(GTK_CHECK_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "proposal", active ? "yes" : "no");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ike-entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str)) {
str = g_strdelimit (g_strdup (str), ",", ';');
nm_setting_vpn_add_data_item (settings, "ike", str);
@ -668,7 +734,7 @@ update_connection (NMVpnEditor *iface,
}
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "esp-entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str)) {
str = g_strdelimit (g_strdup (str), ",", ';');
nm_setting_vpn_add_data_item (settings, "esp", str);
@ -679,56 +745,6 @@ update_connection (NMVpnEditor *iface,
return TRUE;
}
static NMVpnEditor *
nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
{
NMVpnEditor *object;
StrongswanPluginUiWidgetPrivate *priv;
char *ui_file;
if (error)
g_return_val_if_fail (*error == NULL, NULL);
object = g_object_new (STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, NULL);
if (!object) {
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not create strongswan object");
return NULL;
}
priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE ((StrongswanPluginUiWidget*)object);
ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-strongswan-dialog.ui");
priv->builder = gtk_builder_new ();
gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
if (!gtk_builder_add_from_file (priv->builder, ui_file, error)) {
g_warning ("Couldn't load builder file: %s",
error && *error ? (*error)->message : "(unknown)");
g_clear_error (error);
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0,
"could not load required resources at %s", ui_file);
g_free (ui_file);
g_object_unref (object);
return NULL;
}
g_free (ui_file);
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "strongswan-vbox") );
if (!priv->widget) {
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not load UI widget");
g_object_unref (object);
return NULL;
}
g_object_ref_sink (priv->widget);
if (!init_plugin_ui (STRONGSWAN_PLUGIN_UI_WIDGET (object), connection, error)) {
g_object_unref (object);
return NULL;
}
return object;
}
static void
dispose (GObject *object)
{
@ -769,78 +785,45 @@ strongswan_plugin_ui_widget_interface_init (NMVpnEditorInterface *iface_class)
iface_class->update_connection = update_connection;
}
static guint32
get_capabilities (NMVpnEditorPlugin *iface)
NMVpnEditor *
strongswan_editor_new (NMConnection *connection, GError **error)
{
return NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6;
}
NMVpnEditor *object;
StrongswanPluginUiWidgetPrivate *priv;
static NMVpnEditor *
get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
{
return nm_vpn_plugin_ui_widget_interface_new (connection, error);
}
static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, STRONGSWAN_PLUGIN_NAME);
break;
case PROP_DESC:
g_value_set_string (value, STRONGSWAN_PLUGIN_DESC);
break;
case PROP_SERVICE:
g_value_set_string (value, STRONGSWAN_PLUGIN_SERVICE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
strongswan_plugin_ui_class_init (StrongswanPluginUiClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
object_class->get_property = get_property;
g_object_class_override_property (object_class,
PROP_NAME,
NM_VPN_EDITOR_PLUGIN_NAME);
g_object_class_override_property (object_class,
PROP_DESC,
NM_VPN_EDITOR_PLUGIN_DESCRIPTION);
g_object_class_override_property (object_class,
PROP_SERVICE,
NM_VPN_EDITOR_PLUGIN_SERVICE);
}
static void
strongswan_plugin_ui_init (StrongswanPluginUi *plugin)
{
}
static void
strongswan_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class)
{
/* interface implementation */
iface_class->get_editor = get_editor;
iface_class->get_capabilities = get_capabilities;
/* TODO: implement delete_connection to purge associated secrets */
}
G_MODULE_EXPORT NMVpnEditorPlugin *
nm_vpn_editor_plugin_factory (GError **error)
{
if (error)
g_return_val_if_fail (*error == NULL, NULL);
return g_object_new (STRONGSWAN_TYPE_PLUGIN_UI, NULL);
object = g_object_new (STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, NULL);
if (!object) {
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not create strongswan object");
return NULL;
}
priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE ((StrongswanPluginUiWidget*)object);
priv->builder = gtk_builder_new ();
gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
if (!gtk_builder_add_from_resource (priv->builder, STRONGSWAN_UI_RESOURCE, error)) {
g_warning ("Couldn't load builder file: %s",
error && *error ? (*error)->message : "(unknown)");
g_object_unref (object);
return NULL;
}
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "strongswan-vbox") );
if (!priv->widget) {
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not load UI widget");
g_object_unref (object);
return NULL;
}
g_object_ref_sink (priv->widget);
if (!init_plugin_ui (STRONGSWAN_PLUGIN_UI_WIDGET (object), connection, error)) {
g_object_unref (object);
return NULL;
}
return object;
}

View File

@ -31,27 +31,6 @@ typedef enum
#define STRONGSWAN_TYPE_PLUGIN_UI_ERROR (strongswan_plugin_ui_error_get_type ())
GType strongswan_plugin_ui_error_get_type (void);
#define STRONGSWAN_TYPE_PLUGIN_UI (strongswan_plugin_ui_get_type ())
#define STRONGSWAN_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUi))
#define STRONGSWAN_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass))
#define STRONGSWAN_IS_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI))
#define STRONGSWAN_IS_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI))
#define STRONGSWAN_PLUGIN_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass))
typedef struct _StrongswanPluginUi StrongswanPluginUi;
typedef struct _StrongswanPluginUiClass StrongswanPluginUiClass;
struct _StrongswanPluginUi {
GObject parent;
};
struct _StrongswanPluginUiClass {
GObjectClass parent;
};
GType strongswan_plugin_ui_get_type (void);
#define STRONGSWAN_TYPE_PLUGIN_UI_WIDGET (strongswan_plugin_ui_widget_get_type ())
#define STRONGSWAN_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidget))
#define STRONGSWAN_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetClass))
@ -72,5 +51,6 @@ struct _StrongswanPluginUiWidgetClass {
GType strongswan_plugin_ui_widget_get_type (void);
#endif /* _NM_STRONGSWAN_H_ */
NMVpnEditor *strongswan_editor_new (NMConnection *connection, GError **error);
#endif /* _NM_STRONGSWAN_H_ */