From 5c58686c8ef72be5ed8a2d4469b3556f80d4b81c Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 9 Jun 2001 06:31:55 +0000 Subject: Null terminate the strv here. (e_card_locate_match): ref here instead of 2001-06-09 Christopher James Lahey * backend/ebook/e-card-compare.c (use_common_book_cb): Null terminate the strv here. (e_card_locate_match): ref here instead of unref. * backend/ebook/e-card-simple.c (e_card_simple_get): Handle a NULL card here. * contact-editor/Makefile.am (INCLUDES), gui/widgets/Makefile.am (INCLUDES): Added addressbook/gui/merging here. * contact-editor/e-contact-quick-add.c (book_ready_cb), gui/component/addressbook-component.c (dnd_drop_book_open_cb), gui/widgets/e-addressbook-table-adapter.c (addressbook_append_row), gui/widgets/e-addressbook-util.c (add_card_cb), gui/widgets/e-addressbook-view.c (selection_received), gui/widgets/e-minicard-control.c (book_open_cb): Use e_card_merging_book_add_card instead of e_book_add_card here. * gui/Makefile.am (SUBDIRS): Added merging. * gui/component/Makefile.am (evolution_addressbook_LDADD), gui/widgets/Makefile.am (minicard_test_LDADD, minicard_widget_test_LDADD): Added libecardmerging.a here. * gui/merging/, gui/merging/.cvsignore, gui/merging/Makefile.am: New addressbook library. * gui/merging/e-card-duplicate-detected.glade: Glade file for duplicate detected dialog. * gui/merging/e-card-merging.c, gui/merging/e-card-merging.h: New files for detecting duplicates before adding and putting up a dialog if duplicates are found. * gui/widgets/e-minicard-view.c: Include e-addressbook-util.h here. svn path=/trunk/; revision=10170 --- addressbook/backend/ebook/e-card-compare.c | 4 +- addressbook/backend/ebook/e-card-simple.c | 60 ++++++++++++++++++------------ 2 files changed, 38 insertions(+), 26 deletions(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/ebook/e-card-compare.c b/addressbook/backend/ebook/e-card-compare.c index fc80d5e6c6..f249c1727b 100644 --- a/addressbook/backend/ebook/e-card-compare.c +++ b/addressbook/backend/ebook/e-card-compare.c @@ -419,7 +419,7 @@ use_common_book_cb (EBook *book, gpointer closure) /* Build up our full query from the parts. */ - + query_parts[p] = NULL; qj = g_strjoinv (" ", query_parts); if (p > 0) { query = g_strdup_printf ("(or %s)", qj); @@ -446,7 +446,7 @@ e_card_locate_match (ECard *card, ECardMatchQueryCallback cb, gpointer closure) info = g_new (MatchSearchInfo, 1); info->card = card; - gtk_object_unref (GTK_OBJECT (card)); + gtk_object_ref (GTK_OBJECT (card)); info->cb = cb; info->closure = closure; diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index f7550017a0..ed10a56685 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -727,15 +727,21 @@ char *e_card_simple_get (ECardSimple *simple, ECardName *name; switch(type) { case E_CARD_SIMPLE_INTERNAL_TYPE_STRING: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &string, - NULL); - return g_strdup(string); + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + field_data[field].ecard_field, &string, + NULL); + return g_strdup(string); + } else + return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &date, - NULL); - return NULL; /* FIXME!!!! */ + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + field_data[field].ecard_field, &date, + NULL); + return NULL; /* FIXME!!!! */ + } else + return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: addr = e_card_simple_get_address(simple, field_data[field].list_type_index); @@ -757,24 +763,30 @@ char *e_card_simple_get (ECardSimple *simple, case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: switch (field) { case E_CARD_SIMPLE_FIELD_NAME_OR_ORG: - gtk_object_get(GTK_OBJECT(simple->card), - "full_name", &string, - NULL); - if (string && *string) + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + "full_name", &string, + NULL); + if (string && *string) + return g_strdup(string); + gtk_object_get(GTK_OBJECT(simple->card), + "org", &string, + NULL); + if (string && *string) + return g_strdup(string); + string = e_card_simple_get_email(simple, + E_CARD_SIMPLE_EMAIL_ID_EMAIL); return g_strdup(string); - gtk_object_get(GTK_OBJECT(simple->card), - "org", &string, - NULL); - if (string && *string) - return g_strdup(string); - string = e_card_simple_get_email(simple, - E_CARD_SIMPLE_EMAIL_ID_EMAIL); - return g_strdup(string); + } else + return NULL; case E_CARD_SIMPLE_FIELD_FAMILY_NAME: - gtk_object_get (GTK_OBJECT(simple->card), - "name", &name, - NULL); - return g_strdup (name->family); + if (simple->card) { + gtk_object_get (GTK_OBJECT(simple->card), + "name", &name, + NULL); + return g_strdup (name->family); + } else + return NULL; default: return NULL; } -- cgit