From e504870c44f30b89276793ef13905315c9495b95 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 24 Oct 2000 16:21:10 +0000 Subject: Lookup a pid by uid. (e_pilot_map_lookup_uid): Lookup a uid by pid. Now 2000-10-23 JP Rosevear * e-pilot-map.c (e_pilot_map_lookup_pid): Lookup a pid by uid. (e_pilot_map_lookup_uid): Lookup a uid by pid. Now this is wrapped, we can store archive info internally * e-pilot-map.h: New accessor prototype 2000-10-23 JP Rosevear * conduits/todo/todo-conduit.c (local_record_from_comp): Use new e-pilot-map lookup function (match): ditto * conduits/calendar/calendar-conduit.c (local_record_from_comp): Use new e-pilot-map lookup function (match): ditto svn path=/trunk/; revision=6146 --- e-util/ChangeLog | 8 ++++++++ e-util/e-pilot-map.c | 25 ++++++++++++++++++++++++- e-util/e-pilot-map.h | 4 +++- 3 files changed, 35 insertions(+), 2 deletions(-) (limited to 'e-util') diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 5851b7f508..ede4147b9f 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,11 @@ +2000-10-23 JP Rosevear + + * e-pilot-map.c (e_pilot_map_lookup_pid): Lookup a pid by uid. + (e_pilot_map_lookup_uid): Lookup a uid by pid. + Now this is wrapped, we can store archive info internally + + * e-pilot-map.h: New accessor prototypes + 2000-10-23 Dan Winship * ename/Makefile.am (INCLUDES): Remove unused GNOMELOCALEDIR diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c index 4b364f39bd..3a1b660c60 100644 --- a/e-util/e-pilot-map.c +++ b/e-util/e-pilot-map.c @@ -98,7 +98,7 @@ map_write_foreach (gpointer key, gpointer value, gpointer data) } gboolean -e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pilot_id) +e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pid) { return FALSE; } @@ -122,6 +122,29 @@ e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archi g_hash_table_insert (map->uid_map, new_uid, new_pid); } +guint32 +e_pilot_map_lookup_pid (EPilotMap *map, const char *uid) +{ + guint32 *pid; + + pid = g_hash_table_lookup (map->uid_map, uid); + + if (pid == NULL) + return 0; + + return *pid; +} + +const char * +e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid) +{ + const char *uid; + + uid = g_hash_table_lookup (map->pid_map, &pid); + + return uid; +} + int e_pilot_map_read (const char *filename, EPilotMap **map) { diff --git a/e-util/e-pilot-map.h b/e-util/e-pilot-map.h index e910f43317..8e3d2b71f6 100644 --- a/e-util/e-pilot-map.h +++ b/e-util/e-pilot-map.h @@ -36,10 +36,12 @@ struct _EPilotMap time_t since; }; -gboolean e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pilot_id); +gboolean e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pid); gboolean e_pilot_map_uid_is_archived (EPilotMap *map, const char *uid); void e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archived); +guint32 e_pilot_map_lookup_pid (EPilotMap *map, const char *uid); +const char * e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid); int e_pilot_map_read (const char *filename, EPilotMap **map); int e_pilot_map_write (const char *filename, EPilotMap *map); -- cgit v1.2.3