From e68394b0d08bd873b39829da8a54ba08177b76e8 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 9 Apr 2004 17:29:51 +0000 Subject: use the new e_destination_export_to_vcard_attribute call to build up the 2004-04-09 Chris Toshok * importers/evolution-ldif-importer.c (resolve_list_card): use the new e_destination_export_to_vcard_attribute call to build up the attributes. * importers/evolution-vcard-importer.c (process_item_fn): if we're importing a vcard that we wrote out previously containing xml in the EMAIL attributes, DTRT and strip it out and use e_destination_export_to_vcard_attribute to build up the proper attribute. * util/Makefile.am (libeabutil_la_SOURCES): remove eab-destination.[ch] and add e-destination.[ch]. * printing/e-contact-print.c (e_contact_print_contact): we don't have to worry about the "e. (contact_list_model_dispose): we're not a GtkObject, we're a GObject. rename _destroy to _dispose, and chain up to the parent class's ::dispose. (e_contact_list_model_class_init): GtkObject -> GObject, and destroy -> dispose. (e_contact_list_model_init): GtkObject -> GObject, and EAB -> E. (e_contact_list_model_add_destination): EAB -> E. (e_contact_list_model_add_email): same. (e_contact_list_model_add_contact): same. (e_contact_list_model_get_destination): same. * gui/contact-list-editor/e-contact-list-editor.c (table_drag_data_received_cb): add email num arg to e_contact_list_model_add_contact. (extract_info): fill in the vcard attributes instead of just generating xml. (fill_in_info): extract the values from the vcard attributes. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_insert_length): eab->e, and don't sometimes copy, sometimes ::new. always ::new. (e_select_names_text_model_delete): same. (e_select_names_text_model_obj_count): same. (nth_obj_index): same. * gui/component/select-names/e-select-names-table-model.c (fill_in_info): eab -> e. * gui/component/select-names/e-select-names-popup.c (make_contact_editor_cb): eab -> e. (change_email_num_cb): same. (toggle_html_mail_cb): same. (populate_popup_contact): same, and remove code that checks for e. (populate_popup_nocontact): same. (e_select_names_populate_popup): same. * gui/component/select-names/e-select-names-model.h: eab -> e, and remove prototypes for nuked functions. * gui/component/select-names/e-select-names-model.c (destination_changed_proxy, send_changed, connect_destination, disconnect_destination): nuke. (e_select_names_model_duplicate): EAB -> E. (e_select_names_model_get_textification): same. (e_select_names_model_get_address_text): same. (e_select_names_model_get_destination): same. (e_select_names_model_export_destinationv): same. (send_changed): same. (e_select_names_model_import_destinationv): same. (e_select_names_model_get_contact): same. (e_select_names_model_contains): same. (e_select_names_model_insert): same, and remove call to connect_destination. (e_select_names_model_append): same. (e_select_names_model_replace): same, and remove call to disconnect/connect_destination. (e_select_names_model_delete): same. (delete_all_iter): nuke. (e_select_names_model_delete_all): use g_object_unref for the foreach call. (e_select_names_model_merge): EAB -> E. (e_select_names_model_name_pos): same. (e_select_names_model_name_pos): same. (e_select_names_model_load_all_contacts): nuke. (e_select_names_model_cancel_all_contact_load): nuke. * gui/component/select-names/e-select-names-manager.c (clean_cb, focus_in_cb, focus_out_cb, completion_popup_cb): nuke. (completion_handler): EAB -> E, and the signals are gone. * gui/component/select-names/e-select-names-completion.c: in general, s/eab_dest/e_dest and s/EABDest/EDest. (e_select_names_completion_got_book_view_cb): move the e_book_view_start to below the assignment of sequence_complete_received, just to put my mind at ease. (e_select_names_completion_stop_query): un-#if notyet the call to e_book_cancel. (e_select_names_completion_start_query): free the waiting_query before assigning to it. * gui/component/select-names/e-select-names-bonobo.c (entry_set_property_fn): remove calls to e_select_names_model_load_all_contacts, since that function is dead. * gui/component/addressbook-migrate.c (setup_progress_dialog): take the label to display to the user as an arg. (migrate_contact_lists_for_local_folders): loop over all contacts in all local addressbooks looking for ones that have #include #include -#include +#include #define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory" #define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_Importer" @@ -353,7 +353,8 @@ getNextLDIFEntry( FILE *f ) static void resolve_list_card (LDIFImporter *gci, EContact *contact) { - GList *email, *l, *new_email = NULL; + GList *email, *l; + GList *email_attrs = NULL; char *full_name; /* set file_as to full_name so we don't later try and figure @@ -372,26 +373,26 @@ resolve_list_card (LDIFImporter *gci, EContact *contact) /* break list chains here, since we don't support them just yet */ if (dn_contact && !e_contact_get (dn_contact, E_CONTACT_IS_LIST)) { - EABDestination *dest; - gchar *dest_xml; + EDestination *dest; + EVCardAttribute *attr = e_vcard_attribute_new (NULL, EVC_EMAIL); /* Hard-wired for default e-mail, since netscape only exports 1 email address */ - dest = eab_destination_new (); - eab_destination_set_contact (dest, dn_contact, 0); - dest_xml = eab_destination_export (dest); + dest = e_destination_new (); + e_destination_set_contact (dest, dn_contact, 0); + + e_destination_export_to_vcard_attribute (dest, attr); + g_object_unref (dest); - if (dest_xml) { - new_email = g_list_append (new_email, dest_xml); - } + email_attrs = g_list_append (email_attrs, attr); } } - e_contact_set (contact, E_CONTACT_EMAIL, new_email); + e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs); g_list_foreach (email, (GFunc) g_free, NULL); g_list_free (email); - g_list_foreach (new_email, (GFunc) g_free, NULL); - g_list_free (new_email); + g_list_foreach (email_attrs, (GFunc) e_vcard_attribute_free, NULL); + g_list_free (email_attrs); } static GList * diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 83bec58892..f457cefafc 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -40,13 +40,13 @@ #include #include - #include #include #include #include #include +#include #define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory" #define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_Importer" @@ -70,6 +70,7 @@ process_item_fn (EvolutionImporter *importer, VCardImporter *gci = (VCardImporter *) closure; EContact *contact; EContactPhoto *photo; + GList *attrs, *attr; if (gci->iterator == NULL) gci->iterator = gci->contactlist; @@ -105,6 +106,25 @@ process_item_fn (EvolutionImporter *importer, e_contact_photo_free (photo); } + /* Deal with our XML EDestination stuff in EMAIL attributes, if there is any. */ + attrs = e_contact_get_attributes (contact, E_CONTACT_EMAIL); + for (attr = attrs; attr; attr = attr->next) { + EVCardAttribute *a = attr->data; + GList *v = e_vcard_attribute_get_values (a); + + if (v && v->data) { + if (!strncmp ((char*)v->data, "data); + + e_destination_export_to_vcard_attribute (dest, a); + + g_object_unref (dest); + + } + } + } + e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs); + /* FIXME Error checking */ e_book_add_contact (gci->book, contact, NULL); -- cgit v1.2.3