aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog38
-rw-r--r--addressbook/backend/ebook/e-book.c36
-rw-r--r--addressbook/backend/ebook/e-book.h5
-rw-r--r--addressbook/backend/idl/addressbook.idl4
-rw-r--r--addressbook/backend/pas/pas-backend-file.c157
-rw-r--r--addressbook/backend/pas/pas-book.c64
-rw-r--r--addressbook/backend/pas/pas-book.h4
-rw-r--r--addressbook/conduit/address-conduit.c272
8 files changed, 365 insertions, 215 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7a54abd23f..c091dee850 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,41 @@
+2000-10-31 JP Rosevear <jpr@helixcode.com>
+
+ * conduit/address-conduit.c (cursor_cb): Let the warning make sense
+ (compute_pid): remove
+ (local_record_from_ecard): Create local record from ecard - not finished
+ (local_record_from_uid): Obtain local_record from uid with the proper
+ e-book way
+ (set_status_cleared): Add empty callback
+ (add_archive_record): kill
+ (delete_archive_record): kill
+ (archive_record): Add empty callback
+ (conduit_get_gpilot_conduit): Update signal connects
+
+ * backend/pas/pas-backend-file.c (vcard_change_type): Function to determine
+ the type of change - not finished
+ (pas_backend_file_search_changes): Create a view and callback based on
+ how the cards have changed
+ (pas_backend_file_process_get_changes): Implement the get changes operation
+ for files
+ (pas_backend_file_process_client_requests): Add GetChanges method for
+ processing
+
+ * backend/pas/pas-book.c (pas_book_queue_get_changes): Add changes to
+ the list
+ (impl_Evolution_Book_get_changes): implement object method
+ (pas_book_get_epv): Add get changes to epv
+ (pas_book_respond_get_changes): Respond to the get changes operation
+
+ * backend/pas/pas-book.h: Add GetChanges PASOperation
+
+ * backend/idl/addressbook.idl: add get_changes and respond_get_changes
+ methods
+
+ * backend/ebook/e-book.c (e_book_get_changes): Client function
+ to a view of the changed objects
+
+ * backend/ebook/e-book.h: New prototype
+
2000-10-30 Kjartan Maraas <kmaraas@gnome.org>
* backend/e-book/e-card.c: Fixed marking of strings
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index bb0226eb5a..32103fc9df 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -909,6 +909,42 @@ gboolean e_book_get_book_view (EBook *book,
return TRUE;
}
+gboolean e_book_get_changes (EBook *book,
+ gchar *changeid,
+ EBookBookViewCallback cb,
+ gpointer closure)
+{
+ CORBA_Environment ev;
+ EBookViewListener *listener;
+
+ g_return_val_if_fail (book != NULL, FALSE);
+ g_return_val_if_fail (E_IS_BOOK (book), FALSE);
+
+ if (book->priv->load_state != URILoaded) {
+ g_warning ("e_book_get_changes: No URI loaded!\n");
+ return FALSE;
+ }
+
+ listener = e_book_view_listener_new();
+
+ CORBA_exception_init (&ev);
+
+ Evolution_Book_get_changes (book->priv->corba_book, bonobo_object_corba_objref(BONOBO_OBJECT(listener)), changeid, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_changes: Exception "
+ "getting changes!\n");
+ CORBA_exception_free (&ev);
+ return FALSE;
+ }
+
+ CORBA_exception_free (&ev);
+
+ e_book_queue_op (book, cb, closure, listener);
+
+ return TRUE;
+}
+
/**
* e_book_get_name:
*/
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index 29f3787f66..3c3f2bc65b 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -107,6 +107,11 @@ gboolean e_book_get_book_view (EBook *book,
EBookBookViewCallback cb,
gpointer closure);
+gboolean e_book_get_changes (EBook *book,
+ char *changeid,
+ EBookBookViewCallback cb,
+ gpointer closure);
+
/* Getting the name of the repository. */
char *e_book_get_name (EBook *book);
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
index e520621858..2c5a54487e 100644
--- a/addressbook/backend/idl/addressbook.idl
+++ b/addressbook/backend/idl/addressbook.idl
@@ -83,6 +83,8 @@ module Evolution {
*/
void get_book_view(in BookViewListener listener, in string query);
+ void get_changes(in BookViewListener listener, in string changeid);
+
void check_connection ();
string get_static_capabilities ();
@@ -115,6 +117,8 @@ module Evolution {
void respond_get_view (in CallStatus status, in BookView view);
+ void respond_get_changes (in CallStatus status, in BookView view);
+
/**
* report_connection_status:
*
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index a54d32d424..84a21d4c6f 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -485,6 +485,104 @@ pas_backend_file_search (PASBackendFile *bf,
g_list_free (cards);
}
+typedef enum {
+ VCardChangeNone,
+ VCardChangeAdded,
+ VCardChangeModified,
+ VCardChangeDeleted
+} VCardChangeType;
+
+static VCardChangeType
+vcard_change_type (const PASBackendFileBookView *view, char *vcard_string)
+{
+ ECard *card;
+
+ card = e_card_new (vcard_string);
+ view->search_context->card = e_card_simple_new (card);
+ gtk_object_unref(GTK_OBJECT(card));
+
+ /* if it's not a valid vcard why is it in our db? :) */
+ if (!view->search_context->card)
+ return VCardChangeNone;
+
+ /* FIX ME, actually need to implement this */
+
+ gtk_object_unref(GTK_OBJECT(view->search_context->card));
+
+ return VCardChangeNone;
+}
+
+static void
+pas_backend_file_search_changes (PASBackendFile *bf,
+ PASBook *book,
+ const PASBackendFileBookView *cnstview)
+{
+ int db_error = 0;
+ GList *add_cards = NULL;
+ GList *mod_cards = NULL;
+ GList *del_cards = NULL;
+ DB *db = bf->priv->file_db;
+ DBT id_dbt, vcard_dbt;
+ PASBackendFileBookView *view = (PASBackendFileBookView *)cnstview;
+
+ if (!bf->priv->loaded)
+ return;
+
+ db_error = db->seq(db, &id_dbt, &vcard_dbt, R_FIRST);
+
+ while (db_error == 0) {
+
+ /* don't include the version in the list of cards */
+ if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
+ || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
+ char *vcard_string = vcard_dbt.data;
+
+ /* check what type of change has occurred, if any */
+ switch (vcard_change_type (view, vcard_string)) {
+ case VCardChangeNone:
+ break;
+ case VCardChangeAdded:
+ add_cards = g_list_append (add_cards, strdup(vcard_string));
+ break;
+ case VCardChangeModified:
+ mod_cards = g_list_append (mod_cards, strdup(vcard_string));
+ break;
+ case VCardChangeDeleted:
+ del_cards = g_list_append (del_cards, strdup(vcard_string));
+ break;
+ }
+ }
+
+ db_error = db->seq(db, &id_dbt, &vcard_dbt, R_NEXT);
+ }
+
+ if (db_error == -1) {
+ g_warning ("pas_backend_file_search_changes: error building list\n");
+ } else {
+ GList *l;
+
+ pas_book_view_notify_add (view->book_view, add_cards);
+ pas_book_view_notify_change (view->book_view, mod_cards);
+
+ for (l = del_cards; l != NULL; l = l->next){
+ char *card = l->data;
+ pas_book_view_notify_remove (view->book_view, card);
+ }
+
+ pas_book_view_notify_complete (view->book_view);
+ }
+
+ /*
+ ** It's fine to do this now since the data has been handed off.
+ */
+ g_list_foreach (add_cards, (GFunc)g_free, NULL);
+ g_list_foreach (mod_cards, (GFunc)g_free, NULL);
+ g_list_foreach (del_cards, (GFunc)g_free, NULL);
+ g_list_free (add_cards);
+ g_list_free (mod_cards);
+ g_list_free (del_cards);
+}
+
static char *
do_create(PASBackend *backend,
char *vcard_req,
@@ -848,6 +946,61 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
}
static void
+pas_backend_file_process_get_changes (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+{
+ PASBackendFile *bf = PAS_BACKEND_FILE (backend);
+ CORBA_Environment ev;
+ PASBookView *book_view;
+ Evolution_Book corba_book;
+ PASBackendFileBookView view;
+ PASBackendFileSearchContext ctx;
+ EIterator *iterator;
+
+ g_return_if_fail (req->listener != NULL);
+
+ corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
+
+ CORBA_exception_init(&ev);
+
+ Evolution_Book_ref(corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_book_view: Exception reffing "
+ "corba book.\n");
+ }
+
+ CORBA_exception_free(&ev);
+
+ book_view = pas_book_view_new (req->listener);
+
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
+ GTK_SIGNAL_FUNC(view_destroy), book);
+
+ pas_book_respond_get_changes (book,
+ (book_view != NULL
+ ? Evolution_BookListener_Success
+ : Evolution_BookListener_CardNotFound /* XXX */),
+ book_view);
+
+ view.book_view = book_view;
+ view.search = req->search;
+ view.search_sexp = NULL;
+ view.search_context = &ctx;
+ ctx.card = NULL;
+
+ e_list_append(bf->priv->book_views, &view);
+
+ iterator = e_list_get_iterator(bf->priv->book_views);
+ e_iterator_last(iterator);
+ pas_backend_file_search_changes (bf, book, e_iterator_get(iterator));
+ gtk_object_unref(GTK_OBJECT(iterator));
+
+ g_free(req->search);
+}
+
+static void
pas_backend_file_process_check_connection (PASBackend *backend,
PASBook *book,
PASRequest *req)
@@ -932,6 +1085,10 @@ pas_backend_file_process_client_requests (PASBook *book)
case GetBookView:
pas_backend_file_process_get_book_view (backend, book, req);
break;
+
+ case GetChanges:
+ pas_backend_file_process_get_changes (backend, book, req);
+ break;
}
g_free (req);
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 4cd51237a1..6a8c17a584 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -130,6 +130,30 @@ pas_book_queue_get_book_view (PASBook *book, const Evolution_BookViewListener li
}
static void
+pas_book_queue_get_changes (PASBook *book, const Evolution_BookViewListener listener, const char *search)
+{
+ PASRequest *req;
+ CORBA_Environment ev;
+
+ req = g_new0 (PASRequest, 1);
+ req->op = GetChanges;
+ req->search = g_strdup(search);
+
+ CORBA_exception_init (&ev);
+
+ req->listener = CORBA_Object_duplicate(listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("pas_book_queue_get_changes: Exception "
+ "duplicating BookViewListener!\n");
+ }
+
+ CORBA_exception_free (&ev);
+
+ pas_book_queue_request (book, req);
+}
+
+static void
pas_book_queue_check_connection (PASBook *book)
{
PASRequest *req;
@@ -233,6 +257,17 @@ impl_Evolution_Book_get_book_view (PortableServer_Servant servant,
}
static void
+impl_Evolution_Book_get_changes (PortableServer_Servant servant,
+ const Evolution_BookViewListener listener,
+ const CORBA_char *search,
+ CORBA_Environment *ev)
+{
+ PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
+
+ pas_book_queue_get_changes (book, listener, search);
+}
+
+static void
impl_Evolution_Book_check_connection (PortableServer_Servant servant,
CORBA_Environment *ev)
{
@@ -442,7 +477,7 @@ pas_book_respond_get_cursor (PASBook *book,
}
/**
- * pas_book_respond_get_cursor:
+ * pas_book_respond_get_book_view:
*/
void
pas_book_respond_get_book_view (PASBook *book,
@@ -468,6 +503,32 @@ pas_book_respond_get_book_view (PASBook *book,
}
/**
+ * pas_book_respond_get_changes:
+ */
+void
+pas_book_respond_get_changes (PASBook *book,
+ Evolution_BookListener_CallStatus status,
+ PASBookView *book_view)
+{
+ CORBA_Environment ev;
+ CORBA_Object object;
+
+ CORBA_exception_init (&ev);
+
+ object = bonobo_object_corba_objref(BONOBO_OBJECT(book_view));
+
+ Evolution_BookListener_respond_get_changes (
+ book->priv->listener, status, object, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("pas_book_respond_get_changes: Exception "
+ "responding to BookListener!\n");
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+/**
* pas_book_report_connection:
*/
void
@@ -622,6 +683,7 @@ pas_book_get_epv (void)
epv->get_static_capabilities = impl_Evolution_Book_get_static_capabilities;
epv->get_cursor = impl_Evolution_Book_get_cursor;
epv->get_book_view = impl_Evolution_Book_get_book_view;
+ epv->get_changes = impl_Evolution_Book_get_changes;
return epv;
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index 9ca81eb25d..ab59d7bb3e 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -29,6 +29,7 @@ typedef enum {
ModifyCard,
GetCursor,
GetBookView,
+ GetChanges,
CheckConnection
} PASOperation;
@@ -80,6 +81,9 @@ void pas_book_respond_get_cursor (PASBook
void pas_book_respond_get_book_view (PASBook *book,
Evolution_BookListener_CallStatus status,
PASBookView *book_view);
+void pas_book_respond_get_changes (PASBook *book,
+ Evolution_BookListener_CallStatus status,
+ PASBookView *book_view);
void pas_book_report_connection (PASBook *book,
gboolean connected);
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index 94d48179a6..048422cb7b 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -180,7 +180,6 @@ cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closur
long length;
int i;
- // ctxt->cursor = cursor;
ctxt->address_load_success = TRUE;
length = e_card_cursor_get_length (cursor);
@@ -191,7 +190,7 @@ cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closur
gtk_main_quit(); /* end the sub event loop */
}
else {
- WARN (_("BLARG\n"));
+ WARN (_("Cursor could not be loaded\n"));
gtk_main_quit(); /* end the sub event loop */
}
}
@@ -203,9 +202,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
if (status == E_BOOK_STATUS_SUCCESS) {
e_book_get_cursor (book, "(contains \"full_name\" \"\")", cursor_cb, ctxt);
- }
- else {
- WARN (_("BLARG\n"));
+ } else {
+ WARN (_("EBook not loaded\n"));
gtk_main_quit(); /* end the sub event loop */
}
}
@@ -250,32 +248,11 @@ map_name (EAddrConduitContext *ctxt)
}
static void
-compute_pid (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char *uid)
-{
-/* guint32 *pid; */
-
-/* pid = g_hash_table_lookup (ctxt->map->uid_map, uid); */
-
-/* if (pid) */
-/* local->local.ID = *pid; */
-/* else */
-/* local->local.ID = 0; */
-}
-
-static void
compute_status (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char *uid)
{
local->local.archived = FALSE;
local->local.secret = FALSE;
-
-/* if (g_hash_table_lookup (ctxt->added, uid)) */
-/* local->local.attr = GnomePilotRecordNew; */
-/* else if (g_hash_table_lookup (ctxt->modified, uid)) */
-/* local->local.attr = GnomePilotRecordModified; */
-/* else if (g_hash_table_lookup (ctxt->deleted, uid)) */
-/* local->local.attr = GnomePilotRecordDeleted; */
-/* else */
-/* local->local.attr = GnomePilotRecordNothing; */
+ local->local.attr = GnomePilotRecordNothing;
}
static GnomePilotRecord *
@@ -304,108 +281,58 @@ local_record_to_pilot_record (EAddrLocalRecord *local,
return p;
}
-#if 0
-/*
- * converts a CalComponent object to a EAddrLocalRecord
- */
static void
-local_record_from_comp (EAddrLocalRecord *local, CalComponent *comp, EAddrConduitContext *ctxt)
+local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitContext *ctxt)
{
- const char *uid;
- int *priority;
- struct icaltimetype *completed;
- CalComponentText summary;
- GSList *d_list = NULL;
- CalComponentText *description;
- CalComponentDateTime due;
- time_t due_time;
- CalComponentClassification classif;
-
- LOG ("local_record_from_comp\n");
+ ECardSimple *simple;
+ const ECardDeliveryAddress *delivery;
g_return_if_fail (local != NULL);
- g_return_if_fail (comp != NULL);
-
- local->comp = comp;
+ g_return_if_fail (ecard != NULL);
- cal_component_get_uid (local->comp, &uid);
- compute_pid (ctxt, local, uid);
- compute_status (ctxt, local, uid);
+ local->ecard = ecard;
+ simple = e_card_simple_new (ecard);
+
+ local->local.ID = e_pilot_map_lookup_pid (ctxt->map, ecard->id);
- local->todo = g_new0 (struct ToDo,1);
+ compute_status (ctxt, local, ecard->id);
- /* STOP: don't replace these with g_strdup, since free_ToDo
- uses free to deallocate */
- cal_component_get_summary (comp, &summary);
- if (summary.value)
- local->todo->description = strdup ((char *) summary.value);
+ local->addr = g_new0 (struct Address, 1);
- cal_component_get_description_list (comp, &d_list);
- if (d_list) {
- description = (CalComponentText *) d_list->data;
- if (description && description->value)
- local->todo->note = strdup (description->value);
- else
- local->todo->note = NULL;
- } else {
- local->todo->note = NULL;
- }
+ 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);
- cal_component_get_due (comp, &due);
- if (due.value) {
- due_time = icaltime_as_timet (*due.value);
-
- local->todo->due = *localtime (&due_time);
- local->todo->indefinite = 0;
- } else {
- local->todo->indefinite = 1;
- }
+ 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);
- cal_component_get_completed (comp, &completed);
- if (completed) {
- local->todo->complete = 1;
- cal_component_free_icaltimetype (completed);
- }
+ /* FIX ME Phone numbers */
- cal_component_get_priority (comp, &priority);
- if (priority) {
- local->todo->priority = *priority;
- cal_component_free_priority (priority);
- }
-
- cal_component_get_classification (comp, &classif);
-
- if (classif == CAL_COMPONENT_CLASS_PRIVATE)
- local->local.secret = 1;
- else
- local->local.secret = 0;
-
- local->local.archived = 0;
+ gtk_object_unref (GTK_OBJECT (simple));
}
-#endif
static void
local_record_from_uid (EAddrLocalRecord *local,
char *uid,
EAddrConduitContext *ctxt)
{
-/* CalComponent *comp; */
-/* CalClientGetStatus status; */
+ ECard *ecard;
-/* g_assert(local!=NULL); */
+ g_assert(local!=NULL);
-/* status = cal_client_get_object (ctxt->client, uid, &comp); */
+ ecard = e_book_get_card (ctxt->ebook, uid);
-/* if (status == CAL_CLIENT_GET_SUCCESS) { */
-/* local_record_from_comp (local, comp, ctxt); */
-/* } else if (status == CAL_CLIENT_GET_NOT_FOUND) { */
-/* comp = cal_component_new (); */
-/* cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); */
-/* cal_component_set_uid (comp, uid); */
-/* local_record_from_comp (local, comp, ctxt); */
-/* } else { */
-/* INFO ("Object did not exist"); */
-/* } */
+ if (ecard != NULL) {
+ local_record_from_ecard (local, ecard, ctxt);
+ } else {
+ ecard = e_card_new (NULL);
+ local_record_from_ecard (local, ecard, ctxt);
+ }
}
static ECard *
@@ -429,11 +356,10 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
if (in_card == NULL) {
ecard = e_card_new("");
- simple = e_card_simple_new(ecard);
} else {
- ecard = in_card;
- simple = E_CARD_SIMPLE (ecard);
+ ecard = e_card_duplicate (in_card);
}
+ simple = e_card_simple_new (ecard);
#define get(pilotprop) \
(address.entry [(pilotprop)])
@@ -518,86 +444,12 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
return ecard;
}
-#if 0
-static CalComponent *
-comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
- GnomePilotRecord *remote,
- CalComponent *in_comp)
-{
- CalComponent *comp;
- struct ToDo todo;
- struct icaltimetype now = icaltime_from_timet (time (NULL), FALSE, FALSE);
- CalComponentText summary = {NULL, NULL};
- CalComponentText description = {NULL, NULL};
- CalComponentDateTime dt = {NULL, NULL};
- struct icaltimetype due;
- GSList *d_list;
-
- g_return_val_if_fail (remote != NULL, NULL);
-
- memset (&todo, 0, sizeof (struct ToDo));
- unpack_ToDo (&todo, remote->record, remote->length);
-
- if (in_comp == NULL) {
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
- cal_component_set_created (comp, &now);
- } else {
- comp = cal_component_clone (in_comp);
- }
-
- LOG (" comp_from_remote_record: "
- "creating from remote %s and comp %s\n",
- print_remote (remote), cal_component_get_as_string (comp));
-
- cal_component_set_last_modified (comp, &now);
-
- summary.value = todo.description;
- cal_component_set_summary (comp, &summary);
-
- description.value = todo.note;
- d_list = g_slist_append (NULL, &description);
- cal_component_set_comment_list (comp, d_list);
- g_slist_free (d_list);
-
- if (todo.complete) {
- int percent = 100;
- cal_component_set_completed (comp, &now);
- cal_component_set_percent (comp, &percent);
- }
-
- /* FIX ME This is a bit hackish, how else can we tell if there is
- * no due date set?
- */
- if (todo.due.tm_sec || todo.due.tm_min || todo.due.tm_hour
- || todo.due.tm_mday || todo.due.tm_mon || todo.due.tm_year) {
- due = icaltime_from_timet (mktime (&todo.due), FALSE, FALSE);
- dt.value = &due;
- cal_component_set_due (comp, &dt);
- }
-
- cal_component_set_priority (comp, &todo.priority);
- cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE);
-
- if (remote->attr & dlpRecAttrSecret)
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE);
- else
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC);
-
- cal_component_commit_sequence (comp);
-
- free_ToDo(&todo);
-
- return comp;
-}
-#endif
-
static void
check_for_slow_setting (GnomePilotConduit *c, EAddrConduitContext *ctxt)
{
int count, map_count;
-/* count = g_list_length (ctxt->uids); */
+ count = g_list_length (ctxt->cards);
count = 0;
map_count = g_hash_table_size (ctxt->map->pid_map);
@@ -671,7 +523,7 @@ pre_sync (GnomePilotConduit *conduit,
unpack_AddressAppInfo (&(ctxt->ai), buf, len);
g_free (buf);
-/* check_for_slow_setting (conduit, ctxt); */
+ check_for_slow_setting (conduit, ctxt);
return 0;
}
@@ -707,6 +559,16 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
}
static gint
+set_status_cleared (GnomePilotConduitSyncAbs *conduit,
+ EAddrLocalRecord *local,
+ EAddrConduitContext *ctxt)
+{
+ LOG ("set_status_cleared: clearing status\n");
+
+ return 0;
+}
+
+static gint
for_each (GnomePilotConduitSyncAbs *conduit,
EAddrLocalRecord **local,
EAddrConduitContext *ctxt)
@@ -877,23 +739,6 @@ add_record (GnomePilotConduitSyncAbs *conduit,
}
static gint
-add_archive_record (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- GnomePilotRecord *remote,
- EAddrConduitContext *ctxt)
-{
- int retval = 0;
-
- g_return_val_if_fail (remote != NULL, -1);
- g_return_val_if_fail (local != NULL, -1);
-
- LOG ("add_archive_record: doing nothing with %s\n",
- print_local (local));
-
- return retval;
-}
-
-static gint
replace_record (GnomePilotConduitSyncAbs *conduit,
EAddrLocalRecord *local,
GnomePilotRecord *remote,
@@ -944,16 +789,17 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
}
static gint
-delete_archive_record (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- EAddrConduitContext *ctxt)
+archive_record (GnomePilotConduitSyncAbs *conduit,
+ EAddrLocalRecord *local,
+ gboolean archive,
+ EAddrConduitContext *ctxt)
{
int retval = 0;
- g_return_val_if_fail(local!=NULL,-1);
-
- LOG ("delete_archive_record: doing nothing\n");
+ g_return_val_if_fail (local != NULL, -1);
+ LOG ("archive_record: %s\n", archive ? "yes" : "no");
+
return retval;
}
@@ -1079,18 +925,16 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, ctxt);
gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt);
+ gtk_signal_connect (retval, "set_status_cleared", (GtkSignalFunc) set_status_cleared, ctxt);
gtk_signal_connect (retval, "for_each", (GtkSignalFunc) for_each, ctxt);
gtk_signal_connect (retval, "for_each_modified", (GtkSignalFunc) for_each_modified, ctxt);
gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt);
gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt);
- gtk_signal_connect (retval, "add_archive_record", (GtkSignalFunc) add_archive_record, ctxt);
-
gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt);
-
gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt);
- gtk_signal_connect (retval, "delete_archive_record", (GtkSignalFunc) delete_archive_record, ctxt);
+ gtk_signal_connect (retval, "archive_record", (GtkSignalFunc) archive_record, ctxt);
gtk_signal_connect (retval, "match", (GtkSignalFunc) match, ctxt);
gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);