From ea97b04e218258d26cfef97cbe825cbe27d83e75 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Fri, 29 Aug 2008 15:46:09 -0400 Subject: [PATCH] Loading the XSLT styles to transform osyncformat to gdata. Creating the style context is expensive, so loading it just *after* informing all changes seem a good approach. This resource will be used in 'commitchanges'. --- src/gcalendar.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gcalendar.c b/src/gcalendar.c index 861ac4c..1ddc6cd 100644 --- a/src/gcalendar.c +++ b/src/gcalendar.c @@ -186,6 +186,7 @@ error: static void gc_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + char buffer[512]; static int counter = 0; struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; @@ -278,6 +279,13 @@ static void gc_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx) osync_change_unref(chg); } + /* Load XSLT style to convert osync xmlformat-event --> gdata */ + snprintf(buffer, sizeof(buffer) - 1, "%s/osync2gcal.xslt", + plgdata->xslt_path); + if ((result = xslt_initialize(plgdata->xslt_ctx_gcal, buffer))) + goto error; + osync_trace(TRACE_INTERNAL, "\ndone calendar: %s\n", buffer); + } slow_sync_flag = 0; @@ -358,6 +366,13 @@ static void gc_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx) osync_change_unref(chg); } + /* Load XSLT style to convert osync xmlformat-contact --> gdata */ + snprintf(buffer, sizeof(buffer) - 1, "%s/osync2gcont.xslt", + plgdata->xslt_path); + if ((result = xslt_initialize(plgdata->xslt_ctx_gcont, buffer))) + goto error; + osync_trace(TRACE_INTERNAL, "\ndone contact: %s\n", buffer); + } exit: -- 2.11.4.GIT