diff options
author | JP Rosevear <jpr@ximian.com> | 2004-02-07 02:19:04 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-02-07 02:19:04 +0800 |
commit | e75aa2712e5ae4df8c42c28df7238bd13e0510e9 (patch) | |
tree | 5522eb431150bbe06275ceba62977f18039ac36a | |
parent | 19789f0e8d22e4898d0ac57ee2cf49ea85952e93 (diff) | |
download | gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar.gz gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar.bz2 gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar.lz gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar.xz gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.tar.zst gsoc2013-evolution-e75aa2712e5ae4df8c42c28df7238bd13e0510e9.zip |
implement (load_file_fn): use g_file_get_contents to get a string we can
2004-02-06 JP Rosevear <jpr@ximian.com>
* importers/evolution-vcard-importer.c (importer_destroy_cb):
implement
(load_file_fn): use g_file_get_contents to get a string we can
convert to a contact list with eab_contact_list_from_string
svn path=/trunk/; revision=24654
-rw-r--r-- | addressbook/ChangeLog | 7 | ||||
-rw-r--r-- | addressbook/importers/evolution-vcard-importer.c | 32 |
2 files changed, 32 insertions, 7 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 400de05d1f..5065372b2c 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,12 @@ 2004-02-06 JP Rosevear <jpr@ximian.com> + * importers/evolution-vcard-importer.c (importer_destroy_cb): + implement + (load_file_fn): use g_file_get_contents to get a string we can + convert to a contact list with eab_contact_list_from_string + +2004-02-06 JP Rosevear <jpr@ximian.com> + * importers/GNOME_Evolution_Addressbook_LDIF_Importer.server.in.in: shlib importer info diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index c794d7854a..45dbacf537 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -42,13 +42,11 @@ #include <libebook/e-book.h> -//#include <e-book-util.h> #include <importer/evolution-importer.h> #include <importer/GNOME_Evolution_Importer.h> #include <widgets/misc/e-source-selector.h> - -#include <e-util/e-path.h> +#include <util/eab-book-util.h> #define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory" #define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_Importer" @@ -211,7 +209,18 @@ static void importer_destroy_cb (gpointer data, GObject *where_object_was) { - /* FIXME Implement */ + VCardImporter *gci = data; + + if (gci->primary) + g_object_unref (gci->primary); + + if (gci->book) + g_object_unref (gci->book); + + g_list_foreach (gci->contactlist, (GFunc) g_object_unref, NULL); + g_list_free (gci->contactlist); + + g_free (gci); } static gboolean @@ -220,7 +229,8 @@ load_file_fn (EvolutionImporter *importer, void *closure) { VCardImporter *gci; - + char *contents; + if (check_file_is_vcard (filename) == FALSE) { return FALSE; } @@ -230,14 +240,22 @@ load_file_fn (EvolutionImporter *importer, gci->iterator = NULL; gci->ready = FALSE; - /* Load the book and the cards */ + /* Load the book */ gci->book = e_book_new (); if (!gci->book) { g_message (G_STRLOC ":Couldn't create EBook."); return FALSE; } e_book_load_source (gci->book, gci->primary, TRUE, NULL); -// gci->cardlist = e_card_load_cards_from_file_with_default_charset(filename, "ISO-8859-1"); + + /* Load the file and the contacts */ + if (!g_file_get_contents (filename, &contents, NULL, NULL)) { + g_message (G_STRLOC ":Couldn't read file."); + return FALSE; + } + gci->contactlist = eab_contact_list_from_string (contents); + g_free (contents); + gci->ready = TRUE; return TRUE; |