changeset 12446:17d22e9367a8

[gaim-migrate @ 14753] " Luke asked me to write this patch, to disable the password entry box unless the "save password" checkbox is active (this prevents gaim from re-asking for a password immediately after typing it into the new account box). This patch is indented wrong, but I didn't want to screw my editor up just to make tabs for 5 lines. It also adds a callback function, which is the "bulk" of the patch - I assume that this callback function Just Goes Away when the toggle button is no longer around, but I don't know this for sure... I think that's all of the disclaimers I have for this code. It Worked For Me. :-)" -- Joshua T. Blanton committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 09 Dec 2005 22:07:44 +0000
parents de7f34c005ce
children e683e7514160
files src/gtkaccount.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Fri Dec 09 15:01:55 2005 +0000
+++ b/src/gtkaccount.c	Fri Dec 09 22:07:44 2005 +0000
@@ -708,6 +708,18 @@
 #endif
 }
 
+/* This function is required to toggle the usability of the password entry
+ * box - it is set as a callback for the "Save Password" checkbox */
+void toggle_password_visibility(GtkWidget *button, gpointer pwd_entry)
+{
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
+    gtk_widget_set_sensitive(pwd_entry, TRUE);
+  } else {
+    gtk_widget_set_sensitive(pwd_entry, FALSE);
+  }
+  gtk_widget_show(pwd_entry);
+}
+
 static void
 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
 {
@@ -818,6 +830,7 @@
 	dialog->password_entry = gtk_entry_new();
 	gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE);
 	gtk_entry_set_invisible_char(GTK_ENTRY(dialog->password_entry), GAIM_INVISIBLE_CHAR);
+  gtk_widget_set_sensitive(dialog->password_entry, FALSE);
 	dialog->password_box = add_pref_box(dialog, vbox, _("Password:"),
 										  dialog->password_entry);
 
@@ -830,6 +843,9 @@
 		gtk_check_button_new_with_label(_("Remember password"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
 								 FALSE);
+  g_signal_connect(G_OBJECT(dialog->remember_pass_check), "toggled",
+                 G_CALLBACK(toggle_password_visibility),
+                 (gpointer)dialog->password_entry);
 	gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check,
 					   FALSE, FALSE, 0);
 	gtk_widget_show(dialog->remember_pass_check);