Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Commits
r19451 - in projects/haf/trunk/gtk+: . gtk
 

Index | Next | Previous | View Flat


subversion at stage

Oct 16, 2009, 3:31 AM


Views: 435
Permalink
r19451 - in projects/haf/trunk/gtk+: . gtk

Author: mitch
Date: 2009-10-16 13:31:04 +0300 (Fri, 16 Oct 2009)
New Revision: 19451

Modified:
projects/haf/trunk/gtk+/ChangeLog
projects/haf/trunk/gtk+/gtk/gtkentry.c
Log:
2009-10-16 Michael Natterer <mitch [at] lanedo>

Fixes: NB#136999 - Cannot paste phonenumber to mobile number
field, if number contains space

Apply patch from Christian Dywan:

* gtk/gtkentry.c: when in TELE input mode, don't fail when invalid
characters are pasted, but simply filter them out (so pasting
e.g. "+49 12 / 1234" results in pasting "49121234")



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog 2009-10-16 10:26:36 UTC (rev 19450)
+++ projects/haf/trunk/gtk+/ChangeLog 2009-10-16 10:31:04 UTC (rev 19451)
@@ -1,5 +1,16 @@
2009-10-16 Michael Natterer <mitch [at] lanedo>

+ Fixes: NB#136999 - Cannot paste phonenumber to mobile number
+ field, if number contains space
+
+ Apply patch from Christian Dywan:
+
+ * gtk/gtkentry.c: when in TELE input mode, don't fail when invalid
+ characters are pasted, but simply filter them out (so pasting
+ e.g. "+49 12 / 1234" results in pasting "49121234")
+
+2009-10-16 Michael Natterer <mitch [at] lanedo>
+
Fixed: NB#120908 - Combo box is not disabled when there are no
words stored in the history of Find toolbar


Modified: projects/haf/trunk/gtk+/gtk/gtkentry.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkentry.c 2009-10-16 10:26:36 UTC (rev 19450)
+++ projects/haf/trunk/gtk+/gtk/gtkentry.c 2009-10-16 10:31:04 UTC (rev 19451)
@@ -2916,7 +2916,8 @@
gtk_entry_filter_text (GtkEntry *entry,
const gchar *str,
gint length,
- gint nbytes)
+ gint nbytes,
+ gchar **filtered)
{
HildonGtkInputMode input_mode;

@@ -2929,6 +2930,28 @@
return FALSE;

input_mode = hildon_gtk_entry_get_input_mode (entry);
+
+ if ((input_mode & HILDON_GTK_INPUT_MODE_TELE) != 0)
+ {
+ gboolean valid = TRUE;
+ GString *result = g_string_sized_new (nbytes);
+ while(length)
+ {
+ gunichar chr = g_utf8_get_char (str);
+
+ if (hildon_gtk_input_mode_is_valid_char (input_mode, chr))
+ g_string_append_unichar (result, chr);
+ else
+ valid = FALSE;
+
+ str = g_utf8_next_char (str);
+ length--;
+ }
+
+ *filtered = g_string_free (result, FALSE);
+ return valid;
+ }
+
while(length)
{
gunichar chr = g_utf8_get_char (str);
@@ -2956,6 +2979,9 @@
GtkEntry *entry = GTK_ENTRY (editable);
gint index;
gint n_chars;
+#ifdef MAEMO_CHANGES
+ gchar *filtered = NULL;
+#endif

if (new_text_length < 0)
new_text_length = strlen (new_text);
@@ -2963,11 +2989,20 @@
n_chars = g_utf8_strlen (new_text, new_text_length);

#ifdef MAEMO_CHANGES
- if (!gtk_entry_filter_text (entry, new_text, n_chars, new_text_length))
+ if (!gtk_entry_filter_text (entry, new_text, n_chars, new_text_length, &filtered))
{
- g_signal_emit (entry, signals[INVALID_INPUT], 0,
- GTK_INVALID_INPUT_MODE_RESTRICTION);
- return;
+ if (filtered)
+ {
+ new_text = filtered;
+ new_text_length = strlen (filtered);
+ n_chars = g_utf8_strlen (filtered, new_text_length);
+ }
+ else
+ {
+ g_signal_emit (entry, signals[INVALID_INPUT], 0,
+ GTK_INVALID_INPUT_MODE_RESTRICTION);
+ return;
+ }
}
#endif /* MAEMO_CHANGES */

@@ -3079,6 +3114,10 @@

emit_changed (entry);
g_object_notify (G_OBJECT (editable), "text");
+
+#ifdef MAEMO_CHANGES
+ g_free (filtered);
+#endif
}

static void

_______________________________________________
maemo-commits mailing list
maemo-commits [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-commits

Subject User Time
r19451 - in projects/haf/trunk/gtk+: . gtk subversion at stage Oct 16, 2009, 3:31 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.