aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/importers
diff options
context:
space:
mode:
authorJP Rosevear <jpr@src.gnome.org>2003-11-07 13:52:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-11-07 13:52:24 +0800
commit200606f92810d3de322e5ee96f8326e1a656f8bb (patch)
treeda0dc27f5311128dcb6e7eb6400931e45743372e /calendar/importers
parente5472b4cc9a4bb80b89437a16f8b77943ea35555 (diff)
downloadgsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.gz
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.bz2
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.lz
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.xz
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.zst
gsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.zip
Various changes to merge in evolution-data-server reliance.
svn path=/trunk/; revision=23206
Diffstat (limited to 'calendar/importers')
-rw-r--r--calendar/importers/Makefile.am5
-rw-r--r--calendar/importers/icalendar-importer.c106
2 files changed, 53 insertions, 58 deletions
diff --git a/calendar/importers/Makefile.am b/calendar/importers/Makefile.am
index 658f494cd8..8f4862daeb 100644
--- a/calendar/importers/Makefile.am
+++ b/calendar/importers/Makefile.am
@@ -11,12 +11,8 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
- -I$(top_srcdir)/calendar/cal-client \
- -I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/calendar \
-I$(top_builddir)/calendar \
- -I$(top_srcdir)/libical/src \
- -I$(top_srcdir)/libical/src/libicalvcal \
$(EVOLUTION_CALENDAR_CFLAGS)
libevolution_calendar_importers_la_SOURCES = \
@@ -28,7 +24,6 @@ libevolution_calendar_importers_la_LDFLAGS = -avoid-version -module
libevolution_calendar_importers_la_LIBADD = \
$(top_builddir)/shell/importer/libevolution-importer.la \
- $(top_builddir)/libical/src/libicalvcal/libicalvcal-evolution.la \
$(IMPORTERS_LIBS)
# evolution_calendar_importer_SOURCES = \
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index a98fd9f126..733b5e41de 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -32,13 +32,13 @@
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-exception.h>
-#include <cal-client.h>
+#include <libecal/e-cal.h>
#include <importer/evolution-importer.h>
#include <importer/evolution-intelligent-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
#include <shell/e-shell.h>
#include <shell/evolution-shell-client.h>
-#include "icalvcal.h"
+#include <libical/icalvcal.h>
#include "evolution-calendar-importer.h"
/* We timeout after 2 minutes, when opening the folders. */
@@ -46,8 +46,8 @@
typedef struct {
- CalClient *client;
- CalClient *tasks_client;
+ ECal *client;
+ ECal *tasks_client;
EvolutionImporter *importer;
icalcomponent *icalcomp;
gboolean folder_contains_events;
@@ -179,34 +179,34 @@ prepare_tasks (icalcomponent *icalcomp, GList *vtodos)
g_list_free (vtodos);
}
-static CalClientResult
-update_single_object (CalClient *client, icalcomponent *icalcomp)
+static ECalResult
+update_single_object (ECal *client, icalcomponent *icalcomp)
{
char *uid;
icalcomponent *tmp_icalcomp;
uid = (char *) icalcomponent_get_uid (icalcomp);
- if (cal_client_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
- return cal_client_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL)
- ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR;
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL)
+ ? E_CAL_RESULT_SUCCESS : E_CAL_RESULT_CORBA_ERROR;
- return cal_client_create_object (client, icalcomp, &uid, NULL)
- ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR;
+ return e_cal_create_object (client, icalcomp, &uid, NULL)
+ ? E_CAL_RESULT_SUCCESS : E_CAL_RESULT_CORBA_ERROR;
}
-static CalClientResult
-update_objects (CalClient *client, icalcomponent *icalcomp)
+static ECalResult
+update_objects (ECal *client, icalcomponent *icalcomp)
{
icalcomponent *subcomp;
icalcomponent_kind kind;
- CalClientResult result;
+ ECalResult result;
kind = icalcomponent_isa (icalcomp);
if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
return update_single_object (client, icalcomp);
else if (kind != ICAL_VCALENDAR_COMPONENT)
- return CAL_CLIENT_RESULT_INVALID_OBJECT;
+ return E_CAL_RESULT_INVALID_OBJECT;
subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
while (subcomp) {
@@ -217,21 +217,21 @@ update_objects (CalClient *client, icalcomponent *icalcomp)
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- result = cal_client_add_timezone (client, zone, NULL);
+ result = e_cal_add_timezone (client, zone, NULL);
icaltimezone_free (zone, 1);
- if (result != CAL_CLIENT_RESULT_SUCCESS)
+ if (result != E_CAL_RESULT_SUCCESS)
return result;
} else if (kind == ICAL_VTODO_COMPONENT ||
kind == ICAL_VEVENT_COMPONENT) {
result = update_single_object (client, subcomp);
- if (result != CAL_CLIENT_RESULT_SUCCESS)
+ if (result != E_CAL_RESULT_SUCCESS)
return result;
}
subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
}
- return CAL_CLIENT_RESULT_SUCCESS;
+ return E_CAL_RESULT_SUCCESS;
}
static void
@@ -240,27 +240,27 @@ process_item_fn (EvolutionImporter *importer,
void *closure,
CORBA_Environment *ev)
{
- CalClientLoadState state, tasks_state;
+ ECalLoadState state, tasks_state;
ICalImporter *ici = (ICalImporter *) closure;
GNOME_Evolution_ImporterListener_ImporterResult result;
result = GNOME_Evolution_ImporterListener_OK;
g_return_if_fail (ici != NULL);
- g_return_if_fail (IS_CAL_CLIENT (ici->client));
+ g_return_if_fail (E_IS_CAL (ici->client));
g_return_if_fail (ici->icalcomp != NULL);
- state = cal_client_get_load_state (ici->client);
- tasks_state = cal_client_get_load_state (ici->tasks_client);
- if (state == CAL_CLIENT_LOAD_LOADING
- || tasks_state == CAL_CLIENT_LOAD_LOADING) {
+ state = e_cal_get_load_state (ici->client);
+ tasks_state = e_cal_get_load_state (ici->tasks_client);
+ if (state == E_CAL_LOAD_LOADING
+ || tasks_state == E_CAL_LOAD_LOADING) {
GNOME_Evolution_ImporterListener_notifyResult (
listener,
GNOME_Evolution_ImporterListener_BUSY,
TRUE, ev);
return;
- } else if (state != CAL_CLIENT_LOAD_LOADED
- || tasks_state != CAL_CLIENT_LOAD_LOADED) {
+ } else if (state != E_CAL_LOAD_LOADED
+ || tasks_state != E_CAL_LOAD_LOADED) {
GNOME_Evolution_ImporterListener_notifyResult (
listener,
GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION,
@@ -274,20 +274,20 @@ process_item_fn (EvolutionImporter *importer,
contains just tasks, we strip out the VEVENTs, which do not get
imported at all. */
if (ici->folder_contains_events && ici->folder_contains_tasks) {
- if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
} else if (ici->folder_contains_events) {
GList *vtodos = prepare_events (ici->icalcomp);
- if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
prepare_tasks (ici->icalcomp, vtodos);
if (update_objects (ici->tasks_client,
- ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ ici->icalcomp) != E_CAL_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
} else {
prepare_tasks (ici->icalcomp, NULL);
- if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
}
@@ -369,14 +369,14 @@ load_file_fn (EvolutionImporter *importer,
} else
real_uri = g_strdup (physical_uri);
- /* create CalClient's */
+ /* create ECal's */
if (!ici->client)
- ici->client = cal_client_new (real_uri, CALOBJ_TYPE_EVENT);
+ ici->client = e_cal_new (real_uri, CALOBJ_TYPE_EVENT);
if (!ici->tasks_client)
- ici->tasks_client = cal_client_new ("", CALOBJ_TYPE_TODO); /* FIXME */
+ ici->tasks_client = e_cal_new ("", CALOBJ_TYPE_TODO); /* FIXME */
- if (cal_client_open (ici->client, TRUE, NULL)
- && cal_client_open (ici->tasks_client, FALSE, NULL)) {
+ if (e_cal_open (ici->client, TRUE, NULL)
+ && e_cal_open (ici->tasks_client, FALSE, NULL)) {
ici->icalcomp = icalcomp;
ret = TRUE;
}
@@ -521,14 +521,14 @@ vcal_load_file_fn (EvolutionImporter *importer,
} else
real_uri = g_strdup (physical_uri);
- /* create CalClient's */
+ /* create ECal's */
if (!ici->client)
- ici->client = cal_client_new (real_uri, CALOBJ_TYPE_EVENT);
+ ici->client = e_cal_new (real_uri, CALOBJ_TYPE_EVENT);
if (!ici->tasks_client)
- ici->tasks_client = cal_client_new ("", CALOBJ_TYPE_TODO);
+ ici->tasks_client = e_cal_new ("", CALOBJ_TYPE_TODO);
- if (cal_client_open (ici->client, TRUE, NULL)
- && cal_client_open (ici->tasks_client, FALSE, NULL)) {
+ if (e_cal_open (ici->client, TRUE, NULL)
+ && e_cal_open (ici->tasks_client, FALSE, NULL)) {
ici->icalcomp = icalcomp;
ret = TRUE;
}
@@ -601,7 +601,7 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii,
icalcomponent *icalcomp = NULL;
char *filename;
GList *vtodos;
- CalClient *calendar_client = NULL, *tasks_client = NULL;
+ ECal *calendar_client = NULL, *tasks_client = NULL;
int t;
/* If neither is selected, just return. */
@@ -611,14 +611,14 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii,
/* Try to open the default calendar & tasks folders. */
if (ici->do_calendar) {
- calendar_client = cal_client_new ("", CALOBJ_TYPE_EVENT); /* FIXME: use default folder */
- if (!cal_client_open (calendar_client, FALSE, NULL))
+ calendar_client = e_cal_new ("", CALOBJ_TYPE_EVENT); /* FIXME: use default folder */
+ if (!e_cal_open (calendar_client, FALSE, NULL))
goto out;
}
if (ici->do_tasks) {
- tasks_client = cal_client_new ("", CALOBJ_TYPE_TODO); /* FIXME: use default folder */
- if (!cal_client_open (tasks_client, FALSE, NULL))
+ tasks_client = e_cal_new ("", CALOBJ_TYPE_TODO); /* FIXME: use default folder */
+ if (!e_cal_open (tasks_client, FALSE, NULL))
goto out;
}
@@ -638,23 +638,23 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii,
/* Wait for client to finish opening the calendar & tasks folders. */
for (t = 0; t < IMPORTER_TIMEOUT_SECONDS; t++) {
- CalClientLoadState calendar_state, tasks_state;
+ ECalLoadState calendar_state, tasks_state;
- calendar_state = tasks_state = CAL_CLIENT_LOAD_LOADED;
+ calendar_state = tasks_state = E_CAL_LOAD_LOADED;
- /* We need this so the CalClient gets notified that the
+ /* We need this so the ECal gets notified that the
folder is opened, via Corba. */
while (gtk_events_pending ())
gtk_main_iteration ();
if (ici->do_calendar)
- calendar_state = cal_client_get_load_state (calendar_client);
+ calendar_state = e_cal_get_load_state (calendar_client);
if (ici->do_tasks)
- tasks_state = cal_client_get_load_state (tasks_client);
+ tasks_state = e_cal_get_load_state (tasks_client);
- if (calendar_state == CAL_CLIENT_LOAD_LOADED
- && tasks_state == CAL_CLIENT_LOAD_LOADED)
+ if (calendar_state == E_CAL_LOAD_LOADED
+ && tasks_state == E_CAL_LOAD_LOADED)
break;
sleep (1);