[NetworkManager-fortisslvpn/lr/gtk-4.0: 3/3] all: add support for Gtk4




commit e3c4c4d94b50a1d1269f2268463d8a5887b3bc1b
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Oct 11 12:56:39 2021 +0200

    all: add support for Gtk4

 .gitignore                                |  3 +
 Makefile.am                               | 56 +++++++++++++++++-
 configure.ac                              | 30 ++++++++--
 properties/nm-fortisslvpn-dialog.ui       |  4 +-
 properties/nm-fortisslvpn-editor-plugin.c | 32 ++++++----
 properties/nm-fortisslvpn-editor.c        | 97 ++++++++++++++-----------------
 6 files changed, 149 insertions(+), 73 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b2c8982..f41e5ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ stamp-*
 .libs
 autom4te.cache
 intltool-*
+gtk4/
 po/boldquot.sed
 po/en@boldquot.header
 po/en@quot.header
@@ -80,6 +81,8 @@ auth-dialog/nm-fortisslvpn-auth-dialog
 nm-fortisslvpn-service.name
 nm-fortisslvpn.desktop
 properties/resources.[ch]
+gtk4/resources.c
+gtk4/nm-fortisslvpn-dialog.ui
 src/nm-fortisslvpn-pppd-service-dbus.c
 src/nm-fortisslvpn-pppd-service-dbus.h
 src/nm-fortisslvpn-pinentry
diff --git a/Makefile.am b/Makefile.am
index 883a730..d5af8c5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -143,13 +143,20 @@ 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-fortisslvpn-editor-plugin.c \
        properties/nm-fortisslvpn-editor-plugin.h
 
 editor_sources = \
-       properties/resources.c \
-       properties/resources.h \
        properties/nm-fortisslvpn-editor.c \
        properties/nm-fortisslvpn-editor.h \
        shared/nm-fortissl-properties.c \
@@ -160,7 +167,14 @@ properties_cppflags = \
        -I$(srcdir)/shared \
        $(GLIB_CFLAGS)
 
+BUILT_SOURCES += \
+       gtk4/resources.c \
+       properties/resources.c \
+       properties/resources.h
+
 CLEANFILES += \
+       gtk4/nm-fortisslvpn-dialog.ui \
+       gtk4/resources.c \
        properties/resources.c \
        properties/resources.h
 
@@ -218,6 +232,10 @@ if WITH_GNOME
 plugin_LTLIBRARIES += properties/libnm-vpn-plugin-fortisslvpn-editor.la
 endif
 
+nodist_properties_libnm_vpn_plugin_fortisslvpn_editor_la_SOURCES = \
+       properties/resources.h \
+       properties/resources.c
+
 properties_libnm_vpn_plugin_fortisslvpn_editor_la_SOURCES = \
        $(editor_sources)
 
@@ -241,10 +259,44 @@ properties_libnm_vpn_plugin_fortisslvpn_editor_la_LDFLAGS = \
 
 ###############################################################################
 
+if WITH_GTK4
+plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-fortisslvpn-editor.la
+endif
+
+nodist_properties_libnm_gtk4_vpn_plugin_fortisslvpn_editor_la_SOURCES = \
+       properties/resources.h \
+       gtk4/resources.c
+
+properties_libnm_gtk4_vpn_plugin_fortisslvpn_editor_la_SOURCES = \
+       $(editor_sources)
+
+properties_libnm_gtk4_vpn_plugin_fortisslvpn_editor_la_CPPFLAGS = \
+       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
+       $(properties_cppflags) \
+       $(GTK4_CFLAGS) \
+       $(LIBNM_CFLAGS) \
+       $(LIBNMA_GTK4_CFLAGS)
+
+properties_libnm_gtk4_vpn_plugin_fortisslvpn_editor_la_LIBADD = \
+       properties/libnm-vpn-plugin-fortisslvpn-utils.la \
+       $(GLIB_LIBS) \
+       $(GTK4_LIBS) \
+       $(LIBNM_LIBS) \
+       $(LIBNMA_GTK4_LIBS)
+
+properties_libnm_gtk4_vpn_plugin_fortisslvpn_editor_la_LDFLAGS = \
+       $(properties_libnm_vpn_plugin_fortisslvpn_editor_la_LDFLAGS)
+
+###############################################################################
+
 if WITH_LIBNM_GLIB
 noinst_LTLIBRARIES += properties/libnm-fortisslvpn-properties-core.la
 endif
 
+nodist_properties_libnm_fortisslvpn_properties_core_la_SOURCES = \
+       properties/resources.h \
+       properties/resources.c
+
 properties_libnm_fortisslvpn_properties_core_la_SOURCES = \
        $(shared_sources) \
        $(plugin_sources) \
diff --git a/configure.ac b/configure.ac
index 62a4201..0a0d3f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,7 @@ dnl
 dnl GNOME support
 dnl
 AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-fortisslvpn 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-fortisslvpn 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
@@ -83,6 +84,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
@@ -90,6 +97,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)]))
@@ -108,17 +116,19 @@ AC_SUBST(GLIB_LIBS)
 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
 
-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.8.33)
+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.8.33)
 
        if test x"$with_libnm_glib" != xno; then
                PKG_CHECK_MODULES(LIBNM_GTK, libnm-gtk >= 1.2.0)
@@ -133,6 +143,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.33)
+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"
@@ -170,6 +187,7 @@ echo ""
 echo "Build configuration: "
 echo "  --with-dist-version=$ac_distver"
 echo "  --with-gnome=$with_gnome"
+echo "  --with-gtk4=$with_gtk4"
 echo "  --with-libnm-glib=$with_libnm_glib"
 echo "  --with-pppd-plugin-dir=$PPPD_PLUGIN_DIR"
 echo "  --enable-absolute-paths=$enable_absolute_paths"
diff --git a/properties/nm-fortisslvpn-dialog.ui b/properties/nm-fortisslvpn-dialog.ui
index c60a269..977c08e 100644
--- a/properties/nm-fortisslvpn-dialog.ui
+++ b/properties/nm-fortisslvpn-dialog.ui
@@ -171,7 +171,7 @@ config: the first parameter of fortisslvpn</property>
     </child>
     <action-widgets>
       <action-widget response="-6">cancel_button</action-widget>
-      <action-widget response="-5">ok_button</action-widget>
+      <action-widget response="-5" default="true">ok_button</action-widget>
     </action-widgets>
     <child type="titlebar">
       <object class="GtkHeaderBar">
@@ -193,7 +193,6 @@ config: the first parameter of fortisslvpn</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>
@@ -204,6 +203,7 @@ config: the first parameter of fortisslvpn</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-fortisslvpn-editor-plugin.c b/properties/nm-fortisslvpn-editor-plugin.c
index 0c5ff73..26e1f59 100644
--- a/properties/nm-fortisslvpn-editor-plugin.c
+++ b/properties/nm-fortisslvpn-editor-plugin.c
@@ -79,23 +79,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 (FORTISSLVPN_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-fortisslvpn-editor.so";
+       } else {
+               editor = "libnm-gtk4-vpn-plugin-fortisslvpn-editor.so";
+       }
+
 #ifdef NM_VPN_OLD
-               return nm_fortisslvpn_editor_new (connection, error);
+       return nm_fortisslvpn_editor_new (connection, error);
 #else
-               return nm_vpn_plugin_utils_load_editor ("libnm-vpn-plugin-fortisslvpn-editor.so",
-                                                       "nm_vpn_editor_factory_fortisslvpn",
-                                                       _call_editor_factory,
-                                                       iface,
-                                                       connection,
-                                                       NULL,
-                                                       error);
+       return nm_vpn_plugin_utils_load_editor (editor,
+                                               "nm_vpn_editor_factory_fortisslvpn",
+                                               _call_editor_factory,
+                                               iface,
+                                               connection,
+                                               NULL,
+                                               error);
 #endif
-       }
 }
 
 static void
diff --git a/properties/nm-fortisslvpn-editor.c b/properties/nm-fortisslvpn-editor.c
index 293f12e..ca76856 100644
--- a/properties/nm-fortisslvpn-editor.c
+++ b/properties/nm-fortisslvpn-editor.c
@@ -35,6 +35,20 @@
 
 /*****************************************************************************/
 
+#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_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
+
+/*****************************************************************************/
+
 typedef struct {
        GtkBuilder *builder;
        GtkWidget *widget;
@@ -78,7 +92,7 @@ setup_password_widget (FortisslvpnEditor *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);
@@ -133,7 +147,7 @@ init_password_icon (FortisslvpnEditor *self,
         */
        if (s_vpn)
                nm_setting_get_secret_flags (NM_SETTING (s_vpn), 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,
                                                   (NMSetting *) s_vpn, secret_key);
@@ -142,29 +156,25 @@ init_password_icon (FortisslvpnEditor *self,
                          G_CALLBACK (password_storage_changed_cb), self);
 }
 
-static gboolean
-advanced_dialog_delete_cb (GtkWidget *dialog, gpointer user_data)
-{
-       /* Don't destroy it. */
-       return TRUE;
-}
-
 static void
 advanced_dialog_response_cb (GtkWidget *dialog, gint response, gpointer user_data)
 {
        FortisslvpnEditor *self = FORTISSLVPN_EDITOR (user_data);
        FortisslvpnEditorPrivate *priv = FORTISSLVPN_EDITOR_GET_PRIVATE (self);
-       GtkEntry *trusted_cert_entry = GTK_ENTRY (gtk_builder_get_object (priv->builder, 
"trusted_cert_entry"));
-       GtkEntry *realm_entry = GTK_ENTRY (gtk_builder_get_object (priv->builder, "realm_entry"));
+       GtkEditable *trusted_cert_entry = GTK_EDITABLE (gtk_builder_get_object (priv->builder, 
"trusted_cert_entry"));
+       GtkEditable *realm_entry = GTK_EDITABLE (gtk_builder_get_object (priv->builder, "realm_entry"));
        GtkSwitch *use_otp = GTK_SWITCH (gtk_builder_get_object (priv->builder, "use_otp"));
 
        g_return_if_fail (trusted_cert_entry);
        g_return_if_fail (realm_entry);
 
+       gtk_widget_hide (dialog);
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), NULL);
+
        if (response == GTK_RESPONSE_OK) {
                g_free (priv->trusted_cert);
-               priv->trusted_cert = g_strdup (gtk_entry_get_text (trusted_cert_entry));
-               priv->realm = g_strdup (gtk_entry_get_text (realm_entry));
+               priv->trusted_cert = g_strdup (gtk_editable_get_text (trusted_cert_entry));
+               priv->realm = g_strdup (gtk_editable_get_text (realm_entry));
                stuff_changed_cb (NULL, self);
 
                if (gtk_switch_get_active (use_otp))
@@ -172,13 +182,11 @@ advanced_dialog_response_cb (GtkWidget *dialog, gint response, gpointer user_dat
                else
                        priv->otp_flags &= ~NM_SETTING_SECRET_FLAG_NOT_SAVED;
        } else {
-               gtk_entry_set_text (trusted_cert_entry, priv->trusted_cert);
-               gtk_entry_set_text (realm_entry, priv->realm);
+               gtk_editable_set_text (trusted_cert_entry, priv->trusted_cert);
+               gtk_editable_set_text (realm_entry, priv->realm);
                gtk_switch_set_active (use_otp,
                                       priv->otp_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED);
        }
-
-       gtk_widget_hide (dialog);
 }
 
 static void
@@ -187,20 +195,21 @@ advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
        FortisslvpnEditor *self = FORTISSLVPN_EDITOR (user_data);
        FortisslvpnEditorPrivate *priv = FORTISSLVPN_EDITOR_GET_PRIVATE (self);
        GtkWidget *dialog = GTK_WIDGET (gtk_builder_get_object (priv->builder, "advanced_dialog"));
-       g_assert (dialog);
+       void *root;
 
-       if (!priv->window_added) {
-               GtkWidget *toplevel = gtk_widget_get_toplevel (priv->widget);
+       g_assert (dialog);
 
-               g_assert (gtk_widget_is_toplevel (toplevel));
-               gtk_window_group_add_window (priv->window_group, GTK_WINDOW (toplevel));
-               gtk_window_group_add_window (priv->window_group, GTK_WINDOW (dialog));
-               gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
-               priv->window_added = TRUE;
+       root = gtk_widget_get_root (priv->widget);
+       if (GTK_IS_WINDOW(root)) {
+               gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (root));
+               if (!priv->window_added) {
+                       gtk_window_group_add_window (priv->window_group, GTK_WINDOW (root));
+                       gtk_window_group_add_window (priv->window_group, GTK_WINDOW (dialog));
+                       priv->window_added = TRUE;
+               }
        }
 
-       gtk_widget_grab_focus (GTK_WIDGET (gtk_builder_get_object (priv->builder, "ok_button")));
-       gtk_widget_show_all (dialog);
+       gtk_widget_show (dialog);
 }
 
 static gboolean
@@ -222,7 +231,7 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
        if (s_vpn) {
                value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_GATEWAY);
                if (value && strlen (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 (stuff_changed_cb), self);
 
@@ -232,7 +241,7 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
        if (s_vpn) {
                value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_USER);
                if (value && strlen (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 (stuff_changed_cb), self);
 
@@ -243,7 +252,7 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
                                                                             
NM_FORTISSLVPN_KEY_TRUSTED_CERT));
                if (!priv->trusted_cert)
                        priv->trusted_cert = g_strdup ("");
-               gtk_entry_set_text (GTK_ENTRY (widget), priv->trusted_cert);
+               gtk_editable_set_text (GTK_EDITABLE (widget), priv->trusted_cert);
        }
 
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "realm_entry"));
@@ -253,7 +262,7 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
                                                                      NM_FORTISSLVPN_KEY_REALM));
                if (!priv->realm)
                        priv->realm = g_strdup ("");
-               gtk_entry_set_text (GTK_ENTRY (widget), priv->realm);
+               gtk_editable_set_text (GTK_EDITABLE (widget), priv->realm);
        }
 
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "use_otp"));
@@ -322,7 +331,7 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
        g_return_val_if_fail (widget, FALSE);
 
        g_signal_connect (G_OBJECT (widget), "response", G_CALLBACK (advanced_dialog_response_cb), self);
-       g_signal_connect (G_OBJECT (widget), "delete-event", G_CALLBACK (advanced_dialog_delete_cb), NULL);
+       gtk_window_set_hide_on_close (GTK_WINDOW (widget), TRUE);
 
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "advanced_button"));
        g_return_val_if_fail (widget, FALSE);
@@ -359,7 +368,7 @@ save_password_and_flags (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 && strlen (password))
                        nm_setting_vpn_add_secret (s_vpn, secret_key, password);
                break;
@@ -387,13 +396,13 @@ 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 && strlen (str))
                nm_setting_vpn_add_data_item (s_vpn, NM_FORTISSLVPN_KEY_GATEWAY, str);
 
        /* Username */
        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 && strlen (str))
                nm_setting_vpn_add_data_item (s_vpn, NM_FORTISSLVPN_KEY_USER, str);
 
@@ -403,24 +412,6 @@ update_connection (NMVpnEditor *iface,
                                 "user_password_entry",
                                 NM_FORTISSLVPN_KEY_PASSWORD);
 
-       /* CA file */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ca_chooser"));
-       str = nma_cert_chooser_get_cert (NMA_CERT_CHOOSER (widget), NULL);
-       if (str && strlen (str))
-               nm_setting_vpn_add_data_item (s_vpn, NM_FORTISSLVPN_KEY_CA, str);
-
-       /* User certificate */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "cert_chooser"));
-       str = nma_cert_chooser_get_cert (NMA_CERT_CHOOSER (widget), NULL);
-       if (str && strlen (str))
-               nm_setting_vpn_add_data_item (s_vpn, NM_FORTISSLVPN_KEY_CERT, str);
-
-       /* User key */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "cert_chooser"));
-       str = nma_cert_chooser_get_key (NMA_CERT_CHOOSER (widget), NULL);
-       if (str && strlen (str))
-               nm_setting_vpn_add_data_item (s_vpn, NM_FORTISSLVPN_KEY_KEY, str);
-
        /* Trusted certificate */
        if (priv->trusted_cert && strlen (priv->trusted_cert))
                nm_setting_vpn_add_data_item (s_vpn,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]