aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-10-27 20:30:27 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-10-27 20:30:27 +0800
commite071cdeeb46b0f667c4847525f78a988c199297d (patch)
tree9c01c38adb2478f66b5713f7b871bad2961be0d4
parent8f267d0eb4806a96783e9c054e5c82f1140beca6 (diff)
downloadgsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar.gz
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar.bz2
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar.lz
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar.xz
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.tar.zst
gsoc2013-evolution-e071cdeeb46b0f667c4847525f78a988c199297d.zip
Get archive field while parsing (map_write_foreach): Write out archive
2000-10-27 JP Rosevear <jpr@helixcode.com> * e-pilot-map.c (map_sax_start_element): Get archive field while parsing (map_write_foreach): Write out archive field (e_pilot_map_pid_is_archived): implement (e_pilot_map_uid_is_archived): ditto (e_pilot_map_insert): Insert new node structures (e_pilot_map_lookup_pid): Take into account the list is now a list of structures (e_pilot_map_lookup_uid): ditto svn path=/trunk/; revision=6224
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c1
-rw-r--r--calendar/conduits/todo/todo-conduit.c3
-rw-r--r--e-util/ChangeLog12
-rw-r--r--e-util/e-pilot-map.c92
5 files changed, 86 insertions, 29 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 22fdd7ac7a..dd91c49fc1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2000-10-27 JP Rosevear <jpr@helixcode.com>
+
+ * conduits/todo/todo-conduit.c (add_archive_record): Take proper
+ number of parameters
+
+ * conduits/calendar/calendar-conduit.c (add_archive_record): ditto
+
2000-10-26 Federico Mena Quintero <federico@helixcode.com>
* gui/event-editor.c (EventEditorPrivate): Integrate Anna's new
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index ac3bd515c3..d25bdf32d1 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -874,7 +874,6 @@ add_record (GnomePilotConduitSyncAbs *conduit,
static gint
add_archive_record (GnomePilotConduitSyncAbs *conduit,
- ECalLocalRecord *local,
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index d4b715f4e8..0d08002b86 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -755,7 +755,6 @@ add_record (GnomePilotConduitSyncAbs *conduit,
static gint
add_archive_record (GnomePilotConduitSyncAbs *conduit,
- EToDoLocalRecord *local,
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
@@ -818,7 +817,7 @@ delete_archive_record (GnomePilotConduitSyncAbs *conduit,
EToDoLocalRecord *local,
EToDoConduitContext *ctxt)
{
- int retval =0;
+ int retval = 0;
g_return_val_if_fail(local!=NULL,-1);
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 72b58c06e5..3d978fc061 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,15 @@
+2000-10-27 JP Rosevear <jpr@helixcode.com>
+
+ * e-pilot-map.c (map_sax_start_element): Get archive field while
+ parsing
+ (map_write_foreach): Write out archive field
+ (e_pilot_map_pid_is_archived): implement
+ (e_pilot_map_uid_is_archived): ditto
+ (e_pilot_map_insert): Insert new node structures
+ (e_pilot_map_lookup_pid): Take into account the list is now
+ a list of structures
+ (e_pilot_map_lookup_uid): ditto
+
2000-10-26 Michael Meeks <michael@helixcode.com>
* ename/e-address-western.c (e_address_western_is_postal):
diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c
index 3a1b660c60..583e0ad2ec 100644
--- a/e-util/e-pilot-map.c
+++ b/e-util/e-pilot-map.c
@@ -26,6 +26,19 @@
#include <gnome-xml/parser.h>
#include <e-pilot-map.h>
+typedef struct
+{
+ char *uid;
+ gboolean archived;
+} EPilotMapPidNode;
+
+typedef struct
+{
+ guint32 pid;
+ gboolean archived;
+} EPilotMapUidNode;
+
+
static void
map_set_node_timet (xmlNodePtr node, const char *name, time_t t)
{
@@ -54,30 +67,28 @@ map_sax_start_element (void *data, const xmlChar *name,
}
if (!strcmp (name, "map")) {
- char *uid = NULL;
- guint32 *pid = g_new (guint32, 1);
-
- *pid = 0;
+ const char *uid = NULL;
+ guint32 pid = 0;
+ gboolean archived = FALSE;
while (attrs && *attrs != NULL) {
const xmlChar **val = attrs;
val++;
if (!strcmp (*attrs, "uid"))
- uid = g_strdup (*val);
+ uid = *val;
if (!strcmp (*attrs, "pilot_id"))
- *pid = strtoul (*val, NULL, 0);
+ pid = strtoul (*val, NULL, 0);
+
+ if (!strcmp (*attrs, "archived"))
+ archived = strtoul (*val, NULL, 0)== 1 ? TRUE : FALSE;
attrs = ++val;
}
- if (uid && *pid != 0) {
- g_hash_table_insert (map->pid_map, pid, uid);
- g_hash_table_insert (map->uid_map, uid, pid);
- } else {
- g_free (pid);
- }
+ if (uid && pid != 0)
+ e_pilot_map_insert (map, pid, uid, archived);
}
}
@@ -87,26 +98,47 @@ map_write_foreach (gpointer key, gpointer value, gpointer data)
xmlNodePtr root = data;
xmlNodePtr mnode;
unsigned long *pid = key;
- const char *uid = value;
+ EPilotMapPidNode *pnode = value;
char *pidstr;
-
+
mnode = xmlNewChild (root, NULL, "map", NULL);
- xmlSetProp (mnode, "uid", uid);
+
pidstr = g_strdup_printf ("%lu", *pid);
xmlSetProp (mnode, "pilot_id", pidstr);
g_free (pidstr);
+
+ xmlSetProp (mnode, "uid", pnode->uid);
+
+ if (pnode->archived)
+ xmlSetProp (mnode, "archived", "1");
+ else
+ xmlSetProp (mnode, "archived", "0");
}
gboolean
e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pid)
{
- return FALSE;
+ EPilotMapPidNode *pnode;
+
+ pnode = g_hash_table_lookup (map->pid_map, &pid);
+
+ if (pnode == NULL)
+ return FALSE;
+
+ return pnode->archived;
}
gboolean
e_pilot_map_uid_is_archived (EPilotMap *map, const char *uid)
{
- return FALSE;
+ EPilotMapUidNode *unode;
+
+ unode = g_hash_table_lookup (map->uid_map, uid);
+
+ if (unode == NULL)
+ return FALSE;
+
+ return unode->archived;
}
void
@@ -114,35 +146,43 @@ e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archi
{
char *new_uid;
guint32 *new_pid = g_new (guint32, 1);
+ EPilotMapPidNode *pnode = g_new0 (EPilotMapPidNode, 1);
+ EPilotMapUidNode *unode = g_new0 (EPilotMapUidNode, 1);
*new_pid = pid;
new_uid = g_strdup (uid);
- g_hash_table_insert (map->pid_map, new_pid, new_uid);
- g_hash_table_insert (map->uid_map, new_uid, new_pid);
+ pnode->uid = new_uid;
+ pnode->archived = archived;
+
+ unode->pid = pid;
+ unode->archived = archived;
+
+ g_hash_table_insert (map->pid_map, new_pid, pnode);
+ g_hash_table_insert (map->uid_map, new_uid, unode);
}
guint32
e_pilot_map_lookup_pid (EPilotMap *map, const char *uid)
{
- guint32 *pid;
+ EPilotMapUidNode *unode;
- pid = g_hash_table_lookup (map->uid_map, uid);
+ unode = g_hash_table_lookup (map->uid_map, uid);
- if (pid == NULL)
+ if (unode == NULL)
return 0;
- return *pid;
+ return unode->pid;
}
const char *
e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid)
{
- const char *uid;
+ EPilotMapPidNode *pnode;
- uid = g_hash_table_lookup (map->pid_map, &pid);
+ pnode = g_hash_table_lookup (map->pid_map, &pid);
- return uid;
+ return pnode->uid;
}
int