NetworkManager r4092 - in trunk/vpn-daemons/openvpn: . properties



Author: tambeti
Date: Wed Sep 24 08:00:05 2008
New Revision: 4092
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4092&view=rev

Log:
2008-09-24  Tambet Ingo  <tambet gmail com>

	* properties/nm-openvpn-dialog.glade: Add "show passwords" checkbox.

	* properties/nm-openvpn.c (auth_combo_changed_cb): Change the
	sensitivity of "show passwords" checkbox depending on whether the
	active page has any password entries.

	* properties/auth-helpers.c (fill_password): Add a signal handler for
	"show passwords" checkbox to change the password entry's visibility.

Modified:
   trunk/vpn-daemons/openvpn/ChangeLog
   trunk/vpn-daemons/openvpn/properties/auth-helpers.c
   trunk/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade
   trunk/vpn-daemons/openvpn/properties/nm-openvpn.c

Modified: trunk/vpn-daemons/openvpn/properties/auth-helpers.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/auth-helpers.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/auth-helpers.c	Wed Sep 24 08:00:05 2008
@@ -41,6 +41,12 @@
 #include "src/nm-openvpn-service.h"
 #include "common-gnome/keyring-helpers.h"
 
+static void
+show_password (GtkToggleButton *togglebutton, GtkEntry *password_entry)
+{
+	gtk_entry_set_visibility (password_entry, gtk_toggle_button_get_active (togglebutton));
+}
+
 static GtkWidget *
 fill_password (GladeXML *xml,
 			   const char *widget_name,
@@ -48,11 +54,15 @@
 			   gboolean cert_password)
 {
 	GtkWidget *widget;
+	GtkWidget *show_passwords;
 	char *password;
 
 	widget = glade_xml_get_widget (xml, widget_name);
 	g_assert (widget);
 
+	show_passwords = glade_xml_get_widget (xml, "show_passwords");
+	g_signal_connect (show_passwords, "toggled", G_CALLBACK (show_password), widget);
+
 	if (!connection)
 		return widget;
 

Modified: trunk/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade	(original)
+++ trunk/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade	Wed Sep 24 08:00:05 2008
@@ -202,7 +202,7 @@
 	      <child>
 		<widget class="GtkTable" id="table3">
 		  <property name="visible">True</property>
-		  <property name="n_rows">2</property>
+		  <property name="n_rows">3</property>
 		  <property name="n_columns">2</property>
 		  <property name="homogeneous">False</property>
 		  <property name="row_spacing">6</property>
@@ -1439,6 +1439,28 @@
 		      <property name="bottom_attach">2</property>
 		    </packing>
 		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="show_passwords">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Show passwords</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="right_attach">2</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
 		</widget>
 	      </child>
 	    </widget>

Modified: trunk/vpn-daemons/openvpn/properties/nm-openvpn.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	Wed Sep 24 08:00:05 2008
@@ -171,18 +171,25 @@
 	OpenvpnPluginUiWidget *self = OPENVPN_PLUGIN_UI_WIDGET (user_data);
 	OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
 	GtkWidget *auth_notebook;
+	GtkWidget *show_passwords;
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	gint new_page = 0;
 
 	auth_notebook = glade_xml_get_widget (priv->xml, "auth_notebook");
 	g_assert (auth_notebook);
+	show_passwords = glade_xml_get_widget (priv->xml, "show_passwords");
+	g_assert (auth_notebook);
 
 	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
 	g_assert (model);
 	g_assert (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter));
 
 	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);



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