[network-manager-openvpn] properties/ui: add "Show password" button for HTTP proxy password



commit cac9d481cd112aa6378cfc7e5bd6edcf5e1a7995
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Fri Feb 4 13:47:29 2011 +0100

    properties/ui: add "Show password" button for HTTP proxy password

 properties/auth-helpers.c       |   22 ++++++++++++++++++++--
 properties/nm-openvpn-dialog.ui |   17 +++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 503e432..fdaa028 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -2,6 +2,7 @@
 /***************************************************************************
  *
  * Copyright (C) 2008 - 2010 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2008 - 2011 Red Hat, Inc.
  * Copyright (C) 2008 Tambet Ingo, <tambet gmail com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -1153,11 +1154,11 @@ proxy_type_changed (GtkComboBox *combo, gpointer user_data)
 		"proxy_desc_label", "proxy_server_label", "proxy_server_entry",
 		"proxy_port_label", "proxy_port_spinbutton", "proxy_retry_checkbutton",
 		"proxy_username_label", "proxy_password_label", "proxy_username_entry",
-		"proxy_password_entry", NULL
+		"proxy_password_entry", "show_proxy_password", NULL
 	};
 	const char *user_pass_widgets[] = {
 		"proxy_username_label", "proxy_password_label", "proxy_username_entry",
-		"proxy_password_entry", NULL
+		"proxy_password_entry", "show_proxy_password", NULL
 	};
 
 	active = gtk_combo_box_get_active (combo);
@@ -1186,6 +1187,20 @@ proxy_type_changed (GtkComboBox *combo, gpointer user_data)
 	gtk_widget_set_sensitive (widget, !sensitive);
 }
 
+static void
+show_proxy_password_toggled_cb (GtkCheckButton *button, gpointer user_data)
+{
+	GtkBuilder *builder = (GtkBuilder *) user_data;
+	GtkWidget *widget;
+	gboolean visible;
+
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "proxy_password_entry"));
+	g_assert (widget);
+
+	visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+	gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
+}
+
 #define TA_DIR_COL_NAME 0
 #define TA_DIR_COL_NUM 1
 
@@ -1311,6 +1326,9 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
 	proxy_type_changed (GTK_COMBO_BOX (combo), builder);
 	g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (proxy_type_changed), builder);
 
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "show_proxy_password"));
+	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (show_proxy_password_toggled_cb), builder);
+
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "port_checkbutton"));
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (port_toggled_cb), builder);
 
diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
index 739f4f7..27b37b7 100644
--- a/properties/nm-openvpn-dialog.ui
+++ b/properties/nm-openvpn-dialog.ui
@@ -1686,6 +1686,23 @@ Example: /CN=myvpn.company.com&lt;/i&gt;</property>
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkCheckButton" id="show_proxy_password">
+                        <property name="label" translatable="yes">Show password</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="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options"/>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
                       <placeholder/>
                     </child>
                     <child>



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