[network-manager-openvpn/lr/cert-chooser: 6/6] properties: switch to using the NMACertChooser
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/lr/cert-chooser: 6/6] properties: switch to using the NMACertChooser
- Date: Wed, 17 May 2017 12:09:16 +0000 (UTC)
commit 4694837e7cd2abf36f527faf2455af739562bff6
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Mar 8 16:26:33 2017 +0100
properties: switch to using the NMACertChooser
properties/auth-helpers.c | 478 +++++++-----------------
properties/auth-helpers.h | 2 -
properties/nm-openvpn-dialog.ui | 786 +++++++++++++--------------------------
properties/nm-openvpn-editor.c | 22 +-
4 files changed, 398 insertions(+), 890 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index ab236f2..ac3cbca 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -35,6 +35,9 @@
#ifdef NM_VPN_OLD
#define nm_utils_is_valid_iface_name(n,e) nm_utils_iface_valid_name(n)
+#include <nm-cert-chooser.h>
+#else
+#include <nma-cert-chooser.h>
#endif
#include "utils.h"
@@ -76,37 +79,6 @@ comp_lzo_values_conf_to_display (const char *value_conf)
/*****************************************************************************/
-static void
-show_password (GtkToggleButton *togglebutton, GtkEntry *password_entry)
-{
- gtk_entry_set_visibility (password_entry, gtk_toggle_button_get_active (togglebutton));
-}
-
-static GtkWidget *
-setup_secret_widget (GtkBuilder *builder,
- const char *widget_name,
- NMSettingVpn *s_vpn,
- const char *secret_key)
-{
- GtkWidget *widget;
- GtkWidget *show_passwords;
- const char *tmp;
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
- g_assert (widget);
-
- show_passwords = GTK_WIDGET (gtk_builder_get_object (builder, "show_passwords"));
- g_signal_connect (show_passwords, "toggled", G_CALLBACK (show_password), widget);
-
- if (s_vpn) {
- tmp = nm_setting_vpn_get_secret (s_vpn, secret_key);
- if (tmp)
- gtk_entry_set_text (GTK_ENTRY (widget), tmp);
- }
-
- return widget;
-}
-
/* From gnome-control-center/panels/network/connection-editor/ui-helpers.c */
static void
@@ -132,152 +104,76 @@ typedef struct {
} TlsChooserSignalData;
static void
-tls_chooser_signal_data_destroy (gpointer data, GClosure *closure)
+tls_cert_changed_cb (NMACertChooser *this, gpointer user_data)
{
- g_slice_free (TlsChooserSignalData, data);
-}
-
-static void
-tls_cert_changed_cb (GtkWidget *widget, gpointer data)
-{
- GtkWidget *other_widgets[2] = { ((TlsChooserSignalData *) data)->widget1,
- ((TlsChooserSignalData *) data)->widget2 };
- GtkFileChooser *this = GTK_FILE_CHOOSER (widget);
- char *fname, *dirname, *tmp;
- int i;
-
- /* If the just-changed file chooser is a PKCS#12 file, then all of the
- * TLS filechoosers have to be PKCS#12. But if it just changed to something
- * other than a PKCS#12 file, then clear out the other file choosers.
- *
- * Basically, all the choosers have to contain PKCS#12 files, or none of
- * them can, because PKCS#12 files contain everything required for the TLS
- * connection (CA, client cert, private key).
- */
-
- fname = gtk_file_chooser_get_filename (this);
- dirname = g_path_get_dirname (fname);
-
- for (i = 0; i < G_N_ELEMENTS (other_widgets); i++) {
- GtkFileChooser *other = GTK_FILE_CHOOSER (other_widgets[i]);
- char *other_fname = gtk_file_chooser_get_filename (other);
- gulong id = GPOINTER_TO_SIZE (g_object_get_data (G_OBJECT (other), BLOCK_HANDLER_ID));
-
- g_signal_handler_block (other, id);
- if (is_pkcs12 (fname)) {
- /* Make sure all choosers have this PKCS#12 file */
- if (!other_fname || strcmp (fname, other_fname))
- gtk_file_chooser_set_filename (other, fname);
- } else {
- /* Just-chosen file isn't PKCS#12 or no file was chosen, so clear out other
- * file selectors that have PKCS#12 files in them.
- */
- if (is_pkcs12 (other_fname))
- gtk_file_chooser_unselect_all (other);
-
- /* Set directory of un-set file choosers to the directory just selected */
- tmp = gtk_file_chooser_get_filename (other);
- if (!tmp && dirname)
- gtk_file_chooser_set_current_folder (other, dirname);
- g_free (tmp);
+ NMACertChooser *other = user_data;
+ NMSetting8021xCKScheme scheme;
+ char *this_cert, *other_cert;
+ char *this_key, *other_key;
+
+ this_cert = nma_cert_chooser_get_cert (this, &scheme);
+ other_cert = nma_cert_chooser_get_cert (other, &scheme);
+ this_key = nma_cert_chooser_get_key (this, &scheme);
+ other_key = nma_cert_chooser_get_key (other, &scheme);
+
+ if (is_pkcs12 (this_cert)) {
+ if (!this_key)
+ nma_cert_chooser_set_key (this, this_cert, NM_SETTING_802_1X_CK_SCHEME_PATH);
+ if (!other_cert) {
+ nma_cert_chooser_set_cert (other, this_cert, NM_SETTING_802_1X_CK_SCHEME_PATH);
+ if (!other_key)
+ nma_cert_chooser_set_key (other, this_cert, NM_SETTING_802_1X_CK_SCHEME_PATH);
}
- g_signal_handler_unblock (other, id);
- g_free (other_fname);
}
- g_free (fname);
- g_free (dirname);
+ g_free (this_cert);
+ g_free (other_cert);
+ g_free (this_key);
+ g_free (other_key);
}
static void
tls_setup (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
const char *prefix,
- GtkWidget *ca_chooser,
+ NMACertChooser *ca_chooser,
ChangedCallback changed_cb,
gpointer user_data)
{
- GtkWidget *widget, *cert, *key;
+ NMACertChooser *cert;
const char *value;
char *tmp;
- GtkFileFilter *filter;
- TlsChooserSignalData *ca_chooser_data, *cert_data, *key_data;
- gulong id1, id2, id3;
- tmp = g_strdup_printf ("%s_user_cert_chooser", prefix);
- cert = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
+ tmp = g_strdup_printf ("%s_user_cert", prefix);
+ cert = NMA_CERT_CHOOSER (gtk_builder_get_object (builder, tmp));
g_free (tmp);
- gtk_size_group_add_widget (group, cert);
- filter = tls_file_chooser_filter_new (TRUE);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (cert), filter);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (cert), TRUE);
- gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (cert),
- _("Choose your personal certificate…"));
- g_signal_connect (G_OBJECT (cert), "selection-changed", G_CALLBACK (changed_cb), user_data);
+ nma_cert_chooser_add_to_size_group (cert, GTK_SIZE_GROUP (gtk_builder_get_object (builder,
"labels")));
+ g_signal_connect (G_OBJECT (cert), "changed", G_CALLBACK (changed_cb), user_data);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CERT);
if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (cert), value);
- }
-
- tmp = g_strdup_printf ("%s_private_key_chooser", prefix);
- key = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
- g_free (tmp);
+ nma_cert_chooser_set_cert (cert, value, NM_SETTING_802_1X_CK_SCHEME_PATH);
- gtk_size_group_add_widget (group, key);
- filter = tls_file_chooser_filter_new (TRUE);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (key), filter);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (key), TRUE);
- gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (key),
- _("Choose your private key…"));
- g_signal_connect (G_OBJECT (key), "selection-changed", G_CALLBACK (changed_cb), user_data);
-
- if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEY);
if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (key), value);
+ nma_cert_chooser_set_key (cert, value, NM_SETTING_802_1X_CK_SCHEME_PATH);
+ value = nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_CERTPASS);
+ if (value)
+ nma_cert_chooser_set_key_password (cert, value);
}
- ca_chooser_data = g_slice_new0 (TlsChooserSignalData);
- ca_chooser_data->widget1 = cert;
- ca_chooser_data->widget2 = key;
- cert_data = g_slice_new0 (TlsChooserSignalData);
- cert_data->widget1 = ca_chooser;
- cert_data->widget2 = key;
- key_data = g_slice_new0 (TlsChooserSignalData);
- key_data->widget1 = ca_chooser;
- key_data->widget2 = cert;
+ nma_cert_chooser_setup_key_password_storage (cert, 0, (NMSetting *) s_vpn,
+ NM_OPENVPN_KEY_CERTPASS, TRUE, FALSE);
/* Link choosers to the PKCS#12 changer callback */
- id1 = g_signal_connect_data (ca_chooser, "selection-changed", G_CALLBACK (tls_cert_changed_cb),
- ca_chooser_data, tls_chooser_signal_data_destroy, 0);
- id2 = g_signal_connect_data (cert, "selection-changed", G_CALLBACK (tls_cert_changed_cb),
- cert_data, tls_chooser_signal_data_destroy, 0);
- id3 = g_signal_connect_data (key, "selection-changed", G_CALLBACK (tls_cert_changed_cb),
- key_data, tls_chooser_signal_data_destroy, 0);
-
- /* Store handler id to be able to block the signal in tls_cert_changed_cb() */
- g_object_set_data (G_OBJECT (ca_chooser), BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id1));
- g_object_set_data (G_OBJECT (cert), BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id2));
- g_object_set_data (G_OBJECT (key), BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id3));
-
- /* Fill in the private key password */
- tmp = g_strdup_printf ("%s_private_key_password_entry", prefix);
- widget = setup_secret_widget (builder, tmp, s_vpn, NM_OPENVPN_KEY_CERTPASS);
- g_free (tmp);
- gtk_size_group_add_widget (group, widget);
- g_signal_connect (widget, "changed", G_CALLBACK (changed_cb), user_data);
-
- nma_utils_setup_password_storage (widget, 0, (NMSetting *) s_vpn, NM_OPENVPN_KEY_CERTPASS,
- TRUE, FALSE);
+ g_signal_connect_object (ca_chooser, "changed", G_CALLBACK (tls_cert_changed_cb), cert, 0);
+ g_signal_connect_object (cert, "changed", G_CALLBACK (tls_cert_changed_cb), ca_chooser, 0);
}
static void
pw_setup (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
const char *prefix,
ChangedCallback changed_cb,
@@ -290,7 +186,6 @@ pw_setup (GtkBuilder *builder,
tmp = g_strdup_printf ("%s_username_entry", prefix);
widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
g_free (tmp);
- gtk_size_group_add_widget (group, widget);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_USERNAME);
@@ -301,39 +196,41 @@ pw_setup (GtkBuilder *builder,
/* Fill in the user password */
tmp = g_strdup_printf ("%s_password_entry", prefix);
- widget = setup_secret_widget (builder, tmp, s_vpn, NM_OPENVPN_KEY_PASSWORD);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
g_free (tmp);
- gtk_size_group_add_widget (group, widget);
g_signal_connect (widget, "changed", G_CALLBACK (changed_cb), user_data);
+ if (s_vpn) {
+ value = nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_PASSWORD);
+ if (value)
+ gtk_entry_set_text (GTK_ENTRY (widget), value);
+ }
+
nma_utils_setup_password_storage (widget, 0, (NMSetting *) s_vpn, NM_OPENVPN_KEY_PASSWORD,
TRUE, FALSE);
}
void
tls_pw_init_auth_widget (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
const char *contype,
const char *prefix,
ChangedCallback changed_cb,
gpointer user_data)
{
- GtkWidget *ca;
+ NMACertChooser *ca;
const char *value;
char *tmp;
- GtkFileFilter *filter;
gboolean tls = FALSE, pw = FALSE;
g_return_if_fail (builder != NULL);
- g_return_if_fail (group != NULL);
g_return_if_fail (changed_cb != NULL);
g_return_if_fail (prefix != NULL);
- tmp = g_strdup_printf ("%s_ca_cert_chooser", prefix);
- ca = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
+ tmp = g_strdup_printf ("%s_ca_cert", prefix);
+ ca = NMA_CERT_CHOOSER (gtk_builder_get_object (builder, tmp));
g_free (tmp);
- gtk_size_group_add_widget (group, ca);
+ nma_cert_chooser_add_to_size_group (ca, GTK_SIZE_GROUP (gtk_builder_get_object (builder, "labels")));
/* Three major connection types here: TLS-only, PW-only, and TLS + PW */
if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS) || !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS))
@@ -341,27 +238,18 @@ tls_pw_init_auth_widget (GtkBuilder *builder,
if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD) || !strcmp (contype,
NM_OPENVPN_CONTYPE_PASSWORD_TLS))
pw = TRUE;
- /* Only TLS types can use PKCS#12 */
- filter = tls_file_chooser_filter_new (tls);
-
- /* Set up CA cert file picker which all connection types support */
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (ca), filter);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (ca), TRUE);
- gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (ca),
- _("Choose a Certificate Authority certificate…"));
- g_signal_connect (G_OBJECT (ca), "selection-changed", G_CALLBACK (changed_cb), user_data);
-
+ g_signal_connect (ca, "changed", G_CALLBACK (changed_cb), user_data);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA);
if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (ca), value);
+ nma_cert_chooser_set_cert (ca, value, NM_SETTING_802_1X_CK_SCHEME_PATH);
}
/* Set up the rest of the options */
if (tls)
- tls_setup (builder, group, s_vpn, prefix, ca, changed_cb, user_data);
+ tls_setup (builder, s_vpn, prefix, ca, changed_cb, user_data);
if (pw)
- pw_setup (builder, group, s_vpn, prefix, changed_cb, user_data);
+ pw_setup (builder, s_vpn, prefix, changed_cb, user_data);
}
#define SK_DIR_COL_NAME 0
@@ -369,7 +257,6 @@ tls_pw_init_auth_widget (GtkBuilder *builder,
void
sk_init_auth_widget (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
ChangedCallback changed_cb,
gpointer user_data)
@@ -383,11 +270,9 @@ sk_init_auth_widget (GtkBuilder *builder,
GtkFileFilter *filter;
g_return_if_fail (builder != NULL);
- g_return_if_fail (group != NULL);
g_return_if_fail (changed_cb != NULL);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_key_chooser"));
- gtk_size_group_add_widget (group, widget);
filter = sk_file_chooser_filter_new ();
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
@@ -429,14 +314,12 @@ sk_init_auth_widget (GtkBuilder *builder,
active = 2;
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_direction_combo"));
- gtk_size_group_add_widget (group, widget);
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
g_object_unref (store);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active < 0 ? 0 : active);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_local_address_entry"));
- gtk_size_group_add_widget (group, widget);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_LOCAL_IP);
@@ -445,7 +328,6 @@ sk_init_auth_widget (GtkBuilder *builder,
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_remote_address_entry"));
- gtk_size_group_add_widget (group, widget);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_IP);
@@ -455,18 +337,12 @@ sk_init_auth_widget (GtkBuilder *builder,
}
static gboolean
-validate_file_chooser (GtkBuilder *builder, const char *name)
+validate_cert_chooser (GtkBuilder *builder, const char *name, GError **error)
{
- GtkWidget *widget;
- char *str;
- gboolean valid = FALSE;
+ NMACertChooser *chooser;
- widget = GTK_WIDGET (gtk_builder_get_object (builder, name));
- str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- if (str && strlen (str))
- valid = TRUE;
- g_free (str);
- return valid;
+ chooser = NMA_CERT_CHOOSER (gtk_builder_get_object (builder, name));
+ return nma_cert_chooser_validate (chooser, error);
}
static gboolean
@@ -474,59 +350,49 @@ validate_tls (GtkBuilder *builder, const char *prefix, GError **error)
{
char *tmp;
gboolean valid, encrypted = FALSE;
- GtkWidget *widget;
+ NMACertChooser *user_cert;
NMSettingSecretFlags pw_flags;
gboolean secrets_required = TRUE;
+ NMSetting8021xCKScheme scheme;
+ GError *local = NULL;
- tmp = g_strdup_printf ("%s_ca_cert_chooser", prefix);
- valid = validate_file_chooser (builder, tmp);
+ tmp = g_strdup_printf ("%s_ca_cert", prefix);
+ valid = validate_cert_chooser (builder, tmp, &local);
g_free (tmp);
if (!valid) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
- NM_OPENVPN_KEY_CA);
+ "%s: %s", NM_OPENVPN_KEY_CA, local->message);
+ g_error_free (local);
return FALSE;
}
- tmp = g_strdup_printf ("%s_user_cert_chooser", prefix);
- valid = validate_file_chooser (builder, tmp);
- g_free (tmp);
- if (!valid) {
- g_set_error (error,
- NMV_EDITOR_PLUGIN_ERROR,
- NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
- NM_OPENVPN_KEY_CERT);
- return FALSE;
- }
-
- tmp = g_strdup_printf ("%s_private_key_chooser", prefix);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
- valid = validate_file_chooser (builder, tmp);
+ tmp = g_strdup_printf ("%s_user_cert", prefix);
+ user_cert = NMA_CERT_CHOOSER (gtk_builder_get_object (builder, tmp));
+ valid = validate_cert_chooser (builder, tmp, &local);
g_free (tmp);
if (!valid) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
- NM_OPENVPN_KEY_KEY);
+ "%s: %s", NM_OPENVPN_KEY_CERT, local->message);
+ g_error_free (local);
return FALSE;
}
/* Encrypted certificates require a password */
- tmp = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ tmp = nma_cert_chooser_get_cert (user_cert, &scheme);
encrypted = is_encrypted (tmp);
g_free (tmp);
- tmp = g_strdup_printf ("%s_private_key_password_entry", prefix);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
- g_free (tmp);
- pw_flags = nma_utils_menu_to_secret_flags (widget);
+ pw_flags = nma_cert_chooser_get_key_password_flags (user_cert);
if ( pw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED
|| pw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
secrets_required = FALSE;
if (encrypted && secrets_required) {
- if (!gtk_entry_get_text_length (GTK_ENTRY (widget))) {
+ if (!nma_cert_chooser_get_key_password (user_cert)) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
@@ -543,6 +409,8 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
{
GtkWidget *widget;
const char *str;
+ char *filename;
+ GError *local = NULL;
if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS)) {
if (!validate_tls (builder, "tls", error))
@@ -561,11 +429,12 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
return FALSE;
}
} else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) {
- if (!validate_file_chooser (builder, "pw_ca_cert_chooser")) {
+ if (!validate_cert_chooser (builder, "pw_ca_cert", &local)) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
- NM_OPENVPN_KEY_CA);
+ "%s: %s", NM_OPENVPN_KEY_CA, local->message);
+ g_error_free (local);
return FALSE;
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "pw_username_entry"));
@@ -578,13 +447,17 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
return FALSE;
}
} else if (!strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
- if (!validate_file_chooser (builder, "sk_key_chooser")) {
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_key_chooser"));
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ if (filename && strlen (filename)) {
+ g_free (filename);
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
NM_OPENVPN_KEY_STATIC_KEY);
return FALSE;
}
+ g_free (filename);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_local_address_entry"));
str = gtk_entry_get_text (GTK_ENTRY (widget));
@@ -612,55 +485,66 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
}
static void
-update_from_filechooser (GtkBuilder *builder,
- const char *key,
- const char *prefix,
- const char *widget_name,
- NMSettingVpn *s_vpn)
+update_from_cert_chooser (GtkBuilder *builder,
+ const char *cert_prop,
+ const char *key_prop,
+ const char *key_pass_prop,
+ const char *prefix,
+ const char *widget_name,
+ NMSettingVpn *s_vpn)
{
- GtkWidget *widget;
- char *tmp, *filename;
+ NMSetting8021xCKScheme scheme;
+ NMACertChooser *cert_chooser;
+ NMSettingSecretFlags pw_flags;
+ char *tmp;
+ const char *password;
g_return_if_fail (builder != NULL);
- g_return_if_fail (key != NULL);
+ g_return_if_fail (cert_prop != NULL);
g_return_if_fail (prefix != NULL);
g_return_if_fail (widget_name != NULL);
g_return_if_fail (s_vpn != NULL);
tmp = g_strdup_printf ("%s_%s", prefix, widget_name);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
+ cert_chooser = NMA_CERT_CHOOSER (gtk_builder_get_object (builder, tmp));
g_free (tmp);
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- if (filename && strlen (filename))
- nm_setting_vpn_add_data_item (s_vpn, key, filename);
- g_free (filename);
-}
+ tmp = nma_cert_chooser_get_cert (cert_chooser, &scheme);
+ if (tmp && strlen (tmp))
+ nm_setting_vpn_add_data_item (s_vpn, cert_prop, tmp);
+ g_free (tmp);
-static void
-update_tls (GtkBuilder *builder, const char *prefix, NMSettingVpn *s_vpn)
-{
- GtkWidget *widget;
- NMSettingSecretFlags pw_flags;
- char *tmp;
- const char *str;
+ if (key_prop) {
+ g_return_if_fail (key_pass_prop != NULL);
- update_from_filechooser (builder, NM_OPENVPN_KEY_CA, prefix, "ca_cert_chooser", s_vpn);
- update_from_filechooser (builder, NM_OPENVPN_KEY_CERT, prefix, "user_cert_chooser", s_vpn);
- update_from_filechooser (builder, NM_OPENVPN_KEY_KEY, prefix, "private_key_chooser", s_vpn);
+ tmp = nma_cert_chooser_get_key (cert_chooser, &scheme);
+ if (tmp && strlen (tmp))
+ nm_setting_vpn_add_data_item (s_vpn, key_prop, tmp);
+ g_free (tmp);
- /* Password */
- tmp = g_strdup_printf ("%s_private_key_password_entry", prefix);
- widget = (GtkWidget *) gtk_builder_get_object (builder, tmp);
- g_assert (widget);
- g_free (tmp);
+ password = nma_cert_chooser_get_key_password (cert_chooser);
+ if (password && strlen (password))
+ nm_setting_vpn_add_secret (s_vpn, key_pass_prop, password);
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- if (str && strlen (str))
- nm_setting_vpn_add_secret (s_vpn, NM_OPENVPN_KEY_CERTPASS, str);
+ pw_flags = nma_cert_chooser_get_key_password_flags (cert_chooser);
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), key_pass_prop, pw_flags, NULL);
+ }
+}
- pw_flags = nma_utils_menu_to_secret_flags (widget);
- nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_OPENVPN_KEY_CERTPASS, pw_flags, NULL);
+static void
+update_tls (GtkBuilder *builder, const char *prefix, NMSettingVpn *s_vpn)
+{
+ update_from_cert_chooser (builder,
+ NM_OPENVPN_KEY_CA,
+ NULL,
+ NULL,
+ prefix, "ca_cert", s_vpn);
+
+ update_from_cert_chooser (builder,
+ NM_OPENVPN_KEY_CERT,
+ NM_OPENVPN_KEY_KEY,
+ NM_OPENVPN_KEY_CERTPASS,
+ prefix, "ca_cert", s_vpn);
}
static void
@@ -707,18 +591,24 @@ auth_widget_update_connection (GtkBuilder *builder,
GtkTreeIter iter;
GtkWidget *widget;
const char *str;
+ char *filename;
if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS)) {
update_tls (builder, "tls", s_vpn);
} else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) {
- update_from_filechooser (builder, NM_OPENVPN_KEY_CA, "pw", "ca_cert_chooser", s_vpn);
+ update_from_cert_chooser (builder, NM_OPENVPN_KEY_CA, NULL, NULL,
+ "pw", "ca_cert", s_vpn);
update_pw (builder, "pw", s_vpn);
} else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) {
update_tls (builder, "pw_tls", s_vpn);
update_pw (builder, "pw_tls", s_vpn);
} else if (!strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
/* Update static key */
- update_from_filechooser (builder, NM_OPENVPN_KEY_STATIC_KEY, "sk", "key_chooser", s_vpn);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_key_chooser"));
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ if (filename && strlen (filename))
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY, filename);
+ g_free (filename);
/* Update direction */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_direction_combo"));
@@ -770,100 +660,6 @@ find_tag (const char *tag, const char *buf, gsize len)
return NULL;
}
-static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
-static const char *pem_dsa_key_begin = "-----BEGIN DSA PRIVATE KEY-----";
-static const char *pem_pkcs8_key_begin = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
-static const char *pem_cert_begin = "-----BEGIN CERTIFICATE-----";
-static const char *pem_unenc_key_begin = "-----BEGIN PRIVATE KEY-----";
-
-static gboolean
-tls_default_filter (const GtkFileFilterInfo *filter_info, gpointer data)
-{
- char *contents = NULL, *p, *ext;
- gsize bytes_read = 0;
- gboolean show = FALSE;
- gboolean pkcs_allowed = GPOINTER_TO_UINT (data);
- struct stat statbuf;
-
- if (!filter_info->filename)
- return FALSE;
-
- p = strrchr (filter_info->filename, '.');
- if (!p)
- return FALSE;
-
- ext = g_ascii_strdown (p, -1);
- if (!ext)
- return FALSE;
-
- if (pkcs_allowed && g_str_has_suffix (ext, ".p12") && is_pkcs12 (filter_info->filename)) {
- g_free (ext);
- return TRUE;
- }
-
- if (!g_str_has_suffix (ext, ".pem") && !g_str_has_suffix (ext, ".crt") &&
- !g_str_has_suffix (ext, ".key") && !g_str_has_suffix (ext, ".cer")) {
- g_free (ext);
- return FALSE;
- }
- g_free (ext);
-
- /* Ignore files that are really large */
- if (!stat (filter_info->filename, &statbuf)) {
- if (statbuf.st_size > 500000)
- return FALSE;
- }
-
- if (!g_file_get_contents (filter_info->filename, &contents, &bytes_read, NULL))
- return FALSE;
-
- if (bytes_read < 400) /* needs to be lower? */
- goto out;
-
- /* Check for PEM signatures */
- if (find_tag (pem_rsa_key_begin, (const char *) contents, bytes_read)) {
- show = TRUE;
- goto out;
- }
-
- if (find_tag (pem_dsa_key_begin, (const char *) contents, bytes_read)) {
- show = TRUE;
- goto out;
- }
-
- if (find_tag (pem_cert_begin, (const char *) contents, bytes_read)) {
- show = TRUE;
- goto out;
- }
-
- if (find_tag (pem_pkcs8_key_begin, (const char *) contents, bytes_read)) {
- show = TRUE;
- goto out;
- }
-
- if (find_tag (pem_unenc_key_begin, (const char *) contents, bytes_read)) {
- show = TRUE;
- goto out;
- }
-
-out:
- g_free (contents);
- return show;
-}
-
-GtkFileFilter *
-tls_file_chooser_filter_new (gboolean pkcs_allowed)
-{
- GtkFileFilter *filter;
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, tls_default_filter, GUINT_TO_POINTER
(pkcs_allowed), NULL);
- gtk_file_filter_set_name (filter, pkcs_allowed ? _("PEM or PKCS#12 certificates (*.pem, *.crt, *.key,
*.cer, *.p12)")
- : _("PEM certificates (*.pem, *.crt, *.key, *.cer)"));
- return filter;
-}
-
-
static const char *sk_key_begin = "-----BEGIN OpenVPN Static key V1-----";
static gboolean
diff --git a/properties/auth-helpers.h b/properties/auth-helpers.h
index 0e53ded..91ddcb2 100644
--- a/properties/auth-helpers.h
+++ b/properties/auth-helpers.h
@@ -27,7 +27,6 @@
typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data);
void tls_pw_init_auth_widget (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
const char *contype,
const char *prefix,
@@ -35,7 +34,6 @@ void tls_pw_init_auth_widget (GtkBuilder *builder,
gpointer user_data);
void sk_init_auth_widget (GtkBuilder *builder,
- GtkSizeGroup *group,
NMSettingVpn *s_vpn,
ChangedCallback changed_cb,
gpointer user_data);
diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
index 73d8bec..a4296e0 100644
--- a/properties/nm-openvpn-dialog.ui
+++ b/properties/nm-openvpn-dialog.ui
@@ -155,14 +155,13 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <property name="column_spacing">12</property>
<child>
- <object class="GtkLabel" id="label23">
+ <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="use_underline">True</property>
- <property name="mnemonic_widget">gateway_entry</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -171,20 +170,12 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment2">
+ <object class="GtkEntry" id="gateway_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="gateway_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Remote gateway(s), with optional
port and protocol (e.g. ovpn.corp.com:1234:tcp). You can specify multiple hosts for redundancy (use commas or
spaces as delimiters).
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Remote gateway(s), with optional port
and protocol (e.g. ovpn.corp.com:1234:tcp). You can specify multiple hosts for redundancy (use commas or
spaces as delimiters).
config: remote</property>
- <property name="hexpand">True</property>
- </object>
- </child>
+ <property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -239,23 +230,7 @@ config: remote</property>
<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="GtkCheckButton" id="show_passwords">
- <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="use_underline">True</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
+ <property name="column_spacing">12</property>
<child>
<object class="GtkNotebook" id="auth_notebook">
<property name="visible">True</property>
@@ -263,138 +238,36 @@ config: remote</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
- <object class="GtkGrid" id="table1">
+ <object class="GtkBox" id="tls">
<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="GtkAlignment" id="alignment22">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="tls_private_key_password_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Password for private
key</property>
- <property name="visibility">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label29">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Private Key Password:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkFileChooserButton" id="tls_private_key_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Local peer’s private key in
.pem format.
-config: key</property>
- <property name="hexpand">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Private Key:</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="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkFileChooserButton" id="tls_ca_cert_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Certificate authority (CA)
file in .pem format.
-config: ca</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
+ <property name="valign">start</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="NMACertChooser" id="tls_ca_cert">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">CA Certificate:</property>
- <property name="xalign">0</property>
+ <property name="title">CA</property>
+ <property name="flags">5</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label3">
+ <object class="NMACertChooser" id="tls_user_cert">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">User Certificate:</property>
- <property name="xalign">0</property>
+ <property name="title">User</property>
+ <property name="flags">4</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkFileChooserButton" id="tls_user_cert_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Local peer’s signed
certificate in .pem format (signed by CA of CA Certificate).
-config: cert</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -410,16 +283,42 @@ config: cert</property>
</packing>
</child>
<child>
- <object class="GtkGrid" id="table4">
+ <object class="GtkBox" id="pw">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <property name="valign">start</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkAlignment" id="alignment20">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Password:</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="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">User name:</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="pw_password_entry">
<property name="visible">True</property>
@@ -429,90 +328,44 @@ config: auth-user-pass</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
<child>
- <object class="GtkFileChooserButton" id="pw_ca_cert_chooser">
+ <object class="GtkEntry" id="pw_username_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Certificate authority (CA)
file in .pem format.
-config: ca</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Username passed to OpenVPN
when prompted for it.
+config: auth-user-pass</property>
+ <property name="hexpand">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Password:</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="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">CA Certificate:</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="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">User name:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment7">
+ <object class="NMACertChooser" id="pw_ca_cert">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="pw_username_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Username passed to OpenVPN
when prompted for it.
-config: auth-user-pass</property>
- <property name="hexpand">True</property>
- </object>
- </child>
+ <property name="title">CA</property>
+ <property name="flags">5</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">2</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -532,93 +385,42 @@ config: auth-user-pass</property>
</packing>
</child>
<child>
- <object class="GtkGrid" id="table5">
+ <object class="GtkBox" id="pw_tls">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <property name="valign">start</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkAlignment" id="alignment23">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
<child>
- <object class="GtkEntry" id="pw_tls_private_key_password_entry">
+ <object class="GtkLabel" id="label28">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Password for private
key</property>
- <property name="hexpand">True</property>
- <property name="visibility">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Password:</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label30">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Private Key Password:</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="GtkAlignment" id="alignment12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
<child>
- <object class="GtkFileChooserButton" id="pw_tls_private_key_chooser">
+ <object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Local peer’s private key in
.pem format.
-config: key</property>
+ <property name="label" translatable="yes">User name:</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Private Key:</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="GtkLabel" id="label28">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Password:</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="GtkAlignment" id="alignment21">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
<child>
<object class="GtkEntry" id="pw_tls_password_entry">
<property name="visible">True</property>
@@ -628,110 +430,57 @@ config: auth-user-pass</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment14">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkFileChooserButton" id="pw_tls_user_cert_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Local peer’s signed
certificate in .pem format (signed by CA of CA Certificate).
-config: cert</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
<child>
- <object class="GtkFileChooserButton" id="pw_tls_ca_cert_chooser">
+ <object class="GtkEntry" id="pw_tls_username_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Certificate authority (CA)
file in .pem format.
-config: ca</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Username passed to OpenVPN
when prompted for it.
+config: auth-user-pass</property>
+ <property name="hexpand">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">User Certificate:</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="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">CA Certificate:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label10">
+ <object class="NMACertChooser" id="pw_tls_ca_cert">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">User name:</property>
- <property name="xalign">0</property>
+ <property name="title">CA</property>
+ <property name="flags">5</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment11">
+ <object class="NMACertChooser" id="pw_tls_user_cert">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="pw_tls_username_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Username passed to OpenVPN
when prompted for it.
-config: auth-user-pass</property>
- <property name="hexpand">True</property>
- </object>
- </child>
+ <property name="title">User</property>
+ <property name="flags">4</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">2</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -751,31 +500,11 @@ config: auth-user-pass</property>
</packing>
</child>
<child>
- <object class="GtkGrid" id="table6">
+ <object class="GtkGrid" id="psk">
<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="GtkAlignment" id="alignment25">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="sk_local_address_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">IP address of the local VPN
endpoint.
-config: ifconfig <l> <rn></property>
- <property name="hexpand">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
+ <property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label31">
<property name="visible">True</property>
@@ -803,26 +532,6 @@ config: ifconfig <l> <rn></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment18">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkEntry" id="sk_remote_address_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">IP address of the remote
VPN endpoint.
-config: ifconfig <l> <rn></property>
- <property name="hexpand">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -847,18 +556,11 @@ config: ifconfig <l> <rn></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment15">
+ <object class="GtkFileChooserButton" id="sk_key_chooser">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkFileChooserButton" id="sk_key_chooser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Pre-shared file for Static
Key encryption mode (non-TLS).
+ <property name="tooltip_text" translatable="yes">Pre-shared file for Static Key
encryption mode (non-TLS).
config: static <file></property>
- </object>
- </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -866,25 +568,44 @@ config: static <file></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment16">
+ <object class="GtkEntry" id="sk_remote_address_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">IP address of the remote VPN
endpoint.
+config: ifconfig <l> <rn></property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="sk_local_address_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">IP address of the local VPN
endpoint.
+config: ifconfig <l> <rn></property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="sk_direction_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkComboBox" id="sk_direction_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Direction for Static Key
encryption mode (non-TLS).
+ <property name="tooltip_text" translatable="yes">Direction for Static Key
encryption mode (non-TLS).
If key direction is used, it must be the opposite of that used on the VPN peer. For example, if the peer
uses “1â€, this connection must use “0â€. If you are unsure what value to use, contact your system
administrator.
config: static <file> [direction]</property>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
+ <property name="model">model1</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</object>
<packing>
@@ -922,7 +643,7 @@ config: static <file> [direction]</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label26">
+ <object class="GtkLabel" id="auth_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Type:</property>
@@ -934,24 +655,17 @@ config: static <file> [direction]</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment3">
+ <object class="GtkComboBox" id="auth_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Select an authentication
mode.</property>
<property name="hexpand">True</property>
- <property name="xalign">0</property>
+ <property name="model">model2</property>
<child>
- <object class="GtkComboBox" id="auth_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Select an authentication
mode.</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
+ <object class="GtkCellRendererText" id="renderer2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</object>
<packing>
@@ -959,9 +673,6 @@ config: static <file> [direction]</property>
<property name="top_attach">0</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -1033,6 +744,21 @@ config: static <file> [direction]</property>
</packing>
</child>
</object>
+ <object class="GtkSizeGroup" id="labels">
+ <property name="ignore_hidden">True</property>
+ <widgets>
+ <widget name="gateway_label"/>
+ <widget name="label27"/>
+ <widget name="label5"/>
+ <widget name="label28"/>
+ <widget name="label10"/>
+ <widget name="label31"/>
+ <widget name="label20"/>
+ <widget name="label12"/>
+ <widget name="label11"/>
+ <widget name="auth_label"/>
+ </widgets>
+ </object>
<object class="GtkListStore" id="model3">
<columns>
<!-- column-name gchararray -->
@@ -1575,41 +1301,19 @@ config: tun-ipv6</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="float_checkbutton">
- <property name="label" translatable="yes">Accept authenticated packets from any address
(F_loat)</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="tooltip_text" translatable="yes">Allow remote peer to change its IP
address and/or port number, such as due to DHCP (this is the default if --remote is not used). --float when
specified with --remote allows an OpenVPN session to initially connect to a peer at a known address, however
if packets arrive from a new address and pass all authentication tests, the new address will take control of
the session. This is useful when you are connecting to a peer which holds a dynamic address such as a dial-in
user or DHCP client.
-
-Essentially, --float tells OpenVPN to accept authenticated packets from any address, not only the address
which was specified in the --remote option.
-
-config: float</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">10</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox8">
+ <object class="GtkBox" id="hbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="ping_checkbutton">
- <property name="label" translatable="yes">Specify pin_g interval:</property>
+ <object class="GtkCheckButton" id="ping_exit_restart_checkbutton">
+ <property name="label" translatable="yes">Specify _exit or restart ping:</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="tooltip_text" translatable="yes">Ping remote over the TCP/UDP
control channel if no packets have been sent for at least n seconds.
-config: ping <n></property>
+ <property name="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart <n></property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@@ -1621,19 +1325,39 @@ config: ping <n></property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="ping_spinbutton">
+ <object class="GtkComboBox" id="ping_exit_restart_combo">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP
control channel if no packets have been sent for at least n seconds.
-config: ping <n></property>
- <property name="adjustment">adjustment7</property>
+ <property name="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart <n></property>
+ <property name="model">model8</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer11"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="ping_exit_restart_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart <n></property>
+ <property name="adjustment">adjustment8</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -1644,19 +1368,19 @@ config: ping <n></property>
</packing>
</child>
<child>
- <object class="GtkBox" id="hbox9">
+ <object class="GtkBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="ping_exit_restart_checkbutton">
- <property name="label" translatable="yes">Specify _exit or restart ping:</property>
+ <object class="GtkCheckButton" id="ping_checkbutton">
+ <property name="label" translatable="yes">Specify pin_g interval:</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="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart <n></property>
+ <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP
control channel if no packets have been sent for at least n seconds.
+config: ping <n></property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@@ -1668,45 +1392,47 @@ config: ping-exit | ping-restart <n></property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="ping_exit_restart_combo">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart <n></property>
- <property name="model">model8</property>
- <child>
- <object class="GtkCellRendererText" id="renderer11"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="ping_exit_restart_spinbutton">
+ <object class="GtkSpinButton" id="ping_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Exit or restart after n seconds
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart <n></property>
- <property name="adjustment">adjustment8</property>
+ <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP
control channel if no packets have been sent for at least n seconds.
+config: ping <n></property>
+ <property name="adjustment">adjustment7</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="position">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="float_checkbutton">
+ <property name="label" translatable="yes">Accept authenticated packets from any address
(F_loat)</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="tooltip_text" translatable="yes">Allow remote peer to change its IP
address and/or port number, such as due to DHCP (this is the default if --remote is not used). --float when
specified with --remote allows an OpenVPN session to initially connect to a peer at a known address, however
if packets arrive from a new address and pass all authentication tests, the new address will take control of
the session. This is useful when you are connecting to a peer which holds a dynamic address such as a dial-in
user or DHCP client.
+
+Essentially, --float tells OpenVPN to accept authenticated packets from any address, not only the address
which was specified in the --remote option.
+
+config: float</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">11</property>
</packing>
</child>
@@ -2231,9 +1957,9 @@ config: tls-auth <file> [direction]</property>
<object class="GtkComboBox" id="tls_auth_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Add an additional layer of
encryption or HMAC authentication.</property>
<property name="model">model10</property>
<property name="active">0</property>
- <property name="tooltip_text" translatable="yes">Add an additional layer of
encryption or HMAC authentication.</property>
<property name="id_column">0</property>
<child>
<object class="GtkCellRendererText" id="renderer16"/>
@@ -2257,10 +1983,10 @@ config: tls-auth <file> [direction]</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Add an additional layer of
encryption or HMAC authentication.</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Additional TLS authentication or
encryption</property>
- <property name="tooltip_text" translatable="yes">Add an additional layer of
encryption or HMAC authentication.</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -2308,7 +2034,7 @@ config: tls-auth <file> [direction]</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <property name="column_spacing">12</property>
<child>
<object class="GtkComboBox" id="proxy_type_combo">
<property name="visible">True</property>
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index 31e12b6..16858d0 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -51,11 +51,11 @@ G_DEFINE_TYPE_EXTENDED (OpenvpnEditor, openvpn_editor_plugin_widget, G_TYPE_OBJE
typedef struct {
GtkBuilder *builder;
GtkWidget *widget;
- GtkSizeGroup *group;
GtkWindowGroup *window_group;
gboolean window_added;
GHashTable *advanced;
gboolean new_connection;
+ GtkWidget *tls_user_cert_chooser;
} OpenvpnEditorPrivate;
/*****************************************************************************/
@@ -160,15 +160,12 @@ auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
OpenvpnEditor *self = OPENVPN_EDITOR (user_data);
OpenvpnEditorPrivate *priv = OPENVPN_EDITOR_GET_PRIVATE (self);
GtkWidget *auth_notebook;
- GtkWidget *show_passwords;
GtkTreeModel *model;
GtkTreeIter iter;
gint new_page = 0;
auth_notebook = GTK_WIDGET (gtk_builder_get_object (priv->builder, "auth_notebook"));
g_assert (auth_notebook);
- show_passwords = GTK_WIDGET (gtk_builder_get_object (priv->builder, "show_passwords"));
- g_assert (auth_notebook);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
g_assert (model);
@@ -176,9 +173,6 @@ auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
gtk_tree_model_get (model, &iter, COL_AUTH_PAGE, &new_page, -1);
- /* Static key page doesn't have any passwords */
- gtk_widget_set_sensitive (show_passwords, new_page != 3);
-
gtk_notebook_set_current_page (GTK_NOTEBOOK (auth_notebook), new_page);
stuff_changed_cb (combo, self);
@@ -269,11 +263,8 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
s_vpn = nm_connection_get_setting_vpn (connection);
- priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
- gtk_size_group_add_widget (priv->group, widget);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
if (value)
@@ -283,7 +274,6 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "auth_combo"));
g_return_val_if_fail (widget != NULL, FALSE);
- gtk_size_group_add_widget (priv->group, widget);
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
@@ -300,7 +290,7 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
}
/* TLS auth widget */
- tls_pw_init_auth_widget (priv->builder, priv->group, s_vpn,
+ tls_pw_init_auth_widget (priv->builder, s_vpn,
NM_OPENVPN_CONTYPE_TLS, "tls",
stuff_changed_cb, self);
gtk_list_store_append (store, &iter);
@@ -311,7 +301,7 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
-1);
/* Password auth widget */
- tls_pw_init_auth_widget (priv->builder, priv->group, s_vpn,
+ tls_pw_init_auth_widget (priv->builder, s_vpn,
NM_OPENVPN_CONTYPE_PASSWORD, "pw",
stuff_changed_cb, self);
gtk_list_store_append (store, &iter);
@@ -324,7 +314,7 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
active = 1;
/* Password+TLS auth widget */
- tls_pw_init_auth_widget (priv->builder, priv->group, s_vpn,
+ tls_pw_init_auth_widget (priv->builder, s_vpn,
NM_OPENVPN_CONTYPE_PASSWORD_TLS, "pw_tls",
stuff_changed_cb, self);
gtk_list_store_append (store, &iter);
@@ -337,7 +327,7 @@ init_editor_plugin (OpenvpnEditor *self, NMConnection *connection, GError **erro
active = 2;
/* Static key auth widget */
- sk_init_auth_widget (priv->builder, priv->group, s_vpn, stuff_changed_cb, self);
+ sk_init_auth_widget (priv->builder, s_vpn, stuff_changed_cb, self);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -545,8 +535,6 @@ dispose (GObject *object)
OpenvpnEditor *plugin = OPENVPN_EDITOR (object);
OpenvpnEditorPrivate *priv = OPENVPN_EDITOR_GET_PRIVATE (plugin);
- g_clear_object (&priv->group);
-
g_clear_object (&priv->window_group);
g_clear_object (&priv->widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]