]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gpe-contacts/gpe-contacts-0.32/filtered-paste.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gpe-contacts / gpe-contacts-0.32 / filtered-paste.patch
1 Index: editing.c
2 ===================================================================
3 RCS file: /cvs/gpe/base/gpe-contacts/editing.c,v
4 retrieving revision 1.59
5 diff -u -r1.59 editing.c
6 --- editing.c   20 Oct 2004 14:00:36 -0000      1.59
7 +++ editing.c   24 Oct 2004 22:32:43 -0000
8 @@ -46,17 +46,23 @@
9  void on_name_clicked (GtkButton *button, gpointer user_data);
10  
11  
12 -
13  /* this is the filter for phone number edits */
14 -static gboolean
15 -phone_key_press_event (GtkWidget *widget, GdkEventKey *k, gpointer p)
16 +void
17 +on_phone_insert_text(GtkEditable *editable, gchar *new_text,
18 +                     gint new_text_length, gint *position,
19 +                     gpointer user_data)
20  {
21 -  if (!strstr(" +0123456789-/()", k->string) 
22 -      && !(k->state & GDK_CONTROL_MASK))
23 -    {
24 -      return TRUE;
25 -    }
26 -  return FALSE;
27 +  int i;
28 +  gboolean isok = TRUE;
29 +  
30 +  for (i = 0; i < new_text_length; i++)
31 +    if (!strchr(" +0123456789-/()", new_text[i]))
32 +      {
33 +        isok = FALSE;
34 +        break;
35 +      }
36 +  if (!isok)
37 +    gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert-text");
38  }
39  
40  static void
41 @@ -91,8 +97,8 @@
42                || strstr(e->tag,".MOBILE") 
43                || strstr(e->tag,".FAX"))
44              {
45 -               g_signal_connect (G_OBJECT (w), "key_press_event", 
46 -                        G_CALLBACK (phone_key_press_event), NULL);
47 +              g_signal_connect (G_OBJECT (w), "insert-text", 
48 +                        G_CALLBACK (on_phone_insert_text), NULL);
49              }
50            if (strcasecmp(e->tag, "NAME")) /* the name field on a button */
51              {