From 603c0228de30416b3c530a8d1eaeb6fa03dcba55 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sat, 20 Oct 2001 19:58:29 +0000 Subject: Filter out empty destinations. (also Bug #13036) 2001-10-20 Jon Trowbridge * 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 --- addressbook/backend/ebook/e-destination.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'addressbook/backend') 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)); -- cgit v1.2.3