aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-16 01:40:28 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-16 01:40:28 +0800
commitc442d00f9325bd84f28ed5965a7b2fc512b9b3b7 (patch)
tree8547badee627e43257590f52e454afa7d766658b /addressbook/gui
parent781d9aad4d9083f4ae380901f7b52e8fd82bf2a4 (diff)
downloadgsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar.gz
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar.bz2
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar.lz
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar.xz
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.tar.zst
gsoc2013-evolution-c442d00f9325bd84f28ed5965a7b2fc512b9b3b7.zip
Bug #449520 - Adding a contact to a contact list fails when using a comma
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 73b5dcd7cf..79fef05f45 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -603,10 +603,35 @@ contact_list_editor_email_entry_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event)
{
EContactListEditor *editor;
+ gboolean can_comma = FALSE;
editor = contact_list_editor_extract (widget);
- if (event->keyval == GDK_comma || event->keyval == GDK_Return) {
+ if (event->keyval == GDK_comma) {
+ GtkEntry *entry;
+ gint cpos = -1;
+
+ entry = GTK_ENTRY (WIDGET (EMAIL_ENTRY));
+ g_object_get (G_OBJECT (entry), "cursor-position", &cpos, NULL);
+
+ /* not the first letter */
+ if (cpos > 0) {
+ const gchar *text;
+ gint quotes = 0, i;
+
+ text = gtk_entry_get_text (entry);
+
+ for (i = 0; text && text [i] && i < cpos; i++) {
+ if (text [i] == '\"')
+ quotes++;
+ }
+
+ /* even count of quotes */
+ can_comma = (quotes & 1) == 0;
+ }
+ }
+
+ if (can_comma || event->keyval == GDK_Return) {
g_signal_emit_by_name (widget, "activate", 0);
contact_list_editor_add_email (editor);