File 0005-CA-system-certificates.patch of Package NetworkManager-gnome

From fb7a88c968e2508bb95ad595cadb9c7445badf30 Mon Sep 17 00:00:00 2001
From: Tambet Ingo <tambet@gmail.com>
Date: Tue, 13 Jan 2009 13:52:42 +0200
Subject: [PATCH] CA system certificates.


diff --git a/src/applet.glade b/src/applet.glade
index 54a5c3d..f175658 100644
--- a/src/applet.glade
+++ b/src/applet.glade
@@ -1443,7 +1443,7 @@ Shared Key</property>
       <child>
 	<widget class="GtkTable" id="table8">
 	  <property name="visible">True</property>
-	  <property name="n_rows">6</property>
+	  <property name="n_rows">7</property>
 	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
 	  <property name="row_spacing">6</property>
@@ -1574,9 +1574,71 @@ Shared Key</property>
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="eap_tls_private_key_label">
+	    <widget class="GtkFileChooserButton" id="eap_tls_user_cert_button">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Private Key:</property>
+	      <property name="title" translatable="yes">Select A File</property>
+	      <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+	      <property name="local_only">True</property>
+	      <property name="show_hidden">False</property>
+	      <property name="do_overwrite_confirmation">False</property>
+	      <property name="width_chars">-1</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="show_checkbutton">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Show password</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">6</property>
+	      <property name="bottom_attach">7</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="eap_tls_private_key_password_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">False</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="activates_default">False</property>
+	    </widget>
+	    <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="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="eap_tls_private_key_password_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Private Key Password:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1594,37 +1656,17 @@ Shared Key</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</property>
-	      <property name="top_attach">3</property>
-	      <property name="bottom_attach">4</property>
+	      <property name="top_attach">5</property>
+	      <property name="bottom_attach">6</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkFileChooserButton" id="eap_tls_private_key_button">
-	      <property name="visible">True</property>
-	      <property name="title" translatable="yes">Select A File</property>
-	      <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
-	      <property name="local_only">True</property>
-	      <property name="show_hidden">False</property>
-	      <property name="do_overwrite_confirmation">False</property>
-	      <property name="width_chars">-1</property>
-	    </widget>
-	    <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">fill</property>
-	      <property name="y_options">fill</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="eap_tls_private_key_password_label">
+	    <widget class="GtkLabel" id="eap_tls_private_key_label">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Private Key Password:</property>
+	      <property name="label" translatable="yes">Private Key:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1650,30 +1692,30 @@ Shared Key</property>
 	  </child>
 
 	  <child>
-	    <widget class="GtkEntry" id="eap_tls_private_key_password_entry">
+	    <widget class="GtkFileChooserButton" id="eap_tls_private_key_button">
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">False</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="activates_default">False</property>
+	      <property name="title" translatable="yes">Select A File</property>
+	      <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+	      <property name="local_only">True</property>
+	      <property name="show_hidden">False</property>
+	      <property name="do_overwrite_confirmation">False</property>
+	      <property name="width_chars">-1</property>
 	    </widget>
 	    <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="y_options"></property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkCheckButton" id="show_checkbutton">
+	    <widget class="GtkCheckButton" id="eap_tls_ca_cert_system">
 	      <property name="visible">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">Show password</property>
+	      <property name="label" translatable="yes">Use System CA Certificates</property>
 	      <property name="use_underline">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
@@ -1684,28 +1726,8 @@ Shared Key</property>
 	    <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="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkFileChooserButton" id="eap_tls_user_cert_button">
-	      <property name="visible">True</property>
-	      <property name="title" translatable="yes">Select A File</property>
-	      <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
-	      <property name="local_only">True</property>
-	      <property name="show_hidden">False</property>
-	      <property name="do_overwrite_confirmation">False</property>
-	      <property name="width_chars">-1</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options">fill</property>
 	    </packing>
@@ -1955,7 +1977,7 @@ Shared Key</property>
       <child>
 	<widget class="GtkTable" id="table10">
 	  <property name="visible">True</property>
-	  <property name="n_rows">4</property>
+	  <property name="n_rows">5</property>
 	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
 	  <property name="row_spacing">6</property>
@@ -2058,6 +2080,25 @@ Shared Key</property>
 	  </child>
 
 	  <child>
+	    <widget class="GtkVBox" id="eap_ttls_inner_auth_vbox">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<placeholder/>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">4</property>
+	      <property name="bottom_attach">5</property>
+	      <property name="x_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
 	    <widget class="GtkLabel" id="eap_ttls_inner_auth_label">
 	      <property name="visible">True</property>
 	      <property name="label" translatable="yes">Inner Authentication:</property>
@@ -2078,8 +2119,8 @@ Shared Key</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</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">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
@@ -2095,29 +2136,32 @@ Shared Key</property>
 	    <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">fill</property>
 	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkVBox" id="eap_ttls_inner_auth_vbox">
+	    <widget class="GtkCheckButton" id="eap_ttls_ca_cert_system">
 	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
-
-	      <child>
-		<placeholder/>
-	      </child>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Use System CA Certificates</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
 	    </widget>
 	    <packing>
-	      <property name="left_attach">0</property>
+	      <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">2</property>
+	      <property name="bottom_attach">3</property>
 	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 	</widget>
@@ -2771,7 +2815,7 @@ Shared Key</property>
       <child>
 	<widget class="GtkTable" id="table13">
 	  <property name="visible">True</property>
-	  <property name="n_rows">5</property>
+	  <property name="n_rows">6</property>
 	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
 	  <property name="row_spacing">6</property>
@@ -2886,8 +2930,8 @@ Shared Key</property>
 	    <packing>
 	      <property name="left_attach">0</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="x_options">fill</property>
 	    </packing>
 	  </child>
@@ -2913,31 +2957,14 @@ Shared Key</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</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">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkComboBox" id="eap_peap_inner_auth_combo">
-	      <property name="visible">True</property>
-	      <property name="items" translatable="yes"> </property>
-	      <property name="add_tearoffs">False</property>
-	      <property name="focus_on_click">True</property>
-	    </widget>
-	    <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">fill</property>
-	      <property name="y_options">fill</property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkLabel" id="eap_peap_version_label">
 	      <property name="visible">True</property>
 	      <property name="label" translatable="yes">PEAP Version:</property>
@@ -2958,14 +2985,31 @@ Shared Key</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</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">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
+	    <widget class="GtkComboBox" id="eap_peap_inner_auth_combo">
+	      <property name="visible">True</property>
+	      <property name="items" translatable="yes"> </property>
+	      <property name="add_tearoffs">False</property>
+	      <property name="focus_on_click">True</property>
+	    </widget>
+	    <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="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
 	    <widget class="GtkComboBox" id="eap_peap_version_combo">
 	      <property name="visible">True</property>
 	      <property name="items" translatable="yes">Automatic
@@ -2977,6 +3021,28 @@ Version 1</property>
 	    <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">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="eap_peap_ca_cert_system">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Use System CA Certificates</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <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">fill</property>
diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c
index 8d82fee..d2e849e 100644
--- a/src/wireless-security/eap-method-peap.c
+++ b/src/wireless-security/eap-method-peap.c
@@ -141,6 +141,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 		g_object_set_data (G_OBJECT (connection), NMA_PATH_CA_CERT_TAG, NULL);
 	}
 
+	widget = glade_xml_get_widget (parent->xml, "eap_peap_ca_cert_system");
+	g_object_set (G_OBJECT (s_8021x), NM_SETTING_802_1X_SYSTEM_CA_CERTS,
+		      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
+		      NULL);
+
 	if (eap_method_get_ignore_ca_cert (parent))
 		g_object_set_data (G_OBJECT (connection), NMA_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (TRUE));
 	else
@@ -169,6 +174,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 	eap_method_fill_connection (eap, connection);
 	eap_method_unref (eap);
 }
+
 static void
 inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 {
@@ -255,6 +261,12 @@ inner_auth_combo_init (EAPMethodPEAP *method,
 	return combo;
 }
 
+static void
+ca_cert_system_toggled (GtkToggleButton *togglebutton, gpointer user_data)
+{
+  gtk_widget_set_sensitive (GTK_WIDGET (user_data), !gtk_toggle_button_get_active (togglebutton));
+}
+
 EAPMethodPEAP *
 eap_method_peap_new (const char *glade_file,
                      WirelessSecurity *parent,
@@ -262,6 +274,7 @@ eap_method_peap_new (const char *glade_file,
 {
 	EAPMethodPEAP *method;
 	GtkWidget *widget;
+	GtkWidget *ca_button;
 	GladeXML *xml;
 	GtkFileFilter *filter;
 	NMSetting8021x *s_8021x = NULL;
@@ -305,6 +318,7 @@ eap_method_peap_new (const char *glade_file,
 		s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
 
 	widget = glade_xml_get_widget (xml, "eap_peap_ca_cert_button");
+	ca_button = widget;
 	g_assert (widget);
 	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
 	gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
@@ -320,6 +334,18 @@ eap_method_peap_new (const char *glade_file,
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
 	}
 
+	widget = glade_xml_get_widget (xml, "eap_peap_ca_cert_system");
+	g_signal_connect (widget, "toggled",
+			  G_CALLBACK (ca_cert_system_toggled),
+			  ca_button);
+	if (s_8021x) {
+	  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), nm_setting_802_1x_get_system_ca_certs (s_8021x));
+	  gtk_widget_set_sensitive (GTK_WIDGET (ca_button), !nm_setting_802_1x_get_system_ca_certs (s_8021x));
+	}
+	g_signal_connect (G_OBJECT (widget), "toggled",
+			  (GCallback) wireless_security_changed_cb,
+			  parent);
+
 	widget = inner_auth_combo_init (method, glade_file, connection);
 	inner_auth_combo_changed_cb (widget, (gpointer) method);
 
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index 7d78d07..7f65401 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -220,6 +220,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 		                   NULL);
 	}
 
+	widget = glade_xml_get_widget (parent->xml, "eap_tls_ca_cert_system");
+	g_object_set (G_OBJECT (s_8021x), NM_SETTING_802_1X_SYSTEM_CA_CERTS,
+			    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
+			    NULL);
+
 	if (eap_method_get_ignore_ca_cert (parent)) {
 		g_object_set_data (G_OBJECT (connection),
 		                   method->phase2 ? NMA_PHASE2_CA_CERT_IGNORE_TAG : NMA_CA_CERT_IGNORE_TAG,
@@ -334,6 +339,12 @@ setup_filepicker (GladeXML *xml,
 		g_signal_connect (G_OBJECT (widget), "notify::filter", (GCallback) reset_filter, filter);
 }
 
+static void
+ca_cert_system_toggled (GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gtk_widget_set_sensitive (GTK_WIDGET (user_data), !gtk_toggle_button_get_active (togglebutton));
+}
+
 EAPMethodTLS *
 eap_method_tls_new (const char *glade_file,
                     WirelessSecurity *parent,
@@ -342,6 +353,7 @@ eap_method_tls_new (const char *glade_file,
 {
 	EAPMethodTLS *method;
 	GtkWidget *widget;
+	GtkWidget *ca_button;
 	GladeXML *xml;
 	NMSetting8021x *s_8021x = NULL;
 
@@ -423,6 +435,19 @@ eap_method_tls_new (const char *glade_file,
 	                  parent, method, connection,
 	                  phase2 ? NMA_PATH_PHASE2_PRIVATE_KEY_TAG : NMA_PATH_PRIVATE_KEY_TAG);
 
+	ca_button = glade_xml_get_widget (xml, "eap_tls_ca_cert_button");
+	widget = glade_xml_get_widget (xml, "eap_tls_ca_cert_system");
+	g_signal_connect (widget, "toggled",
+				   G_CALLBACK (ca_cert_system_toggled),
+				   ca_button);
+	if (s_8021x) {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), nm_setting_802_1x_get_system_ca_certs (s_8021x));
+		gtk_widget_set_sensitive (GTK_WIDGET (ca_button), !nm_setting_802_1x_get_system_ca_certs (s_8021x));
+	}
+	g_signal_connect (G_OBJECT (widget), "toggled",
+				   (GCallback) wireless_security_changed_cb,
+				   parent);
+
 	widget = glade_xml_get_widget (xml, "show_checkbutton");
 	g_assert (widget);
 	g_signal_connect (G_OBJECT (widget), "toggled",
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index b455fc8..28ef723 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -136,6 +136,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 		g_object_set_data (G_OBJECT (connection), NMA_PATH_CA_CERT_TAG, NULL);
 	}
 
+	widget = glade_xml_get_widget (parent->xml, "eap_ttls_ca_cert_system");
+	g_object_set (G_OBJECT (s_8021x), NM_SETTING_802_1X_SYSTEM_CA_CERTS,
+		      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
+		      NULL);
+
 	if (eap_method_get_ignore_ca_cert (parent))
 		g_object_set_data (G_OBJECT (connection), NMA_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (TRUE));
 	else
@@ -287,6 +292,12 @@ inner_auth_combo_init (EAPMethodTTLS *method,
 	return combo;
 }
 
+static void
+ca_cert_system_toggled (GtkToggleButton *togglebutton, gpointer user_data)
+{
+  gtk_widget_set_sensitive (GTK_WIDGET (user_data), !gtk_toggle_button_get_active (togglebutton));
+}
+
 EAPMethodTTLS *
 eap_method_ttls_new (const char *glade_file,
                      WirelessSecurity *parent,
@@ -294,6 +305,7 @@ eap_method_ttls_new (const char *glade_file,
 {
 	EAPMethodTTLS *method;
 	GtkWidget *widget;
+	GtkWidget *ca_button;
 	GladeXML *xml;
 	GtkFileFilter *filter;
 	NMSetting8021x *s_8021x = NULL;
@@ -337,6 +349,7 @@ eap_method_ttls_new (const char *glade_file,
 		s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
 
 	widget = glade_xml_get_widget (xml, "eap_ttls_ca_cert_button");
+	ca_button = widget;
 	g_assert (widget);
 	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
 	gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
@@ -352,6 +365,18 @@ eap_method_ttls_new (const char *glade_file,
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
 	}
 
+	widget = glade_xml_get_widget (xml, "eap_ttls_ca_cert_system");
+	g_signal_connect (widget, "toggled",
+			  G_CALLBACK (ca_cert_system_toggled),
+			  ca_button);
+	if (s_8021x) {
+	  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), nm_setting_802_1x_get_system_ca_certs (s_8021x));
+	  gtk_widget_set_sensitive (GTK_WIDGET (ca_button), !nm_setting_802_1x_get_system_ca_certs (s_8021x));
+	}
+	g_signal_connect (G_OBJECT (widget), "toggled",
+			  (GCallback) wireless_security_changed_cb,
+			  parent);
+
 	widget = glade_xml_get_widget (xml, "eap_ttls_anon_identity_entry");
 	if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
 		gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_anonymous_identity (s_8021x));
-- 
1.6.0.2

openSUSE Build Service is sponsored by