diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-10-24 06:18:44 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-10-24 06:18:44 +0800 |
commit | ecb43703f84f5ec6b43b8f5b1ee7fa363e144af8 (patch) | |
tree | aea6396dcb01489f88f47e7fa7e58deedd04a6c8 /addressbook/conduit | |
parent | 50a68e6b6b60eb6fbf35129867002ef722182ce2 (diff) | |
download | gsoc2013-evolution-ecb43703f84f5ec6b43b8f5b1ee7fa363e144af8.tar.gz gsoc2013-evolution-ecb43703f84f5ec6b43b8f5b1ee7fa363e144af8.tar.zst gsoc2013-evolution-ecb43703f84f5ec6b43b8f5b1ee7fa363e144af8.zip |
Use new libeconduit calls and abstraction
2000-10-23 JP Rosevear <jpr@helixcode.com>
* conduit/address-conduit.h: Use new libeconduit calls and
abstraction
* conduit/address-conduit.c: ditto
2000-10-23 JP Rosevear <jpr@helixcode.com>
* conduits/todo/todo-conduit.h: Use new libeconduit calls and
abstraction
* conduits/calendar/calendar-conduit.c: ditto
* conduits/calendar/calendar-conduit.h: ditto
* conduits/todo/todo-conduit.c: ditto
* conduits/calendar/Makefile.am: Add libeconduit-static.la
* conduits/calendar/calendar-conduit.c (post_sync): Use e_pilot_map_write
(pre_sync): Use e_pilot_map_read
2000-10-23 JP Rosevear <jpr@helixcode.com>
* e-pilot-map.c: Operate with EPilotMap structure so things are
abstract to the caller
(e_pilot_map_pid_is_archived): Infrastructure for marking records
as archived
(e_pilot_map_uid_is_archived): ditto
* e-pilot-map.h: Add more to public interface, including EPilotMap
structure
svn path=/trunk/; revision=6134
Diffstat (limited to 'addressbook/conduit')
-rw-r--r-- | addressbook/conduit/address-conduit.c | 29 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.h | 7 |
2 files changed, 9 insertions, 27 deletions
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index a0b327e977..94d48179a6 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -42,7 +42,6 @@ #include <ebook/e-card-cursor.h> #include <ebook/e-card.h> #include <ebook/e-card-simple.h> -#include <e-pilot-map.h> #define ADDR_CONFIG_LOAD 1 #define ADDR_CONFIG_DESTROY 1 @@ -255,7 +254,7 @@ compute_pid (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char *uid { /* guint32 *pid; */ -/* pid = g_hash_table_lookup (ctxt->uid_map, uid); */ +/* pid = g_hash_table_lookup (ctxt->map->uid_map, uid); */ /* if (pid) */ /* local->local.ID = *pid; */ @@ -601,7 +600,7 @@ check_for_slow_setting (GnomePilotConduit *c, EAddrConduitContext *ctxt) /* count = g_list_length (ctxt->uids); */ count = 0; - map_count = g_hash_table_size (ctxt->pid_map); + map_count = g_hash_table_size (ctxt->map->pid_map); /* If there are no objects or objects but no log */ if ((count == 0) || (count > 0 && map_count == 0)) { @@ -642,11 +641,8 @@ pre_sync (GnomePilotConduit *conduit, } /* Load the uid <--> pilot id mappings */ - ctxt->pid_map = g_hash_table_new (g_int_hash, g_int_equal); - ctxt->uid_map = g_hash_table_new (g_str_hash, g_str_equal); - filename = map_name (ctxt); - e_pilot_map_read (filename, ctxt->pid_map, ctxt->uid_map, &ctxt->since); + e_pilot_map_read (filename, &ctxt->map); g_free (filename); /* Set the count information */ @@ -691,7 +687,7 @@ post_sync (GnomePilotConduit *conduit, LOG ("---------------------------------------------------------\n"); filename = map_name (ctxt); - e_pilot_map_write (filename, ctxt->pid_map); + e_pilot_map_write (filename, ctxt->map); g_free (filename); return 0; @@ -703,15 +699,9 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit, guint32 ID, EAddrConduitContext *ctxt) { - char *new_uid; - guint32 *pid = g_new (guint32, 1); - LOG ("set_pilot_id: setting to %d\n", ID); - *pid = ID; - new_uid = g_strdup (local->ecard->id); - g_hash_table_insert (ctxt->pid_map, pid, new_uid); - g_hash_table_insert (ctxt->uid_map, new_uid, pid); + e_pilot_map_insert (ctxt->map, ID, local->ecard->id, FALSE); return 0; } @@ -858,8 +848,6 @@ add_record (GnomePilotConduitSyncAbs *conduit, EAddrConduitContext *ctxt) { ECard *ecard; - char *new_uid; - guint32 *pid = g_new (guint32, 1); add_card_cons cons; int retval = 0; @@ -883,10 +871,7 @@ add_record (GnomePilotConduitSyncAbs *conduit, e_book_get_card (ctxt->ebook, cons.id)); g_free (cons.id); - *pid = remote->ID; - new_uid = g_strdup (ecard->id); - g_hash_table_insert (ctxt->pid_map, pid, new_uid); - g_hash_table_insert (ctxt->uid_map, new_uid, pid); + e_pilot_map_insert (ctxt->map, remote->ID, ecard->id, FALSE); return retval; } @@ -987,7 +972,7 @@ match (GnomePilotConduitSyncAbs *conduit, g_return_val_if_fail (remote != NULL, -1); /* *local = NULL; */ -/* uid = g_hash_table_lookup (ctxt->pid_map, &remote->ID); */ +/* uid = g_hash_table_lookup (ctxt->map->pid_map, &remote->ID); */ /* if (!uid) */ /* return 0; */ diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h index 55142d08c2..141ec1b53c 100644 --- a/addressbook/conduit/address-conduit.h +++ b/addressbook/conduit/address-conduit.h @@ -32,7 +32,7 @@ #include <pi-address.h> #include <gpilotd/gnome-pilot-conduit.h> #include <gpilotd/gnome-pilot-conduit-sync-abs.h> - +#include <e-pilot-map.h> /* This is the local record structure for the Evolution ToDo conduit. */ typedef struct _EAddrLocalRecord EAddrLocalRecord; @@ -63,10 +63,7 @@ struct _EAddrConduitContext { gboolean address_load_tried; gboolean address_load_success; - time_t since; - - GHashTable *uid_map; - GHashTable *pid_map; + EPilotMap *map; }; #endif __ADDR_CONDUIT_H__ |