diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-28 03:32:10 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-28 03:32:10 +0800 |
commit | e5315bc0c4faa64bf721d5b987e565e57733e5b7 (patch) | |
tree | 6f763510987af847859db16a5c5b4813371e9844 /addressbook | |
parent | 319063bd03c95cfcced8dbeb6d755859d4490c36 (diff) | |
download | gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar.gz gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar.bz2 gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar.lz gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar.xz gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.tar.zst gsoc2013-evolution-e5315bc0c4faa64bf721d5b987e565e57733e5b7.zip |
Migrate pilot data. (migrate_pilot_data): Oops. Apparently the addressbook
2004-04-27 Jeffrey Stedfast <fejj@ximian.com>
* gui/component/addressbook-migrate.c (addressbook_migrate):
Migrate pilot data.
(migrate_pilot_data): Oops. Apparently the addressbook didn't
change the format of the changelog file from db3 to xml, so fix to
simply copy the file over.
svn path=/trunk/; revision=25639
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 3 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-migrate.c | 46 |
2 files changed, 8 insertions, 41 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index bf053d008d..e17173c57e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -2,6 +2,9 @@ * gui/component/addressbook-migrate.c (addressbook_migrate): Migrate pilot data. + (migrate_pilot_data): Oops. Apparently the addressbook didn't + change the format of the changelog file from db3 to xml, so fix to + simply copy the file over. 2004-04-27 Rodney Dawes <dobey@ximian.com> diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index 9b84e8ba8d..a6b21899bf 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -31,8 +31,6 @@ #include "addressbook-migrate.h" #include "e-destination.h" #include <libebook/e-book-async.h> -#include <libedataserver/e-dbhash.h> -#include <libedataserver/e-xml-hash-utils.h> #include <libgnome/gnome-i18n.h> #include <gal/util/e-util.h> #include <gal/util/e-xml-utils.h> @@ -942,14 +940,6 @@ migrate_company_phone_for_local_folders (MigrationContext *context, ESourceGroup } static void -migrate_pilot_db_key (const char *key, const char *data, gpointer user_data) -{ - EXmlHash *xmlhash = user_data; - - e_xmlhash_add (xmlhash, key, data); -} - -static void migrate_pilot_data (const char *old_path, const char *new_path) { struct dirent *dent; @@ -961,9 +951,11 @@ migrate_pilot_data (const char *old_path, const char *new_path) return; while ((dent = readdir (dir))) { - if (!strncmp (dent->d_name, "pilot-map-", 10) && - ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".xml"))) { - /* pilot map file - src and dest file formats are identical */ + if ((!strncmp (dent->d_name, "pilot-map-", 10) && + ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".xml"))) || + (!strncmp (dent->d_name, "pilot-sync-evolution-addressbook-", 33) && + ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".db")))) { + /* src and dest file formats are identical for both map and changelog files */ unsigned char inbuf[4096]; size_t nread, nwritten; int fd0, fd1; @@ -1017,34 +1009,6 @@ migrate_pilot_data (const char *old_path, const char *new_path) close (fd0); close (fd1); g_free (filename); - } else if (!strncmp (dent->d_name, "pilot-sync-evolution-addressbook-", 33) && - ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".db"))) { - /* src and dest formats differ, src format is db3 while dest format is xml */ - EXmlHash *xmlhash; - EDbHash *dbhash; - struct stat st; - - filename = g_build_filename (old_path, dent->d_name, NULL); - if (stat (filename, &st) == -1) { - g_free (filename); - continue; - } - - dbhash = e_dbhash_new (filename); - g_free (filename); - - filename = g_build_filename (new_path, dent->d_name, NULL); - if (stat (filename, &st) != -1) - unlink (filename); - xmlhash = e_xmlhash_new (filename); - g_free (filename); - - e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash); - - e_dbhash_destroy (dbhash); - - e_xmlhash_write (xmlhash); - e_xmlhash_destroy (xmlhash); } } |