diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-11-28 04:30:51 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-11-28 04:30:51 +0800 |
commit | dd896b147626e3f19477d1d19111fb691dbe45bd (patch) | |
tree | 84ad8db9773b2fbdec8c4d9e1e4144a74b38b2dd /addressbook | |
parent | f0770f394c98335e3944a4d2af7fea7fbccf6200 (diff) | |
download | gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar.gz gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar.bz2 gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar.lz gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar.xz gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.tar.zst gsoc2013-evolution-dd896b147626e3f19477d1d19111fb691dbe45bd.zip |
Remove "complete" field
2000-11-27 JP Rosevear <jpr@helixcode.com>
* 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 <jpr@helixcode.com>
* 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 <jpr@helixcode.com>
* providers/local/.cvsignore: shush
svn path=/trunk/; revision=6681
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 20 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-file.c | 32 | ||||
-rw-r--r-- | addressbook/conduit/Makefile.am | 3 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 130 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.h | 1 |
5 files changed, 111 insertions, 75 deletions
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 <jpr@helixcode.com> + + * 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 <clahey@helixcode.com> * 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; |