evolution-data-server r8680 - trunk/libedataserverui



Author: mcrha
Date: Fri Apr 25 14:54:25 2008
New Revision: 8680
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8680&view=rev

Log:
2008-04-25  Milan Crha  <mcrha redhat com>

	** Fix for bug #301980

	* e-passwords.c: (update_capslock_state), (ep_ask_password):
	Warn user when Caps Lock is on.



Modified:
   trunk/libedataserverui/ChangeLog
   trunk/libedataserverui/e-passwords.c

Modified: trunk/libedataserverui/e-passwords.c
==============================================================================
--- trunk/libedataserverui/e-passwords.c	(original)
+++ trunk/libedataserverui/e-passwords.c	Fri Apr 25 14:54:25 2008
@@ -869,10 +869,25 @@
 	ep_idle_dispatch (NULL);
 }
 
+static gboolean
+update_capslock_state (gpointer widget, gpointer event, GtkWidget *label)
+{
+	GdkModifierType mask = 0;
+
+	gdk_window_get_pointer (NULL, NULL, NULL, &mask);
+
+	if (mask & GDK_LOCK_MASK)
+		gtk_widget_show (label);
+	else
+		gtk_widget_hide (label);
+
+	return FALSE;
+}
+
 static void
 ep_ask_password (EPassMsg *msg)
 {
-	GtkWidget *widget;
+	GtkWidget *widget, *capslock_box;
 	GtkWidget *container;
 	gint type = msg->flags & E_PASSWORDS_REMEMBER_MASK;
 	guint noreply = msg->noreply;
@@ -958,6 +973,19 @@
 		GTK_TABLE (container), widget,
 		1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 
+	capslock_box = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (capslock_box), gtk_label_new (""), FALSE, FALSE, 0);
+	widget = gtk_label_new (_("You have the Caps Lock key on."));
+	gtk_box_pack_start (GTK_BOX (capslock_box), widget, TRUE, TRUE, 0);
+	gtk_widget_show_all (capslock_box);
+	gtk_table_attach (
+		GTK_TABLE (container), capslock_box,
+		1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+	g_signal_connect (password_dialog, "key-release-event", G_CALLBACK (update_capslock_state), widget);
+	g_signal_connect (password_dialog, "focus-in-event", G_CALLBACK (update_capslock_state), widget);
+	update_capslock_state (NULL, NULL, widget);
+
 	/* static password, shouldn't be remembered between sessions,
 	   but will be remembered within the session beyond our control */
 	if (type != E_PASSWORDS_REMEMBER_NEVER) {
@@ -984,7 +1012,7 @@
 
 		gtk_table_attach (
 			GTK_TABLE (container), widget,
-			1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+			1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 	}
 
 	msg->noreply = noreply;



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