diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-08-11 10:22:48 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-08-11 10:22:48 +0800 |
commit | 315563e5cff2a4b7027a607bf9e46b336ac8c6d9 (patch) | |
tree | cfa863957bb8f6870d4a7eb6ca366c449f3382c2 | |
parent | 645b837f4d3fd5f81e78676b87e1f905024bac69 (diff) | |
download | gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.gz gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.zst gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.zip |
Remove single- or double-quotes from names before sticking them into the
2001-08-10 Jon Trowbridge <trow@ximian.com>
* gui/contact-editor/e-contact-quick-add.c (e_contact_quick_add):
Remove single- or double-quotes from names before sticking them
into the addressbook. (Bug #6499)
svn path=/trunk/; revision=11909
-rw-r--r-- | addressbook/ChangeLog | 4 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 22 |
2 files changed, 21 insertions, 5 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 73b70d0642..bbc2612995 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,9 @@ 2001-08-10 Jon Trowbridge <trow@ximian.com> + * gui/contact-editor/e-contact-quick-add.c (e_contact_quick_add): + Remove single- or double-quotes from names before sticking them + into the addressbook. (Bug #6499) + * gui/component/addressbook.c (addressbook_query_changed): Properly handle "Category is" queries by checking the search bar suboption. diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index daed820b6c..a94153720f 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -313,19 +313,32 @@ build_quick_add_dialog (QuickAdd *qa) } void -e_contact_quick_add (const gchar *name, const gchar *email, +e_contact_quick_add (const gchar *in_name, const gchar *email, EContactQuickAddCallback cb, gpointer closure) { QuickAdd *qa; GtkWidget *dialog; + gchar *name; + gint len; /* We need to have *something* to work with. */ - if (name == NULL && email == NULL) { + if (in_name == NULL && email == NULL) { if (cb) cb (NULL, closure); return; } + name = g_strdup (in_name); + + /* Remove extra whitespace and the quotes some mailers put around names. */ + g_strstrip (name); + len = strlen (name); + if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) { + name[0] = ' '; + name[len-1] = ' '; + } + g_strstrip (name); + qa = quick_add_new (); qa->cb = cb; qa->closure = closure; @@ -336,6 +349,8 @@ e_contact_quick_add (const gchar *name, const gchar *email, dialog = build_quick_add_dialog (qa); gtk_widget_show_all (dialog); + + g_free (name); } void @@ -394,9 +409,6 @@ e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, g name = g_strdup (text); - /* Clean up name */ - if (name && *name) - g_strstrip (name); /* Clean up email, remove bracketing <>s */ if (email && *email) { |