[evolution] Bug #449520 - Adding a contact to a contact list fails when using a comma
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution] Bug #449520 - Adding a contact to a contact list fails when using a comma
- Date: Thu, 15 Oct 2009 17:41:21 +0000 (UTC)
commit c442d00f9325bd84f28ed5965a7b2fc512b9b3b7
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 15 19:40:28 2009 +0200
Bug #449520 - Adding a contact to a contact list fails when using a comma
.../contact-list-editor/e-contact-list-editor.c | 27 +++++++++++++++++++-
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 73b5dcd..79fef05 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]