aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-03-26 15:05:30 +0800
committerChris Lahey <clahey@src.gnome.org>2000-03-26 15:05:30 +0800
commitddce13d6bdf38390f4f3d66c4aba493e392f195e (patch)
tree45b407a9f73729bf1aa63bae30aeac657e6bf8be /addressbook
parent583d4f988977506a7bd8e227433a479f40f316b7 (diff)
downloadgsoc2013-evolution-ddce13d6bdf38390f4f3d66c4aba493e392f195e.tar.gz
gsoc2013-evolution-ddce13d6bdf38390f4f3d66c4aba493e392f195e.tar.zst
gsoc2013-evolution-ddce13d6bdf38390f4f3d66c4aba493e392f195e.zip
Set the card id properly when retrieving a card.
2000-03-26 Christopher James Lahey <clahey@helixcode.com> * 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
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/backend/ebook/e-book.c2
-rw-r--r--addressbook/backend/ebook/e-card.c19
-rw-r--r--addressbook/backend/ebook/e-card.h2
3 files changed, 21 insertions, 2 deletions
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 */