[maemo-commits] [maemo-commits] r13010 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 3 13:32:07 EEST 2007
Author: xan
Date: 2007-08-03 13:32:05 +0300 (Fri, 03 Aug 2007)
New Revision: 13010

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkentry.c
Log:
2007-08-03  Xan Lopez  <xan.lopez at nokia.com>

	* gtk/gtkentry.c (gtk_entry_filter_text): do not validate the whole string
	unconditionally. Use the new_text_lenght parameter from gtk_entry_real_insert_text
	as the limit for g_utf8_validate. Fixes: NB#64785


Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2007-08-02 19:28:40 UTC (rev 13009)
+++ projects/haf/trunk/gtk+/ChangeLog	2007-08-03 10:32:05 UTC (rev 13010)
@@ -1,3 +1,9 @@
+2007-08-03  Xan Lopez  <xan.lopez at nokia.com>
+
+	* gtk/gtkentry.c (gtk_entry_filter_text): do not validate the whole string
+	unconditionally. Use the new_text_lenght parameter from gtk_entry_real_insert_text
+	as the limit for g_utf8_validate. Fixes: NB#64785
+
 2007-08-02  Xan Lopez  <xan.lopez at nokia.com>
 
 	* gtk/gtkmenu.c:

Modified: projects/haf/trunk/gtk+/gtk/gtkentry.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkentry.c	2007-08-02 19:28:40 UTC (rev 13009)
+++ projects/haf/trunk/gtk+/gtk/gtkentry.c	2007-08-03 10:32:05 UTC (rev 13010)
@@ -2582,7 +2582,8 @@
 static gboolean
 gtk_entry_filter_text (GtkEntry    *entry,
                        const gchar *str,
-                       gint         length)
+                       gint         length,
+                       gint         nbytes)
 {
   HildonGtkInputMode input_mode;
 
@@ -2591,7 +2592,7 @@
   if (!length || !str)
     return FALSE;
 
-  if (!g_utf8_validate (str, -1, NULL))
+  if (!g_utf8_validate (str, nbytes, NULL))
     return FALSE;
 
   input_mode = hildon_gtk_entry_get_input_mode (entry);
@@ -2630,7 +2631,7 @@
   n_chars = g_utf8_strlen (new_text, new_text_length);
 
 #ifdef MAEMO_CHANGES
-  if (!gtk_entry_filter_text (entry, new_text, n_chars))
+  if (!gtk_entry_filter_text (entry, new_text, n_chars, new_text_length))
     {
       g_signal_emit (entry, signals[INVALID_INPUT], 0,
                      GTK_INVALID_INPUT_MODE_RESTRICTION);


More information about the maemo-commits mailing list