[NetworkManager-fortisslvpn/lr/gtk-4.0: 4/6] editor: use NmaCertChooser
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-fortisslvpn/lr/gtk-4.0: 4/6] editor: use NmaCertChooser
- Date: Tue, 18 Jan 2022 19:39:33 +0000 (UTC)
commit fb416de817ce41c4f72655f0dc78871c5b15c7c0
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon Oct 11 13:40:19 2021 +0200
editor: use NmaCertChooser
configure.ac | 2 +-
properties/nm-fortisslvpn-dialog.ui | 74 +++++++------------------------------
properties/nm-fortisslvpn-editor.c | 41 ++++++++++----------
3 files changed, 37 insertions(+), 80 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 01b89be..62a4201 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,7 @@ if test x"$with_gnome" != xno; then
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)
+ PKG_CHECK_MODULES(LIBNMA, libnma >= 1.8.33)
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)
diff --git a/properties/nm-fortisslvpn-dialog.ui b/properties/nm-fortisslvpn-dialog.ui
index 88a24ae..0fdb077 100644
--- a/properties/nm-fortisslvpn-dialog.ui
+++ b/properties/nm-fortisslvpn-dialog.ui
@@ -201,75 +201,29 @@ config: the first parameter of fortisslvpn</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkFileChooserButton" id="key_chooser">
+ <object class="NmaCertChooser" id="ca_chooser">
+ <property name="flags">13</property>
+ <property name="title">CA</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="cert_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="ca_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">User _Key</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">key_chooser</property>
- <property name="xalign">1</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_User Certificate</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">cert_chooser</property>
- <property name="xalign">1</property>
+ <property name="can-focus">False</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">6</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label5">
+ <object class="NmaCertChooser" id="cert_chooser">
+ <property name="flags">12</property>
+ <property name="title">User</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_CA Certificate</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ca_chooser</property>
- <property name="xalign">1</property>
+ <property name="can-focus">False</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">7</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
diff --git a/properties/nm-fortisslvpn-editor.c b/properties/nm-fortisslvpn-editor.c
index 6d87d87..293f12e 100644
--- a/properties/nm-fortisslvpn-editor.c
+++ b/properties/nm-fortisslvpn-editor.c
@@ -24,6 +24,8 @@
#include "nm-fortisslvpn-editor.h"
#include "nm-fortissl-properties.h"
+#include "nma-cert-chooser.h"
+
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -288,32 +290,33 @@ init_editor_plugin (FortisslvpnEditor *self, NMConnection *connection, GError **
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ca_chooser"));
g_return_val_if_fail (widget, FALSE);
+ nma_cert_chooser_add_to_size_group (NMA_CERT_CHOOSER (widget), group);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_CA);
- if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
+ if (value && strlen (value)) {
+ nma_cert_chooser_set_cert (NMA_CERT_CHOOSER (widget), value,
+ NM_SETTING_802_1X_CK_SCHEME_PATH);
+ }
}
- g_signal_connect (G_OBJECT (widget), "update-preview", G_CALLBACK (stuff_changed_cb), self);
+ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "cert_chooser"));
g_return_val_if_fail (widget, FALSE);
+ nma_cert_chooser_add_to_size_group (NMA_CERT_CHOOSER (widget), group);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_CERT);
- if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
- }
- g_signal_connect (G_OBJECT (widget), "update-preview", G_CALLBACK (stuff_changed_cb), self);
-
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "key_chooser"));
- g_return_val_if_fail (widget, FALSE);
-
- if (s_vpn) {
+ if (value && strlen (value)) {
+ nma_cert_chooser_set_cert (NMA_CERT_CHOOSER (widget), value,
+ NM_SETTING_802_1X_CK_SCHEME_PATH);
+ }
value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_KEY);
- if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
+ if (value && strlen (value)) {
+ nma_cert_chooser_set_key (NMA_CERT_CHOOSER (widget), value,
+ NM_SETTING_802_1X_CK_SCHEME_PATH);
+ }
}
- g_signal_connect (G_OBJECT (widget), "update-preview", G_CALLBACK (stuff_changed_cb), self);
+ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "advanced_dialog"));
g_return_val_if_fail (widget, FALSE);
@@ -402,19 +405,19 @@ update_connection (NMVpnEditor *iface,
/* CA file */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ca_chooser"));
- str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ 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 = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ 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, "key_chooser"));
- str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]