aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-10-23 20:52:46 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-10-23 20:52:46 +0800
commitc1103e4a29d0f8ec59cefcfff2ff44dbce151262 (patch)
treea784d9157aed736b4ab365176af124816f55827d /addressbook/backend/ebook
parent2c1e34fa853d10da883be5923ec207fc85dcd8b0 (diff)
downloadgsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar.gz
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar.bz2
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar.lz
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar.xz
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.tar.zst
gsoc2013-evolution-c1103e4a29d0f8ec59cefcfff2ff44dbce151262.zip
make it work with the new ebook api
003-10-21 JP Rosevear <jpr@ximian.com> * conduit/address-conduit.c: make it work with the new ebook api * backend/pas/pas-book.c (pas_book_respond_get_changes): put the vcard in for every change * backend/pas/pas-backend.c (pas_backend_change_add_new): just use the vcard field (pas_backend_change_modify_new): ditto (pas_backend_change_delete_new): ditto * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key): create a fake contact with the uid (pas_backend_file_get_changes): add the card to the changes * backend/ebook/tests/ebook/test-changes.c (main): just print the uid * backend/ebook/e-book.c (e_book_free_change_list): unref the contact * backend/ebook/e-book-types.h: the change struct contains an EContact now * backend/ebook/e-book-listener.c (impl_BookListener_respond_get_changes): create the contact from the vcard string * backend/idl/addressbook.idl: Book change item is no longer a union, it always gives back a card svn path=/trunk/; revision=23031
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-book-listener.c6
-rw-r--r--addressbook/backend/ebook/e-book-types.h4
-rw-r--r--addressbook/backend/ebook/e-book.c2
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-changes.c2
4 files changed, 6 insertions, 8 deletions
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 0bb5193376..f3a7de266c 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -187,20 +187,18 @@ impl_BookListener_respond_get_changes (PortableServer_Servant servant,
EBookChange *change = g_new (EBookChange, 1);
GNOME_Evolution_Addressbook_BookChangeItem corba_change = changes->_buffer[i];
- switch (corba_change._d) {
+ switch (corba_change.changeType) {
case GNOME_Evolution_Addressbook_ContactAdded:
change->change_type = E_BOOK_CHANGE_CARD_ADDED;
- change->vcard = g_strdup (corba_change._u.add_vcard);
break;
case GNOME_Evolution_Addressbook_ContactDeleted:
change->change_type = E_BOOK_CHANGE_CARD_DELETED;
- change->id = g_strdup (corba_change._u.del_id);
break;
case GNOME_Evolution_Addressbook_ContactModified:
change->change_type = E_BOOK_CHANGE_CARD_MODIFIED;
- change->vcard = g_strdup (corba_change._u.mod_vcard);
break;
}
+ change->contact = e_contact_new_from_vcard (corba_change.vcard);
response.list = g_list_prepend (response.list, change);
}
diff --git a/addressbook/backend/ebook/e-book-types.h b/addressbook/backend/ebook/e-book-types.h
index 4ca69bd516..9bbc66e622 100644
--- a/addressbook/backend/ebook/e-book-types.h
+++ b/addressbook/backend/ebook/e-book-types.h
@@ -13,6 +13,7 @@
#define __E_BOOK_TYPES_H__
#include <glib.h>
+#include <ebook/e-contact.h>
G_BEGIN_DECLS
@@ -59,8 +60,7 @@ typedef enum {
typedef struct {
EBookChangeType change_type;
- char *vcard; /* used in the ADDED/MODIFIED case */
- char *id; /* used in the DELETED case */
+ EContact *contact;
} EBookChange;
G_END_DECLS
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index c84b4c3f83..b551c8727b 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -1244,7 +1244,7 @@ e_book_free_change_list (GList *change_list)
for (l = change_list; l; l = l->next) {
EBookChange *change = l->data;
- g_free (change->vcard);
+ g_object_unref (change->contact);
g_free (change);
}
diff --git a/addressbook/backend/ebook/tests/ebook/test-changes.c b/addressbook/backend/ebook/tests/ebook/test-changes.c
index 0c91f30cf4..f1e65adaa0 100644
--- a/addressbook/backend/ebook/tests/ebook/test-changes.c
+++ b/addressbook/backend/ebook/tests/ebook/test-changes.c
@@ -71,7 +71,7 @@ main (int argc, char **argv)
exit(0);
}
- printf ("got changed vcard back: %s\n", change->vcard);
+ printf ("got changed vcard back: %s\n", e_contact_get_const (change->contact, E_CONTACT_UID));
e_book_free_change_list (changes);