aboutsummaryrefslogtreecommitdiffstats
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
parentf9f86c3ee2ffdda05bcc06c997710e9af8218dbf (diff)
downloadgsoc2013-evolution-603c0228de30416b3c530a8d1eaeb6fa03dcba55.tar.gz
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
-rw-r--r--addressbook/ChangeLog19
-rw-r--r--addressbook/backend/ebook/e-destination.c21
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c2
-rw-r--r--addressbook/printing/e-contact-print.c28
4 files changed, 58 insertions, 12 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index f58d868d42..570898d961 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,11 +1,26 @@
+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)
+
2001-10-20 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-minicard-view.c (e_minicard_view_selection_event):
Handle focus_change in event by selecting that contact. Fixes
Ximian bug #3024.
-2001-10-20 Christopher James Lahey <clahey@ximian.com>
-
* gui/component/addressbook-component.c (owner_unset_cb):
Repeatedly call gtk_main_quit here as long as there is a main loop
around. This is an ugly hack around Ximian bug #11760.
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));
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 3280619f13..5142d99f2d 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1521,7 +1521,7 @@ e_addressbook_view_can_create (EAddressbookView *view)
gboolean
e_addressbook_view_can_print (EAddressbookView *view)
{
- return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
+ return view && view->model ? e_addressbook_model_card_count (view->model) : FALSE;
}
gboolean
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index c4118e0dbf..18e5922854 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -44,6 +44,7 @@
#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/backend/ebook/e-card.h>
#include <addressbook/backend/ebook/e-card-simple.h>
+#include <addressbook/backend/ebook/e-destination.h>
#define SCALE 5
#define HYPHEN_PIXELS 20
@@ -438,6 +439,8 @@ e_contact_get_card_size(ECardSimple *simple, EContactPrintContext *ctxt)
g_free(string);
}
height += gnome_font_get_size (ctxt->style->headings_font) * .4;
+
+ g_message ("%s %g", e_card_simple_get (simple, E_CARD_SIMPLE_FIELD_FILE_AS), height);
return height;
}
@@ -474,6 +477,17 @@ e_contact_print_card (ECardSimple *simple, EContactPrintContext *ctxt)
for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; field++) {
char *string;
string = e_card_simple_get(simple, field);
+
+ if (!strncmp (string, "<?xml", 4)) {
+ EDestination *dest = e_destination_import (string);
+ if (dest != NULL) {
+ gchar *new_string = g_strdup (e_destination_get_address (dest));
+ g_free (string);
+ string = new_string;
+ gtk_object_unref (GTK_OBJECT (dest));
+ }
+ }
+
if (string && *string) {
double xoff = 0;
e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, e_card_simple_get_name(simple, field));
@@ -859,8 +873,10 @@ e_contact_build_style(EContactPrintStyle *style)
style->blank_forms = 2;
style->letter_tabs = TRUE;
style->letter_headings = FALSE;
- style->headings_font = gnome_font_new("Helvetica-Bold", 8);
- style->body_font = gnome_font_new("Helvetica", 6);
+
+ style->headings_font = gnome_font_new_closest("Helvetica", GNOME_FONT_BOLD, FALSE, 8);
+ style->body_font = gnome_font_new_closest("Helvetica", GNOME_FONT_BOOK, FALSE, 6);
+
style->print_using_grey = TRUE;
style->paper_type = 0;
style->paper_width = 8.5;
@@ -882,11 +898,15 @@ e_contact_build_style(EContactPrintStyle *style)
style->page_height = 8.5;
#endif
style->orientation_portrait = FALSE;
- style->header_font = gnome_font_new("Helvetica", 6);
+
+ style->header_font = gnome_font_new_closest("Helvetica", GNOME_FONT_BOOK, FALSE, 6);
+
style->left_header = g_strdup("");
style->center_header = g_strdup("");
style->right_header = g_strdup("");
- style->footer_font = gnome_font_new("Helvetica", 6);
+
+ style->footer_font = gnome_font_new_closest("Helvetica", GNOME_FONT_BOOK, FALSE, 6);
+
style->left_footer = g_strdup("");
style->center_footer = g_strdup("");
style->right_footer = g_strdup("");