aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-10-24 06:18:44 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-10-24 06:18:44 +0800
commitecb43703f84f5ec6b43b8f5b1ee7fa363e144af8 (patch)
treeaea6396dcb01489f88f47e7fa7e58deedd04a6c8 /calendar/conduits/todo
parent50a68e6b6b60eb6fbf35129867002ef722182ce2 (diff)
downloadgsoc2013-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 'calendar/conduits/todo')
-rw-r--r--calendar/conduits/todo/todo-conduit.c36
-rw-r--r--calendar/conduits/todo/todo-conduit.h8
2 files changed, 15 insertions, 29 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 992f36eb0d..9158f55c30 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -41,7 +41,6 @@
#include <pi-dlp.h>
#include <pi-version.h>
#include <libical/src/libical/icaltypes.h>
-#include <e-pilot-map.h>
#define TODO_CONFIG_LOAD 1
#define TODO_CONFIG_DESTROY 1
@@ -220,7 +219,7 @@ compute_pid (EToDoConduitContext *ctxt, EToDoLocalRecord *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;
@@ -470,7 +469,7 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt)
int count, map_count;
count = g_list_length (ctxt->uids);
- 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)) {
@@ -513,12 +512,9 @@ pre_sync (GnomePilotConduit *conduit,
/* Get the local database */
ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_TODO);
- /* 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);
-
+ /* Load the uid <--> pilot id map */
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);
/* Find the added, modified and deleted items */
@@ -528,13 +524,13 @@ pre_sync (GnomePilotConduit *conduit,
ctxt->changed = cal_client_get_changed_uids (ctxt->client,
CALOBJ_TYPE_TODO,
- ctxt->since + 1);
+ ctxt->map->since + 1);
for (l = ctxt->changed; l != NULL; l = l->next) {
CalObjChange *coc = l->data;
switch (coc->type) {
case CALOBJ_UPDATED:
- if (g_hash_table_lookup (ctxt->uid_map, coc->uid))
+ if (g_hash_table_lookup (ctxt->map->uid_map, coc->uid))
g_hash_table_insert (ctxt->modified, coc->uid, coc);
else
g_hash_table_insert (ctxt->added, coc->uid, coc);
@@ -587,7 +583,8 @@ 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);
+ e_pilot_map_destroy (ctxt->map);
g_free (filename);
return 0;
@@ -600,16 +597,11 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
EToDoConduitContext *ctxt)
{
const char *uid;
- char *new_uid;
- guint32 *pid = g_new (guint32, 1);
LOG ("set_pilot_id: setting to %d\n", ID);
cal_component_get_uid (local->comp, &uid);
- *pid = ID;
- new_uid = g_strdup (uid);
- 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, uid, FALSE);
return 0;
}
@@ -757,8 +749,6 @@ add_record (GnomePilotConduitSyncAbs *conduit,
{
CalComponent *comp;
const char *uid;
- char *new_uid;
- guint32 *pid = g_new (guint32, 1);
int retval = 0;
g_return_val_if_fail (remote != NULL, -1);
@@ -768,11 +758,9 @@ add_record (GnomePilotConduitSyncAbs *conduit,
comp = comp_from_remote_record (conduit, remote, NULL);
update_comp (conduit, comp, ctxt);
- *pid = remote->ID;
cal_component_get_uid (comp, &uid);
- new_uid = g_strdup (uid);
- 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, uid, FALSE);
return retval;
}
@@ -866,7 +854,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/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
index ecec89c35a..6e1f109a87 100644
--- a/calendar/conduits/todo/todo-conduit.h
+++ b/calendar/conduits/todo/todo-conduit.h
@@ -33,7 +33,7 @@
#include <gpilotd/gnome-pilot-conduit.h>
#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
#include <cal-client/cal-client.h>
-
+#include <e-pilot-map.h>
/* This is the local record structure for the Evolution ToDo conduit. */
typedef struct _EToDoLocalRecord EToDoLocalRecord;
@@ -63,16 +63,14 @@ struct _EToDoConduitContext {
gboolean calendar_load_tried;
gboolean calendar_load_success;
- time_t since;
GList *uids;
GList *changed;
+ EPilotMap *map;
+
GHashTable *added;
GHashTable *modified;
GHashTable *deleted;
-
- GHashTable *uid_map;
- GHashTable *pid_map;
};
#endif __TODO_CONDUIT_H__