[NetworkManager-libreswan/lr/gtk-4.0: 7/7] editor: add a Gtk4 port
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-libreswan/lr/gtk-4.0: 7/7] editor: add a Gtk4 port
- Date: Thu, 4 Nov 2021 12:33:08 +0000 (UTC)
commit 5a620761ef3773ebfd612f0f81841fc20d0f3158
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Tue Oct 19 11:41:39 2021 +0200
editor: add a Gtk4 port
.gitignore | 2 +
Makefile.am | 43 +-
configure.ac | 28 +-
po/POTFILES.skip | 1 +
properties/nm-libreswan-dialog.ui | 720 +++++++++++++++-----------------
properties/nm-libreswan-editor-plugin.c | 32 +-
properties/nm-libreswan-editor.c | 74 ++--
7 files changed, 477 insertions(+), 423 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 4cfc7d9..9ffc5af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,5 +42,7 @@ src/nm-libreswan-helper-service-dbus.h
man/nm-settings-libreswan.5
properties/resources.c
properties/resources.h
+gtk4/nm-libreswan-dialog.ui
+gtk4/resources.c
/NetworkManager-libreswan*.tar*
diff --git a/Makefile.am b/Makefile.am
index 446ee54..bcdc4ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@ CLEANFILES =
DISTCLEANFILES =
-DISTCHECK_CONFIGURE_FLAGS = --enable-more-warnings=yes
+DISTCHECK_CONFIGURE_FLAGS = --enable-more-warnings=yes --with-gtk4
ACLOCAL_AMFLAGS = -I m4
@@ -37,6 +37,15 @@ properties/resources.h: properties/gresource.xml
properties/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES)
--sourcedir=$(srcdir)/properties --generate-dependencies $(srcdir)/properties/gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/properties
--generate-source --internal
+
+gtk4/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies
$(srcdir)/properties/gresource.xml |sed "s,^,$(builddir)/gtk4/,")
+ @mkdir -p $(builddir)/gtk4
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(builddir)/gtk4 --generate-source
--internal
+
+gtk4/%.ui: properties/%.ui
+ @mkdir -p $(builddir)/gtk4
+ gtk4-builder-tool simplify --3to4 $< |grep -v can-default >$@
+
plugin_sources = \
properties/nm-libreswan-editor-plugin.c \
properties/nm-libreswan-editor-plugin.h
@@ -119,6 +128,35 @@ properties_libnm_vpn_plugin_libreswan_editor_la_LDFLAGS = \
###############################################################################
+if WITH_GTK4
+plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-libreswan-editor.la
+endif
+
+properties_libnm_gtk4_vpn_plugin_libreswan_editor_la_CFLAGS = \
+ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
+ $(common_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_GTK4_CFLAGS)
+
+nodist_properties_libnm_gtk4_vpn_plugin_libreswan_editor_la_SOURCES = \
+ properties/resources.h \
+ gtk4/resources.c
+
+properties_libnm_gtk4_vpn_plugin_libreswan_editor_la_SOURCES = \
+ $(editor_sources)
+
+properties_libnm_gtk4_vpn_plugin_libreswan_editor_la_LIBADD = \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ $(LIBNMA_GTK4_LIBS)
+
+properties_libnm_gtk4_vpn_plugin_libreswan_editor_la_LDFLAGS = \
+ -avoid-version \
+ -Wl,--version-script="$(srcdir)/properties/libnm-vpn-plugin-libreswan-editor.ver"
+
+###############################################################################
+
if WITH_GNOME
if WITH_LIBNM_GLIB
plugin_LTLIBRARIES += properties/libnm-libreswan-properties.la
@@ -283,12 +321,15 @@ src_show_xfrm_LDADD = \
###############################################################################
BUILT_SOURCES = \
+ gtk4/resources.c \
src/nm-libreswan-helper-service-dbus.h \
src/nm-libreswan-helper-service-dbus.c \
properties/resources.c \
properties/resources.h
CLEANFILES += \
+ gtk4/nm-libreswan-dialog.ui \
+ gtk4/resources.c \
src/nm-libreswan-helper-service-dbus.h \
src/nm-libreswan-helper-service-dbus.c \
properties/resources.c \
diff --git a/configure.ac b/configure.ac
index 4220e5d..c7a213a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,6 +94,7 @@ dnl
dnl GNOME support
dnl
AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-libreswan without GNOME support,
e.g. vpn service only]), [], [with_gnome_specified=no])
+AC_ARG_WITH(gtk4, AS_HELP_STRING([--with-gtk4], [Build NetworkManager-libreswan with libnma-gtk4 support]),
[], [with_gtk4_specified=no])
AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--with-libnm-glib], [Build NetworkManager-libreswan with libnm-glib
comatibility (depreacted)]), [], [with_libnm_glib_specified=no])
if test "$with_libnm_glib_specified" != no -a "$with_libnm_glib" != no; then
if test "$with_gnome_specified" != no -a "$with_gnome" == no; then
@@ -103,6 +104,12 @@ fi
if test "$with_gnome" != no; then
with_gnome=yes
fi
+if test "$with_gtk4_specified" == no; then
+ with_gtk4=no
+fi
+if test "$with_gtk4" != yes; then
+ with_gtk4=no
+fi
if test "$with_libnm_glib_specified" == no; then
with_libnm_glib=no
fi
@@ -110,6 +117,7 @@ if test "$with_libnm_glib" != yes; then
with_libnm_glib=no
fi
AM_CONDITIONAL(WITH_GNOME, test "$with_gnome" != no)
+AM_CONDITIONAL(WITH_GTK4, test "$with_gtk4" != no)
AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)
AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name
files. Useful for development. (default is no)]))
@@ -127,16 +135,20 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
PKG_CHECK_MODULES(LIBNL, libnl-3.0 >= 3.2.8)
-if test x"$with_gnome" != xno; then
- PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4)
- GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
- PKG_CHECK_MODULES(LIBNMA, libnma >= 1.2.0)
+if test x"$with_gnome" != xno || test x"$with_gtk4" != xno; then
PKG_CHECK_MODULES(LIBSECRET, libsecret-1 >= 0.18, [], [
dnl We use the secret service API that went stable in 0.18
PKG_CHECK_MODULES(LIBSECRET, libsecret-unstable)
LIBSECRET_CFLAGS="$LIBSECRET_CFLAGS -DSECRET_API_SUBJECT_TO_CHANGE"
])
+fi
+
+if test x"$with_gnome" != xno; then
+ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4)
+ GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
+ GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4"
+ PKG_CHECK_MODULES(LIBNMA, libnma >= 1.2.0)
if test x"$with_libnm_glib" != xno; then
PKG_CHECK_MODULES(LIBNM_GTK, libnm-gtk >= 1.2.0)
@@ -151,6 +163,13 @@ if test x"$with_gnome" != xno; then
fi
fi
+if test x"$with_gtk4" != xno; then
+ PKG_CHECK_MODULES(GTK4, gtk4 >= 4.0)
+ GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0"
+ GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0"
+ PKG_CHECK_MODULES(LIBNMA_GTK4, libnma-gtk4 >= 1.8.32)
+fi
+
PKG_CHECK_MODULES(LIBNM, libnm >= 1.2.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"
@@ -191,6 +210,7 @@ AC_OUTPUT
echo ""
echo "Build configuration: "
echo " --with-gnome=$with_gnome"
+echo " --with-gtk4=$with_gtk4"
echo " --with-libnm-glib=$with_libnm_glib"
echo " --enable-absolute-paths=$enable_absolute_paths"
echo " --enable-more-warnings=$set_more_warnings"
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..c7e65ec
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+gtk4/nm-libreswan-dialog.ui
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index a98d6a5..b06573e 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -19,9 +19,8 @@
<object class="GtkBox" id="libreswan-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">12</property>
<property name="orientation">vertical</property>
- <property name="spacing">16</property>
+ <property name="spacing">6</property>
<child>
<object class="GtkBox" id="vbox_general">
<property name="visible">True</property>
@@ -33,6 +32,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">General</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -48,19 +49,17 @@
<object class="GtkGrid" id="table_general">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
<property name="orientation">vertical</property>
<property name="row_spacing">6</property>
- <property name="column_spacing">16</property>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="gateway_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">_Gateway:</property>
+ <property name="label" translatable="yes">_Gateway</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">gateway_entry</property>
- <property name="xalign">0</property>
+ <property name="mnemonic_widget">gateway_entry</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -104,6 +103,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Authentication</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -119,19 +120,17 @@
<object class="GtkGrid" id="table_main">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
<property name="orientation">vertical</property>
<property name="row_spacing">6</property>
- <property name="column_spacing">16</property>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="type_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Type:</property>
+ <property name="label" translatable="yes">Type</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">type_combo</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -160,11 +159,10 @@
<object class="GtkLabel" id="user_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">User name:</property>
+ <property name="label" translatable="yes">User name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">user_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -175,7 +173,6 @@
<object class="GtkEntry" id="user_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
</object>
@@ -188,11 +185,10 @@
<object class="GtkLabel" id="user_password_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">_User password:</property>
+ <property name="label" translatable="yes">_User password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">user_password_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -203,7 +199,6 @@
<object class="GtkEntry" id="user_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
</object>
@@ -216,11 +211,10 @@
<object class="GtkLabel" id="group_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">G_roup name:</property>
+ <property name="label" translatable="yes">G_roup name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -231,7 +225,6 @@
<object class="GtkEntry" id="group_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
</object>
<packing>
@@ -243,11 +236,10 @@
<object class="GtkLabel" id="group_password_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">_Secret:</property>
+ <property name="label" translatable="yes">_Secret</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_password_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -258,7 +250,6 @@
<object class="GtkEntry" id="group_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
</object>
@@ -270,12 +261,9 @@
<child>
<object class="GtkCheckButton" id="show_passwords_checkbutton">
<property name="label" translatable="yes">Show passwords</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="no_show_all">True</property>
- <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -287,11 +275,10 @@
<object class="GtkLabel" id="cert_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">_Certificate name:</property>
+ <property name="label" translatable="yes">_Certificate name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">cert_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -302,7 +289,6 @@
<object class="GtkEntry" id="cert_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
</object>
<packing>
@@ -314,11 +300,10 @@
<object class="GtkLabel" id="remoteid_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">_Remote ID:</property>
+ <property name="label" translatable="yes">_Remote ID</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">remoteid_entry</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -329,7 +314,6 @@
<object class="GtkEntry" id="remoteid_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="no_show_all">True</property>
<property name="hexpand">True</property>
</object>
<packing>
@@ -352,57 +336,48 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="advbutton_alignment">
+ <object class="GtkButton" id="advanced_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="xscale">0</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <property name="margin_top">32</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkButton" id="advanced_button">
- <property name="use_action_appearance">False</property>
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="hbox2">
+ <object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-preferences</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Ad_vanced…</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="icon_name">preferences-system-symbolic</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">A_dvanced…</property>
+ <property name="use_underline">True</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="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
<object class="GtkSizeGroup" id="labels">
@@ -416,6 +391,18 @@
<widget name="remoteid_label"/>
</widgets>
</object>
+ <object class="GtkSizeGroup" id="advanced_labels">
+ <widgets>
+ <widget name="domain_label"/>
+ <widget name="phase1_label"/>
+ <widget name="phase2_label"/>
+ <widget name="phase1_lifetime_label"/>
+ <widget name="phase2_lifetime_label"/>
+ <widget name="remote_network_label"/>
+ <widget name="label_fragmentation"/>
+ <widget name="label_mobike"/>
+ </widgets>
+ </object>
<object class="GtkListStore" id="liststore_yesno">
<columns>
<!-- column-name gchararray -->
@@ -449,20 +436,22 @@
</object>
<object class="GtkDialog" id="libreswan-advanced-dialog">
<property name="can_focus">False</property>
- <property name="border_width">12</property>
<property name="title" translatable="yes">IPsec Advanced Options</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
+ <property name="icon_name">stock-preferences</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
+ <property name="visible">True</property>
<child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <object class="GtkBox" id="dialog-action_area1">
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
<child>
<placeholder/>
</child>
@@ -481,12 +470,18 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="spacing">6</property>
+ <property name="margin_start">24</property>
+ <property name="margin_end">24</property>
+ <property name="margin_top">24</property>
+ <property name="margin_bottom">24</property>
<child>
<object class="GtkLabel" id="identification_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Identification</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -499,57 +494,48 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment1_vbox2">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
- <object class="GtkGrid">
+ <object class="GtkLabel" id="domain_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkLabel" id="domain_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Domain:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">domain_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="domain_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">(NT-)Domain name for authentication.
+ <property name="label" translatable="yes">Domain</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">domain_entry</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="domain_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">(NT-)Domain name for authentication.
config: Domain <domain></property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
+ <property name="invisible_char">●</property>
+ <property name="hexpand">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="security_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Security</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -562,171 +548,161 @@ config: Domain <domain></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment_vbox2">
+ <object class="GtkGrid" id="table_advanced1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
- <object class="GtkGrid" id="table_advanced1">
+ <object class="GtkLabel" id="phase1_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkLabel" id="phase1_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase1 Algorithms:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">phase1_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase1_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">IKE encryption/authentication
algorithm to be used for the connection (phase 1 aka ISAKMP SA). The format is “cipher-hash;modpgroup,
cipher-hash;modpgroup, …”.
+ <property name="label" translatable="yes">Phase1 Algorithms</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">phase1_entry</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase1_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">IKE encryption/authentication algorithm
to be used for the connection (phase 1 aka ISAKMP SA). The format is “cipher-hash;modpgroup,
cipher-hash;modpgroup, …”.
config: ike <proposals></property>
- <property name="hexpand">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="phase2_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase2 Algorithms:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">phase2_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase2_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Specifies the algorithms that will
be offered/accepted for a phase2 negotiation. The format is “cipher-hash;modpgroup, cipher-hash;modpgroup, …”.
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="phase2_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Phase2 Algorithms</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">phase2_entry</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase2_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Specifies the algorithms that will be
offered/accepted for a phase2 negotiation. The format is “cipher-hash;modpgroup, cipher-hash;modpgroup, …”.
config: esp <proposals></property>
- <property name="hexpand">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="phase1_lifetime_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase1 Lifetime:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">phase1_lifetime_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase1_lifetime_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">How long the keying channel of a
connection should last before being renegotiated. The value is expressed by a number followed by an optional
“s”(econds), “m”(inutes), “h”(ours) or “d”(ays).
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="phase1_lifetime_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Phase1 Lifetime</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">phase1_lifetime_entry</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase1_lifetime_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">How long the keying channel of a
connection should last before being renegotiated. The value is expressed by a number followed by an optional
“s”(econds), “m”(inutes), “h”(ours) or “d”(ays).
config: ikelifetime <lifetime></property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="phase2_lifetime_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase2 Lifetime:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">phase2_lifetime_entry</property>
- <property name="single_line_mode">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase2_lifetime_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">How long a particular instance of a
connection (a set of encryption/authentication keys for user packets) should last, from successful
negotiation to expiry. The value is expressed by a number followed by an optional “s”(econds), “m”(inutes),
“h”(ours) or “d”(ays).
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="phase2_lifetime_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Phase2 Lifetime</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">phase2_lifetime_entry</property>
+ <property name="single_line_mode">True</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase2_lifetime_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">How long a particular instance of a
connection (a set of encryption/authentication keys for user packets) should last, from successful
negotiation to expiry. The value is expressed by a number followed by an optional “s”(econds), “m”(inutes),
“h”(ours) or “d”(ays).
config: salifetime <lifetime></property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="rekey_checkbutton">
- <property name="label" translatable="yes">Disable rekeying</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Whether a connection should not be
renegotiated when it is about to expire.
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="rekey_checkbutton">
+ <property name="label" translatable="yes">Disable rekeying</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Whether a connection should not be
renegotiated when it is about to expire.
config: rekey <no/yes></property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="pfs_checkbutton">
- <property name="label" translatable="yes">Disable PFS</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Disable perfect forward security.
Enable this option only if the server doesn’t support PFS.
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="pfs_checkbutton">
+ <property name="label" translatable="yes">Disable PFS</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Disable perfect forward security.
Enable this option only if the server doesn’t support PFS.
config: pfs <no/yes></property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
+ <property name="draw_indicator">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="connectivity_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Connectivity</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -739,131 +715,119 @@ config: pfs <no/yes></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment3_vbox2">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
- <object class="GtkGrid">
+ <object class="GtkLabel" id="remote_network_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkLabel" id="remote_network_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Remote Network:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">remote_network_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="remote_network_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Private subnet behind the remote
participant, expressed as network/netmask.
+ <property name="label" translatable="yes">Remote Network</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">remote_network_entry</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="remote_network_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Private subnet behind the remote
participant, expressed as network/netmask.
config: rightsubnet <net></property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_fragmentation">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Enable fragmentation</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">fragmentation_combo</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_fragmentation">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Enable fragmentation</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">fragmentation_combo</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="fragmentation_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="model">liststore_yesnoforce</property>
+ <property name="active">1</property>
<child>
- <object class="GtkComboBox" id="fragmentation_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="model">liststore_yesnoforce</property>
- <property name="active">1</property>
- <child>
- <object class="GtkCellRendererText" id="fragmentation_renderer"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
+ <object class="GtkCellRendererText" id="fragmentation_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
- <child>
- <object class="GtkCheckButton" id="narrowing_checkbutton">
- <property name="label" translatable="yes">narrowing</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">IKEv2 negotiation may allow
establishing an IPsec connection with narrowed down traffic selectors. This option is ignored for IKEv1.
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="narrowing_checkbutton">
+ <property name="label" translatable="yes">narrowing</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">IKEv2 negotiation may allow
establishing an IPsec connection with narrowed down traffic selectors. This option is ignored for IKEv1.
config: narrowing <yes/no></property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_mobike">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Enable MOBIKE</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">mobike_combo</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_mobike">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Enable MOBIKE</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">mobike_combo</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="mobike_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">liststore_yesno</property>
+ <property name="active">0</property>
<child>
- <object class="GtkComboBox" id="mobike_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">liststore_yesno</property>
- <property name="active">0</property>
- <child>
- <object class="GtkCellRendererText" id="type_renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
+ <object class="GtkCellRendererText" id="type_renderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">5</property>
- </packing>
</child>
</object>
<packing>
@@ -898,7 +862,6 @@ config: narrowing <yes/no></property>
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="receives-default">True</property>
<property name="use-underline">True</property>
</object>
</child>
@@ -909,6 +872,7 @@ config: narrowing <yes/no></property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
+ <property name="can-default">True</property>
<style>
<class name="default"/>
<class name="suggested-action"/>
diff --git a/properties/nm-libreswan-editor-plugin.c b/properties/nm-libreswan-editor-plugin.c
index cbe06f9..a974766 100644
--- a/properties/nm-libreswan-editor-plugin.c
+++ b/properties/nm-libreswan-editor-plugin.c
@@ -332,23 +332,35 @@ _call_editor_factory (gpointer factory,
static NMVpnEditor *
get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
{
+ gpointer gtk3_only_symbol;
+ GModule *self_module;
+ const char *editor;
+
g_return_val_if_fail (LIBRESWAN_IS_EDITOR_PLUGIN (iface), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (!error || !*error, NULL);
- {
+ self_module = g_module_open (NULL, 0);
+ g_module_symbol (self_module, "gtk_container_add", >k3_only_symbol);
+ g_module_close (self_module);
+
+ if (gtk3_only_symbol) {
+ editor = "libnm-vpn-plugin-libreswan-editor.so";
+ } else {
+ editor = "libnm-gtk4-vpn-plugin-libreswan-editor.so";
+ }
+
#ifdef NM_VPN_OLD
- return nm_vpn_editor_new (connection, error);
+ return nm_vpn_editor_new (connection, error);
#else
- return nm_vpn_plugin_utils_load_editor ("libnm-vpn-plugin-libreswan-editor.so",
- "nm_vpn_editor_factory_libreswan",
- _call_editor_factory,
- iface,
- connection,
- NULL,
- error);
+ return nm_vpn_plugin_utils_load_editor (editor,
+ "nm_vpn_editor_factory_libreswan",
+ _call_editor_factory,
+ iface,
+ connection,
+ NULL,
+ error);
#endif
- }
}
static void
diff --git a/properties/nm-libreswan-editor.c b/properties/nm-libreswan-editor.c
index a7ec64d..4d372c6 100644
--- a/properties/nm-libreswan-editor.c
+++ b/properties/nm-libreswan-editor.c
@@ -40,6 +40,20 @@
#define PW_TYPE_ASK 1
#define PW_TYPE_UNUSED 2
+#if !GTK_CHECK_VERSION(4,0,0)
+#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
+
/*****************************************************************************/
static void libreswan_editor_interface_init (NMVpnEditorInterface *iface_class);
@@ -78,7 +92,7 @@ check_validity (LibreswanEditor *self, GError **error)
int contype;
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str) || strstr (str, " ") || strstr (str, "\t")) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
@@ -92,7 +106,7 @@ check_validity (LibreswanEditor *self, GError **error)
if (contype == TYPE_IKEV2_CERT) {
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "cert_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str) || strstr (str, " ") || strstr (str, "\t")) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
@@ -164,7 +178,7 @@ setup_password_widget (LibreswanEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_secret (s_vpn, secret_name);
- gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
+ gtk_editable_set_text (GTK_EDITABLE (widget), value ? value : "");
}
g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
@@ -177,7 +191,7 @@ show_toggled_cb (GtkCheckButton *button, LibreswanEditor *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, "user_password_entry"));
g_assert (widget);
@@ -239,7 +253,7 @@ init_password_icon (LibreswanEditor *self,
if (!flags || !strcmp (flags, NM_LIBRESWAN_PW_TYPE_SAVE))
flags = nm_setting_vpn_get_data_item (s_vpn, type_key);
}
- value = gtk_entry_get_text (GTK_ENTRY (entry));
+ value = gtk_editable_get_text (GTK_EDITABLE (entry));
if ((!value || !*value) && !flags) {
nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
(NMSetting *) s_vpn, secret_key);
@@ -253,12 +267,12 @@ static void
advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
{
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (user_data);
- GtkWidget *toplevel;
+ void *root;
- toplevel = gtk_widget_get_toplevel (priv->widget);
- if (gtk_widget_is_toplevel (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), GTK_WINDOW (toplevel));
- gtk_widget_show_all (priv->advanced_dialog);
+ root = gtk_widget_get_root (priv->widget);
+ if (GTK_IS_WINDOW(root))
+ gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), GTK_WINDOW (root));
+ gtk_widget_show (priv->advanced_dialog);
}
static void update_adv_settings (LibreswanEditor *self, NMSettingVpn *s_vpn);
@@ -271,6 +285,7 @@ advanced_dialog_response_cb (GtkWidget *dialog, gint response, gpointer user_dat
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (self);
gtk_widget_hide (priv->advanced_dialog);
+ gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), NULL);
if (response == GTK_RESPONSE_APPLY)
update_adv_settings (self, priv->s_vpn);
@@ -311,10 +326,10 @@ populate_widget (LibreswanEditor *self,
value = "";
if (GTK_IS_ENTRY (widget)) {
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
} else if (GTK_IS_CHECK_BUTTON (widget)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- nm_streq0 (value, match_value));
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget),
+ nm_streq0 (value, match_value));
} else if (GTK_IS_COMBO_BOX (widget)) {
gint idx = -1;
@@ -461,8 +476,7 @@ init_editor_plugin (LibreswanEditor *self,
priv->advanced_dialog = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"libreswan-advanced-dialog"));
g_return_val_if_fail (priv->advanced_dialog != NULL, FALSE);
- g_signal_connect (G_OBJECT (priv->advanced_dialog), "delete-event",
- G_CALLBACK (gtk_widget_hide_on_delete), self);
+ gtk_window_set_hide_on_close (GTK_WINDOW (priv->advanced_dialog), TRUE);
g_signal_connect (G_OBJECT (priv->advanced_dialog), "response",
G_CALLBACK (advanced_dialog_response_cb), self);
@@ -493,7 +507,7 @@ save_one_password (NMSettingVpn *s_vpn,
switch (flags) {
case NM_SETTING_SECRET_FLAG_NONE:
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 && *password)
nm_setting_vpn_add_secret (s_vpn, secret_key, password);
data_val = NM_LIBRESWAN_PW_TYPE_SAVE;
@@ -521,7 +535,7 @@ update_adv_settings (LibreswanEditor *self, NMSettingVpn *s_vpn)
/* Domain entry */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_DOMAIN, str);
else
@@ -530,7 +544,7 @@ update_adv_settings (LibreswanEditor *self, NMSettingVpn *s_vpn)
/* Remote Network */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"remote_network_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_REMOTENETWORK, str);
else
@@ -538,21 +552,21 @@ update_adv_settings (LibreswanEditor *self, NMSettingVpn *s_vpn)
/* Disable rekeying */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "rekey_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_REKEY, "no");
else
nm_setting_vpn_remove_data_item (s_vpn, NM_LIBRESWAN_KEY_REKEY);
/* Disable PFS */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "pfs_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_PFS, "no");
else
nm_setting_vpn_remove_data_item (s_vpn, NM_LIBRESWAN_KEY_PFS);
/* Narrowing */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "narrowing_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_NARROWING, "yes");
else
nm_setting_vpn_remove_data_item (s_vpn, NM_LIBRESWAN_KEY_NARROWING);
@@ -598,7 +612,7 @@ update_connection (NMVpnEditor *iface,
/* Gateway */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_RIGHT, str);
@@ -610,7 +624,7 @@ update_connection (NMVpnEditor *iface,
/* Certificate name */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "cert_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_LEFTCERT, str);
@@ -625,7 +639,7 @@ update_connection (NMVpnEditor *iface,
case TYPE_IKEV1_XAUTH:
/* Group name */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_LEFTID, str);
@@ -633,7 +647,7 @@ update_connection (NMVpnEditor *iface,
nm_setting_vpn_remove_data_item (s_vpn, NM_LIBRESWAN_KEY_LEFTXAUTHUSER);
nm_setting_vpn_remove_data_item (s_vpn, NM_LIBRESWAN_KEY_LEFTUSERNAME);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_LEFTXAUTHUSER, str);
@@ -655,33 +669,33 @@ update_connection (NMVpnEditor *iface,
/* Remote ID */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remoteid_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_RIGHTID, str);
/* Phase 1 Algorithms: ike */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "phase1_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_IKE, str);
/* Phase 2 Algorithms: esp */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "phase2_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_ESP, str);
/* Phase 1 Lifetime: ike */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"phase1_lifetime_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_IKELIFETIME, str);
/* Phase 2 Lifetime: sa */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"phase2_lifetime_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && *str)
nm_setting_vpn_add_data_item (s_vpn, NM_LIBRESWAN_KEY_SALIFETIME, str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]