From ddce13d6bdf38390f4f3d66c4aba493e392f195e Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 26 Mar 2000 07:05:30 +0000 Subject: Set the card id properly when retrieving a card. 2000-03-26 Christopher James Lahey * addressbook/backend/ebook/e-book.c: Set the card id properly when retrieving a card. * addressbook/backend/ebook/e-card.c, addressbook/backend/ebook/e-card.h: Added the ability to set the card's id (and made getting it work correctly also.) svn path=/trunk/; revision=2166 --- addressbook/backend/ebook/e-book.c | 2 ++ addressbook/backend/ebook/e-card.c | 19 +++++++++++++++++-- addressbook/backend/ebook/e-card.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'addressbook/backend/ebook') diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index 6d0a3394c2..16819c334a 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -414,6 +414,8 @@ e_book_get_card (EBook *book, card = e_card_new (vcard); g_free(vcard); + + e_card_set_id(card, id); return card; } diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 88205fad53..c259ea5193 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -123,9 +123,18 @@ ECard *e_card_new (char *vcard) return card; } -char *e_card_get_id (ECard *card) +char * +e_card_get_id (ECard *card) +{ + return card->id; +} + +void +e_card_set_id (ECard *card, char *id) { - return NULL; + if ( card->id ) + g_free(card->id); + card->id = g_strdup(id); } char *e_card_get_vcard (ECard *card) @@ -478,16 +487,21 @@ static void e_card_destroy (GtkObject *object) { ECard *card = E_CARD(object); + if ( card->id ) + g_free(card->id); if ( card->fname ) g_free(card->fname); if ( card->name ) e_card_name_free(card->name); if ( card->bday ) g_free(card->bday); + g_list_foreach(card->email, (GFunc)g_free, NULL); g_list_free(card->email); + g_list_foreach(card->phone, (GFunc)e_card_phone_free, NULL); g_list_free(card->phone); + g_list_foreach(card->address, (GFunc)e_card_delivery_address_free, NULL); g_list_free(card->address); } @@ -580,6 +594,7 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) static void e_card_init (ECard *card) { + card->id = g_strdup(""); card->fname = NULL; card->name = NULL; diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 04c3cd2a96..b5abf34e24 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -28,6 +28,7 @@ typedef struct _ECardClass ECardClass; struct _ECard { GtkObject object; + char *id; char *fname; /* The full name. */ ECardName *name; /* The structured name. */ @@ -85,6 +86,7 @@ struct _ECardClass { ECard *e_card_new (char *vcard); char *e_card_get_id (ECard *card); +void e_card_set_id (ECard *card, gchar *character); char *e_card_get_vcard (ECard *card); /* Standard Gtk function */ -- cgit v1.2.3