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/conduit/Makefile.am | 3 +- addressbook/conduit/address-conduit.c | 130 +++++++++++++++++++--------------- addressbook/conduit/address-conduit.h | 1 - 3 files changed, 74 insertions(+), 60 deletions(-) (limited to 'addressbook/conduit') 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; -- cgit v1.2.3