From dd896b147626e3f19477d1d19111fb691dbe45bd Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 27 Nov 2000 20:30:51 +0000 Subject: Remove "complete" field 2000-11-27 JP Rosevear * conduit/address-conduit.h: Remove "complete" field * conduit/address-conduit.c (print_local): Make it print useful debug info (print_remote): ditto (local_record_from_ecard): Make sure phone numbers get out to the pilot (ecard_from_remote_record): Set phone strings to "" if they are null (sequence_complete): unref the book view (view_cb): ref the book view (free_prepare): do nothing * backend/pas/pas-backend-file.c (pas_backend_file_book_view_free): Destroy the card lists with the rest of the view. (pas_backend_file_changes): Don't destroy the card lists here (pas_backend_file_book_view_free): Free the card/id lists in the change context here, the correct place. (pas_backend_file_changes): instead of here... 2000-11-27 JP Rosevear * conduits/todo/todo-conduit.c (free_prepare): Ditto * conduits/calendar/calendar-conduit.c (free_prepare): Adjust free_prepare to the correct signal parameters. Don't actually do anything - there is a semantic discrepancy that needs to be resolved. 2000-11-27 JP Rosevear * providers/local/.cvsignore: shush svn path=/trunk/; revision=6681 --- addressbook/ChangeLog | 20 ++++ addressbook/backend/pas/pas-backend-file.c | 32 ++++--- addressbook/conduit/Makefile.am | 3 +- addressbook/conduit/address-conduit.c | 130 ++++++++++++++------------ addressbook/conduit/address-conduit.h | 1 - calendar/ChangeLog | 9 ++ calendar/conduits/calendar/calendar-conduit.c | 7 +- calendar/conduits/todo/todo-conduit.c | 9 +- camel/ChangeLog | 4 + camel/providers/local/.cvsignore | 7 ++ 10 files changed, 134 insertions(+), 88 deletions(-) create mode 100644 camel/providers/local/.cvsignore diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 154e812ee3..8aff64f30d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,23 @@ +2000-11-27 JP Rosevear + + * conduit/address-conduit.h: Remove "complete" field + + * conduit/address-conduit.c (print_local): Make it print useful debug + info + (print_remote): ditto + (local_record_from_ecard): Make sure phone numbers get out to the pilot + (ecard_from_remote_record): Set phone strings to "" if they are null + (sequence_complete): unref the book view + (view_cb): ref the book view + (free_prepare): do nothing + + * backend/pas/pas-backend-file.c (pas_backend_file_book_view_free): + Destroy the card lists with the rest of the view. + (pas_backend_file_changes): Don't destroy the card lists here + (pas_backend_file_book_view_free): Free the card/id lists in the + change context here, the correct place. + (pas_backend_file_changes): instead of here... + 2000-11-22 Christopher James Lahey * backend/pas/pas-backend-file.c: Set view.change_context to NULL diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index d0ace222ad..2ff9d1164e 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -119,8 +119,24 @@ pas_backend_file_book_view_free(PASBackendFileBookView *book_view, void *closure if (book_view->search_sexp) gtk_object_unref(GTK_OBJECT(book_view->search_sexp)); g_free(book_view->search_context); + g_free(book_view->change_id); + if (book_view->change_context) { + g_list_foreach (book_view->change_context->add_cards, (GFunc)g_free, NULL); + g_list_foreach (book_view->change_context->add_ids, (GFunc)g_free, NULL); + g_list_foreach (book_view->change_context->mod_cards, (GFunc)g_free, NULL); + g_list_foreach (book_view->change_context->mod_ids, (GFunc)g_free, NULL); + g_list_foreach (book_view->change_context->del_cards, (GFunc)g_free, NULL); + g_list_foreach (book_view->change_context->del_ids, (GFunc)g_free, NULL); + g_list_free (book_view->change_context->add_cards); + g_list_free (book_view->change_context->add_ids); + g_list_free (book_view->change_context->mod_cards); + g_list_free (book_view->change_context->mod_ids); + g_list_free (book_view->change_context->del_cards); + g_list_free (book_view->change_context->del_ids); + } g_free(book_view->change_context); + g_free(book_view); } @@ -546,11 +562,11 @@ pas_backend_file_changes (PASBackendFile *bf, const PASBackendFileBookView *cnstview) { int db_error = 0; - DB *db = bf->priv->file_db; DBT id_dbt, vcard_dbt; char *filename; EDbHash *ehash; GList *i, *v; + DB *db = bf->priv->file_db; PASBackendFileBookView *view = (PASBackendFileBookView *)cnstview; PASBackendFileChangeContext *ctx = cnstview->change_context; @@ -628,20 +644,6 @@ pas_backend_file_changes (PASBackendFile *bf, 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 (ctx->add_cards, (GFunc)g_free, NULL); - g_list_foreach (ctx->add_ids, (GFunc)g_free, NULL); - g_list_foreach (ctx->mod_cards, (GFunc)g_free, NULL); - g_list_foreach (ctx->mod_ids, (GFunc)g_free, NULL); - g_list_foreach (ctx->del_cards, (GFunc)g_free, NULL); - g_list_foreach (ctx->del_ids, (GFunc)g_free, NULL); - g_list_free (ctx->add_cards); - g_list_free (ctx->add_ids); - g_list_free (ctx->mod_cards); - g_list_free (ctx->mod_ids); - g_list_free (ctx->del_cards); - g_list_free (ctx->del_ids); } static char * diff --git a/addressbook/conduit/Makefile.am b/addressbook/conduit/Makefile.am index 21ac3bbe68..05b4112f68 100644 --- a/addressbook/conduit/Makefile.am +++ b/addressbook/conduit/Makefile.am @@ -38,9 +38,10 @@ libeaddress_conduit_la_LIBADD = \ $(top_builddir)/e-util/ename/libename-static.la \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/e-util/libeconduit-static.la \ + $(GNOME_PILOT_LIBS) \ + $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ $(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 29907f72e0..b1b3fa7bdd 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -89,7 +89,7 @@ typedef struct CardObjectChangeType type; } CardObjectChange; -/* debug spew DELETE ME */ +/* Debug routines */ static char * print_local (EAddrLocalRecord *local) { @@ -100,22 +100,17 @@ print_local (EAddrLocalRecord *local) return buff; } -/* if (local->addr && local->addr->description) { */ -/* sprintf (buff, "[%d %ld %d %d '%s' '%s']", */ -/* local->todo->indefinite, */ -/* mktime (& local->todo->due), */ -/* local->todo->priority, */ -/* local->todo->complete, */ -/* local->todo->description, */ -/* local->todo->note); */ -/* return buff; */ -/* } */ + if (local->addr) { + sprintf (buff, "['%s' '%s' '%s']", + local->addr->entry[entryLastname], + local->addr->entry[entryFirstname], + local->addr->entry[entryCompany]); + return buff; + } return ""; } - -/* debug spew DELETE ME */ static char *print_remote (GnomePilotRecord *remote) { static char buff[ 4096 ]; @@ -129,14 +124,10 @@ static char *print_remote (GnomePilotRecord *remote) memset (&addr, 0, sizeof (struct Address)); unpack_Address (&addr, remote->record, remote->length); - sprintf (buff, "Hi"); -/* sprintf (buff, "[%d %ld %d %d '%s' '%s']", */ -/* todo.indefinite, */ -/* mktime (& todo.due), */ -/* todo.priority, */ -/* todo.complete, */ -/* todo.description, */ -/* todo.note); */ + sprintf (buff, "['%s' '%s' '%s']", + addr.entry[entryLastname], + addr.entry[entryFirstname], + addr.entry[entryCompany]); return buff; } @@ -148,8 +139,6 @@ 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); } @@ -278,7 +267,7 @@ local_record_to_pilot_record (EAddrLocalRecord *local, g_return_val_if_fail (local != NULL, NULL); g_assert (local->addr != NULL ); - LOG ("local_record_to_remote_record\n"); + LOG ("local_record_to_pilot_record\n"); p = g_new0 (GnomePilotRecord, 1); @@ -300,7 +289,9 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont { ECardSimple *simple; const ECardDeliveryAddress *delivery; - + int phone = entryPhone1; + int i; + g_return_if_fail (local != NULL); g_return_if_fail (ecard != NULL); @@ -331,7 +322,34 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont local->addr->entry[entryCountry] = strdup (delivery->country); } - /* FIX ME Phone numbers */ + for (i = 0; i <= 7; i++) { + const char *phone_str = NULL; + char *phonelabel = ctxt->ai.phoneLabels[i]; + + if (!strcmp (phonelabel, "E-mail")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_EMAIL); + else if (!strcmp (phonelabel, "Home")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_HOME); + else if (!strcmp (phonelabel, "Work")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS); + else if (!strcmp (phonelabel, "Fax")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX); + else if (!strcmp (phonelabel, "Other")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER); + else if (!strcmp (phonelabel, "Main")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY); + else if (!strcmp (phonelabel, "Pager")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER); + else if (!strcmp (phonelabel, "Mobile")) + phone_str = e_card_simple_get_const (simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE); + + if (phone_str) { + local->addr->entry[phone] = strdup (phone_str); + local->addr->phoneLabel[phone - entryPhone1] = i; + phone++; + } + + } gtk_object_unref (GTK_OBJECT (simple)); } @@ -433,34 +451,34 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, if (check (entryCompany)) e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ORG, get (entryCompany)); - for (i = entryPhone1; i <= entryPhone5; i ++) { - if (address.entry [i] && *(address.entry [i])) { - char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]]; - if (!strcmp (phonelabel, "E-mail")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, address.entry[i]); - else if (!strcmp (phonelabel, "Home")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_HOME, address.entry[i]); - else if (!strcmp (phonelabel, "Work")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, address.entry[i]); - else if (!strcmp (phonelabel, "Fax")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, address.entry[i]); - else if (!strcmp (phonelabel, "Other")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER, address.entry[i]); - else if (!strcmp (phonelabel, "Main")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, address.entry[i]); - else if (!strcmp (phonelabel, "Pager")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER, address.entry[i]); - else if (!strcmp (phonelabel, "Mobile")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE, address.entry[i]); - } + for (i = entryPhone1; i <= entryPhone5; i++) { + char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]]; + + if (!strcmp (phonelabel, "E-mail")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Home")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_HOME,address.entry[i] ? address.entry[i] : "" ); + else if (!strcmp (phonelabel, "Work")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Fax")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Other")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Main")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Pager")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER, address.entry[i] ? address.entry[i] : ""); + else if (!strcmp (phonelabel, "Mobile")) + e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE, address.entry[i] ? address.entry[i] : ""); } #undef get -#undef set - - free_Address(&address); +#undef check + e_card_simple_sync_card (simple); gtk_object_unref(GTK_OBJECT(simple)); + free_Address(&address); + return ecard; } @@ -535,13 +553,15 @@ card_removed (EBookView *book_view, const char *id, EAddrConduitContext *ctxt) static void sequence_complete (EBookView *book_view, EAddrConduitContext *ctxt) { - ctxt->complete = TRUE; - gtk_main_quit (); + gtk_object_unref (GTK_OBJECT (book_view)); + gtk_main_quit (); } static void view_cb (EBook *book, EBookStatus status, EBookView *book_view, EAddrConduitContext *ctxt) { + gtk_object_ref (GTK_OBJECT (book_view)); + gtk_signal_connect (GTK_OBJECT (book_view), "card_added", (GtkSignalFunc) card_added, ctxt); gtk_signal_connect (GTK_OBJECT (book_view), "card_changed", @@ -593,7 +613,6 @@ pre_sync (GnomePilotConduit *conduit, /* Force the view loading to be synchronous */ gtk_main (); - g_free (change_id); /* Set the count information */ @@ -966,18 +985,13 @@ prepare (GnomePilotConduitSyncAbs *conduit, static gint free_prepare (GnomePilotConduitSyncAbs *conduit, - EAddrLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, EAddrConduitContext *ctxt) { LOG ("free_prepare: freeing\n"); - g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); - g_free (*remote); - *remote = NULL; - return 0; } diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h index 9f0af7d293..8b901a5da7 100644 --- a/addressbook/conduit/address-conduit.h +++ b/addressbook/conduit/address-conduit.h @@ -61,7 +61,6 @@ struct _EAddrConduitContext { GList *cards; GList *changed; GHashTable *changed_hash; - gboolean complete; gboolean address_load_tried; gboolean address_load_success; diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 0fae81da76..c105c036cb 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2000-11-27 JP Rosevear + + * conduits/todo/todo-conduit.c (free_prepare): Ditto + + * conduits/calendar/calendar-conduit.c (free_prepare): Adjust + free_prepare to the correct signal parameters. Don't actually + do anything - there is a semantic discrepancy that needs to be + resolved. + 2000-11-26 Damon Chaplin * gui/e-day-view.c (e_day_view_set_days_shown): == instead of =. diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 7341d7a292..6e903b14f1 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -1046,18 +1046,13 @@ prepare (GnomePilotConduitSyncAbs *conduit, static gint free_prepare (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, ECalConduitContext *ctxt) { LOG ("free_prepare: freeing\n"); - g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); - g_free (*remote); - *remote = NULL; - return 0; } diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index b41dead5cc..0884af229d 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -269,7 +269,7 @@ local_record_to_pilot_record (EToDoLocalRecord *local, g_assert (local->comp != NULL); g_assert (local->todo != NULL ); - LOG ("local_record_to_remote_record\n"); + LOG ("local_record_to_pilot_record\n"); p = g_new0 (GnomePilotRecord, 1); @@ -920,18 +920,13 @@ prepare (GnomePilotConduitSyncAbs *conduit, static gint free_prepare (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, EToDoConduitContext *ctxt) { LOG ("free_prepare: freeing\n"); - g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); - g_free (*remote); - *remote = NULL; - return 0; } diff --git a/camel/ChangeLog b/camel/ChangeLog index eec2b98347..3a0310c555 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,7 @@ +2000-11-27 JP Rosevear + + * providers/local/.cvsignore: shush + 2000-11-27 Not Zed * providers/Makefile.am: Removed mh, mbox, added local, to the default. diff --git a/camel/providers/local/.cvsignore b/camel/providers/local/.cvsignore new file mode 100644 index 0000000000..fd6b811c68 --- /dev/null +++ b/camel/providers/local/.cvsignore @@ -0,0 +1,7 @@ +.deps +Makefile +Makefile.in +.libs +.deps +*.lo +*.la -- cgit v1.2.3