? depcomp
? gnome-keyring-1-uninstalled.pc
? install-sh
? missing
? mkinstalldirs
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-keyring/ChangeLog,v
retrieving revision 1.119
diff -u -3 -p -r1.119 ChangeLog
--- ChangeLog	15 Jan 2005 03:29:38 -0000	1.119
+++ ChangeLog	6 Feb 2005 22:57:47 -0000
@@ -1,3 +1,7 @@
+2005-02-06  Jorge Bernal	<koke@amedias.org>
+
+	* gnome-keyring-ask.c: Added a strength password meter on creation dialogs.
+
 2005-01-14  Pawan Chitrakar  <pawan@nplinux.org>
 
 	* configure.in: Added ne "Nepali" in ALL_LINGUAS
Index: INSTALL
===================================================================
RCS file: /cvs/gnome/gnome-keyring/INSTALL,v
retrieving revision 1.2
diff -u -3 -p -r1.2 INSTALL
--- INSTALL	26 Nov 2004 16:46:00 -0000	1.2
+++ INSTALL	6 Feb 2005 22:57:47 -0000
@@ -1,4 +1,4 @@
-Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
 Foundation, Inc.
 
    This file is free documentation; the Free Software Foundation gives
Index: gnome-keyring-ask.c
===================================================================
RCS file: /cvs/gnome/gnome-keyring/gnome-keyring-ask.c,v
retrieving revision 1.9
diff -u -3 -p -r1.9 gnome-keyring-ask.c
--- gnome-keyring-ask.c	14 Jan 2004 23:48:56 -0000	1.9
+++ gnome-keyring-ask.c	6 Feb 2005 22:57:48 -0000
@@ -67,11 +67,74 @@ enum {
 	APPLICATION_NAME_UNKNOWN,
 };
 
+static void
+on_password_changed                    (GtkEditable     *editable,
+                                        gpointer         user_data)
+{
+	const char *password;
+	int length;
+	int i;
+	int upper, lower, digit, misc;
+	gdouble pwstrength;
+
+	password = gtk_entry_get_text (GTK_ENTRY (editable));
+
+	/*
+	 * This code is based on the Master Password dialog in Firefox
+	 * (pref-masterpass.js)
+	 * Original code triple-licensed under the MPL, GPL, and LGPL
+	 * so is license-compatible with this file
+	 */
+
+	length = strlen (password);
+	upper = 0;
+	lower = 0;
+	digit = 0;
+	misc = 0;
+
+	for ( i = 0; i < length ; i++) {
+		if (g_ascii_isdigit (password[i])) {
+			digit++;
+		} else if (g_ascii_islower (password[i])) {
+			lower++;
+		} else if (g_ascii_isupper (password[i])) {
+			upper++;
+		} else {
+			misc++;
+		}
+	}
+
+	if (length > 5)
+		length = 5;
+	
+	if (digit > 3)
+		digit = 3;
+	
+	if (upper > 3)
+		upper = 3;
+	
+	if (misc > 3)
+		misc = 3;
+	
+	pwstrength=((length*0.1)-0.2) + (digit*0.1) + (misc*0.15) + (upper*0.1);
+
+	if ( pwstrength < 0.0 ) {
+		pwstrength = 0.0;
+	}
+
+	if ( pwstrength > 1.0 ) {
+		pwstrength = 1.0;
+	}
+
+	gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (user_data), pwstrength);
+}
+
 static gint
 run_dialog (const char *title,
 	    const char *primary,
 	    const char *secondary,
 	    gboolean include_password,
+	    gboolean show_strength_bar,
 	    char **password_out,
 	    guint default_response,
 	    const gchar *first_button_text,
@@ -88,6 +151,8 @@ run_dialog (const char *title,
 	GtkWidget *hbox;
 	GtkWidget *vbox;
 	GtkWidget *image;
+	GtkWidget *strength_bar;
+	GtkWidget *strength_bar_text;
 	const char *password;
 
 	dialog = gtk_dialog_new_with_buttons (title , NULL, 0, NULL);
@@ -156,6 +221,26 @@ run_dialog (const char *title,
 		gtk_box_pack_start (GTK_BOX (vbox),
 				    entry,
 				    FALSE, FALSE, 0);
+
+		if (show_strength_bar) {
+			strength_bar_text = gtk_label_new (_("<span weight=\"bold\">Strength password meter:</span>"));
+			gtk_label_set_use_markup (GTK_LABEL (strength_bar_text), TRUE);
+			gtk_misc_set_alignment (GTK_MISC (strength_bar_text), 0.0, 0.5);
+			gtk_label_set_justify (GTK_LABEL (strength_bar_text),
+					GTK_JUSTIFY_LEFT);
+			gtk_box_pack_start (GTK_BOX (vbox),
+					strength_bar_text,
+					FALSE, FALSE, 0);
+			
+			strength_bar = gtk_progress_bar_new ();
+			g_signal_connect ((gpointer) entry, "changed",
+					G_CALLBACK (on_password_changed),
+					strength_bar);
+
+			gtk_box_pack_start (GTK_BOX (vbox),
+					strength_bar,
+					FALSE, FALSE, 0);
+		}
 	}
 
  retry:
@@ -289,7 +374,7 @@ ask_for_keyring_password (void)
 	response = run_dialog (_("Unlock Keyring"),
 			       primary,
 			       message,
-			       TRUE, &password,
+			       TRUE, FALSE, &password,
 			       GTK_RESPONSE_OK,
 			       _("_Deny"), GTK_RESPONSE_CANCEL,
 			       GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -369,7 +454,7 @@ ask_for_new_keyring_password (void)
 	response = run_dialog (_("New Keyring Password"),
 			       _("Choose password for new keyring"),
 			       message,
-			       TRUE, &password,
+			       TRUE, TRUE, &password,
 			       GTK_RESPONSE_OK,
 			       _("_Deny"), GTK_RESPONSE_CANCEL,
 			       GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -416,7 +501,7 @@ ask_for_default_keyring (void)
 	response = run_dialog (_("Create Default Keyring"),
 			       _("Choose password for default keyring"),
 			       message,
-			       TRUE, &password,
+			       TRUE, TRUE, &password,
 			       GTK_RESPONSE_OK,
 			       _("_Deny"), GTK_RESPONSE_CANCEL,
 			       GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -500,7 +585,7 @@ ask_for_item_read_write_acccess (void)
 
 	response = run_dialog (_("Allow access"),
 			       primary, secondary,
-			       FALSE, NULL,
+			       FALSE, FALSE, NULL,
 			       2,
 			       _("_Deny"), GTK_RESPONSE_CANCEL,
 			       _("Allow _Once"), 1,
