aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-10-21 03:58:29 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-10-21 03:58:29 +0800
commit603c0228de30416b3c530a8d1eaeb6fa03dcba55 (patch)
tree670773e02c7c6ec19bc207e60c2de5705e5e5458 /addressbook/backend/ebook
parentf9f86c3ee2ffdda05bcc06c997710e9af8218dbf (diff)
downloadgsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.gz
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.bz2
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.lz
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.xz
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.zst
gsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.zip
Filter out empty destinations. (also Bug #13036)
2001-10-20 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-destination.c (e_destination_importv): Filter out empty destinations. (also Bug #13036) * printing/e-contact-print.c (e_contact_build_style): Use gnome_font_new_closest; if gnome_font_new fails and returns NULL, our spacing gets all messed up. (Bug #10785) * gui/widgets/e-addressbook-view.c (e_addressbook_view_can_print): Allow printing if there are any cards in our view. The selection has nothing to do with it. * backend/ebook/e-destination.c (e_destination_is_empty): Check for strings that contain non-whitespace, rather than just looking for a non-zero first character. (Bug #13036) svn path=/trunk/; revision=13826
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-destination.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 155322fec2..ff674e41a6 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -314,6 +314,17 @@ e_destination_clear (EDestination *dest)
e_destination_thaw (dest);
}
+static gboolean
+nonempty (const gchar *s)
+{
+ while (s) {
+ if (! isspace ((gint) *s))
+ return TRUE;
+ ++s;
+ }
+ return FALSE;
+}
+
gboolean
e_destination_is_empty (const EDestination *dest)
{
@@ -324,10 +335,10 @@ e_destination_is_empty (const EDestination *dest)
return !(p->card != NULL
|| (p->book_uri && *p->book_uri)
|| (p->card_uid && *p->card_uid)
- || (p->raw && *p->raw)
- || (p->name && *p->name)
- || (p->email && *p->email)
- || (p->addr && *p->addr)
+ || (p->raw && nonempty (p->raw))
+ || (p->name && nonempty (p->name))
+ || (p->email && nonempty (p->email))
+ || (p->addr && nonempty (p->addr))
|| (p->list_dests != NULL));
}
@@ -1539,7 +1550,7 @@ e_destination_importv (const gchar *str)
EDestination *dest;
dest = e_destination_new ();
- if (e_destination_xml_decode (dest, node)) {
+ if (e_destination_xml_decode (dest, node) && !e_destination_is_empty (dest)) {
g_ptr_array_add (dest_array, dest);
} else {
gtk_object_unref (GTK_OBJECT (dest));