[network-manager-applet/thaller/758076_ui_no_ca_cert_required: 1/2] applet: extend ui to ignore ca cert instead of nag dialog.
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/thaller/758076_ui_no_ca_cert_required: 1/2] applet: extend ui to ignore ca cert instead of nag dialog.
- Date: Fri, 16 Aug 2013 09:25:55 +0000 (UTC)
commit 2db0b157437b7e4ee9319336500f6c9590de184e
Author: Thomas Haller <thaller redhat com>
Date: Fri Aug 16 11:21:45 2013 +0200
applet: extend ui to ignore ca cert instead of nag dialog.
This applies to EAP methods PEAP, TLS, TTLS.
When the user configures a connection without CA certificate,
previously a warning dialog was shown where the user could
either return to the connection configuration or proceed.
Change the UI so that the configuration mask has a checkbox
"No CA is required" and enable the "Connect" button only when
either a certificate is selected or the user choose to ignore
it.
The flag no_ca_required is not actually saved anywhere. It is
just something within the UI. For a new connection, the ca file
choose is empty and the no_ca_required flag is not set (thus,
the user has to make an active choice first). For editing existing
connections, the flag no_ca_required is set iff no ca filename
is configured. In the latter case it is assumed, that the user
already made this choice consciously the last when the connection
was edited.
The nag dialog is still here and active. The next commit will
remove it.
https://bugzilla.redhat.com/show_bug.cgi?id=758076
https://bugzilla.redhat.com/show_bug.cgi?id=809489
Signed-off-by: Thomas Haller <thaller redhat com>
src/wireless-security/eap-method-peap.c | 30 ++++++++++++++-
src/wireless-security/eap-method-peap.ui | 39 ++++++++++++++-----
src/wireless-security/eap-method-tls.c | 36 +++++++++++++++++
src/wireless-security/eap-method-tls.ui | 39 ++++++++++++++-----
src/wireless-security/eap-method-ttls.c | 34 ++++++++++++++++-
src/wireless-security/eap-method-ttls.ui | 31 ++++++++++++---
src/wireless-security/eap-method.c | 62 ++++++++++++++++++++++++++++++
src/wireless-security/eap-method.h | 7 +++
8 files changed, 250 insertions(+), 28 deletions(-)
---
diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c
index 4d2041c..f4ec4f4 100644
--- a/src/wireless-security/eap-method-peap.c
+++ b/src/wireless-security/eap-method-peap.c
@@ -63,6 +63,8 @@ validate (EAPMethod *parent)
if (!eap_method_validate_filepicker (parent->builder, "eap_peap_ca_cert_button", TYPE_CA_CERT, NULL,
NULL))
return FALSE;
+ if (eap_method_ca_cert_required (parent->builder, "eap_peap_ca_cert_not_required_checkbox",
"eap_peap_ca_cert_button") )
+ return FALSE;
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_inner_auth_combo"));
g_assert (widget);
@@ -77,6 +79,14 @@ validate (EAPMethod *parent)
}
static void
+ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+{
+ EAPMethod *parent = user_data;
+
+ eap_method_ca_cert_not_required_toggled (parent->builder, "eap_peap_ca_cert_not_required_checkbox",
"eap_peap_ca_cert_button");
+}
+
+static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
@@ -89,6 +99,10 @@ add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
g_object_unref (method->size_group);
method->size_group = g_object_ref (group);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ gtk_size_group_add_widget (group, widget);
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_anon_identity_label"));
g_assert (widget);
gtk_size_group_add_widget (group, widget);
@@ -316,7 +330,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
{
EAPMethod *parent;
EAPMethodPEAP *method;
- GtkWidget *widget;
+ GtkWidget *widget, *widget_ca_not_required_checkbox;
GtkFileFilter *filter;
NMSetting8021x *s_8021x = NULL;
const char *filename;
@@ -343,6 +357,16 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) ca_cert_not_required_toggled,
+ parent);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) wireless_security_changed_cb,
+ ws_parent);
+ widget_ca_not_required_checkbox = widget;
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_ca_cert_button"));
g_assert (widget);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
@@ -354,11 +378,13 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
filter = eap_method_default_file_chooser_filter_new (FALSE);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
if (connection && s_8021x) {
+ filename = NULL;
if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) {
filename = nm_setting_802_1x_get_ca_cert_path (s_8021x);
if (filename)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
}
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget_ca_not_required_checkbox), !filename);
}
widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
@@ -399,6 +425,8 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_ca_cert_button"));
gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_not_required_checkbox"));
+ gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_inner_auth_label"));
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_inner_auth_combo"));
diff --git a/src/wireless-security/eap-method-peap.ui b/src/wireless-security/eap-method-peap.ui
index 3d1caa7..3bb455a 100644
--- a/src/wireless-security/eap-method-peap.ui
+++ b/src/wireless-security/eap-method-peap.ui
@@ -99,6 +99,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="eap_peap_ca_cert_not_required_checkbox">
+ <property name="label" translatable="yes">No CA certificate is _required</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</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
<object class="GtkVBox" id="eap_peap_inner_auth_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -108,8 +127,8 @@
</object>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
@@ -123,8 +142,8 @@
<property name="mnemonic_widget">eap_peap_inner_auth_combo</property>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -144,8 +163,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -160,8 +179,8 @@
<property name="mnemonic_widget">eap_peap_version_combo</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -181,8 +200,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index da02873..db34dd0 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -68,6 +68,9 @@ validate (EAPMethod *parent)
if (!eap_method_validate_filepicker (parent->builder, "eap_tls_ca_cert_button", TYPE_CA_CERT, NULL,
NULL))
return FALSE;
+ if (eap_method_ca_cert_required (parent->builder, "eap_tls_ca_cert_not_required_checkbox",
"eap_tls_ca_cert_button") )
+ return FALSE;
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_private_key_password_entry"));
g_assert (widget);
@@ -91,10 +94,26 @@ validate (EAPMethod *parent)
}
static void
+ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+{
+ EAPMethod *parent = user_data;
+
+ eap_method_ca_cert_not_required_toggled (parent->builder, "eap_tls_ca_cert_not_required_checkbox",
"eap_tls_ca_cert_button");
+}
+
+static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
GtkWidget *widget;
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ gtk_size_group_add_widget (group, widget);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ gtk_size_group_add_widget (group, widget);
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_identity_label"));
g_assert (widget);
gtk_size_group_add_widget (group, widget);
@@ -394,6 +413,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
EAPMethod *parent;
GtkWidget *widget;
NMSetting8021x *s_8021x = NULL;
+ gboolean ca_not_required;
parent = eap_method_init (sizeof (EAPMethodTLS),
validate,
@@ -416,6 +436,15 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) ca_cert_not_required_toggled,
+ parent);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) wireless_security_changed_cb,
+ ws_parent);
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_identity_entry"));
g_assert (widget);
g_signal_connect (G_OBJECT (widget), "changed",
@@ -443,6 +472,11 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
phase2 ? nm_setting_802_1x_get_phase2_private_key_path :
nm_setting_802_1x_get_private_key_path,
TRUE, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_ca_cert_button"));
+ ca_not_required = !gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), ca_not_required);
+
/* Fill secrets, if any */
if (connection)
update_secrets (parent, connection);
@@ -474,6 +508,8 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_ca_cert_button"));
gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
+ gtk_widget_hide (widget);
}
return method;
diff --git a/src/wireless-security/eap-method-tls.ui b/src/wireless-security/eap-method-tls.ui
index 23c16a5..dac5fda 100644
--- a/src/wireless-security/eap-method-tls.ui
+++ b/src/wireless-security/eap-method-tls.ui
@@ -91,6 +91,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="eap_tls_ca_cert_not_required_checkbox">
+ <property name="label" translatable="yes">No CA certificate is _required</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</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="eap_tls_private_key_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -100,8 +119,8 @@
<property name="mnemonic_widget">eap_tls_private_key_button</property>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -114,8 +133,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -130,8 +149,8 @@
<property name="mnemonic_widget">eap_tls_private_key_password_entry</property>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -146,8 +165,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="y_options"/>
</packing>
</child>
@@ -164,8 +183,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index 65346c2..b2ba58a 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -63,6 +63,8 @@ validate (EAPMethod *parent)
if (!eap_method_validate_filepicker (parent->builder, "eap_ttls_ca_cert_button", TYPE_CA_CERT, NULL,
NULL))
return FALSE;
+ if (eap_method_ca_cert_required (parent->builder, "eap_ttls_ca_cert_not_required_checkbox",
"eap_ttls_ca_cert_button") )
+ return FALSE;
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
g_assert (widget);
@@ -77,6 +79,14 @@ validate (EAPMethod *parent)
}
static void
+ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+{
+ EAPMethod *parent = user_data;
+
+ eap_method_ca_cert_not_required_toggled (parent->builder, "eap_ttls_ca_cert_not_required_checkbox",
"eap_ttls_ca_cert_button");
+}
+
+static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
@@ -89,6 +99,14 @@ add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
g_object_unref (method->size_group);
method->size_group = g_object_ref (group);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ gtk_size_group_add_widget (group, widget);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ gtk_size_group_add_widget (group, widget);
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_label"));
g_assert (widget);
gtk_size_group_add_widget (group, widget);
@@ -316,7 +334,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
{
EAPMethod *parent;
EAPMethodTTLS *method;
- GtkWidget *widget;
+ GtkWidget *widget, *widget_ca_not_required_checkbox;
GtkFileFilter *filter;
NMSetting8021x *s_8021x = NULL;
const char *filename;
@@ -343,6 +361,16 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox"));
+ g_assert (widget);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) ca_cert_not_required_toggled,
+ parent);
+ g_signal_connect (G_OBJECT (widget), "toggled",
+ (GCallback) wireless_security_changed_cb,
+ ws_parent);
+ widget_ca_not_required_checkbox = widget;
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button"));
g_assert (widget);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
@@ -354,11 +382,13 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
filter = eap_method_default_file_chooser_filter_new (FALSE);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
if (connection && s_8021x) {
+ filename = NULL;
if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) {
filename = nm_setting_802_1x_get_ca_cert_path (s_8021x);
if (filename)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
}
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget_ca_not_required_checkbox), !filename);
}
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_entry"));
@@ -380,6 +410,8 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button"));
gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox"));
+ gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_label"));
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
diff --git a/src/wireless-security/eap-method-ttls.ui b/src/wireless-security/eap-method-ttls.ui
index d33c10e..312695d 100644
--- a/src/wireless-security/eap-method-ttls.ui
+++ b/src/wireless-security/eap-method-ttls.ui
@@ -82,6 +82,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="eap_ttls_ca_cert_not_required_checkbox">
+ <property name="label" translatable="yes">No CA certificate is _required</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</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="eap_ttls_inner_auth_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -91,8 +110,8 @@
<property name="mnemonic_widget">eap_ttls_inner_auth_combo</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -112,8 +131,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -129,8 +148,8 @@
</object>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index cdc525d..45da69d 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -658,3 +658,65 @@ eap_method_is_encrypted_private_key (const char *path)
return default_filter_privkey (&info, (gpointer) TRUE);
}
+/* Some methods (PEAP, TLS, TTLS) require a CA certificate. The user can choose
+ * not to provide such a certificate. This method whether the checkbox
+ * ca_cert_not_required_checkbutton is checked or ca_cert_chooser has a certificate
+ * selected.
+ */
+gboolean
+eap_method_ca_cert_required (GtkBuilder *builder, const char *ca_cert_not_required_checkbutton, const char
*ca_cert_chooser)
+{
+ char *filename;
+ GtkWidget *widget;
+
+ g_assert (builder && ca_cert_not_required_checkbutton && ca_cert_chooser);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, ca_cert_not_required_checkbutton));
+ g_assert (widget && GTK_IS_TOGGLE_BUTTON (widget));
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, ca_cert_chooser));
+ g_assert (widget && GTK_IS_FILE_CHOOSER (widget));
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ if (!filename)
+ return TRUE;
+ g_free (filename);
+ }
+ return FALSE;
+}
+
+
+void
+eap_method_ca_cert_not_required_toggled (GtkBuilder *builder, const char *ca_cert_not_required_checkbutton,
const char *ca_cert_chooser)
+{
+ char *filename, *filename_old;
+ gboolean is_not_required;
+ GtkWidget *widget;
+
+ g_assert (builder && ca_cert_not_required_checkbutton && ca_cert_chooser);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, ca_cert_not_required_checkbutton));
+ g_assert (widget && GTK_IS_TOGGLE_BUTTON (widget));
+ is_not_required = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, ca_cert_chooser));
+ g_assert (widget && GTK_IS_FILE_CHOOSER (widget));
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ filename_old = g_object_steal_data (G_OBJECT (widget), "filename-old");
+ if (is_not_required) {
+ g_free (filename_old);
+ filename_old = filename;
+ filename = NULL;
+ } else {
+ g_free (filename);
+ filename = filename_old;
+ filename_old = NULL;
+ }
+ gtk_widget_set_sensitive (widget, !is_not_required);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
+ g_free (filename);
+ g_object_set_data_full (G_OBJECT (widget), "filename-old", filename_old, g_free);
+}
+
diff --git a/src/wireless-security/eap-method.h b/src/wireless-security/eap-method.h
index fdfa1a8..d2be1f3 100644
--- a/src/wireless-security/eap-method.h
+++ b/src/wireless-security/eap-method.h
@@ -124,5 +124,12 @@ void eap_method_phase2_update_secrets_helper (EAPMethod *method,
const char *combo_name,
guint32 column);
+gboolean eap_method_ca_cert_required (GtkBuilder *builder,
+ const char *id_ca_cert_is_not_required,
+ const char *id_ca_cert_button);
+void eap_method_ca_cert_not_required_toggled (GtkBuilder *builder,
+ const char *id_ca_cert_is_not_required,
+ const char *id_ca_cert_button);
+
#endif /* EAP_METHOD_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]