[evolution] [EContactEditor] Do not store empty values in vCard
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] [EContactEditor] Do not store empty values in vCard
- Date: Thu, 21 Jun 2018 15:15:50 +0000 (UTC)
commit f15cf4ba434c11c98e525c1a74f8d63e1728aa16
Author: Milan Crha <mcrha redhat com>
Date: Thu Jun 21 17:14:05 2018 +0200
[EContactEditor] Do not store empty values in vCard
Simple values like Notes, Nickname, URLs and so on could be stored
in the vCard on Save even when they had been empty, which is not
needed, thus better to skip them and remove attributes instead,
if needed.
src/addressbook/gui/contact-editor/e-contact-editor.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index cbc19b5419..f506bd514d 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2845,7 +2845,7 @@ extract_simple_field (EContactEditor *editor,
if (GTK_IS_ENTRY (widget)) {
const gchar *text = gtk_entry_get_text (GTK_ENTRY (widget));
- e_contact_set (contact, field_id, (gchar *) text);
+ e_contact_set (contact, field_id, (text && *text) ? (gchar *) text : NULL);
} else if (GTK_IS_COMBO_BOX_TEXT (widget)) {
gchar *text = NULL;
@@ -2859,7 +2859,7 @@ extract_simple_field (EContactEditor *editor,
if (!text)
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget));
- e_contact_set (contact, field_id, text);
+ e_contact_set (contact, field_id, (text && *text) ? text : NULL);
g_free (text);
} else if (GTK_IS_COMBO_BOX (widget)) {
@@ -2885,7 +2885,7 @@ extract_simple_field (EContactEditor *editor,
-1);
}
- e_contact_set (contact, field_id, text);
+ e_contact_set (contact, field_id, (text && *text) ? text : NULL);
g_free (text);
@@ -2897,12 +2897,12 @@ extract_simple_field (EContactEditor *editor,
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_get_end_iter (buffer, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- e_contact_set (contact, field_id, text);
+ e_contact_set (contact, field_id, (text && *text) ? text : NULL);
g_free (text);
} else if (E_IS_URL_ENTRY (widget)) {
const gchar *text = gtk_entry_get_text (GTK_ENTRY (widget));
- e_contact_set (contact, field_id, (gchar *) text);
+ e_contact_set (contact, field_id, (text && *text) ? (gchar *) text : NULL);
} else if (E_IS_DATE_EDIT (widget)) {
EContactDate date;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]