[NetworkManager-libreswan/lr/gtk-4.0: 7/7] editor: add a Gtk4 port




commit ae47d1969f3a5ca1c207366bb528ef57e2b4ed81
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 +++++++++++--
 properties/nm-libreswan-editor-plugin.c | 32 +++++++++-----
 properties/nm-libreswan-editor.c        | 74 ++++++++++++++++++++-------------
 5 files changed, 134 insertions(+), 45 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 fbc3747..7f5c219 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)
+
+noinst_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 9218d46..ff0cf09 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-fortisslvpn 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)]))
@@ -126,16 +134,20 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=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)
@@ -150,6 +162,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"
@@ -190,6 +209,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/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", &gtk3_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]