[Patch][ReSend] network-manager-applet OTP UI bits



Hi,
Resending this patch again
Dan, Can you please look at it :)

diff --git a/src/applet.glade b/src/applet.glade
index 2bde5f4..ac45e28 100644
--- a/src/applet.glade
+++ b/src/applet.glade
@@ -297,6 +297,7 @@
 		      <property name="max_length">0</property>
 		      <property name="text" translatable="yes"></property>
 		      <property name="has_frame">True</property>
+		      <property name="invisible_char">•</property>
 		      <property name="activates_default">True</property>
 		    </widget>
 		    <packing>
@@ -697,6 +698,7 @@
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">True</property>
 	    </widget>
 	    <packing>
@@ -987,6 +989,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -1029,6 +1032,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -1144,6 +1148,7 @@ Shared Key</property>
 	      <property name="max_length">64</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">True</property>
 	    </widget>
 	    <packing>
@@ -1484,6 +1489,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -1660,6 +1666,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -1846,6 +1853,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -1888,6 +1896,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -2003,6 +2012,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -2189,7 +2199,7 @@ Shared Key</property>
 	<widget class="GtkTable" id="table11">
 	  <property name="visible">True</property>
 	  <property name="n_rows">3</property>
-	  <property name="n_columns">2</property>
+	  <property name="n_columns">3</property>
 	  <property name="homogeneous">False</property>
 	  <property name="row_spacing">6</property>
 	  <property name="column_spacing">12</property>
@@ -2261,6 +2271,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -2303,6 +2314,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
@@ -2313,6 +2325,22 @@ Shared Key</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkComboBox" id="eap_password_state">
+	      <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">2</property>
+	      <property name="right_attach">3</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="tab_expand">False</property>
@@ -2825,6 +2853,7 @@ Shared Key</property>
 	      <property name="max_length">0</property>
 	      <property name="text" translatable="yes"></property>
 	      <property name="has_frame">True</property>
+	      <property name="invisible_char">•</property>
 	      <property name="activates_default">False</property>
 	    </widget>
 	    <packing>
diff --git a/src/gconf-helpers/gconf-helpers.c b/src/gconf-helpers/gconf-helpers.c
index a299ccc..4466f28 100644
--- a/src/gconf-helpers/gconf-helpers.c
+++ b/src/gconf-helpers/gconf-helpers.c
@@ -2553,3 +2553,50 @@ nm_gconf_set_ignore_ca_cert (const char *uuid, gboolean phase2, gboolean ignore)
 	g_object_unref (client);
 }
 
+static char *
+get_always_ask_path (const char *uuid)
+{
+	return g_strdup_printf (APPLET_PREFS_PATH "/8021x-password-always-ask/%s", uuid);
+}
+
+gboolean
+nm_gconf_get_8021x_password_always_ask (const char *uuid)
+{
+	GConfClient *client;
+	char *key = NULL;
+	gboolean ask = FALSE;
+
+	g_return_val_if_fail (uuid != NULL, FALSE);
+
+	client = gconf_client_get_default ();
+
+	key = get_always_ask_path (uuid);
+	ask = gconf_client_get_bool (client, key, NULL);
+	g_free (key);
+
+	g_object_unref (client);
+	return ask;
+}
+
+void
+nm_gconf_set_8021x_password_always_ask (const char *uuid, gboolean ask)
+{
+	GConfClient *client;
+	char *key = NULL;
+
+	g_return_if_fail (uuid != NULL);
+
+	client = gconf_client_get_default ();
+
+	key = get_always_ask_path (uuid);
+	if (ask)
+		gconf_client_set_bool (client, key, TRUE, NULL);
+	else
+		gconf_client_unset (client, key, NULL);
+	g_free (key);
+
+	g_object_unref (client);
+}
+
+
+
diff --git a/src/gconf-helpers/gconf-helpers.h b/src/gconf-helpers/gconf-helpers.h
index 17d1ce8..9ea8de9 100644
--- a/src/gconf-helpers/gconf-helpers.h
+++ b/src/gconf-helpers/gconf-helpers.h
@@ -257,5 +257,8 @@ void pre_keyring_callback (void);
 gboolean nm_gconf_get_ignore_ca_cert (const char *uuid, gboolean phase2);
 void nm_gconf_set_ignore_ca_cert (const char *uuid, gboolean phase2, gboolean ignore);
 
+gboolean nm_gconf_get_8021x_password_always_ask (const char *uuid);
+void nm_gconf_set_8021x_password_always_ask (const char *uuid, gboolean always_ask);
+
 #endif	/* GCONF_HELPERS_H */
 
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 0eea74a..2831caf 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -92,6 +92,9 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 	EAPMethodSimple *method = (EAPMethodSimple *) parent;
 	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
+        int active;
+        gboolean bool;
+        NMSettingConnection *s_con;
 
 	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
 	g_assert (s_8021x);
@@ -127,6 +130,18 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 	widget = glade_xml_get_widget (parent->xml, "eap_simple_password_entry");
 	g_assert (widget);
 	g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (GTK_ENTRY (widget)), NULL);
+
+       // Get value from combo box
+        widget = glade_xml_get_widget (parent->xml, "eap_password_state");
+        g_assert (widget);
+        active = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
+        if (active == 1)
+                bool = TRUE;
+        else
+                bool = FALSE;
+        s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+        nm_gconf_set_8021x_password_always_ask (nm_setting_connection_get_uuid (s_con),bool);
+
 }
 
 static void
@@ -148,6 +163,9 @@ eap_method_simple_new (const char *glade_file,
 	EAPMethodSimple *method;
 	GtkWidget *widget;
 	GladeXML *xml;
+        GtkListStore *store;
+        GtkTreeIter iter;
+        int active;
 
 	g_return_val_if_fail (glade_file != NULL, NULL);
 
@@ -209,6 +227,34 @@ eap_method_simple_new (const char *glade_file,
 	                  (GCallback) show_toggled_cb,
 	                  method);
 
+	/* Patch for storing the password in the keyring*/
+        widget = glade_xml_get_widget (xml, "eap_password_state");
+        g_assert (widget);
+
+        store = gtk_list_store_new (1, G_TYPE_STRING);
+        gtk_list_store_append (store, &iter);
+        gtk_list_store_set (store, &iter, 0, "Saved", -1);
+        gtk_list_store_append (store, &iter);
+        gtk_list_store_set (store, &iter, 0, "Always Ask", -1);
+        gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
+        g_object_unref (store);
+
+        active = 0;
+        if (connection) {
+                NMSettingConnection *s_con;
+
+                s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+                g_assert (s_con);
+
+                if (nm_gconf_get_8021x_password_always_ask (nm_setting_connection_get_uuid (s_con)))
+                        active = 1;
+                else
+                        active = 0;
+        }
+
+        gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active );
+
+
 	return method;
 }
 


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