aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog31
-rw-r--r--addressbook/backend/ebook/e-book-listener.c39
-rw-r--r--addressbook/backend/ebook/e-book-listener.h1
-rw-r--r--addressbook/backend/ebook/e-book.c55
-rw-r--r--addressbook/backend/pas/pas-backend-file.c45
-rw-r--r--addressbook/conduit/Makefile.am2
-rw-r--r--addressbook/conduit/address-conduit.c252
-rw-r--r--addressbook/conduit/address-conduit.h3
8 files changed, 335 insertions, 93 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 284b703570..1c0dbeca78 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,34 @@
+2000-11-09 JP Rosevear <jpr@helixcode.com>
+
+ * conduit/address-conduit.h: Add changed_hash, change list and complete bool
+
+ * conduit/address-conduit.c (local_record_from_ecard): Add empty field checks
+ (card_added): callback for book view
+ (card_changed): ditto
+ (card_removed): ditto
+ (sequence_complete): ditto
+ (view_cb): callback for the get changes call
+ (pre_sync): force synchronous loading of book view
+ (for_each): we already have the card so create the local record directly
+ (for_each_modified): Uncomment and fix
+ (delete_record): ditto
+
+ * conduit/Makefile.am: link against gal for ebook - needs fixing
+
+ * backend/ebook/e-book.c (e_book_do_response_get_changes): Properly respond
+ to a get_changes call
+ (e_book_check_listener_queue): define the get changes response operation
+
+ * backend/ebook/e-book-listener.c (e_book_listener_queue_get_changes_response):
+ Queue up a get changes response
+ (impl_BookListener_respond_get_changes): Implement the get_changes method
+ (e_book_listener_get_epv): add get_changes implementation to epv
+
+ * backend/pas/pas-backend-file.c (pas_backend_file_book_view_copy): Only
+ copy the search_context and change_context elements if they actually exist
+ (pas_backend_file_changes): Hard code a path for now, only notify if
+ there is something to notify about
+
2000-11-07 JP Rosevear <jpr@helixcode.com>
* backend/pas/pas-book.h: Update PASRequest structure
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 5efdaa37df..fb96329825 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -158,6 +158,22 @@ e_book_listener_queue_get_view_response (EBookListener *listener,
}
static void
+e_book_listener_queue_get_changes_response (EBookListener *listener,
+ EBookStatus status,
+ Evolution_BookView book_view)
+{
+ EBookListenerResponse *resp;
+
+ resp = g_new0 (EBookListenerResponse, 1);
+
+ resp->op = GetChangesResponse;
+ resp->status = status;
+ resp->book_view = book_view;
+
+ e_book_listener_queue_response (listener, resp);
+}
+
+static void
e_book_listener_queue_link_status (EBookListener *listener,
gboolean connected)
{
@@ -254,6 +270,28 @@ impl_BookListener_respond_get_view (PortableServer_Servant servant,
}
static void
+impl_BookListener_respond_get_changes (PortableServer_Servant servant,
+ const Evolution_BookListener_CallStatus status,
+ const Evolution_BookView book_view,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
+ Evolution_BookView book_view_copy;
+
+ book_view_copy = CORBA_Object_duplicate (book_view, ev);
+
+ if (ev->_major != CORBA_NO_EXCEPTION) {
+ g_warning ("EBookListener: Exception while duplicating BookView.\n");
+ return;
+ }
+
+ e_book_listener_queue_get_changes_response (
+ listener,
+ e_book_listener_convert_status (status),
+ book_view_copy);
+}
+
+static void
impl_BookListener_respond_open_book (PortableServer_Servant servant,
const Evolution_BookListener_CallStatus status,
const Evolution_Book book,
@@ -525,6 +563,7 @@ e_book_listener_get_epv (void)
epv->respond_get_cursor = impl_BookListener_respond_get_cursor;
epv->respond_get_view = impl_BookListener_respond_get_view;
+ epv->respond_get_changes = impl_BookListener_respond_get_changes;
epv->report_connection_status = impl_BookListener_report_connection_status;
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
index eb0432e360..3e4a160d33 100644
--- a/addressbook/backend/ebook/e-book-listener.h
+++ b/addressbook/backend/ebook/e-book-listener.h
@@ -45,6 +45,7 @@ typedef enum {
ModifyCardResponse,
GetCursorResponse,
GetBookViewResponse,
+ GetChangesResponse,
/* Async events */
LinkStatusEvent,
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 32103fc9df..ce130a5888 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -187,6 +187,8 @@ e_book_do_response_get_cursor (EBook *book,
g_free (op);
}
+
+
static void
e_book_do_response_get_view (EBook *book,
EBookListenerResponse *resp)
@@ -238,6 +240,56 @@ e_book_do_response_get_view (EBook *book,
}
static void
+e_book_do_response_get_changes (EBook *book,
+ EBookListenerResponse *resp)
+{
+ CORBA_Environment ev;
+ EBookOp *op;
+ EBookView *book_view;
+
+ op = e_book_pop_op (book);
+
+ if (op == NULL) {
+ g_warning ("e_book_do_response_get_changes: Cannot find operation "
+ "in local op queue!\n");
+ return;
+ }
+
+ book_view = e_book_view_new(resp->book_view, op->listener);
+
+ if (op->cb)
+ ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure);
+
+ /*
+ * Release the remote Evolution_Book in the PAS.
+ */
+ CORBA_exception_init (&ev);
+
+ Bonobo_Unknown_unref (resp->book_view, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_do_response_get_changs: Exception unref'ing "
+ "remote Evolution_BookView interface!\n");
+ CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ }
+
+ CORBA_Object_release (resp->book_view, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_do_response_get_changes: Exception releasing "
+ "remote Evolution_BookView interface!\n");
+ }
+
+ CORBA_exception_free (&ev);
+
+ gtk_object_unref(GTK_OBJECT(book_view));
+ bonobo_object_unref(BONOBO_OBJECT(op->listener));
+
+ g_free (op);
+}
+
+static void
e_book_do_response_open (EBook *book,
EBookListenerResponse *resp)
{
@@ -307,6 +359,9 @@ e_book_check_listener_queue (EBookListener *listener, EBook *book)
case GetBookViewResponse:
e_book_do_response_get_view(book, resp);
break;
+ case GetChangesResponse:
+ e_book_do_response_get_changes(book, resp);
+ break;
case OpenBookResponse:
e_book_do_response_open (book, resp);
break;
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index d90c33c76a..ce4ada1bc2 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -90,16 +90,23 @@ pas_backend_file_book_view_copy(const PASBackendFileBookView *book_view, void *c
new_book_view->search_sexp = book_view->search_sexp;
if (new_book_view->search_sexp)
gtk_object_ref(GTK_OBJECT(new_book_view->search_sexp));
- new_book_view->search_context = g_new(PASBackendFileSearchContext, 1);
- new_book_view->search_context->card = book_view->search_context->card;
-
+ if (book_view->search_context) {
+ new_book_view->search_context = g_new(PASBackendFileSearchContext, 1);
+ new_book_view->search_context->card = book_view->search_context->card;
+ }
+
new_book_view->change_id = g_strdup(book_view->change_id);
- new_book_view->change_context = g_new(PASBackendFileChangeContext, 1);
- new_book_view->change_context->db = book_view->change_context->db;
- new_book_view->change_context->add_cards = book_view->change_context->add_cards;
- new_book_view->change_context->mod_cards = book_view->change_context->mod_cards;
- new_book_view->change_context->del_cards = book_view->change_context->del_cards;
-
+ if (book_view->change_context) {
+ new_book_view->change_context = g_new(PASBackendFileChangeContext, 1);
+ new_book_view->change_context->db = book_view->change_context->db;
+ new_book_view->change_context->add_cards = book_view->change_context->add_cards;
+ new_book_view->change_context->add_ids = book_view->change_context->add_ids;
+ new_book_view->change_context->mod_cards = book_view->change_context->mod_cards;
+ new_book_view->change_context->mod_ids = book_view->change_context->mod_ids;
+ new_book_view->change_context->del_cards = book_view->change_context->del_cards;
+ new_book_view->change_context->del_ids = book_view->change_context->del_ids;
+ }
+
return new_book_view;
}
@@ -548,9 +555,8 @@ pas_backend_file_changes (PASBackendFile *bf,
if (!bf->priv->loaded)
return;
- /* Find the changed ids */
- filename = g_strdup ("test");
-
+ /* Find the changed ids - FIX ME, patch should not be hard coded */
+ filename = g_strdup_printf ("%s/evolution/local/Contacts/%s.db", g_get_home_dir (), view->change_id);
ehash = e_dbhash_new (filename);
g_free (filename);
@@ -582,7 +588,7 @@ pas_backend_file_changes (PASBackendFile *bf,
db_error = db->seq(db, &id_dbt, &vcard_dbt, R_NEXT);
}
- e_dbhash_foreach_key (ehash, (EDbHashFunc *)pas_backend_file_changes_foreach_key, view->change_context);
+ e_dbhash_foreach_key (ehash, (EDbHashFunc)pas_backend_file_changes_foreach_key, view->change_context);
/* Update the hash */
for (i = ctx->add_ids, v = ctx->add_cards; i != NULL; i = i->next, v = v->next){
@@ -600,15 +606,18 @@ pas_backend_file_changes (PASBackendFile *bf,
e_dbhash_remove (ehash, id);
}
- e_dbhash_write (ehash);
- e_dbhash_destroy (ehash);
+ e_dbhash_write (ehash);
+ e_dbhash_destroy (ehash);
/* Send the changes */
if (db_error == -1) {
g_warning ("pas_backend_file_changes: error building list\n");
} else {
- pas_book_view_notify_add (view->book_view, ctx->add_cards);
- pas_book_view_notify_change (view->book_view, ctx->mod_cards);
+ if (ctx->add_cards != NULL)
+ pas_book_view_notify_add (view->book_view, ctx->add_cards);
+
+ if (ctx->mod_cards != NULL)
+ pas_book_view_notify_change (view->book_view, ctx->mod_cards);
for (v = ctx->del_cards; v != NULL; v = v->next){
char *vcard = v->data;
@@ -1037,7 +1046,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
view.book_view = book_view;
view.change_id = req->change_id;
view.change_context = &ctx;
- ctx.db = NULL;
+ ctx.db = bf->priv->file_db;
ctx.add_cards = NULL;
ctx.add_ids = NULL;
ctx.mod_cards = NULL;
diff --git a/addressbook/conduit/Makefile.am b/addressbook/conduit/Makefile.am
index 368a50e477..21ac3bbe68 100644
--- a/addressbook/conduit/Makefile.am
+++ b/addressbook/conduit/Makefile.am
@@ -35,9 +35,11 @@ libeaddress_conduit_la_SOURCES = \
libeaddress_conduit_la_LIBADD = \
$(top_builddir)/addressbook/backend/ebook/libebook-static.la \
$(top_builddir)/e-util/libeutil-static.la \
+ $(top_builddir)/e-util/ename/libename-static.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeconduit-static.la \
$(BONOBO_VFS_GNOME_LIBS) \
+ $(EXTRA_GNOME_LIBS) \
$(PISOCK_LIBDIR) $(PISOCK_LIBS) \
$(GNOME_LIBDIR) \
$(GNOME_LIBS)
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index 048422cb7b..29907f72e0 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -77,6 +77,18 @@ typedef struct {
char *id;
} add_card_cons;
+typedef enum {
+ CARD_ADDED,
+ CARD_MODIFIED,
+ CARD_DELETED
+} CardObjectChangeType;
+
+typedef struct
+{
+ char *uid;
+ CardObjectChangeType type;
+} CardObjectChange;
+
/* debug spew DELETE ME */
static char *
print_local (EAddrLocalRecord *local)
@@ -136,6 +148,8 @@ e_addr_context_new (EAddrConduitContext **ctxt, guint32 pilot_id)
*ctxt = g_new0 (EAddrConduitContext,1);
g_assert (ctxt!=NULL);
+ (*ctxt)->complete = FALSE;
+
addrconduit_load_configuration (&(*ctxt)->cfg, pilot_id);
}
@@ -299,18 +313,24 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont
local->addr = g_new0 (struct Address, 1);
- local->addr->entry[entryFirstname] = strdup (ecard->name->given);
- local->addr->entry[entryLastname] = strdup (ecard->name->family);
- local->addr->entry[entryCompany] = strdup (ecard->org);
- local->addr->entry[entryTitle] = strdup (ecard->title);
+ if (ecard->name->given)
+ local->addr->entry[entryFirstname] = strdup (ecard->name->given);
+ if (ecard->name->family)
+ local->addr->entry[entryLastname] = strdup (ecard->name->family);
+ if (ecard->org)
+ local->addr->entry[entryCompany] = strdup (ecard->org);
+ if (ecard->title)
+ local->addr->entry[entryTitle] = strdup (ecard->title);
delivery = e_card_simple_get_delivery_address (simple, E_CARD_SIMPLE_ADDRESS_ID_HOME);
- local->addr->entry[entryAddress] = strdup (delivery->street);
- local->addr->entry[entryCity] = strdup (delivery->city);
- local->addr->entry[entryState] = strdup (delivery->region);
- local->addr->entry[entryZip] = strdup (delivery->code);
- local->addr->entry[entryCountry] = strdup (delivery->country);
-
+ if (delivery) {
+ local->addr->entry[entryAddress] = strdup (delivery->street);
+ local->addr->entry[entryCity] = strdup (delivery->city);
+ local->addr->entry[entryState] = strdup (delivery->region);
+ local->addr->entry[entryZip] = strdup (delivery->code);
+ local->addr->entry[entryCountry] = strdup (delivery->country);
+ }
+
/* FIX ME Phone numbers */
gtk_object_unref (GTK_OBJECT (simple));
@@ -465,6 +485,74 @@ check_for_slow_setting (GnomePilotConduit *c, EAddrConduitContext *ctxt)
}
}
+static void
+card_added (EBookView *book_view, const GList *cards, EAddrConduitContext *ctxt)
+{
+ const GList *l;
+
+ for (l = cards; l != NULL; l = l->next) {
+ ECard *card = l->data;
+ CardObjectChange *coc = g_new0 (CardObjectChange, 1);
+
+ coc->uid = e_card_get_id (card);
+ coc->type = CARD_ADDED;
+
+ ctxt->changed = g_list_prepend (ctxt->changed, coc);
+ g_hash_table_insert (ctxt->changed_hash, coc->uid, coc);
+ }
+}
+
+static void
+card_changed (EBookView *book_view, const GList *cards, EAddrConduitContext *ctxt)
+{
+ const GList *l;
+
+ for (l = cards; l != NULL; l = l->next) {
+ ECard *card = l->data;
+ CardObjectChange *coc = g_new0 (CardObjectChange, 1);
+
+ coc->uid = e_card_get_id (card);
+ coc->type = CARD_MODIFIED;
+
+ ctxt->changed = g_list_prepend (ctxt->changed, coc);
+ g_hash_table_insert (ctxt->changed_hash, coc->uid, coc);
+ }
+}
+
+
+static void
+card_removed (EBookView *book_view, const char *id, EAddrConduitContext *ctxt)
+{
+ CardObjectChange *coc = g_new0 (CardObjectChange, 1);
+
+ coc->uid = g_strdup (id);
+ coc->type = CARD_DELETED;
+
+ ctxt->changed = g_list_prepend (ctxt->changed, coc);
+ g_hash_table_insert (ctxt->changed_hash, coc->uid, coc);
+}
+
+static void
+sequence_complete (EBookView *book_view, EAddrConduitContext *ctxt)
+{
+ ctxt->complete = TRUE;
+ gtk_main_quit ();
+}
+
+static void
+view_cb (EBook *book, EBookStatus status, EBookView *book_view, EAddrConduitContext *ctxt)
+{
+ gtk_signal_connect (GTK_OBJECT (book_view), "card_added",
+ (GtkSignalFunc) card_added, ctxt);
+ gtk_signal_connect (GTK_OBJECT (book_view), "card_changed",
+ (GtkSignalFunc) card_changed, ctxt);
+ gtk_signal_connect (GTK_OBJECT (book_view), "card_removed",
+ (GtkSignalFunc) card_removed, ctxt);
+ gtk_signal_connect (GTK_OBJECT (book_view), "sequence_complete",
+ (GtkSignalFunc) sequence_complete, ctxt);
+
+}
+
/* Pilot syncing callbacks */
static gint
pre_sync (GnomePilotConduit *conduit,
@@ -476,6 +564,7 @@ pre_sync (GnomePilotConduit *conduit,
int len;
unsigned char *buf;
char *filename;
+ char *change_id;
/* gint num_records; */
abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
@@ -497,15 +586,22 @@ pre_sync (GnomePilotConduit *conduit,
e_pilot_map_read (filename, &ctxt->map);
g_free (filename);
+ /* Count and hash the changes */
+ change_id = g_strdup_printf ("pilot-sync-evolution-addressbook-%d", ctxt->cfg->pilot_id);
+ ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ e_book_get_changes (ctxt->ebook, change_id, view_cb, ctxt);
+
+ /* Force the view loading to be synchronous */
+ gtk_main ();
+
+ g_free (change_id);
+
/* Set the count information */
/* num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO); */
/* gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->added); */
-/* gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->modified); */
-/* gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->deleted); */
-/* gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, num_records); */
+/* gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records); */
+/* gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records); */
+/* gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records); */
gtk_object_set_data (GTK_OBJECT (conduit), "dbinfo", dbi);
@@ -588,7 +684,7 @@ for_each (GnomePilotConduitSyncAbs *conduit,
LOG ("iterating over %d records", g_list_length (cards));
*local = g_new0 (EAddrLocalRecord, 1);
-/* local_record_from_uid (*local, uids->data, ctxt) */;
+ local_record_from_ecard (*local, cards->data, ctxt);
iterator = cards;
} else {
@@ -602,7 +698,7 @@ for_each (GnomePilotConduitSyncAbs *conduit,
iterator = g_list_next (iterator);
*local = g_new0 (EAddrLocalRecord, 1);
- local_record_from_uid (*local, iterator->data, ctxt);
+ local_record_from_ecard (*local, iterator->data, ctxt);
} else {
LOG ("for_each ending");
@@ -621,51 +717,51 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
EAddrLocalRecord **local,
EAddrConduitContext *ctxt)
{
-/* static GList *changes, *iterator; */
-/* static int count; */
+ static GList *changes, *iterator;
+ static int count;
-/* g_return_val_if_fail (local != NULL, 0); */
+ g_return_val_if_fail (local != NULL, 0);
-/* if (*local == NULL) { */
-/* LOG ("beginning for_each_modified: beginning\n"); */
+ if (*local == NULL) {
+ LOG ("beginning for_each_modified: beginning\n");
-/* changes = ctxt->changed; */
+ changes = ctxt->changed;
-/* count = 0; */
+ count = 0;
-/* if (changes != NULL) { */
-/* CalObjChange *coc = changes->data; */
+ if (changes != NULL) {
+ CardObjectChange *coc = changes->data;
-/* LOG ("iterating over %d records", g_list_length (changes)); */
+ LOG ("iterating over %d records", g_list_length (changes));
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, coc->uid, ctxt); */
-
-/* iterator = changes; */
-/* } else { */
-/* LOG ("no events"); */
-/* (*local) = NULL; */
-/* return 0; */
-/* } */
-/* } else { */
-/* count++; */
-/* if (g_list_next (iterator)) { */
-/* CalObjChange *coc; */
-
-/* iterator = g_list_next (iterator); */
-/* coc = iterator->data; */
-
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, coc->uid, ctxt); */
-/* } else { */
-/* LOG ("for_each_modified ending"); */
+ *local = g_new0 (EAddrLocalRecord, 1);
+ local_record_from_uid (*local, coc->uid, ctxt);
+
+ iterator = changes;
+ } else {
+ LOG ("no events");
+ (*local) = NULL;
+ return 0;
+ }
+ } else {
+ count++;
+ if (g_list_next (iterator)) {
+ CardObjectChange *coc;
+
+ iterator = g_list_next (iterator);
+ coc = iterator->data;
+
+ *local = g_new0 (EAddrLocalRecord, 1);
+ local_record_from_uid (*local, coc->uid, ctxt);
+ } else {
+ LOG ("for_each_modified ending");
/* Tell the pilot the iteration is over */
-/* (*local) = NULL; */
+ (*local) = NULL;
-/* return 0; */
-/* } */
-/* } */
+ return 0;
+ }
+ }
return 0;
}
@@ -686,7 +782,7 @@ compare (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local!=NULL,-1);
g_return_val_if_fail (remote!=NULL,-1);
-/* local_pilot = local_record_to_pilot_record (local, ctxt); */
+ local_pilot = local_record_to_pilot_record (local, ctxt);
if (!local_pilot)
return -1;
@@ -774,18 +870,22 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
EAddrLocalRecord *local,
EAddrConduitContext *ctxt)
{
-/* const char *uid; */
-
-/* g_return_val_if_fail (local != NULL, -1); */
-/* g_assert (local->comp != NULL); */
-
-/* cal_component_get_uid (local->comp, &uid); */
+ EBookStatus commit_status;
+ int retval = 0;
+
+ g_return_val_if_fail (local != NULL, -1);
+ g_return_val_if_fail (local->ecard != NULL, -1);
-/* LOG ("delete_record: deleting %s\n", uid); */
+ LOG ("delete_record: delete %s\n", print_local (local));
-/* cal_client_remove_object (ctxt->client, uid); */
+ e_book_remove_card_by_id (ctxt->ebook, local->ecard->id, status_cb, &commit_status);
- return 0;
+ gtk_main (); /* enter sub mainloop */
+
+ if (commit_status != E_BOOK_STATUS_SUCCESS)
+ WARN ("delete_record: failed to delete card in ebook\n");
+
+ return retval;
}
static gint
@@ -799,6 +899,8 @@ archive_record (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
LOG ("archive_record: %s\n", archive ? "yes" : "no");
+
+ e_pilot_map_insert (ctxt->map, local->local.ID, local->ecard->id, archive);
return retval;
}
@@ -809,7 +911,7 @@ match (GnomePilotConduitSyncAbs *conduit,
EAddrLocalRecord **local,
EAddrConduitContext *ctxt)
{
-/* char *uid; */
+ char *uid;
LOG ("match: looking for local copy of %s\n",
print_remote (remote));
@@ -817,16 +919,16 @@ match (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
g_return_val_if_fail (remote != NULL, -1);
-/* *local = NULL; */
-/* uid = g_hash_table_lookup (ctxt->map->pid_map, &remote->ID); */
+ *local = NULL;
+ uid = g_hash_table_lookup (ctxt->map->pid_map, &remote->ID);
-/* if (!uid) */
-/* return 0; */
+ if (!uid)
+ return 0;
-/* LOG (" matched\n"); */
+ LOG (" matched\n");
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, uid, ctxt); */
+ *local = g_new0 (EAddrLocalRecord, 1);
+ local_record_from_uid (*local, uid, ctxt);
return 0;
}
@@ -840,7 +942,7 @@ free_match (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
-/* gtk_object_unref (GTK_OBJECT (local->comp)); */
+ gtk_object_unref (GTK_OBJECT (local->ecard));
g_free (local);
return 0;
@@ -854,10 +956,10 @@ prepare (GnomePilotConduitSyncAbs *conduit,
{
LOG ("prepare: encoding local %s\n", print_local (local));
-/* *remote = local_record_to_pilot_record (local, ctxt); */
+ *remote = local_record_to_pilot_record (local, ctxt);
-/* if (!*remote) */
-/* return -1; */
+ if (!*remote)
+ return -1;
return 0;
}
diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h
index 141ec1b53c..9f0af7d293 100644
--- a/addressbook/conduit/address-conduit.h
+++ b/addressbook/conduit/address-conduit.h
@@ -59,6 +59,9 @@ struct _EAddrConduitContext {
EBook *ebook;
GList *cards;
+ GList *changed;
+ GHashTable *changed_hash;
+ gboolean complete;
gboolean address_load_tried;
gboolean address_load_success;