aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
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
parente5472b4cc9a4bb80b89437a16f8b77943ea35555 (diff)
downloadgsoc2013-evolution-200606f92810d3de322e5ee96f8326e1a656f8bb.tar.gz
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')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/Makefile.am2
-rw-r--r--calendar/cal-client/.cvsignore17
-rw-r--r--calendar/cal-client/Makefile.am86
-rw-r--r--calendar/cal-client/cal-client-types.c52
-rw-r--r--calendar/cal-client/cal-client-types.h75
-rw-r--r--calendar/cal-client/cal-client.c3823
-rw-r--r--calendar/cal-client/cal-client.h212
-rw-r--r--calendar/cal-client/cal-listener.c1025
-rw-r--r--calendar/cal-client/cal-listener.h120
-rw-r--r--calendar/cal-client/cal-marshal.list6
-rw-r--r--calendar/cal-client/cal-query.c374
-rw-r--r--calendar/cal-client/cal-query.h69
-rw-r--r--calendar/cal-client/client-test.c218
-rw-r--r--calendar/cal-client/query-listener.c304
-rw-r--r--calendar/cal-client/query-listener.h69
-rw-r--r--calendar/cal-client/test.ics318
-rw-r--r--calendar/cal-util/.cvsignore9
-rw-r--r--calendar/cal-util/Makefile.am58
-rw-r--r--calendar/cal-util/cal-component.c5504
-rw-r--r--calendar/cal-util/cal-component.h449
-rw-r--r--calendar/cal-util/cal-recur.c4021
-rw-r--r--calendar/cal-util/cal-recur.h71
-rw-r--r--calendar/cal-util/cal-util-marshal.list9
-rw-r--r--calendar/cal-util/cal-util.c926
-rw-r--r--calendar/cal-util/cal-util.h137
-rw-r--r--calendar/cal-util/test-recur.c182
-rw-r--r--calendar/cal-util/timeutil.c576
-rw-r--r--calendar/cal-util/timeutil.h122
-rw-r--r--calendar/conduits/calendar/Makefile.am8
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c330
-rw-r--r--calendar/conduits/todo/Makefile.am8
-rw-r--r--calendar/conduits/todo/todo-conduit.c210
-rw-r--r--calendar/gui/Makefile.am25
-rw-r--r--calendar/gui/alarm-notify/Makefile.am6
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.c12
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.h4
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c12
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c147
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.h6
-rw-r--r--calendar/gui/alarm-notify/util.c2
-rw-r--r--calendar/gui/alarm-notify/util.h2
-rw-r--r--calendar/gui/cal-search-bar.c10
-rw-r--r--calendar/gui/calendar-commands.c60
-rw-r--r--calendar/gui/calendar-config.c2
-rw-r--r--calendar/gui/calendar-offline-handler.c38
-rw-r--r--calendar/gui/comp-editor-factory.c66
-rw-r--r--calendar/gui/comp-util.c98
-rw-r--r--calendar/gui/comp-util.h20
-rw-r--r--calendar/gui/control-factory.c4
-rw-r--r--calendar/gui/dialogs/Makefile.am2
-rw-r--r--calendar/gui/dialogs/alarm-options.c128
-rw-r--r--calendar/gui/dialogs/alarm-options.h4
-rw-r--r--calendar/gui/dialogs/alarm-page.c122
-rw-r--r--calendar/gui/dialogs/cancel-comp.c14
-rw-r--r--calendar/gui/dialogs/cancel-comp.h6
-rw-r--r--calendar/gui/dialogs/changed-comp.c18
-rw-r--r--calendar/gui/dialogs/changed-comp.h4
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c12
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h26
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c32
-rw-r--r--calendar/gui/dialogs/comp-editor-util.h2
-rw-r--r--calendar/gui/dialogs/comp-editor.c162
-rw-r--r--calendar/gui/dialogs/comp-editor.h22
-rw-r--r--calendar/gui/dialogs/delete-comp.c26
-rw-r--r--calendar/gui/dialogs/delete-comp.h6
-rw-r--r--calendar/gui/dialogs/delete-error.c20
-rw-r--r--calendar/gui/dialogs/delete-error.h6
-rw-r--r--calendar/gui/dialogs/event-editor.c70
-rw-r--r--calendar/gui/dialogs/event-editor.h4
-rw-r--r--calendar/gui/dialogs/event-page.c118
-rw-r--r--calendar/gui/dialogs/meeting-page.c44
-rw-r--r--calendar/gui/dialogs/meeting-page.h6
-rw-r--r--calendar/gui/dialogs/recur-comp.c20
-rw-r--r--calendar/gui/dialogs/recur-comp.h10
-rw-r--r--calendar/gui/dialogs/recurrence-page.c160
-rw-r--r--calendar/gui/dialogs/schedule-page.c26
-rw-r--r--calendar/gui/dialogs/send-comp.c12
-rw-r--r--calendar/gui/dialogs/send-comp.h6
-rw-r--r--calendar/gui/dialogs/task-details-page.c36
-rw-r--r--calendar/gui/dialogs/task-editor.c72
-rw-r--r--calendar/gui/dialogs/task-editor.h4
-rw-r--r--calendar/gui/dialogs/task-page.c90
-rw-r--r--calendar/gui/e-alarm-list.c56
-rw-r--r--calendar/gui/e-alarm-list.h8
-rw-r--r--calendar/gui/e-cal-list-view-config.c4
-rw-r--r--calendar/gui/e-cal-list-view.c48
-rw-r--r--calendar/gui/e-cal-list-view.h10
-rw-r--r--calendar/gui/e-cal-model-calendar.c4
-rw-r--r--calendar/gui/e-cal-model-tasks.c22
-rw-r--r--calendar/gui/e-cal-model.c114
-rw-r--r--calendar/gui/e-cal-model.h14
-rw-r--r--calendar/gui/e-cal-view.c546
-rw-r--r--calendar/gui/e-cal-view.h138
-rw-r--r--calendar/gui/e-calendar-table.c102
-rw-r--r--calendar/gui/e-calendar-view.c546
-rw-r--r--calendar/gui/e-calendar-view.h138
-rw-r--r--calendar/gui/e-cell-date-edit-text.c6
-rw-r--r--calendar/gui/e-cell-date-edit-text.h2
-rw-r--r--calendar/gui/e-comp-editor-registry.c8
-rw-r--r--calendar/gui/e-date-time-list.c30
-rw-r--r--calendar/gui/e-date-time-list.h8
-rw-r--r--calendar/gui/e-day-view-config.c4
-rw-r--r--calendar/gui/e-day-view-main-item.c56
-rw-r--r--calendar/gui/e-day-view-time-item.c4
-rw-r--r--calendar/gui/e-day-view-top-item.c30
-rw-r--r--calendar/gui/e-day-view.c542
-rw-r--r--calendar/gui/e-day-view.h10
-rw-r--r--calendar/gui/e-itip-control.c350
-rw-r--r--calendar/gui/e-meeting-attendee.c10
-rw-r--r--calendar/gui/e-meeting-attendee.h6
-rw-r--r--calendar/gui/e-meeting-list-view.c12
-rw-r--r--calendar/gui/e-meeting-model.c24
-rw-r--r--calendar/gui/e-meeting-model.h6
-rw-r--r--calendar/gui/e-meeting-store.c24
-rw-r--r--calendar/gui/e-meeting-store.h6
-rw-r--r--calendar/gui/e-select-names-renderer.c4
-rw-r--r--calendar/gui/e-tasks.c102
-rw-r--r--calendar/gui/e-tasks.h2
-rw-r--r--calendar/gui/e-timezone-entry.h2
-rw-r--r--calendar/gui/e-week-view-config.c4
-rw-r--r--calendar/gui/e-week-view-event-item.c40
-rw-r--r--calendar/gui/e-week-view-main-item.c2
-rw-r--r--calendar/gui/e-week-view.c200
-rw-r--r--calendar/gui/e-week-view.h8
-rw-r--r--calendar/gui/gnome-cal.c230
-rw-r--r--calendar/gui/gnome-cal.h6
-rw-r--r--calendar/gui/goto.c2
-rw-r--r--calendar/gui/itip-utils.c286
-rw-r--r--calendar/gui/itip-utils.h30
-rw-r--r--calendar/gui/print.c112
-rw-r--r--calendar/gui/print.h2
-rw-r--r--calendar/gui/tag-calendar.c38
-rw-r--r--calendar/gui/tag-calendar.h8
-rw-r--r--calendar/gui/tasks-component.c12
-rw-r--r--calendar/gui/tasks-control.c4
-rw-r--r--calendar/idl/evolution-calendar.idl255
-rw-r--r--calendar/importers/Makefile.am5
-rw-r--r--calendar/importers/icalendar-importer.c106
-rw-r--r--calendar/pcs/.cvsignore11
-rw-r--r--calendar/pcs/Makefile.am92
-rw-r--r--calendar/pcs/cal-backend-file-events.c145
-rw-r--r--calendar/pcs/cal-backend-file-events.h61
-rw-r--r--calendar/pcs/cal-backend-file-todos.c135
-rw-r--r--calendar/pcs/cal-backend-file-todos.h61
-rw-r--r--calendar/pcs/cal-backend-file.c1988
-rw-r--r--calendar/pcs/cal-backend-file.h65
-rw-r--r--calendar/pcs/cal-backend-http.c621
-rw-r--r--calendar/pcs/cal-backend-http.h61
-rw-r--r--calendar/pcs/cal-backend-object-sexp.c1007
-rw-r--r--calendar/pcs/cal-backend-object-sexp.h67
-rw-r--r--calendar/pcs/cal-backend-sync.c607
-rw-r--r--calendar/pcs/cal-backend-sync.h143
-rw-r--r--calendar/pcs/cal-backend-util.c61
-rw-r--r--calendar/pcs/cal-backend-util.h42
-rw-r--r--calendar/pcs/cal-backend.c1199
-rw-r--r--calendar/pcs/cal-backend.h178
-rw-r--r--calendar/pcs/cal-common.h47
-rw-r--r--calendar/pcs/cal-factory.c482
-rw-r--r--calendar/pcs/cal-factory.h74
-rw-r--r--calendar/pcs/cal.c1244
-rw-r--r--calendar/pcs/cal.h111
-rw-r--r--calendar/pcs/query.c492
-rw-r--r--calendar/pcs/query.h81
164 files changed, 3228 insertions, 31396 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 41c4fdc1aa..d6d7a0e498 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2003-11-07 JP Rosevear <jpr@ximian.com>
+
+ * In the gui this is a search and replace commit for moving the
+ calendar to evolution-data-server; it also deletes the old backend
+ files; e-cal-view was rename to e-calendar-view to remove name
+ conflict
+
2003-11-05 JP Rosevear <jpr@ximian.com>
* gui/migration.c: fix typo
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 4b0426da91..76851cc008 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -4,7 +4,7 @@ else
CONDUIT_DIR =
endif
-SUBDIRS = idl cal-util pcs cal-client gui importers $(CONDUIT_DIR)
+SUBDIRS = idl gui importers $(CONDUIT_DIR)
EXTRA_DIST = \
ChangeLog.pre-1-4 \
diff --git a/calendar/cal-client/.cvsignore b/calendar/cal-client/.cvsignore
deleted file mode 100644
index f2aa4f92ae..0000000000
--- a/calendar/cal-client/.cvsignore
+++ /dev/null
@@ -1,17 +0,0 @@
-Makefile.in
-.deps
-.libs
-.pure
-Makefile
-evolution-calendar-stubs.c
-evolution-calendar-skels.c
-evolution-calendar-common.c
-evolution-calendar.h
-evolution-calendar-common.lo
-evolution-calendar-skels.lo
-evolution-calendar-stubs.lo
-cal-marshal.c
-cal-marshal.h
-*.lo
-*.la
-client-test
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am
deleted file mode 100644
index 9008c05940..0000000000
--- a/calendar/cal-client/Makefile.am
+++ /dev/null
@@ -1,86 +0,0 @@
-INCLUDES = \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DG_LOG_DOMAIN=\"cal-client\" \
- -I$(top_srcdir)/calendar \
- -I$(srcdir) -I$(top_srcdir) \
- -I. \
- -I.. \
- -I$(top_builddir) \
- -I$(top_srcdir)/libical/src \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-AM_CFLAGS = \
- -DGTK_DISABLE_DEPRECATED=1 \
- -DGDK_DISABLE_DEPRECATED=1 \
- -DG_DISABLE_DEPRECATED=1 \
- -DGNOME_DISABLE_DEPRECATED=1
-
-CORBA_GENERATED_C = \
- evolution-calendar-common.c \
- evolution-calendar-skels.c \
- evolution-calendar-stubs.c
-CORBA_GENERATED_H = \
- evolution-calendar.h
-
-CORBA_GENERATED = $(CORBA_GENERATED_C) $(CORBA_GENERATED_H)
-
-idls = \
- $(srcdir)/../idl/evolution-calendar.idl
-
-idl_flags = $(IDL_INCLUDES)
-
-$(CORBA_GENERATED_H): $(idls)
- $(ORBIT_IDL) $(idl_flags) $(srcdir)/../idl/evolution-calendar.idl
-$(CORBA_GENERATED_C): $(CORBA_GENERATED_H)
-
-privlib_LTLIBRARIES = libcal-client.la
-
-libcal_clientincludedir = $(privincludedir)/cal-client
-
-libcal_client_la_SOURCES = \
- $(CORBA_GENERATED_C) \
- cal-client-types.c \
- cal-marshal.c \
- cal-marshal.h \
- cal-client.c \
- cal-listener.c \
- cal-listener.h \
- cal-query.c \
- query-listener.c \
- query-listener.h
-
-libcal_client_la_LIBADD = \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/e-util/libeutil.la
-
-libcal_clientinclude_HEADERS = \
- $(CORBA_GENERATED_H) \
- cal-client-types.h \
- cal-client.h \
- cal-query.h
-
-#
-# client-test program
-#
-
-noinst_PROGRAMS = client-test
-
-client_test_SOURCES = \
- client-test.c
-
-client_test_INCLUDES = \
- $(INCLUDES) \
- -DG_LOG_DOMAIN=\"client-test\"
-
-client_test_LDADD = \
- libcal-client.la \
- $(EVOLUTION_CALENDAR_LIBS)
-
-MARSHAL_GENERATED = cal-marshal.c cal-marshal.h
-@EVO_MARSHAL_RULE@
-
-BUILT_SOURCES = $(CORBA_GENERATED) $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/calendar/cal-client/cal-client-types.c b/calendar/cal-client/cal-client-types.c
deleted file mode 100644
index 36a524ec99..0000000000
--- a/calendar/cal-client/cal-client-types.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Evolution calendar utilities and types
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include "cal-client-types.h"
-
-
-
-/**
- * cal_client_change_list_free:
- * @list: List of #CalClientChange structures.
- *
- * Frees a list of #CalClientChange structures.
- **/
-void
-cal_client_change_list_free (GList *list)
-{
- CalClientChange *c;
- GList *l;
-
- for (l = list; l; l = l->next) {
- c = l->data;
-
- g_assert (c != NULL);
- g_assert (c->comp != NULL);
-
- g_object_unref (G_OBJECT (c->comp));
- g_free (c);
- }
-
- g_list_free (list);
-}
diff --git a/calendar/cal-client/cal-client-types.h b/calendar/cal-client/cal-client-types.h
deleted file mode 100644
index 925628337b..0000000000
--- a/calendar/cal-client/cal-client-types.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Evolution calendar utilities and types
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_CLIENT_TYPES_H
-#define CAL_CLIENT_TYPES_H
-
-#include <cal-util/cal-component.h>
-
-G_BEGIN_DECLS
-
-
-
-#define E_CALENDAR_ERROR e_calendar_error_quark()
-
-GQuark e_calendar_error_quark (void) G_GNUC_CONST;
-
-typedef enum {
- CAL_CLIENT_CHANGE_ADDED = 1 << 0,
- CAL_CLIENT_CHANGE_MODIFIED = 1 << 1,
- CAL_CLIENT_CHANGE_DELETED = 1 << 2
-} CalClientChangeType;
-
-typedef struct
-{
- CalComponent *comp;
- CalClientChangeType type;
-} CalClientChange;
-
-typedef enum {
- E_CALENDAR_STATUS_OK,
- E_CALENDAR_STATUS_INVALID_ARG,
- E_CALENDAR_STATUS_BUSY,
- E_CALENDAR_STATUS_REPOSITORY_OFFLINE,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- E_CALENDAR_STATUS_OBJECT_NOT_FOUND,
- E_CALENDAR_STATUS_INVALID_OBJECT,
- E_CALENDAR_STATUS_URI_NOT_LOADED,
- E_CALENDAR_STATUS_URI_ALREADY_LOADED,
- E_CALENDAR_STATUS_PERMISSION_DENIED,
- E_CALENDAR_STATUS_CARD_NOT_FOUND,
- E_CALENDAR_STATUS_CARD_ID_ALREADY_EXISTS,
- E_CALENDAR_STATUS_PROTOCOL_NOT_SUPPORTED,
- E_CALENDAR_STATUS_CANCELLED,
- E_CALENDAR_STATUS_COULD_NOT_CANCEL,
- E_CALENDAR_STATUS_AUTHENTICATION_FAILED,
- E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED,
- E_CALENDAR_STATUS_CORBA_EXCEPTION,
- E_CALENDAR_STATUS_OTHER_ERROR
-} ECalendarStatus;
-
-void cal_client_change_list_free (GList *list);
-
-G_END_DECLS
-
-#endif
-
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
deleted file mode 100644
index f69567b90e..0000000000
--- a/calendar/cal-client/cal-client.c
+++ /dev/null
@@ -1,3823 +0,0 @@
-/* Evolution calendar client
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <string.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-i18n.h>
-#include <libgnome/gnome-util.h>
-
-#include "e-util/e-component-listener.h"
-#include "e-util/e-config-listener.h"
-#include "e-util/e-url.h"
-#include "e-util/e-msgport.h"
-#include "cal-util/cal-util-marshal.h"
-#include "cal-util/timeutil.h"
-#include "cal-client.h"
-#include "cal-listener.h"
-#include "query-listener.h"
-
-
-
-typedef struct {
- EMutex *mutex;
- pthread_cond_t cond;
- ECalendarStatus status;
-
- char *uid;
- GList *list;
- gboolean bool;
- char *string;
-
- CalQuery *query;
- QueryListener *listener;
-} ECalendarOp;
-
-/* Private part of the CalClient structure */
-struct _CalClientPrivate {
- /* Load state to avoid multiple loads */
- CalClientLoadState load_state;
-
- /* URI of the calendar that is being loaded or is already loaded, or
- * NULL if we are not loaded.
- */
- char *uri;
- CalObjType type;
-
- ECalendarOp *current_op;
-
- EMutex *mutex;
-
- /* Email address associated with this calendar, or NULL */
- char *cal_address;
- char *alarm_email_address;
- char *ldap_attribute;
-
- /* Scheduling info */
- char *capabilities;
-
- /* The calendar factories we are contacting */
- GList *factories;
-
- /* Our calendar listener implementation */
- CalListener *listener;
-
- /* The calendar client interface object we are contacting */
- GNOME_Evolution_Calendar_Cal cal;
-
- /* The authentication function */
- CalClientAuthFunc auth_func;
- gpointer auth_user_data;
-
- /* A cache of timezones retrieved from the server, to avoid getting
- them repeatedly for each get_object() call. */
- GHashTable *timezones;
-
- /* The default timezone to use to resolve DATE and floating DATE-TIME
- values. */
- icaltimezone *default_zone;
-
- /* The component listener to keep track of the lifetime of backends */
- EComponentListener *comp_listener;
-};
-
-
-
-/* Signal IDs */
-enum {
- CAL_OPENED,
- CAL_SET_MODE,
- BACKEND_ERROR,
- CATEGORIES_CHANGED,
- FORGET_PASSWORD,
- BACKEND_DIED,
- LAST_SIGNAL
-};
-
-static void cal_client_get_object_timezones_cb (icalparameter *param,
- void *data);
-
-static guint cal_client_signals[LAST_SIGNAL];
-
-static GObjectClass *parent_class;
-
-#define E_CALENDAR_CHECK_STATUS(status,error) G_STMT_START{ \
- if ((status) == E_CALENDAR_STATUS_OK) { \
- return TRUE; \
- } \
- else { \
- const char *msg; \
- msg = cal_client_get_error_message ((status)); \
- g_set_error ((error), E_CALENDAR_ERROR, (status), msg, (status)); \
- return FALSE; \
- } }G_STMT_END
-
-
-
-/* Error quark */
-GQuark
-e_calendar_error_quark (void)
-{
- static GQuark q = 0;
- if (q == 0)
- q = g_quark_from_static_string ("e-calendar-error-quark");
-
- return q;
-}
-
-GType
-cal_client_open_status_enum_get_type (void)
-{
- static GType cal_client_open_status_enum_type = 0;
-
- if (!cal_client_open_status_enum_type) {
- static GEnumValue values [] = {
- { CAL_CLIENT_OPEN_SUCCESS, "CalClientOpenSuccess", "success" },
- { CAL_CLIENT_OPEN_ERROR, "CalClientOpenError", "error" },
- { CAL_CLIENT_OPEN_NOT_FOUND, "CalClientOpenNotFound", "not-found" },
- { CAL_CLIENT_OPEN_PERMISSION_DENIED, "CalClientOpenPermissionDenied", "denied" },
- { CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED, "CalClientOpenMethodNotSupported", "unsupported" },
- { -1, NULL, NULL }
- };
-
- cal_client_open_status_enum_type = g_enum_register_static ("CalClientOpenStatusEnum", values);
- }
-
- return cal_client_open_status_enum_type;
-}
-
-GType
-cal_client_set_mode_status_enum_get_type (void)
-{
- static GType cal_client_set_mode_status_enum_type = 0;
-
- if (!cal_client_set_mode_status_enum_type) {
- static GEnumValue values [] = {
- { CAL_CLIENT_SET_MODE_SUCCESS, "CalClientSetModeSuccess", "success" },
- { CAL_CLIENT_SET_MODE_ERROR, "CalClientSetModeError", "error" },
- { CAL_CLIENT_SET_MODE_NOT_SUPPORTED, "CalClientSetModeNotSupported", "unsupported" },
- { -1, NULL, NULL }
- };
-
- cal_client_set_mode_status_enum_type =
- g_enum_register_static ("CalClientSetModeStatusEnum", values);
- }
-
- return cal_client_set_mode_status_enum_type;
-}
-
-GType
-cal_mode_enum_get_type (void)
-{
- static GType cal_mode_enum_type = 0;
-
- if (!cal_mode_enum_type) {
- static GEnumValue values [] = {
- { CAL_MODE_INVALID, "CalModeInvalid", "invalid" },
- { CAL_MODE_LOCAL, "CalModeLocal", "local" },
- { CAL_MODE_REMOTE, "CalModeRemote", "remote" },
- { CAL_MODE_ANY, "CalModeAny", "any" },
- { -1, NULL, NULL }
- };
-
- cal_mode_enum_type = g_enum_register_static ("CalModeEnum", values);
- }
-
- return cal_mode_enum_type;
-}
-
-/* EBookOp calls */
-
-static ECalendarOp*
-e_calendar_new_op (CalClient *client)
-{
- ECalendarOp *op = g_new0 (ECalendarOp, 1);
-
- op->mutex = e_mutex_new (E_MUTEX_SIMPLE);
- pthread_cond_init (&op->cond, 0);
-
- client->priv->current_op = op;
-
- return op;
-}
-
-static ECalendarOp*
-e_calendar_get_op (CalClient *client)
-{
- if (!client->priv->current_op) {
- g_warning (G_STRLOC ": Unexpected response");
- return NULL;
- }
-
- return client->priv->current_op;
-}
-
-static void
-e_calendar_free_op (ECalendarOp *op)
-{
- /* XXX more stuff here */
- pthread_cond_destroy (&op->cond);
- e_mutex_destroy (op->mutex);
- g_free (op);
-}
-
-static void
-e_calendar_remove_op (CalClient *client, ECalendarOp *op)
-{
- if (client->priv->current_op != op)
- g_warning (G_STRLOC ": Cannot remove op, it's not current");
-
- client->priv->current_op = NULL;
-}
-
-/* Gets rid of the factories that a client knows about */
-static void
-destroy_factories (CalClient *client)
-{
- CalClientPrivate *priv;
- CORBA_Object factory;
- CORBA_Environment ev;
- int result;
- GList *f;
-
- priv = client->priv;
-
- CORBA_exception_init (&ev);
-
- for (f = priv->factories; f; f = f->next) {
- factory = f->data;
-
- result = CORBA_Object_is_nil (factory, &ev);
- if (BONOBO_EX (&ev)) {
- g_message ("destroy_factories(): could not see if a factory was nil");
- CORBA_exception_free (&ev);
-
- continue;
- }
-
- if (result)
- continue;
-
- CORBA_Object_release (factory, &ev);
- if (BONOBO_EX (&ev)) {
- g_message ("destroy_factories(): could not release a factory");
- CORBA_exception_free (&ev);
- }
- }
-
- g_list_free (priv->factories);
- priv->factories = NULL;
-}
-
-/* Gets rid of the calendar client interface object that a client knows about */
-static void
-destroy_cal (CalClient *client)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- int result;
-
- priv = client->priv;
-
- CORBA_exception_init (&ev);
- result = CORBA_Object_is_nil (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- g_message (G_STRLOC ": could not see if the "
- "calendar client interface object was nil");
- priv->cal = CORBA_OBJECT_NIL;
- CORBA_exception_free (&ev);
- return;
- }
- CORBA_exception_free (&ev);
-
- if (result)
- return;
-
- bonobo_object_release_unref (priv->cal, NULL);
- priv->cal = CORBA_OBJECT_NIL;
-
-}
-
-static void
-free_timezone (gpointer key, gpointer value, gpointer data)
-{
- /* Note that the key comes from within the icaltimezone value, so we
- don't free that. */
- icaltimezone_free (value, TRUE);
-}
-
-
-
-static void
-backend_died_cb (EComponentListener *cl, gpointer user_data)
-{
- CalClientPrivate *priv;
- CalClient *client = (CalClient *) user_data;
-
- g_return_if_fail (IS_CAL_CLIENT (client));
-
- priv = client->priv;
- priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
- g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_DIED], 0);
-}
-
-/* Signal handlers for the listener's signals */
-/* Handle the cal_opened notification from the listener */
-
-static void
-cal_read_only_cb (CalListener *listener, ECalendarStatus status, gboolean read_only, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->bool = read_only;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_cal_address_cb (CalListener *listener, ECalendarStatus status, const char *address, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (address);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_alarm_address_cb (CalListener *listener, ECalendarStatus status, const char *address, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (address);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_ldap_attribute_cb (CalListener *listener, ECalendarStatus status, const char *attribute, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (attribute);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_static_capabilities_cb (CalListener *listener, ECalendarStatus status, const char *capabilities, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (capabilities);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_opened_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_removed_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_object_created_cb (CalListener *listener, ECalendarStatus status, const char *uid, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->uid = g_strdup (uid);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_object_modified_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_object_removed_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_alarm_discarded_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_objects_received_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_objects_sent_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_default_object_requested_cb (CalListener *listener, ECalendarStatus status, const char *object, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (object);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_object_requested_cb (CalListener *listener, ECalendarStatus status, const char *object, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (object);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_object_list_cb (CalListener *listener, ECalendarStatus status, GList *objects, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
- GList *l;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = g_list_copy (objects);
-
- for (l = op->list; l; l = l->next)
- l->data = icalcomponent_new_clone (l->data);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_get_timezone_cb (CalListener *listener, ECalendarStatus status, const char *object, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->string = g_strdup (object);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-
-}
-
-static void
-cal_add_timezone_cb (CalListener *listener, ECalendarStatus status, const char *tzid, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->uid = g_strdup (tzid);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-
-}
-
-static void
-cal_set_default_timezone_cb (CalListener *listener, ECalendarStatus status, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_get_changes_cb (CalListener *listener, ECalendarStatus status, GList *changes, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
- GList *l;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = g_list_copy (changes);
-
- for (l = op->list; l; l = l->next) {
- CalClientChange *ccc = l->data, *new_ccc;
-
- new_ccc = g_new (CalClientChange, 1);
- new_ccc->comp = cal_component_clone (ccc->comp);
- new_ccc->type = ccc->type;
-
- l->data = new_ccc;
- }
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_get_free_busy_cb (CalListener *listener, ECalendarStatus status, GList *freebusy, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
- GList *l;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = g_list_copy (freebusy);
-
- for (l = op->list; l; l = l->next)
- l->data = cal_component_clone (l->data);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-static void
-cal_query_cb (CalListener *listener, ECalendarStatus status, GNOME_Evolution_Calendar_Query query, gpointer data)
-{
- CalClient *client = data;
- ECalendarOp *op;
-
- op = e_calendar_get_op (client);
-
- if (op == NULL) {
- g_warning (G_STRLOC ": Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->query = cal_query_new (query, op->listener, client);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-/* Handle the cal_set_mode notification from the listener */
-static void
-cal_set_mode_cb (CalListener *listener,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode,
- gpointer data)
-{
- CalClient *client;
- CalClientPrivate *priv;
- CalClientSetModeStatus client_status;
-
- client = CAL_CLIENT (data);
- priv = client->priv;
-
- client_status = CAL_CLIENT_OPEN_ERROR;
-
- switch (status) {
- case GNOME_Evolution_Calendar_Listener_MODE_SET:
- client_status = CAL_CLIENT_SET_MODE_SUCCESS;
- break;
- case GNOME_Evolution_Calendar_Listener_MODE_NOT_SET:
- client_status = CAL_CLIENT_SET_MODE_ERROR;
- break;
- case GNOME_Evolution_Calendar_Listener_MODE_NOT_SUPPORTED:
- client_status = CAL_CLIENT_SET_MODE_NOT_SUPPORTED;
- break;
- default:
- g_assert_not_reached ();
- }
-
- /* We are *not* inside a signal handler (this is just a simple callback
- * called from the listener), so there is not a temporary reference to
- * the client object. We ref() so that we can safely emit our own
- * signal and clean up.
- */
-
- g_object_ref (G_OBJECT (client));
-
- g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_SET_MODE],
- 0, client_status, mode);
-
- g_object_unref (G_OBJECT (client));
-}
-
-/* Handle the error_occurred signal from the listener */
-static void
-backend_error_cb (CalListener *listener, const char *message, gpointer data)
-{
- CalClient *client;
-
- client = CAL_CLIENT (data);
- g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_ERROR], 0, message);
-}
-
-/* Handle the categories_changed signal from the listener */
-static void
-categories_changed_cb (CalListener *listener, const GNOME_Evolution_Calendar_StringSeq *categories,
- gpointer data)
-{
- CalClient *client;
- GPtrArray *cats;
- int i;
-
- client = CAL_CLIENT (data);
-
- cats = g_ptr_array_new ();
- g_ptr_array_set_size (cats, categories->_length);
-
- for (i = 0; i < categories->_length; i++)
- cats->pdata[i] = categories->_buffer[i];
-
- g_signal_emit (G_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], 0, cats);
-
- g_ptr_array_free (cats, TRUE);
-}
-
-
-
-static gboolean
-get_factories (const char *str_uri, GList **factories)
-{
- GNOME_Evolution_Calendar_CalFactory factory;
- Bonobo_ServerInfoList *servers;
- EUri *uri;
- char *query;
- int i;
-
-
- /* Determine the protocol and query for factory supporting that */
- uri = e_uri_new (str_uri);
- if (!uri) {
- g_warning (G_STRLOC ": Invalid uri string");
-
- return FALSE;
- }
-
- query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')"
- " AND calendar:supported_protocols.has ('%s')", uri->protocol);
-
-
- servers = bonobo_activation_query (query, NULL, NULL);
-
- g_free (query);
- e_uri_free (uri);
-
- if (!servers) {
- g_warning (G_STRLOC ": Unable to query for calendar factories");
-
- return FALSE;
- }
-
- /* Try to activate the servers for the protocol */
- for (i = 0; i < servers->_length; i++) {
- const Bonobo_ServerInfo *info;
-
- info = servers->_buffer + i;
-
- g_message (G_STRLOC ": Activating calendar factory (%s)", info->iid);
- factory = bonobo_activation_activate_from_id (info->iid, 0, NULL, NULL);
-
- if (factory == CORBA_OBJECT_NIL)
- g_warning (G_STRLOC ": Could not activate calendar factory (%s)", info->iid);
- else
- *factories = g_list_append (*factories, factory);
- }
-
- CORBA_free (servers);
-
- return TRUE;
-}
-
-/* Object initialization function for the calendar client */
-static void
-cal_client_init (CalClient *client, CalClientClass *klass)
-{
- CalClientPrivate *priv;
-
- priv = g_new0 (CalClientPrivate, 1);
- client->priv = priv;
-
- priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
- priv->uri = NULL;
- priv->mutex = e_mutex_new (E_MUTEX_REC);
- priv->listener = cal_listener_new (cal_set_mode_cb,
- backend_error_cb,
- categories_changed_cb,
- client);
-
- priv->cal_address = NULL;
- priv->alarm_email_address = NULL;
- priv->ldap_attribute = NULL;
- priv->capabilities = FALSE;
- priv->factories = NULL;
- priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
- priv->default_zone = icaltimezone_get_utc_timezone ();
- priv->comp_listener = NULL;
-
- g_signal_connect (G_OBJECT (priv->listener), "read_only", G_CALLBACK (cal_read_only_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "cal_address", G_CALLBACK (cal_cal_address_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "alarm_address", G_CALLBACK (cal_alarm_address_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "ldap_attribute", G_CALLBACK (cal_ldap_attribute_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "static_capabilities", G_CALLBACK (cal_static_capabilities_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "open", G_CALLBACK (cal_opened_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "remove", G_CALLBACK (cal_removed_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "create_object", G_CALLBACK (cal_object_created_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "modify_object", G_CALLBACK (cal_object_modified_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "remove_object", G_CALLBACK (cal_object_removed_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "discard_alarm", G_CALLBACK (cal_alarm_discarded_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "receive_objects", G_CALLBACK (cal_objects_received_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "send_objects", G_CALLBACK (cal_objects_sent_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "default_object", G_CALLBACK (cal_default_object_requested_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "object", G_CALLBACK (cal_object_requested_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "object_list", G_CALLBACK (cal_object_list_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "get_timezone", G_CALLBACK (cal_get_timezone_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "add_timezone", G_CALLBACK (cal_add_timezone_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "set_default_timezone", G_CALLBACK (cal_set_default_timezone_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "get_changes", G_CALLBACK (cal_get_changes_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "get_free_busy", G_CALLBACK (cal_get_free_busy_cb), client);
- g_signal_connect (G_OBJECT (priv->listener), "query", G_CALLBACK (cal_query_cb), client);
-}
-
-/* Finalize handler for the calendar client */
-static void
-cal_client_finalize (GObject *object)
-{
- CalClient *client;
- CalClientPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_CLIENT (object));
-
- client = CAL_CLIENT (object);
- priv = client->priv;
-
- if (priv->listener) {
- cal_listener_stop_notification (priv->listener);
- bonobo_object_unref (priv->listener);
- priv->listener = NULL;
- }
-
- if (priv->comp_listener) {
- g_signal_handlers_disconnect_matched (G_OBJECT (priv->comp_listener),
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- client);
- g_object_unref (G_OBJECT (priv->comp_listener));
- priv->comp_listener = NULL;
- }
-
- destroy_factories (client);
- destroy_cal (client);
-
- priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
-
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
- if (priv->mutex) {
- e_mutex_destroy (priv->mutex);
- priv->mutex = NULL;
- }
-
- if (priv->cal_address) {
- g_free (priv->cal_address);
- priv->cal_address = NULL;
- }
- if (priv->alarm_email_address) {
- g_free (priv->alarm_email_address);
- priv->alarm_email_address = NULL;
- }
- if (priv->ldap_attribute) {
- g_free (priv->ldap_attribute);
- priv->ldap_attribute = NULL;
- }
- if (priv->capabilities) {
- g_free (priv->capabilities);
- priv->capabilities = NULL;
- }
-
- g_hash_table_foreach (priv->timezones, free_timezone, NULL);
- g_hash_table_destroy (priv->timezones);
- priv->timezones = NULL;
-
- g_free (priv);
- client->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Class initialization function for the calendar client */
-static void
-cal_client_class_init (CalClientClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- cal_client_signals[CAL_OPENED] =
- g_signal_new ("cal_opened",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, cal_opened),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- CAL_CLIENT_OPEN_STATUS_ENUM_TYPE);
- cal_client_signals[CAL_SET_MODE] =
- g_signal_new ("cal_set_mode",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, cal_set_mode),
- NULL, NULL,
- cal_util_marshal_VOID__ENUM_ENUM,
- G_TYPE_NONE, 2,
- CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE,
- CAL_MODE_ENUM_TYPE);
- cal_client_signals[BACKEND_ERROR] =
- g_signal_new ("backend_error",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, backend_error),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- cal_client_signals[CATEGORIES_CHANGED] =
- g_signal_new ("categories_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, categories_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
- cal_client_signals[FORGET_PASSWORD] =
- g_signal_new ("forget_password",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, forget_password),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- cal_client_signals[BACKEND_DIED] =
- g_signal_new ("backend_died",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, backend_died),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- klass->cal_opened = NULL;
- klass->categories_changed = NULL;
- klass->forget_password = NULL;
- klass->backend_died = NULL;
-
- object_class->finalize = cal_client_finalize;
-}
-
-/**
- * cal_client_get_type:
- *
- * Registers the #CalClient class if necessary, and returns the type ID assigned
- * to it.
- *
- * Return value: The type ID of the #CalClient class.
- **/
-GType
-cal_client_get_type (void)
-{
- static GType cal_client_type = 0;
-
- if (!cal_client_type) {
- static GTypeInfo info = {
- sizeof (CalClientClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_client_class_init,
- NULL, NULL,
- sizeof (CalClient),
- 0,
- (GInstanceInitFunc) cal_client_init
- };
- cal_client_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0);
- }
-
- return cal_client_type;
-}
-
-
-static gboolean
-fetch_corba_cal (CalClient *client, const char *str_uri, CalObjType type)
-{
- CalClientPrivate *priv;
- GList *f;
- CORBA_Environment ev;
-
- priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_NOT_LOADED, FALSE);
- g_assert (priv->uri == NULL);
-
- g_return_val_if_fail (str_uri != NULL, FALSE);
-
- if (!get_factories (str_uri, &priv->factories))
- return FALSE;
-
- priv->uri = g_strdup (str_uri);
- priv->type = type;
-
- for (f = priv->factories; f; f = f->next) {
- GNOME_Evolution_Calendar_Cal cal;
-
- CORBA_exception_init (&ev);
-
- cal = GNOME_Evolution_Calendar_CalFactory_getCal (f->data, priv->uri, priv->type,
- BONOBO_OBJREF (priv->listener), &ev);
- if (BONOBO_EX (&ev))
- continue;
-
- priv->cal = cal;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * cal_client_new:
- *
- * Creates a new calendar client. It should be initialized by calling
- * cal_client_open().
- *
- * Return value: A newly-created calendar client, or NULL if the client could
- * not be constructed because it could not contact the calendar server.
- **/
-CalClient *
-cal_client_new (const char *uri, CalObjType type)
-{
- CalClient *client;
-
- client = g_object_new (CAL_CLIENT_TYPE, NULL);
-
- if (!fetch_corba_cal (client, uri, type)) {
- g_object_unref (client);
-
- return NULL;
- }
-
- return client;
-}
-
-/**
- * cal_client_set_auth_func
- * @client: A calendar client.
- * @func: The authentication function
- * @data: User data to be used when calling the authentication function
- *
- * Associates the given authentication function with a calendar client. This
- * function will be called any time the calendar server needs a password
- * from the client. So, calendar clients should provide such authentication
- * function, which, when called, should act accordingly (by showing a dialog
- * box, for example, to ask the user for the password).
- *
- * The authentication function must have the following form:
- * char * auth_func (CalClient *client,
- * const gchar *prompt,
- * const gchar *key,
- * gpointer user_data)
- */
-void
-cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer data)
-{
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
-
- client->priv->auth_func = func;
- client->priv->auth_user_data = data;
-}
-
-/**
- * cal_client_open
- * @client: A calendar client.
- * @str_uri: URI of calendar to open.
- * @only_if_exists: FALSE if the calendar should be opened even if there
- * was no storage for it, i.e. to create a new calendar or load an existing
- * one if it already exists. TRUE if it should only try to load calendars
- * that already exist.
- *
- * Makes a calendar client initiate a request to open a calendar. The calendar
- * client will emit the "cal_opened" signal when the response from the server is
- * received.
- *
- * Return value: TRUE on success, FALSE on failure to issue the open request.
- **/
-gboolean
-cal_client_open (CalClient *client, gboolean only_if_exists, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- priv->load_state = CAL_CLIENT_LOAD_LOADING;
-
- GNOME_Evolution_Calendar_Cal_open (priv->cal, only_if_exists, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_OPENED], 0,
- E_CALENDAR_STATUS_CORBA_EXCEPTION);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- if (status == E_CALENDAR_STATUS_OK)
- priv->load_state = CAL_CLIENT_LOAD_LOADED;
- else
- priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
-
- g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_OPENED], 0, status);
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-typedef struct {
- CalClient *client;
-
- gboolean exists;
-} CalClientAsyncData;
-
-static gboolean
-open_async (gpointer data)
-{
- CalClientAsyncData *ccad = data;
- GError *error = NULL;
-
- cal_client_open (ccad->client, ccad->exists, &error);
-
- g_clear_error (&error);
-
- g_object_unref (ccad);
- g_free (ccad);
-
- return FALSE;
-}
-
-void
-cal_client_open_async (CalClient *client, gboolean only_if_exists)
-{
- CalClientAsyncData *ccad;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
-
- ccad = g_new0 (CalClientAsyncData, 1);
- ccad->client = g_object_ref (client);
- ccad->exists = only_if_exists;
-
- /* FIXME This should really spawn a new thread */
- g_idle_add (open_async, ccad);
-}
-
-gboolean
-cal_client_remove_calendar (CalClient *client, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_remove (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-#if 0
-/* Builds an URI list out of a CORBA string sequence */
-static GList *
-build_uri_list (GNOME_Evolution_Calendar_StringSeq *seq)
-{
- GList *uris = NULL;
- int i;
-
- for (i = 0; i < seq->_length; i++)
- uris = g_list_prepend (uris, g_strdup (seq->_buffer[i]));
-
- return uris;
-}
-#endif
-
-/**
- * cal_client_uri_list:
- * @client: A calendar client
- * @type: type of uri's to get
- *
- *
- * Return value: A list of URI's open on the wombat
- **/
-GList *
-cal_client_uri_list (CalClient *client, CalMode mode)
-{
-#if 0
- CalClientPrivate *priv;
- GNOME_Evolution_Calendar_StringSeq *uri_seq;
- GList *uris = NULL;
- CORBA_Environment ev;
- GList *f;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- for (f = priv->factories; f; f = f->next) {
- CORBA_exception_init (&ev);
- uri_seq = GNOME_Evolution_Calendar_CalFactory_uriList (f->data, mode, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("cal_client_uri_list(): request failed");
-
- /* free memory and return */
- g_list_foreach (uris, (GFunc) g_free, NULL);
- g_list_free (uris);
- uris = NULL;
- break;
- }
- else {
- uris = g_list_concat (uris, build_uri_list (uri_seq));
- CORBA_free (uri_seq);
- }
-
- CORBA_exception_free (&ev);
- }
-
- return uris;
-#endif
-
- return NULL;
-}
-
-
-/**
- * cal_client_get_load_state:
- * @client: A calendar client.
- *
- * Queries the state of loading of a calendar client.
- *
- * Return value: A #CalClientLoadState value indicating whether the client has
- * not been loaded with cal_client_open_calendar() yet, whether it is being
- * loaded, or whether it is already loaded.
- **/
-CalClientLoadState
-cal_client_get_load_state (CalClient *client)
-{
- CalClientPrivate *priv;
-
- g_return_val_if_fail (client != NULL, CAL_CLIENT_LOAD_NOT_LOADED);
- g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_LOAD_NOT_LOADED);
-
- priv = client->priv;
- return priv->load_state;
-}
-
-/**
- * cal_client_get_uri:
- * @client: A calendar client.
- *
- * Queries the URI that is open in a calendar client.
- *
- * Return value: The URI of the calendar that is already loaded or is being
- * loaded, or NULL if the client has not started a load request yet.
- **/
-const char *
-cal_client_get_uri (CalClient *client)
-{
- CalClientPrivate *priv;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
-
- priv = client->priv;
- return priv->uri;
-}
-
-/**
- * cal_client_is_read_only:
- * @client: A calendar client.
- *
- * Queries whether the calendar client can perform modifications
- * on the calendar or not. Whether the backend is read only or not
- * is specified, on exit, in the @read_only argument.
- *
- * Return value: TRUE if the call was successful, FALSE if there was an error.
- */
-gboolean
-cal_client_is_read_only (CalClient *client, gboolean *read_only, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *read_only = our_op->bool;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- return status;
-}
-
-/**
- * cal_client_get_cal_address:
- * @client: A calendar client.
- *
- * Queries the calendar address associated with a calendar client.
- *
- * Return value: The calendar address associated with the calendar that
- * is loaded or being loaded, or %NULL if the client has not started a
- * load request yet or the calendar has no associated email address.
- **/
-gboolean
-cal_client_get_cal_address (CalClient *client, char **cal_address, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getCalAddress (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *cal_address = our_op->string;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_get_alarm_email_address (CalClient *client, char **alarm_address, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getAlarmEmailAddress (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *alarm_address = our_op->string;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_get_ldap_attribute (CalClient *client, char **ldap_attribute, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getLdapAttribute (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *ldap_attribute = our_op->string;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-static gboolean
-load_static_capabilities (CalClient *client, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
- char *cap;
-
- priv = client->priv;
-
- if (priv->capabilities)
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getStaticCapabilities (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- cap = our_op->string;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-static gboolean
-check_capability (CalClient *client, const char *cap)
-{
- CalClientPrivate *priv;
-
- priv = client->priv;
-
- /* FIXME Check result */
- load_static_capabilities (client, NULL);
- if (priv->capabilities && strstr (priv->capabilities, cap))
- return TRUE;
-
- return FALSE;
-}
-
-gboolean
-cal_client_get_one_alarm_only (CalClient *client)
-{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- return check_capability (client, CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY);
-}
-
-gboolean
-cal_client_get_organizer_must_attend (CalClient *client)
-{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- return check_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND);
-}
-
-gboolean
-cal_client_get_static_capability (CalClient *client, const char *cap)
-{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- return check_capability (client, cap);
-}
-
-gboolean
-cal_client_get_save_schedules (CalClient *client)
-{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- return check_capability (client, CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
-}
-
-gboolean
-cal_client_set_mode (CalClient *client, CalMode mode)
-{
- CalClientPrivate *priv;
- gboolean retval = TRUE;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, -1);
- g_return_val_if_fail (IS_CAL_CLIENT (client), -1);
-
- priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, -1);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_setMode (priv->cal, mode, &ev);
-
- if (BONOBO_EX (&ev))
- retval = FALSE;
-
- CORBA_exception_free (&ev);
-
- return retval;
-}
-
-
-/* This is used in the callback which fetches all the timezones needed for an
- object. */
-typedef struct _CalClientGetTimezonesData CalClientGetTimezonesData;
-struct _CalClientGetTimezonesData {
- CalClient *client;
-
- /* This starts out at E_CALENDAR_STATUS_OK. If an error occurs this
- contains the last error. */
- ECalendarStatus status;
-};
-
-gboolean
-cal_client_get_default_object (CalClient *client, icalcomponent **icalcomp, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getDefaultObject (priv->cal, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *icalcomp = icalparser_parse_string (our_op->string);
- g_free (our_op->string);
-
- if (!*icalcomp) {
- status = E_CALENDAR_STATUS_INVALID_OBJECT;
- } else {
- CalClientGetTimezonesData cb_data;
-
- /* Now make sure we have all timezones needed for this object.
- We do this to try to avoid any problems caused by getting a timezone
- in the middle of other code. Any calls to ORBit result in a
- recursive call of the GTK+ main loop, which can cause problems for
- code that doesn't expect it. Currently GnomeCanvas has problems if
- we try to get a timezone in the middle of a redraw, and there is a
- resize pending, which leads to an assert failure and an abort. */
- cb_data.client = client;
- cb_data.status = E_CALENDAR_STATUS_OK;
- icalcomponent_foreach_tzid (*icalcomp,
- cal_client_get_object_timezones_cb,
- &cb_data);
-
- status = cb_data.status;
- }
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-/**
- * cal_client_get_object:
- * @client: A calendar client.
- * @uid: Unique identifier for a calendar component.
- * @icalcomp: Return value for the calendar component object.
- *
- * Queries a calendar for a calendar component object based on its unique
- * identifier.
- *
- * Return value: Result code based on the status of the operation.
- **/
-gboolean
-cal_client_get_object (CalClient *client, const char *uid, const char *rid, icalcomponent **icalcomp, GError **error)
-{
-
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getObject (priv->cal, uid, rid ? rid : "", &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *icalcomp = icalparser_parse_string (our_op->string);
- g_free (our_op->string);
-
- if (status == E_CALENDAR_STATUS_OK && !*icalcomp) {
- status = E_CALENDAR_STATUS_INVALID_OBJECT;
- } else if (status == E_CALENDAR_STATUS_OK){
- CalClientGetTimezonesData cb_data;
-
- /* Now make sure we have all timezones needed for this object.
- We do this to try to avoid any problems caused by getting a timezone
- in the middle of other code. Any calls to ORBit result in a
- recursive call of the GTK+ main loop, which can cause problems for
- code that doesn't expect it. Currently GnomeCanvas has problems if
- we try to get a timezone in the middle of a redraw, and there is a
- resize pending, which leads to an assert failure and an abort. */
- cb_data.client = client;
- cb_data.status = E_CALENDAR_STATUS_OK;
- icalcomponent_foreach_tzid (*icalcomp,
- cal_client_get_object_timezones_cb,
- &cb_data);
-
- status = cb_data.status;
- }
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-
-static void
-cal_client_get_object_timezones_cb (icalparameter *param,
- void *data)
-{
- CalClientGetTimezonesData *cb_data = data;
- const char *tzid;
- icaltimezone *zone;
- GError *error = NULL;
-
- tzid = icalparameter_get_tzid (param);
- if (!tzid) {
- cb_data->status = E_CALENDAR_STATUS_INVALID_OBJECT;
- return;
- }
-
- if (!cal_client_get_timezone (cb_data->client, tzid, &zone, &error))
- cb_data->status = error->code;
-
- g_clear_error (&error);
-}
-
-/* Resolves TZIDs for the recurrence generator. */
-icaltimezone*
-cal_client_resolve_tzid_cb (const char *tzid, gpointer data)
-{
- CalClient *client;
- icaltimezone *zone = NULL;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (IS_CAL_CLIENT (data), NULL);
-
- client = CAL_CLIENT (data);
-
- /* FIXME: Handle errors. */
- cal_client_get_timezone (client, tzid, &zone, NULL);
-
- return zone;
-}
-
-gboolean
-cal_client_get_changes (CalClient *client, const char *change_id, GList **changes, GError **error)
-{
- CORBA_Environment ev;
- ECalendarOp *our_op;
- ECalendarStatus status;
-
- g_return_val_if_fail (client != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (IS_CAL_CLIENT (client), E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (change_id != NULL, E_CALENDAR_STATUS_INVALID_ARG);
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getChanges (client->priv->cal, change_id, &ev);
-
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *changes = our_op->list;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-
-/**
- * cal_client_get_object_list:
- * @client:
- * @query:
- *
- *
- *
- * Return value:
- **/
-gboolean
-cal_client_get_object_list (CalClient *client, const char *query, GList **objects, GError **error)
-{
- CORBA_Environment ev;
- ECalendarOp *our_op;
- ECalendarStatus status;
-
- g_return_val_if_fail (client != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (IS_CAL_CLIENT (client), E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (query != NULL, E_CALENDAR_STATUS_INVALID_ARG);
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getObjectList (client->priv->cal, query, &ev);
-
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *objects = our_op->list;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_get_object_list_as_comp (CalClient *client, const char *query, GList **objects, GError **error)
-{
- GList *ical_objects = NULL;
- GList *l;
-
- g_return_val_if_fail (client != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (IS_CAL_CLIENT (client), E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (query != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (objects != NULL, E_CALENDAR_STATUS_INVALID_ARG);
-
- if (!cal_client_get_object_list (client, query, &ical_objects, error))
- return FALSE;
-
- *objects = NULL;
- for (l = ical_objects; l; l = l->next) {
- CalComponent *comp;
-
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, l->data);
- *objects = g_list_prepend (*objects, comp);
- }
-
- g_list_free (ical_objects);
-
- return TRUE;
-}
-
-void
-cal_client_free_object_list (GList *objects)
-{
- GList *l;
-
- for (l = objects; l; l = l->next)
- icalcomponent_free (l->data);
-
- g_list_free (objects);
-}
-
-/**
- * cal_client_get_free_busy
- * @client:: A calendar client.
- * @users: List of users to retrieve free/busy information for.
- * @start: Start time for query.
- * @end: End time for query.
- *
- * Gets free/busy information from the calendar server.
- *
- * Returns: a GList of VFREEBUSY CalComponents
- */
-gboolean
-cal_client_get_free_busy (CalClient *client, GList *users, time_t start, time_t end,
- GList **freebusy, GError **error)
-{
- CORBA_Environment ev;
- ECalendarOp *our_op;
- ECalendarStatus status;
- GNOME_Evolution_Calendar_UserList corba_users;
- GList *l;
- int i, len;
-
- g_return_val_if_fail (client != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (IS_CAL_CLIENT (client), E_CALENDAR_STATUS_INVALID_ARG);
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- /* create the CORBA user list to be passed to the backend */
- len = g_list_length (users);
-
- corba_users._length = len;
- corba_users._buffer = CORBA_sequence_GNOME_Evolution_Calendar_User_allocbuf (len);
-
- for (l = users, i = 0; l; l = l->next, i++)
- corba_users._buffer[i] = CORBA_string_dup (l->data);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getFreeBusy (client->priv->cal, &corba_users, start, end, &ev);
-
- CORBA_free (corba_users._buffer);
-
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- *freebusy = NULL;
- for (l = our_op->list; l; l = l->next) {
- CalComponent *comp;
-
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
-
- icalcomp = icalparser_parse_string (l->data);
- if (!icalcomp)
- continue;
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VFREEBUSY_COMPONENT) {
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
- continue;
- }
-
- *freebusy = g_list_append (*freebusy, comp);
- }
- else
- icalcomponent_free (icalcomp);
- }
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-struct comp_instance {
- CalComponent *comp;
- time_t start;
- time_t end;
-};
-
-/* Called from cal_recur_generate_instances(); adds an instance to the list */
-static gboolean
-add_instance (CalComponent *comp, time_t start, time_t end, gpointer data)
-{
- GList **list;
- struct comp_instance *ci;
-
- list = data;
-
- ci = g_new (struct comp_instance, 1);
-
- ci->comp = comp;
- g_object_ref (G_OBJECT (ci->comp));
-
- ci->start = start;
- ci->end = end;
-
- *list = g_list_prepend (*list, ci);
-
- return TRUE;
-}
-
-/* Used from g_list_sort(); compares two struct comp_instance structures */
-static gint
-compare_comp_instance (gconstpointer a, gconstpointer b)
-{
- const struct comp_instance *cia, *cib;
- time_t diff;
-
- cia = a;
- cib = b;
-
- diff = cia->start - cib->start;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-/**
- * cal_client_generate_instances:
- * @client: A calendar client.
- * @type: Bitmask with types of objects to return.
- * @start: Start time for query.
- * @end: End time for query.
- * @cb: Callback for each generated instance.
- * @cb_data: Closure data for the callback.
- *
- * Does a combination of cal_client_get_object_list () and
- * cal_recur_generate_instances().
- *
- * The callback function should do a g_object_ref() of the calendar component
- * it gets passed if it intends to keep it around.
- **/
-void
-cal_client_generate_instances (CalClient *client, CalObjType type,
- time_t start, time_t end,
- CalRecurInstanceFn cb, gpointer cb_data)
-{
- CalClientPrivate *priv;
- GList *objects;
- GList *instances;
- GList *l;
- char *query;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
-
- priv = client->priv;
- g_return_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED);
-
- g_return_if_fail (start != -1 && end != -1);
- g_return_if_fail (start <= end);
- g_return_if_fail (cb != NULL);
-
- /* Generate objects */
- query = g_strdup_printf ("(occur-in-time-range? (%lu) (%lu))", start, end);
- if (!cal_client_get_object_list (client, query, &objects, NULL)) {
- g_free (query);
- return;
- }
- g_free (query);
-
- instances = NULL;
-
- for (l = objects; l; l = l->next) {
- CalComponent *comp;
-
- comp = l->data;
- cal_recur_generate_instances (comp, start, end, add_instance, &instances,
- cal_client_resolve_tzid_cb, client,
- priv->default_zone);
- g_object_unref (G_OBJECT (comp));
- }
-
- g_list_free (objects);
-
- /* Generate instances and spew them out */
-
- instances = g_list_sort (instances, compare_comp_instance);
-
- for (l = instances; l; l = l->next) {
- struct comp_instance *ci;
- gboolean result;
-
- ci = l->data;
-
- result = (* cb) (ci->comp, ci->start, ci->end, cb_data);
-
- if (!result)
- break;
- }
-
- /* Clean up */
-
- for (l = instances; l; l = l->next) {
- struct comp_instance *ci;
-
- ci = l->data;
- g_object_unref (G_OBJECT (ci->comp));
- g_free (ci);
- }
-
- g_list_free (instances);
-}
-
-/* Builds a list of CalComponentAlarms structures */
-static GSList *
-build_component_alarms_list (CalClient *client, GList *object_list, time_t start, time_t end)
-{
- GSList *comp_alarms;
- GList *l;
-
- comp_alarms = NULL;
-
- for (l = object_list; l != NULL; l = l->next) {
- CalComponent *comp;
- CalComponentAlarms *alarms;
- icalcomponent *icalcomp;
- CalAlarmAction omit[] = {-1};
-
- icalcomp = icalparser_parse_string (l->data);
- if (!icalcomp)
- continue;
-
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
- continue;
- }
-
- alarms = cal_util_generate_alarms_for_comp (comp, start, end, omit, cal_client_resolve_tzid_cb,
- icalcomp, client->priv->default_zone);
- if (alarms)
- comp_alarms = g_slist_prepend (comp_alarms, alarms);
- }
-
- return comp_alarms;
-}
-
-/**
- * cal_client_get_alarms_in_range:
- * @client: A calendar client.
- * @start: Start time for query.
- * @end: End time for query.
- *
- * Queries a calendar for the alarms that trigger in the specified range of
- * time.
- *
- * Return value: A list of #CalComponentAlarms structures. This should be freed
- * using the cal_client_free_alarms() function, or by freeing each element
- * separately with cal_component_alarms_free() and then freeing the list with
- * g_slist_free().
- **/
-GSList *
-cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end)
-{
- CalClientPrivate *priv;
- GSList *alarms;
- char *sexp;
- GList *object_list = NULL;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
-
- priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL);
-
- g_return_val_if_fail (start != -1 && end != -1, NULL);
- g_return_val_if_fail (start <= end, NULL);
-
- /* build the query string */
- sexp = g_strdup ("(and (has-alarms? #t))");
-
- /* execute the query on the server */
- if (!cal_client_get_object_list (client, sexp, &object_list, NULL)) {
- g_free (sexp);
- return NULL;
- }
-
- alarms = build_component_alarms_list (client, object_list, start, end);
-
- g_list_foreach (object_list, (GFunc) g_free, NULL);
- g_list_free (object_list);
- g_free (sexp);
-
- return alarms;
-}
-
-/**
- * cal_client_free_alarms:
- * @comp_alarms: A list of #CalComponentAlarms structures.
- *
- * Frees a list of #CalComponentAlarms structures as returned by
- * cal_client_get_alarms_in_range().
- **/
-void
-cal_client_free_alarms (GSList *comp_alarms)
-{
- GSList *l;
-
- for (l = comp_alarms; l; l = l->next) {
- CalComponentAlarms *alarms;
-
- alarms = l->data;
- g_assert (alarms != NULL);
-
- cal_component_alarms_free (alarms);
- }
-
- g_slist_free (comp_alarms);
-}
-
-/**
- * cal_client_get_alarms_for_object:
- * @client: A calendar client.
- * @uid: Unique identifier for a calendar component.
- * @start: Start time for query.
- * @end: End time for query.
- * @alarms: Return value for the component's alarm instances. Will return NULL
- * if no instances occur within the specified time range. This should be freed
- * using the cal_component_alarms_free() function.
- *
- * Queries a calendar for the alarms of a particular object that trigger in the
- * specified range of time.
- *
- * Return value: TRUE on success, FALSE if the object was not found.
- **/
-gboolean
-cal_client_get_alarms_for_object (CalClient *client, const char *uid,
- time_t start, time_t end,
- CalComponentAlarms **alarms)
-{
- CalClientPrivate *priv;
- icalcomponent *icalcomp;
- CalComponent *comp;
- CalAlarmAction omit[] = {-1};
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE);
-
- g_return_val_if_fail (uid != NULL, FALSE);
- g_return_val_if_fail (start != -1 && end != -1, FALSE);
- g_return_val_if_fail (start <= end, FALSE);
- g_return_val_if_fail (alarms != NULL, FALSE);
-
- *alarms = NULL;
-
- if (!cal_client_get_object (client, uid, NULL, &icalcomp, NULL))
- return FALSE;
- if (!icalcomp)
- return FALSE;
-
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
- return FALSE;
- }
-
- *alarms = cal_util_generate_alarms_for_comp (comp, start, end, omit, cal_client_resolve_tzid_cb,
- icalcomp, priv->default_zone);
-
- return TRUE;
-}
-
-/**
- * cal_client_discard_alarm
- * @client: A calendar client.
- * @comp: The component to discard the alarm from.
- * @auid: Unique identifier of the alarm to be discarded.
- *
- * Tells the calendar backend to get rid of the alarm identified by the
- * @auid argument in @comp. Some backends might remove the alarm or
- * update internal information about the alarm be discarded, or, like
- * the file backend does, ignore the operation.
- *
- * Return value: a #CalClientResult value indicating the result of the
- * operation.
- */
-gboolean
-cal_client_discard_alarm (CalClient *client, CalComponent *comp, const char *auid, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
- const char *uid;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- cal_component_get_uid (comp, &uid);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_discardAlarm (priv->cal, uid, auid, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-typedef struct _ForeachTZIDCallbackData ForeachTZIDCallbackData;
-struct _ForeachTZIDCallbackData {
- CalClient *client;
- GHashTable *timezone_hash;
- gboolean include_all_timezones;
- gboolean success;
-};
-
-/* This adds the VTIMEZONE given by the TZID parameter to the GHashTable in
- data. */
-static void
-foreach_tzid_callback (icalparameter *param, void *cbdata)
-{
- ForeachTZIDCallbackData *data = cbdata;
- CalClientPrivate *priv;
- const char *tzid;
- icaltimezone *zone;
- icalcomponent *vtimezone_comp;
- char *vtimezone_as_string;
-
- priv = data->client->priv;
-
- /* Get the TZID string from the parameter. */
- tzid = icalparameter_get_tzid (param);
- if (!tzid)
- return;
-
- /* Check if we've already added it to the GHashTable. */
- if (g_hash_table_lookup (data->timezone_hash, tzid))
- return;
-
- if (data->include_all_timezones) {
- if (!cal_client_get_timezone (data->client, tzid, &zone, NULL)) {
- data->success = FALSE;
- return;
- }
- } else {
- /* Check if it is in our cache. If it is, it must already be
- on the server so return. */
- if (g_hash_table_lookup (priv->timezones, tzid))
- return;
-
- /* Check if it is a builtin timezone. If it isn't, return. */
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (!zone)
- return;
- }
-
- /* Convert it to a string and add it to the hash. */
- vtimezone_comp = icaltimezone_get_component (zone);
- if (!vtimezone_comp)
- return;
-
- vtimezone_as_string = icalcomponent_as_ical_string (vtimezone_comp);
-
- g_hash_table_insert (data->timezone_hash, (char*) tzid,
- g_strdup (vtimezone_as_string));
-}
-
-/* This appends the value string to the GString given in data. */
-static void
-append_timezone_string (gpointer key, gpointer value, gpointer data)
-{
- GString *vcal_string = data;
-
- g_string_append (vcal_string, value);
- g_free (value);
-}
-
-
-/* This simply frees the hash values. */
-static void
-free_timezone_string (gpointer key, gpointer value, gpointer data)
-{
- g_free (value);
-}
-
-
-/* This converts the VEVENT/VTODO to a string. If include_all_timezones is
- TRUE, it includes all the VTIMEZONE components needed for the VEVENT/VTODO.
- If not, it only includes builtin timezones that may not be on the server.
-
- To do that we check every TZID in the component to see if it is a builtin
- timezone. If it is, we see if it it in our cache. If it is in our cache,
- then we know the server already has it and we don't need to send it.
- If it isn't in our cache, then we need to send it to the server.
- If we need to send any timezones to the server, then we have to create a
- complete VCALENDAR object, otherwise we can just send a single VEVENT/VTODO
- as before. */
-static char*
-cal_client_get_component_as_string_internal (CalClient *client,
- icalcomponent *icalcomp,
- gboolean include_all_timezones)
-{
- GHashTable *timezone_hash;
- GString *vcal_string;
- int initial_vcal_string_len;
- ForeachTZIDCallbackData cbdata;
- char *obj_string;
- CalClientPrivate *priv;
-
- priv = client->priv;
-
- timezone_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* Add any timezones needed to the hash. We use a hash since we only
- want to add each timezone once at most. */
- cbdata.client = client;
- cbdata.timezone_hash = timezone_hash;
- cbdata.include_all_timezones = include_all_timezones;
- cbdata.success = TRUE;
- icalcomponent_foreach_tzid (icalcomp, foreach_tzid_callback, &cbdata);
- if (!cbdata.success) {
- g_hash_table_foreach (timezone_hash, free_timezone_string,
- NULL);
- return NULL;
- }
-
- /* Create the start of a VCALENDAR, to add the VTIMEZONES to,
- and remember its length so we know if any VTIMEZONEs get added. */
- vcal_string = g_string_new (NULL);
- g_string_append (vcal_string,
- "BEGIN:VCALENDAR\n"
- "PRODID:-//Ximian//NONSGML Evolution Calendar//EN\n"
- "VERSION:2.0\n"
- "METHOD:PUBLISH\n");
- initial_vcal_string_len = vcal_string->len;
-
- /* Now concatenate all the timezone strings. This also frees the
- timezone strings as it goes. */
- g_hash_table_foreach (timezone_hash, append_timezone_string,
- vcal_string);
-
- /* Get the string for the VEVENT/VTODO. */
- obj_string = g_strdup (icalcomponent_as_ical_string (icalcomp));
-
- /* If there were any timezones to send, create a complete VCALENDAR,
- else just send the VEVENT/VTODO string. */
- if (!include_all_timezones
- && vcal_string->len == initial_vcal_string_len) {
- g_string_free (vcal_string, TRUE);
- } else {
- g_string_append (vcal_string, obj_string);
- g_string_append (vcal_string, "END:VCALENDAR\n");
- g_free (obj_string);
- obj_string = vcal_string->str;
- g_string_free (vcal_string, FALSE);
- }
-
- g_hash_table_destroy (timezone_hash);
-
- return obj_string;
-}
-
-/**
- * cal_client_get_component_as_string:
- * @client: A calendar client.
- * @icalcomp: A calendar component object.
- *
- * Gets a calendar component as an iCalendar string, with a toplevel
- * VCALENDAR component and all VTIMEZONEs needed for the component.
- *
- * Return value: the component as a complete iCalendar string, or NULL on
- * failure. The string should be freed after use.
- **/
-char*
-cal_client_get_component_as_string (CalClient *client, icalcomponent *icalcomp)
-{
- return cal_client_get_component_as_string_internal (client, icalcomp, TRUE);
-}
-
-gboolean
-cal_client_create_object (CalClient *client, icalcomponent *icalcomp, char **uid, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_createObject (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- if (uid)
- *uid = our_op->uid;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_modify_object (CalClient *client, icalcomponent *icalcomp, CalObjModType mod, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_modifyObject (priv->cal, icalcomponent_as_ical_string (icalcomp), mod, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_remove_object_with_mod (CalClient *client, const char *uid,
- const char *rid, CalObjModType mod, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_removeObject (priv->cal, uid, rid ? rid : "", mod, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-/**
- * cal_client_remove_object:
- * @client: A calendar client.
- * @uid: Unique identifier of the calendar component to remove.
- *
- * Asks a calendar to remove a component. If the server is able to remove the
- * component, all clients will be notified and they will emit the "obj_removed"
- * signal.
- *
- * Return value: a #CalClientResult value indicating the result of the
- * operation.
- **/
-gboolean
-cal_client_remove_object (CalClient *client, const char *uid, GError **error)
-{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- return cal_client_remove_object_with_mod (client, uid, NULL, CALOBJ_MOD_ALL, error);
-}
-
-gboolean
-cal_client_receive_objects (CalClient *client, icalcomponent *icalcomp, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_receiveObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_send_objects (CalClient *client, icalcomponent *icalcomp, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_sendObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-gboolean
-cal_client_get_timezone (CalClient *client, const char *tzid, icaltimezone **zone, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
- icalcomponent *icalcomp;
-
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
- g_return_val_if_fail (tzid != NULL, FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (priv->mutex);
-
- /* Check for well known zones and in the cache */
- *zone = NULL;
-
- /* If tzid is NULL or "" we return NULL, since it is a 'local time'. */
- if (!tzid || !tzid[0]) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
- }
-
- /* If it is UTC, we return the special UTC timezone. */
- if (!strcmp (tzid, "UTC")) {
- *zone = icaltimezone_get_utc_timezone ();
- } else {
- /* See if we already have it in the cache. */
- *zone = g_hash_table_lookup (priv->timezones, tzid);
- }
-
- if (*zone) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
- }
-
- /* call the backend */
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_getTimezone (priv->cal, tzid, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- icalcomp = icalparser_parse_string (our_op->string);
- g_free (our_op->string);
-
- /* FIXME Invalid object status? */
- if (!icalcomp) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OBJECT_NOT_FOUND, error);
- }
-
- *zone = icaltimezone_new ();
- if (!icaltimezone_set_component (*zone, icalcomp)) {
- icaltimezone_free (*zone, 1);
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OBJECT_NOT_FOUND, error);
- }
-
- /* Now add it to the cache, to avoid the server call in future. */
- g_hash_table_insert (priv->timezones, icaltimezone_get_tzid (*zone), *zone);
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-/**
- * cal_client_add_timezone
- * @client: A calendar client.
- * @izone: The timezone to add.
- * @error: Placeholder for error information.
- *
- * Add a VTIMEZONE object to the given calendar.
- *
- * Returns: TRUE if successful, FALSE otherwise.
- */
-gboolean
-cal_client_add_timezone (CalClient *client, icaltimezone *izone, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
- const char *tzobj;
-
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
- g_return_val_if_fail (izone != NULL, FALSE);
-
- priv = client->priv;
-
- e_mutex_lock (priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (priv->mutex);
-
- /* convert icaltimezone into a string */
- tzobj = icalcomponent_as_ical_string (icaltimezone_get_component (izone));
-
- /* call the backend */
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_addTimezone (priv->cal, tzobj, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-/**
- * cal_client_get_query:
- * @client: A calendar client.
- * @sexp: S-expression representing the query.
- *
- * Creates a live query object from a loaded calendar.
- *
- * Return value: A query object that will emit notification signals as calendar
- * components are added and removed from the query in the server.
- **/
-gboolean
-cal_client_get_query (CalClient *client, const char *sexp, CalQuery **query, GError **error)
-{
- CORBA_Environment ev;
- ECalendarOp *our_op;
- ECalendarStatus status;
-
- g_return_val_if_fail (client != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (IS_CAL_CLIENT (client), E_CALENDAR_STATUS_INVALID_ARG);
- g_return_val_if_fail (query != NULL, E_CALENDAR_STATUS_INVALID_ARG);
-
- e_mutex_lock (client->priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (client->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- our_op->listener = query_listener_new ();
- GNOME_Evolution_Calendar_Cal_getQuery (client->priv->cal, sexp, BONOBO_OBJREF (our_op->listener), &ev);
-
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *query = our_op->query;
-
- bonobo_object_unref (BONOBO_OBJECT (our_op->listener));
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-
-/* This ensures that the given timezone is on the server. We use this to pass
- the default timezone to the server, so it can resolve DATE and floating
- DATE-TIME values into specific times. (Most of our IDL interface uses
- time_t values to pass specific times from the server to the client.) */
-static gboolean
-cal_client_ensure_timezone_on_server (CalClient *client, icaltimezone *zone, GError **error)
-{
- CalClientPrivate *priv;
- char *tzid;
- icaltimezone *tmp_zone;
-
- priv = client->priv;
-
- /* FIXME This is highly broken since there is no locking */
-
- /* If the zone is NULL or UTC we don't need to do anything. */
- if (!zone)
- return TRUE;
-
- tzid = icaltimezone_get_tzid (zone);
-
- if (!strcmp (tzid, "UTC"))
- return TRUE;
-
- /* See if we already have it in the cache. If we do, it must be on
- the server already. */
- tmp_zone = g_hash_table_lookup (priv->timezones, tzid);
- if (tmp_zone)
- return TRUE;
-
- /* Now we have to send it to the server, in case it doesn't already
- have it. */
- return cal_client_add_timezone (client, zone, error);
-}
-
-gboolean
-cal_client_set_default_timezone (CalClient *client, icaltimezone *zone, GError **error)
-{
- CalClientPrivate *priv;
- CORBA_Environment ev;
- ECalendarStatus status;
- ECalendarOp *our_op;
- const char *tzid;
-
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
- g_return_val_if_fail (zone != NULL, FALSE);
-
- priv = client->priv;
-
- /* Make sure the server has the VTIMEZONE data. */
- if (!cal_client_ensure_timezone_on_server (client, zone, error))
- return FALSE;
-
- e_mutex_lock (priv->mutex);
-
- if (client->priv->load_state != CAL_CLIENT_LOAD_LOADED) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
- }
-
- if (client->priv->current_op != NULL) {
- e_mutex_unlock (client->priv->mutex);
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error);
- }
-
- our_op = e_calendar_new_op (client);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (priv->mutex);
-
- /* FIXME Adding it to the server to change the tzid */
- tzid = icaltimezone_get_tzid (zone);
-
- /* call the backend */
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Cal_setDefaultTimezone (priv->cal, tzid, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning (G_STRLOC ": Unable to contact backend");
-
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_calendar_remove_op (client, our_op);
- e_mutex_unlock (our_op->mutex);
- e_calendar_free_op (our_op);
-
- E_CALENDAR_CHECK_STATUS (status, error);
-}
-
-/**
- * cal_client_get_error_message
- * @status: A status code.
- *
- * Get an error message for the given status code.
- *
- * Returns: the error message.
- */
-const char *
-cal_client_get_error_message (ECalendarStatus status)
-{
- switch (status) {
- case E_CALENDAR_STATUS_INVALID_ARG :
- return _("Invalid argument");
- case E_CALENDAR_STATUS_BUSY :
- return _("Backend is busy");
- case E_CALENDAR_STATUS_REPOSITORY_OFFLINE :
- return _("Repository is offline");
- case E_CALENDAR_STATUS_NO_SUCH_CALENDAR :
- return _("No such calendar");
- case E_CALENDAR_STATUS_OBJECT_NOT_FOUND :
- return _("Object not found");
- case E_CALENDAR_STATUS_INVALID_OBJECT :
- return _("Invalid object");
- case E_CALENDAR_STATUS_URI_NOT_LOADED :
- return _("URI not loaded");
- case E_CALENDAR_STATUS_URI_ALREADY_LOADED :
- return _("URI already loaded");
- case E_CALENDAR_STATUS_PERMISSION_DENIED :
- return _("Permission denied");
- case E_CALENDAR_STATUS_CARD_NOT_FOUND :
- return _("Object not found");
- case E_CALENDAR_STATUS_CARD_ID_ALREADY_EXISTS :
- return _("Object ID already exists");
- case E_CALENDAR_STATUS_PROTOCOL_NOT_SUPPORTED :
- return _("Protocol not supported");
- case E_CALENDAR_STATUS_CANCELLED :
- return _("Operation has been cancelled");
- case E_CALENDAR_STATUS_COULD_NOT_CANCEL :
- return _("Could not cancel operation");
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED :
- return _("Authentication failed");
- case E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED :
- return _("Authentication required");
- case E_CALENDAR_STATUS_CORBA_EXCEPTION :
- return _("A CORBA esception has occurred");
- case E_CALENDAR_STATUS_OTHER_ERROR :
- return _("Unknown error");
- case E_CALENDAR_STATUS_OK :
- return _("No error");
- }
-
- return NULL;
-}
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
deleted file mode 100644
index 9491c73fa3..0000000000
--- a/calendar/cal-client/cal-client.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Evolution calendar client
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_CLIENT_H
-#define CAL_CLIENT_H
-
-#include <glib-object.h>
-#include <cal-util/cal-recur.h>
-#include <cal-util/cal-util.h>
-#include <cal-client/cal-query.h>
-#include "cal-client-types.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_CLIENT_TYPE (cal_client_get_type ())
-#define CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_CLIENT_TYPE, CalClient))
-#define CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass))
-#define IS_CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_TYPE))
-#define IS_CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE))
-
-#define CAL_CLIENT_OPEN_STATUS_ENUM_TYPE (cal_client_open_status_enum_get_type ())
-#define CAL_CLIENT_REMOVE_STATUS_ENUM_TYPE (cal_client_remove_status_enum_get_type ())
-#define CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE (cal_client_set_mode_status_enum_get_type ())
-#define CAL_MODE_ENUM_TYPE (cal_mode_enum_get_type ())
-
-typedef struct _CalClientClass CalClientClass;
-
-typedef struct _CalClientPrivate CalClientPrivate;
-
-/* Open status for the cal_opened signal */
-typedef enum {
- CAL_CLIENT_OPEN_SUCCESS,
- CAL_CLIENT_OPEN_ERROR,
- CAL_CLIENT_OPEN_NOT_FOUND,
- CAL_CLIENT_OPEN_PERMISSION_DENIED,
- CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED
-} CalClientOpenStatus;
-
-/* Set mode status for the cal_client_set_mode function */
-typedef enum {
- CAL_CLIENT_SET_MODE_SUCCESS,
- CAL_CLIENT_SET_MODE_ERROR,
- CAL_CLIENT_SET_MODE_NOT_SUPPORTED
-} CalClientSetModeStatus;
-
-/* Get status for the cal_client_get_object() function */
-typedef enum {
- CAL_CLIENT_GET_SUCCESS,
- CAL_CLIENT_GET_NOT_FOUND,
- CAL_CLIENT_GET_SYNTAX_ERROR
-} CalClientGetStatus;
-
-/* Status for update_object(s) and remove_object */
-typedef enum {
- CAL_CLIENT_RESULT_SUCCESS,
- CAL_CLIENT_RESULT_CORBA_ERROR,
- CAL_CLIENT_RESULT_INVALID_OBJECT,
- CAL_CLIENT_RESULT_NOT_FOUND,
- CAL_CLIENT_RESULT_PERMISSION_DENIED
-} CalClientResult;
-
-/* Whether the client is not loaded, is being loaded, or is already loaded */
-typedef enum {
- CAL_CLIENT_LOAD_NOT_LOADED,
- CAL_CLIENT_LOAD_LOADING,
- CAL_CLIENT_LOAD_LOADED
-} CalClientLoadState;
-
-struct _CalClient {
- GObject object;
-
- /* Private data */
- CalClientPrivate *priv;
-};
-
-struct _CalClientClass {
- GObjectClass parent_class;
-
- /* Notification signals */
-
- void (* cal_opened) (CalClient *client, CalClientOpenStatus status);
- void (* cal_set_mode) (CalClient *client, CalClientSetModeStatus status, CalMode mode);
-
- void (* backend_error) (CalClient *client, const char *message);
-
- void (* categories_changed) (CalClient *client, GPtrArray *categories);
-
- void (* forget_password) (CalClient *client, const char *key);
-
- void (* backend_died) (CalClient *client);
-};
-
-typedef gchar * (* CalClientAuthFunc) (CalClient *client,
- const gchar *prompt,
- const gchar *key,
- gpointer user_data);
-
-GType cal_client_get_type (void);
-
-GType cal_client_open_status_enum_get_type (void);
-GType cal_client_set_mode_status_enum_get_type (void);
-GType cal_mode_enum_get_type (void);
-
-CalClient *cal_client_new (const char *uri, CalObjType type);
-
-void cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer data);
-
-gboolean cal_client_open (CalClient *client, gboolean only_if_exists, GError **error);
-void cal_client_open_async (CalClient *client, gboolean only_if_exists);
-gboolean cal_client_remove_calendar (CalClient *client, GError **error);
-
-GList *cal_client_uri_list (CalClient *client, CalMode mode);
-
-CalClientLoadState cal_client_get_load_state (CalClient *client);
-
-const char *cal_client_get_uri (CalClient *client);
-
-gboolean cal_client_is_read_only (CalClient *client, gboolean *read_only, GError **error);
-gboolean cal_client_get_cal_address (CalClient *client, char **cal_address, GError **error);
-gboolean cal_client_get_alarm_email_address (CalClient *client, char **alarm_address, GError **error);
-gboolean cal_client_get_ldap_attribute (CalClient *client, char **ldap_attribute, GError **error);
-
-gboolean cal_client_get_one_alarm_only (CalClient *client);
-gboolean cal_client_get_organizer_must_attend (CalClient *client);
-gboolean cal_client_get_save_schedules (CalClient *client);
-gboolean cal_client_get_static_capability (CalClient *client, const char *cap);
-
-gboolean cal_client_set_mode (CalClient *client, CalMode mode);
-
-gboolean cal_client_get_default_object (CalClient *client,
- icalcomponent **icalcomp, GError **error);
-
-gboolean cal_client_get_object (CalClient *client,
- const char *uid,
- const char *rid,
- icalcomponent **icalcomp,
- GError **error);
-
-gboolean cal_client_get_changes (CalClient *client, const char *change_id, GList **changes, GError **error);
-
-gboolean cal_client_get_object_list (CalClient *client, const char *query, GList **objects, GError **error);
-gboolean cal_client_get_object_list_as_comp (CalClient *client, const char *query, GList **objects, GError **error);
-void cal_client_free_object_list (GList *objects);
-
-gboolean cal_client_get_free_busy (CalClient *client, GList *users, time_t start, time_t end,
- GList **freebusy, GError **error);
-
-void cal_client_generate_instances (CalClient *client, CalObjType type,
- time_t start, time_t end,
- CalRecurInstanceFn cb, gpointer cb_data);
-
-GSList *cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end);
-
-void cal_client_free_alarms (GSList *comp_alarms);
-
-gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid,
- time_t start, time_t end,
- CalComponentAlarms **alarms);
-
-gboolean cal_client_create_object (CalClient *client, icalcomponent *icalcomp, char **uid, GError **error);
-gboolean cal_client_modify_object (CalClient *client, icalcomponent *icalcomp, CalObjModType mod, GError **error);
-gboolean cal_client_remove_object (CalClient *client, const char *uid, GError **error);
-gboolean cal_client_remove_object_with_mod (CalClient *client, const char *uid, const char *rid, CalObjModType mod, GError **error);
-
-gboolean cal_client_discard_alarm (CalClient *client, CalComponent *comp, const char *auid, GError **error);
-
-gboolean cal_client_receive_objects (CalClient *client, icalcomponent *icalcomp, GError **error);
-gboolean cal_client_send_objects (CalClient *client, icalcomponent *icalcomp, GError **error);
-
-gboolean cal_client_get_timezone (CalClient *client, const char *tzid, icaltimezone **zone, GError **error);
-gboolean cal_client_add_timezone (CalClient *client, icaltimezone *izone, GError **error);
-/* Sets the default timezone to use to resolve DATE and floating DATE-TIME
- values. This will typically be from the user's timezone setting. Call this
- before using any other functions. It will pass the default timezone on to
- the server. Returns TRUE on success. */
-gboolean cal_client_set_default_timezone (CalClient *client, icaltimezone *zone, GError **error);
-
-gboolean cal_client_get_query (CalClient *client, const char *sexp, CalQuery **query, GError **error);
-
-/* Resolves TZIDs for the recurrence generator. */
-icaltimezone *cal_client_resolve_tzid_cb (const char *tzid, gpointer data);
-
-/* Returns a complete VCALENDAR for a VEVENT/VTODO including all VTIMEZONEs
- used by the component. It also includes a 'METHOD:PUBLISH' property. */
-char* cal_client_get_component_as_string (CalClient *client, icalcomponent *icalcomp);
-
-const char * cal_client_get_error_message (ECalendarStatus status);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c
deleted file mode 100644
index ac04be7c07..0000000000
--- a/calendar/cal-client/cal-listener.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/* Evolution calendar listener
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include <bonobo/bonobo-main.h>
-#include "cal-marshal.h"
-#include "cal-listener.h"
-
-
-
-/* Private part of the CalListener structure */
-struct CalListenerPrivate {
- /* Notification functions and their closure data */
- CalListenerCalSetModeFn cal_set_mode_fn;
- CalListenerErrorOccurredFn error_occurred_fn;
- CalListenerCategoriesChangedFn categories_changed_fn;
- gpointer fn_data;
-
- /* Whether notification is desired */
- gboolean notify : 1;
-};
-
-/* Signal IDs */
-enum {
- READ_ONLY,
- CAL_ADDRESS,
- ALARM_ADDRESS,
- LDAP_ATTRIBUTE,
- STATIC_CAPABILITIES,
- OPEN,
- REMOVE,
- CREATE_OBJECT,
- MODIFY_OBJECT,
- REMOVE_OBJECT,
- DISCARD_ALARM,
- RECEIVE_OBJECTS,
- SEND_OBJECTS,
- DEFAULT_OBJECT,
- OBJECT,
- OBJECT_LIST,
- GET_TIMEZONE,
- ADD_TIMEZONE,
- SET_DEFAULT_TIMEZONE,
- GET_CHANGES,
- GET_FREE_BUSY,
- QUERY,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static BonoboObjectClass *parent_class;
-
-static ECalendarStatus
-convert_status (const GNOME_Evolution_Calendar_CallStatus status)
-{
- switch (status) {
- case GNOME_Evolution_Calendar_Success:
- return E_CALENDAR_STATUS_OK;
- case GNOME_Evolution_Calendar_RepositoryOffline:
- return E_CALENDAR_STATUS_REPOSITORY_OFFLINE;
- case GNOME_Evolution_Calendar_PermissionDenied:
- return E_CALENDAR_STATUS_PERMISSION_DENIED;
- case GNOME_Evolution_Calendar_ObjectNotFound:
- return E_CALENDAR_STATUS_OBJECT_NOT_FOUND;
- case GNOME_Evolution_Calendar_InvalidObject:
- return E_CALENDAR_STATUS_INVALID_OBJECT;
- case GNOME_Evolution_Calendar_CardIdAlreadyExists:
- return E_CALENDAR_STATUS_CARD_ID_ALREADY_EXISTS;
- case GNOME_Evolution_Calendar_AuthenticationFailed:
- return E_CALENDAR_STATUS_AUTHENTICATION_FAILED;
- case GNOME_Evolution_Calendar_AuthenticationRequired:
- return E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
- case GNOME_Evolution_Calendar_OtherError:
- default:
- return E_CALENDAR_STATUS_OTHER_ERROR;
- }
-}
-
-static void
-impl_notifyReadOnly (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_boolean read_only,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[READ_ONLY], 0, convert_status (status), read_only);
-}
-
-static void
-impl_notifyCalAddress (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *address,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[CAL_ADDRESS], 0, convert_status (status), address);
-}
-
-static void
-impl_notifyAlarmEmailAddress (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *address,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[ALARM_ADDRESS], 0, convert_status (status), address);
-}
-
-static void
-impl_notifyLDAPAttribute (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *ldap_attribute,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[LDAP_ATTRIBUTE], 0, convert_status (status), ldap_attribute);
-}
-
-static void
-impl_notifyStaticCapabilities (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *capabilities,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[STATIC_CAPABILITIES], 0, convert_status (status));
-}
-
-/* ::notifyCalOpened method */
-static void
-impl_notifyCalOpened (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[OPEN], 0, convert_status (status));
-}
-
-static void
-impl_notifyCalRemoved (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[REMOVE], 0, convert_status (status));
-}
-
-static void
-impl_notifyObjectCreated (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *uid,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[CREATE_OBJECT], 0, convert_status (status), uid);
-}
-
-static void
-impl_notifyObjectModified (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[MODIFY_OBJECT], 0, convert_status (status));
-}
-
-static void
-impl_notifyObjectRemoved (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[REMOVE_OBJECT], 0, convert_status (status));
-}
-
-static void
-impl_notifyAlarmDiscarded (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[DISCARD_ALARM], 0, convert_status (status));
-}
-
-static void
-impl_notifyObjectsReceived (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[RECEIVE_OBJECTS], 0, convert_status (status));
-}
-
-static void
-impl_notifyObjectsSent (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[SEND_OBJECTS], 0, convert_status (status));
-}
-
-static void
-impl_notifyDefaultObjectRequested (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *object,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[DEFAULT_OBJECT], 0, convert_status (status), object);
-}
-
-static void
-impl_notifyObjectRequested (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *object,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[OBJECT], 0, convert_status (status), object);
-}
-
-static GList *
-build_object_list (const GNOME_Evolution_Calendar_stringlist *seq)
-{
- GList *list;
- int i;
-
- list = NULL;
- for (i = 0; i < seq->_length; i++) {
- icalcomponent *comp;
-
- comp = icalcomponent_new_from_string (seq->_buffer[i]);
- if (!comp)
- continue;
-
- list = g_list_prepend (list, comp);
- }
-
- return list;
-}
-
-static void
-impl_notifyObjectListRequested (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const GNOME_Evolution_Calendar_stringlist *objects,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
- GList *object_list, *l;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- object_list = build_object_list (objects);
-
- g_signal_emit (G_OBJECT (listener), signals[OBJECT_LIST], 0, convert_status (status), object_list);
-
- for (l = object_list; l; l = l->next)
- icalcomponent_free (l->data);
- g_list_free (object_list);
-}
-
-static void
-impl_notifyTimezoneRequested (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *object,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[GET_TIMEZONE], 0, convert_status (status), object);
-}
-
-static void
-impl_notifyTimezoneAdded (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const CORBA_char *tzid,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[ADD_TIMEZONE], 0, convert_status (status), tzid);
-}
-
-static void
-impl_notifyDefaultTimezoneSet (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[SET_DEFAULT_TIMEZONE], 0, convert_status (status));
-}
-
-static GList *
-build_change_list (const GNOME_Evolution_Calendar_CalObjChangeSeq *seq)
-{
- GList *list = NULL;
- icalcomponent *icalcomp;
- int i;
-
- /* Create the list in reverse order */
- for (i = 0; i < seq->_length; i++) {
- GNOME_Evolution_Calendar_CalObjChange *corba_coc;
- CalClientChange *ccc;
-
- corba_coc = &seq->_buffer[i];
- ccc = g_new (CalClientChange, 1);
-
- icalcomp = icalparser_parse_string (corba_coc->calobj);
- if (!icalcomp)
- continue;
-
- ccc->comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (ccc->comp, icalcomp)) {
- icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (ccc->comp));
- continue;
- }
- ccc->type = corba_coc->type;
-
- list = g_list_prepend (list, ccc);
- }
-
- list = g_list_reverse (list);
-
- return list;
-}
-
-static void
-impl_notifyChanges (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const GNOME_Evolution_Calendar_CalObjChangeSeq *seq,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
- GList *changes, *l;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- changes = build_change_list (seq);
-
- g_signal_emit (G_OBJECT (listener), signals[GET_CHANGES], 0, convert_status (status), changes);
-
- for (l = changes; l; l = l->next)
- g_free (l->data);
- g_list_free (changes);
-}
-
-static GList *
-build_free_busy_list (const GNOME_Evolution_Calendar_CalObjSeq *seq)
-{
- GList *list = NULL;
- int i;
-
- /* Create the list in reverse order */
- for (i = 0; i < seq->_length; i++) {
- CalComponent *comp;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
-
- icalcomp = icalcomponent_new_from_string (seq->_buffer[i]);
- if (!icalcomp)
- continue;
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VFREEBUSY_COMPONENT) {
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
- continue;
- }
-
- list = g_list_append (list, comp);
- } else {
- icalcomponent_free (icalcomp);
- }
- }
-
- return list;
-}
-
-static void
-impl_notifyFreeBusy (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const GNOME_Evolution_Calendar_CalObjSeq *seq,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
- GList *freebusy, *l;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- freebusy = build_free_busy_list (seq);
-
- g_signal_emit (G_OBJECT (listener), signals[GET_FREE_BUSY], 0, convert_status (status), freebusy);
-
- for (l = freebusy; l; l = l->next)
- g_free (l->data);
- g_list_free (freebusy);
-}
-
-static void
-impl_notifyQuery (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- const GNOME_Evolution_Calendar_Query query,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_signal_emit (G_OBJECT (listener), signals[QUERY], 0, convert_status (status), query);
-}
-
-/* ::notifyCalSetMode method */
-static void
-impl_notifyCalSetMode (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_message ("notify_set_mode");
-
- g_assert (priv->cal_set_mode_fn != NULL);
- (* priv->cal_set_mode_fn) (listener, status, mode, priv->fn_data);
-}
-
-
-/* ::notifyErrorOccurred method */
-static void
-impl_notifyErrorOccurred (PortableServer_Servant servant,
- const CORBA_char *message,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_message ("notify_error");
-
- g_assert (priv->error_occurred_fn != NULL);
- (* priv->error_occurred_fn) (listener, message, priv->fn_data);
-}
-
-/* ::notifyCategoriesChanged method */
-static void
-impl_notifyCategoriesChanged (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_StringSeq *categories,
- CORBA_Environment *ev)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- listener = CAL_LISTENER (bonobo_object_from_servant (servant));
- priv = listener->priv;
-
- if (!priv->notify)
- return;
-
- g_message ("notify_categories");
-
- g_assert (priv->categories_changed_fn != NULL);
- (* priv->categories_changed_fn) (listener, categories, priv->fn_data);
-}
-
-
-
-/* Object initialization function for the calendar listener */
-static void
-cal_listener_init (CalListener *listener, CalListenerClass *klass)
-{
- CalListenerPrivate *priv;
-
- priv = g_new0 (CalListenerPrivate, 1);
- listener->priv = priv;
-
- priv->error_occurred_fn = NULL;
- priv->categories_changed_fn = NULL;
-
- priv->notify = TRUE;
-}
-
-/* Finalize handler for the calendar listener */
-static void
-cal_listener_finalize (GObject *object)
-{
- CalListener *listener;
- CalListenerPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_LISTENER (object));
-
- listener = CAL_LISTENER (object);
- priv = listener->priv;
-
- priv->error_occurred_fn = NULL;
- priv->categories_changed_fn = NULL;
- priv->fn_data = NULL;
-
- priv->notify = FALSE;
-
- g_free (priv);
- listener->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Class initialization function for the calendar listener */
-static void
-cal_listener_class_init (CalListenerClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- klass->epv.notifyReadOnly = impl_notifyReadOnly;
- klass->epv.notifyCalAddress = impl_notifyCalAddress;
- klass->epv.notifyAlarmEmailAddress = impl_notifyAlarmEmailAddress;
- klass->epv.notifyLDAPAttribute = impl_notifyLDAPAttribute;
- klass->epv.notifyStaticCapabilities = impl_notifyStaticCapabilities;
- klass->epv.notifyCalOpened = impl_notifyCalOpened;
- klass->epv.notifyCalRemoved = impl_notifyCalRemoved;
- klass->epv.notifyObjectCreated = impl_notifyObjectCreated;
- klass->epv.notifyObjectModified = impl_notifyObjectModified;
- klass->epv.notifyObjectRemoved = impl_notifyObjectRemoved;
- klass->epv.notifyAlarmDiscarded = impl_notifyAlarmDiscarded;
- klass->epv.notifyObjectsReceived = impl_notifyObjectsReceived;
- klass->epv.notifyObjectsSent = impl_notifyObjectsSent;
- klass->epv.notifyDefaultObjectRequested = impl_notifyDefaultObjectRequested;
- klass->epv.notifyObjectRequested = impl_notifyObjectRequested;
- klass->epv.notifyObjectListRequested = impl_notifyObjectListRequested;
- klass->epv.notifyTimezoneRequested = impl_notifyTimezoneRequested;
- klass->epv.notifyTimezoneAdded = impl_notifyTimezoneAdded;
- klass->epv.notifyDefaultTimezoneSet = impl_notifyDefaultTimezoneSet;
- klass->epv.notifyChanges = impl_notifyChanges;
- klass->epv.notifyFreeBusy = impl_notifyFreeBusy;
- klass->epv.notifyQuery = impl_notifyQuery;
- klass->epv.notifyCalSetMode = impl_notifyCalSetMode;
- klass->epv.notifyErrorOccurred = impl_notifyErrorOccurred;
- klass->epv.notifyCategoriesChanged = impl_notifyCategoriesChanged;
-
- object_class->finalize = cal_listener_finalize;
-
- signals[READ_ONLY] =
- g_signal_new ("read_only",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, read_only),
- NULL, NULL,
- cal_marshal_VOID__INT_BOOLEAN,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_BOOLEAN);
- signals[CAL_ADDRESS] =
- g_signal_new ("cal_address",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, cal_address),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[ALARM_ADDRESS] =
- g_signal_new ("alarm_address",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, alarm_address),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[LDAP_ATTRIBUTE] =
- g_signal_new ("ldap_attribute",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, ldap_attribute),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[STATIC_CAPABILITIES] =
- g_signal_new ("static_capabilities",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, static_capabilities),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[OPEN] =
- g_signal_new ("open",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, open),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[REMOVE] =
- g_signal_new ("remove",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, remove),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[CREATE_OBJECT] =
- g_signal_new ("create_object",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, create_object),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[MODIFY_OBJECT] =
- g_signal_new ("modify_object",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, modify_object),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[REMOVE_OBJECT] =
- g_signal_new ("remove_object",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, remove_object),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[DISCARD_ALARM] =
- g_signal_new ("discard_alarm",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, discard_alarm),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[RECEIVE_OBJECTS] =
- g_signal_new ("receive_objects",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, receive_objects),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[SEND_OBJECTS] =
- g_signal_new ("send_objects",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, send_objects),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[DEFAULT_OBJECT] =
- g_signal_new ("default_object",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, default_object),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[OBJECT] =
- g_signal_new ("object",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, object),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[OBJECT_LIST] =
- g_signal_new ("object_list",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, object_list),
- NULL, NULL,
- cal_marshal_VOID__INT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER);
- signals[GET_TIMEZONE] =
- g_signal_new ("get_timezone",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, get_timezone),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[ADD_TIMEZONE] =
- g_signal_new ("add_timezone",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, add_timezone),
- NULL, NULL,
- cal_marshal_VOID__INT_STRING,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
- signals[SET_DEFAULT_TIMEZONE] =
- g_signal_new ("set_default_timezone",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, set_default_timezone),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- signals[GET_CHANGES] =
- g_signal_new ("get_changes",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, get_changes),
- NULL, NULL,
- cal_marshal_VOID__INT_POINTER,
- G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_POINTER);
- signals[GET_FREE_BUSY] =
- g_signal_new ("get_free_busy",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, get_free_busy),
- NULL, NULL,
- cal_marshal_VOID__INT_POINTER,
- G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_POINTER);
- signals[QUERY] =
- g_signal_new ("query",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CalListenerClass, query),
- NULL, NULL,
- cal_marshal_VOID__INT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER);
-}
-
-BONOBO_TYPE_FUNC_FULL (CalListener,
- GNOME_Evolution_Calendar_Listener,
- BONOBO_TYPE_OBJECT,
- cal_listener);
-
-/**
- * cal_listener_construct:
- * @listener: A calendar listener.
- * @cal_opened_fn: Function that will be called to notify that a calendar was
- * opened.
- * @cal_removed_fn: Function that will be called to notify that a calendar was
- * removed
- * @error_occurred_fn: Function that will be called to notify errors.
- * @categories_changed_fn: Function that will be called to notify that the list
- * of categories that are present in the calendar's objects has changed.
- * @fn_data: Closure data pointer that will be passed to the notification
- * functions.
- *
- * Constructs a calendar listener by setting the callbacks that it will use for
- * notification from the calendar server.
- *
- * Return value: the same object as the @listener argument.
- **/
-CalListener *
-cal_listener_construct (CalListener *listener,
- CalListenerCalSetModeFn cal_set_mode_fn,
- CalListenerErrorOccurredFn error_occurred_fn,
- CalListenerCategoriesChangedFn categories_changed_fn,
- gpointer fn_data)
-{
- CalListenerPrivate *priv;
-
- g_return_val_if_fail (listener != NULL, NULL);
- g_return_val_if_fail (IS_CAL_LISTENER (listener), NULL);
- g_return_val_if_fail (cal_set_mode_fn != NULL, NULL);
- g_return_val_if_fail (error_occurred_fn != NULL, NULL);
- g_return_val_if_fail (categories_changed_fn != NULL, NULL);
-
- priv = listener->priv;
-
- priv->cal_set_mode_fn = cal_set_mode_fn;
- priv->error_occurred_fn = error_occurred_fn;
- priv->categories_changed_fn = categories_changed_fn;
- priv->fn_data = fn_data;
-
- return listener;
-}
-
-/**
- * cal_listener_new:
- * @cal_opened_fn: Function that will be called to notify that a calendar was
- * opened.
- * @error_occurred_fn: Function that will be called to notify errors.
- * @categories_changed_fn: Function that will be called to notify that the list
- * of categories that are present in the calendar's objects has changed.
- * @fn_data: Closure data pointer that will be passed to the notification
- * functions.
- *
- * Creates a new #CalListener object.
- *
- * Return value: A newly-created #CalListener object.
- **/
-CalListener *
-cal_listener_new (CalListenerCalSetModeFn cal_set_mode_fn,
- CalListenerErrorOccurredFn error_occurred_fn,
- CalListenerCategoriesChangedFn categories_changed_fn,
- gpointer fn_data)
-{
- CalListener *listener;
-
- g_return_val_if_fail (error_occurred_fn != NULL, NULL);
- g_return_val_if_fail (categories_changed_fn != NULL, NULL);
-
- listener = g_object_new (CAL_LISTENER_TYPE,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
-
- return cal_listener_construct (listener,
- cal_set_mode_fn,
- error_occurred_fn,
- categories_changed_fn,
- fn_data);
-}
-
-/**
- * cal_listener_stop_notification:
- * @listener: A calendar listener.
- *
- * Informs a calendar listener that no further notification is desired. The
- * callbacks specified when the listener was created will no longer be invoked
- * after this function is called.
- **/
-void
-cal_listener_stop_notification (CalListener *listener)
-{
- CalListenerPrivate *priv;
-
- g_return_if_fail (listener != NULL);
- g_return_if_fail (IS_CAL_LISTENER (listener));
-
- priv = listener->priv;
- g_return_if_fail (priv->notify != FALSE);
-
- priv->notify = FALSE;
-}
diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h
deleted file mode 100644
index 1230104999..0000000000
--- a/calendar/cal-client/cal-listener.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Evolution calendar listener
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_LISTENER_H
-#define CAL_LISTENER_H
-
-#include <bonobo/bonobo-object.h>
-#include "evolution-calendar.h"
-#include "cal-client-types.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_LISTENER_TYPE (cal_listener_get_type ())
-#define CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_LISTENER_TYPE, CalListener))
-#define CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \
- CalListenerClass))
-#define IS_CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_LISTENER_TYPE))
-#define IS_CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE))
-
-typedef struct CalListenerPrivate CalListenerPrivate;
-
-typedef struct {
- BonoboObject xobject;
-
- /* Private data */
- CalListenerPrivate *priv;
-} CalListener;
-
-typedef struct {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_Listener__epv epv;
-
- /* Signals */
- void (*read_only) (CalListener *listener, ECalendarStatus status, gboolean read_only);
- void (*cal_address) (CalListener *listener, ECalendarStatus status, const char *address);
- void (*alarm_address) (CalListener *listener, ECalendarStatus status, const char *address);
- void (*ldap_attribute) (CalListener *listener, ECalendarStatus status, const char *ldap_attribute);
- void (*static_capabilities) (CalListener *listener, ECalendarStatus status, const char *capabilities);
-
- void (*open) (CalListener *listener, ECalendarStatus status);
- void (*remove) (CalListener *listener, ECalendarStatus status);
-
- void (*create_object) (CalListener *listener, ECalendarStatus status, const char *id);
- void (*modify_object) (CalListener *listener, ECalendarStatus status);
- void (*remove_object) (CalListener *listener, ECalendarStatus status);
-
- void (*discard_alarm) (CalListener *listener, ECalendarStatus status);
-
- void (*receive_objects) (CalListener *listener, ECalendarStatus status);
- void (*send_objects) (CalListener *listener, ECalendarStatus status);
-
- void (*default_object) (CalListener *listener, ECalendarStatus status, const char *object);
- void (*object) (CalListener *listener, ECalendarStatus status, const char *object);
- void (*object_list) (CalListener *listener, ECalendarStatus status, GList **objects);
-
- void (*get_timezone) (CalListener *listener, ECalendarStatus status, const char *object);
- void (*add_timezone) (CalListener *listener, ECalendarStatus status, const char *tzid);
- void (*set_default_timezone) (CalListener *listener, ECalendarStatus status, const char *tzid);
-
- void (*get_changes) (CalListener *listener, ECalendarStatus status, GList *changes);
- void (*get_free_busy) (CalListener *listener, ECalendarStatus status, GList *freebusy);
-
- void (*query) (CalListener *listener, ECalendarStatus status, GNOME_Evolution_Calendar_Query query);
-} CalListenerClass;
-
-/* Notification functions */
-typedef void (* CalListenerCalSetModeFn) (CalListener *listener,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode,
- gpointer data);
-
-typedef void (* CalListenerErrorOccurredFn) (CalListener *listener,
- const char *message,
- gpointer data);
-
-typedef void (* CalListenerCategoriesChangedFn) (CalListener *listener,
- const GNOME_Evolution_Calendar_StringSeq *categories,
- gpointer data);
-
-
-GType cal_listener_get_type (void);
-
-CalListener *cal_listener_construct (CalListener *listener,
- CalListenerCalSetModeFn cal_set_mode_fn,
- CalListenerErrorOccurredFn error_occurred_fn,
- CalListenerCategoriesChangedFn categories_changed_fn,
- gpointer fn_data);
-
-CalListener *cal_listener_new (CalListenerCalSetModeFn cal_set_mode_fn,
- CalListenerErrorOccurredFn error_occurred_fn,
- CalListenerCategoriesChangedFn categories_changed_fn,
- gpointer fn_data);
-
-void cal_listener_stop_notification (CalListener *listener);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-client/cal-marshal.list b/calendar/cal-client/cal-marshal.list
deleted file mode 100644
index e0ca019669..0000000000
--- a/calendar/cal-client/cal-marshal.list
+++ /dev/null
@@ -1,6 +0,0 @@
-NONE:INT
-NONE:POINTER
-NONE:INT,STRING
-NONE:INT,BOOL
-NONE:INT,POINTER
-NONE:STRING,INT
diff --git a/calendar/cal-client/cal-query.c b/calendar/cal-client/cal-query.c
deleted file mode 100644
index e77f5ad3e9..0000000000
--- a/calendar/cal-client/cal-query.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* Evolution calendar - Live query client object
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <bonobo/bonobo-exception.h>
-#include "cal-marshal.h"
-#include "cal-client.h"
-#include "cal-query.h"
-#include "query-listener.h"
-
-
-
-/* Private part of the CalQuery structure */
-struct _CalQueryPrivate {
- /* Handle to the query in the server */
- GNOME_Evolution_Calendar_Query query;
-
- /* Our query listener implementation */
- QueryListener *listener;
-
- /* The CalClient associated with this query */
- CalClient *client;
-};
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_QUERY,
- PROP_LISTENER,
- PROP_CLIENT
-};
-
-/* Signal IDs */
-enum {
- OBJECTS_ADDED,
- OBJECTS_MODIFIED,
- OBJECTS_REMOVED,
- QUERY_PROGRESS,
- QUERY_DONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static GObjectClass *parent_class;
-
-
-
-static void
-objects_added_cb (QueryListener *listener, GList *objects, gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- g_signal_emit (G_OBJECT (query), signals[OBJECTS_ADDED], 0, objects);
-}
-
-static void
-objects_modified_cb (QueryListener *listener, GList *objects, gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- g_signal_emit (G_OBJECT (query), signals[OBJECTS_MODIFIED], 0, objects);
-}
-
-static void
-objects_removed_cb (QueryListener *listener, GList *uids, gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- g_signal_emit (G_OBJECT (query), signals[OBJECTS_REMOVED], 0, uids);
-}
-
-static void
-query_progress_cb (QueryListener *listener, const char *message, int percent, gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- g_signal_emit (G_OBJECT (query), signals[QUERY_PROGRESS], 0, message, percent);
-}
-
-static void
-query_done_cb (QueryListener *listener, ECalendarStatus status, gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- g_signal_emit (G_OBJECT (query), signals[QUERY_DONE], 0, status);
-}
-
-/* Object initialization function for the calendar query */
-static void
-cal_query_init (CalQuery *query, CalQueryClass *klass)
-{
- CalQueryPrivate *priv;
-
- priv = g_new0 (CalQueryPrivate, 1);
- query->priv = priv;
-
- priv->listener = NULL;
- priv->query = CORBA_OBJECT_NIL;
-}
-
-static void
-cal_query_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- CalQuery *query;
- CalQueryPrivate *priv;
-
- query = CAL_QUERY (object);
- priv = query->priv;
-
- switch (property_id) {
- case PROP_QUERY:
- priv->query = bonobo_object_dup_ref (g_value_get_pointer (value), NULL);
- break;
- case PROP_LISTENER:
- priv->listener = bonobo_object_ref (g_value_get_pointer (value));
-
- g_signal_connect (G_OBJECT (priv->listener), "objects_added",
- G_CALLBACK (objects_added_cb), query);
- g_signal_connect (G_OBJECT (priv->listener), "objects_modified",
- G_CALLBACK (objects_modified_cb), query);
- g_signal_connect (G_OBJECT (priv->listener), "objects_removed",
- G_CALLBACK (objects_removed_cb), query);
- g_signal_connect (G_OBJECT (priv->listener), "query_progress",
- G_CALLBACK (query_progress_cb), query);
- g_signal_connect (G_OBJECT (priv->listener), "query_done",
- G_CALLBACK (query_done_cb), query);
- break;
- case PROP_CLIENT:
- priv->client = CAL_CLIENT (g_value_dup_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-cal_query_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- CalQuery *query;
- CalQueryPrivate *priv;
-
- query = CAL_QUERY (object);
- priv = query->priv;
-
- switch (property_id) {
- case PROP_QUERY:
- g_value_set_pointer (value, priv->query);
- break;
- case PROP_LISTENER:
- g_value_set_pointer (value, priv->listener);
- break;
- case PROP_CLIENT:
- g_value_set_object (value, priv->client);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-
-/* Finalize handler for the calendar query */
-static void
-cal_query_finalize (GObject *object)
-{
- CalQuery *query;
- CalQueryPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_QUERY (object));
-
- query = CAL_QUERY (object);
- priv = query->priv;
-
- /* The server keeps a copy of the query listener, so we must unref it */
- g_signal_handlers_disconnect_matched (priv->listener, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, query);
- bonobo_object_unref (BONOBO_OBJECT (priv->listener));
-
- if (priv->query != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (priv->query, NULL);
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Class initialization function for the calendar query */
-static void
-cal_query_class_init (CalQueryClass *klass)
-{
- GObjectClass *object_class;
- GParamSpec *param;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = cal_query_set_property;
- object_class->get_property = cal_query_get_property;
- object_class->finalize = cal_query_finalize;
-
- param = g_param_spec_pointer ("query", NULL, NULL,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_QUERY, param);
- param = g_param_spec_pointer ("listener", NULL, NULL,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_LISTENER, param);
- param = g_param_spec_object ("client", NULL, NULL, CAL_CLIENT_TYPE,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_CLIENT, param);
-
- signals[OBJECTS_ADDED] =
- g_signal_new ("objects_added",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalQueryClass, objects_added),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[OBJECTS_MODIFIED] =
- g_signal_new ("objects_modified",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalQueryClass, objects_modified),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[OBJECTS_REMOVED] =
- g_signal_new ("objects_removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalQueryClass, objects_removed),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[QUERY_PROGRESS] =
- g_signal_new ("query_progress",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalQueryClass, query_progress),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT);
- signals[QUERY_DONE] =
- g_signal_new ("query_done",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalQueryClass, query_done),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-}
-
-/**
- * cal_query_get_type:
- *
- * Registers the #CalQuery class if necessary, and returns the type ID assigned
- * to it.
- *
- * Return value: The type ID of the #CalQuery class.
- **/
-GType
-cal_query_get_type (void)
-{
- static GType cal_query_type = 0;
-
- if (!cal_query_type) {
- static GTypeInfo info = {
- sizeof (CalQueryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_query_class_init,
- NULL, NULL,
- sizeof (CalQuery),
- 0,
- (GInstanceInitFunc) cal_query_init
- };
- cal_query_type = g_type_register_static (G_TYPE_OBJECT, "CalQuery", &info, 0);
- }
-
- return cal_query_type;
-}
-
-/**
- * cal_query_new:
- * @client: Client from which the query is being created.
- * @cal: Handle to an open calendar.
- * @sexp: S-expression that defines the query.
- *
- * Creates a new query object by issuing the query creation request to the
- * calendar server.
- *
- * Return value: A newly-created query object, or NULL if the request failed.
- **/
-CalQuery *
-cal_query_new (GNOME_Evolution_Calendar_Query corba_query, QueryListener *listener, CalClient *client)
-{
- CalQuery *query;
-
- query = g_object_new (CAL_QUERY_TYPE, "query", corba_query, "listener",
- listener, "client", client, NULL);
-
- return query;
-}
-
-/**
- * cal_query_get_client
- * @query: A #CalQuery object.
- *
- * Get the #CalClient associated with this query.
- *
- * Returns: the associated client.
- */
-CalClient *
-cal_query_get_client (CalQuery *query)
-{
- g_return_val_if_fail (IS_CAL_QUERY (query), NULL);
-
- return query->priv->client;
-}
-
-void
-cal_query_start (CalQuery *query)
-{
- CalQueryPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_CAL_QUERY (query));
-
- priv = query->priv;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Query_start (priv->query, &ev);
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": Unable to start query");
-
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/cal-client/cal-query.h b/calendar/cal-client/cal-query.h
deleted file mode 100644
index 05390dd12a..0000000000
--- a/calendar/cal-client/cal-query.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Evolution calendar - Live query client object
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_QUERY_H
-#define CAL_QUERY_H
-
-#include <glib-object.h>
-#include "cal-client-types.h"
-#include "query-listener.h"
-#include "evolution-calendar.h"
-
-G_BEGIN_DECLS
-
-typedef struct _CalClient CalClient;
-
-
-
-#define CAL_QUERY_TYPE (cal_query_get_type ())
-#define CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_QUERY_TYPE, CalQuery))
-#define CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_QUERY_TYPE, CalQueryClass))
-#define IS_CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_QUERY_TYPE))
-#define IS_CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_QUERY_TYPE))
-
-typedef struct _CalQueryPrivate CalQueryPrivate;
-
-typedef struct {
- GObject object;
-
- /* Private data */
- CalQueryPrivate *priv;
-} CalQuery;
-
-typedef struct {
- GObjectClass parent_class;
-
- /* Notification signals */
- void (* objects_added) (CalQuery *query, GList *objects);
- void (* objects_modified) (CalQuery *query, GList *objects);
- void (* objects_removed) (CalQuery *query, GList *uids);
- void (* query_progress) (CalQuery *query, char *message, int percent);
- void (* query_done) (CalQuery *query, ECalendarStatus status);
-} CalQueryClass;
-
-GType cal_query_get_type (void);
-
-CalQuery *cal_query_new (GNOME_Evolution_Calendar_Query corba_query, QueryListener *listener, CalClient *client);
-CalClient *cal_query_get_client (CalQuery *query);
-void cal_query_start (CalQuery *query);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c
deleted file mode 100644
index 48763be50a..0000000000
--- a/calendar/cal-client/client-test.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Evolution calendar client - test program
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-main.h>
-#include "cal-client.h"
-#include "cal-util/cal-component.h"
-
-static CalClient *client1;
-static CalClient *client2;
-
-/* Prints a message with a client identifier */
-static void
-cl_printf (CalClient *client, const char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- printf ("Client %s: ",
- client == client1 ? "1" :
- client == client2 ? "2" :
- "UNKNOWN");
- vprintf (format, args);
- va_end (args);
-}
-
-static void
-objects_added_cb (GObject *object, GList *objects, gpointer data)
-{
- GList *l;
-
- for (l = objects; l; l = l->next)
- cl_printf (data, "Object added %s\n", icalcomponent_get_uid (l->data));
-}
-
-static void
-objects_modified_cb (GObject *object, GList *objects, gpointer data)
-{
- GList *l;
-
- for (l = objects; l; l = l->next)
- cl_printf (data, "Object modified %s\n", icalcomponent_get_uid (l->data));
-}
-
-static void
-objects_removed_cb (GObject *object, GList *objects, gpointer data)
-{
- GList *l;
-
- for (l = objects; l; l = l->next)
- cl_printf (data, "Object removed %s\n", icalcomponent_get_uid (l->data));
-}
-
-static void
-query_done_cb (GObject *object, ECalendarStatus status, gpointer data)
-{
- cl_printf (data, "Query done\n");
-}
-
-/* Lists the UIDs of objects in a calendar, called as an idle handler */
-static gboolean
-list_uids (gpointer data)
-{
- CalClient *client;
- GList *objects = NULL;
- GList *l;
-
- client = CAL_CLIENT (data);
-
- g_message ("Blah");
-
- if (!cal_client_get_object_list (client, "(contains? \"any\" \"Test4\")", &objects, NULL))
- return FALSE;
-
- cl_printf (client, "UIDS: ");
-
- if (!objects)
- printf ("none\n");
- else {
- for (l = objects; l; l = l->next) {
- const char *uid;
-
- uid = icalcomponent_get_uid (l->data);
- printf ("`%s' ", uid);
- }
-
- printf ("\n");
-
- for (l = objects; l; l = l->next) {
- printf ("------------------------------\n");
- printf ("%s", icalcomponent_as_ical_string (l->data));
- printf ("------------------------------\n");
- }
- }
-
- cal_client_free_object_list (objects);
-
- g_object_unref (client);
-
- return FALSE;
-}
-
-/* Callback used when a calendar is opened */
-static void
-cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
-{
- CalQuery *query;
-
- cl_printf (client, "Load/create %s\n",
- ((status == CAL_CLIENT_OPEN_SUCCESS) ? "success" :
- (status == CAL_CLIENT_OPEN_ERROR) ? "error" :
- (status == CAL_CLIENT_OPEN_NOT_FOUND) ? "not found" :
- (status == CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED) ? "method not supported" :
- "unknown status value"));
-
- if (status == CAL_CLIENT_OPEN_SUCCESS) {
- if (!cal_client_get_query (client, "(contains? \"any\" \"Test4\")", &query, NULL))
- g_warning (G_STRLOC ": Unable to obtain query");
-
- g_signal_connect (G_OBJECT (query), "objects_added",
- G_CALLBACK (objects_added_cb), client);
- g_signal_connect (G_OBJECT (query), "objects_modified",
- G_CALLBACK (objects_modified_cb), client);
- g_signal_connect (G_OBJECT (query), "objects_removed",
- G_CALLBACK (objects_removed_cb), client);
- g_signal_connect (G_OBJECT (query), "query_done",
- G_CALLBACK (query_done_cb), client);
-
- cal_query_start (query);
-
- g_idle_add (list_uids, client);
- }
- else
- g_object_unref (client);
-}
-
-/* Callback used when a client is destroyed */
-static void
-client_destroy_cb (gpointer data, GObject *object)
-{
- if (CAL_CLIENT (object) == client1)
- client1 = NULL;
- else if (CAL_CLIENT (object) == client2)
- client2 = NULL;
- else
- g_assert_not_reached ();
-
- if (!client1 && !client2)
- bonobo_main_quit ();
-}
-
-/* Creates a calendar client and tries to load the specified URI into it */
-static void
-create_client (CalClient **client, const char *uri, CalObjType type, gboolean only_if_exists)
-{
- *client = cal_client_new (uri, type);
- if (!*client) {
- g_message (G_STRLOC ": could not create the client");
- exit (1);
- }
-
- g_object_weak_ref (G_OBJECT (*client), client_destroy_cb, NULL);
-
- g_signal_connect (*client, "cal_opened",
- G_CALLBACK (cal_opened_cb),
- NULL);
-
- printf ("Calendar loading `%s'...\n", uri);
-
- if (!cal_client_open (*client, only_if_exists, NULL)) {
- g_message (G_STRLOC ": failure when issuing calendar open request `%s'",
- uri);
- exit (1);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- textdomain (GETTEXT_PACKAGE);
-
- g_type_init ();
- bonobo_activation_init (argc, argv);
-
- if (!bonobo_init (&argc, argv)) {
- g_message ("main(): could not initialize Bonobo");
- exit (1);
- }
-
- create_client (&client1, "file:///home/gnome24-evolution-new-calendar/evolution/local/Calendar",
- CALOBJ_TYPE_EVENT, FALSE);
-// create_client (&client2, "file:///tmp/tasks", TRUE);
-
- bonobo_main ();
- return 0;
-}
diff --git a/calendar/cal-client/query-listener.c b/calendar/cal-client/query-listener.c
deleted file mode 100644
index 4c8cbb4fe5..0000000000
--- a/calendar/cal-client/query-listener.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* Evolution calendar - Live search query listener convenience object
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "cal-marshal.h"
-#include "query-listener.h"
-
-
-
-/* Private part of the QueryListener structure */
-
-struct _QueryListenerPrivate {
- int dummy;
-};
-
-/* Signal IDs */
-enum {
- OBJECTS_ADDED,
- OBJECTS_MODIFIED,
- OBJECTS_REMOVED,
- QUERY_PROGRESS,
- QUERY_DONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static BonoboObjectClass *parent_class;
-
-/* CORBA method implementations */
-/* FIXME This is duplicated from cal-listener.c */
-static ECalendarStatus
-convert_status (const GNOME_Evolution_Calendar_CallStatus status)
-{
- switch (status) {
- case GNOME_Evolution_Calendar_Success:
- return E_CALENDAR_STATUS_OK;
- case GNOME_Evolution_Calendar_RepositoryOffline:
- return E_CALENDAR_STATUS_REPOSITORY_OFFLINE;
- case GNOME_Evolution_Calendar_PermissionDenied:
- return E_CALENDAR_STATUS_PERMISSION_DENIED;
- case GNOME_Evolution_Calendar_ObjectNotFound:
- return E_CALENDAR_STATUS_OBJECT_NOT_FOUND;
- case GNOME_Evolution_Calendar_CardIdAlreadyExists:
- return E_CALENDAR_STATUS_CARD_ID_ALREADY_EXISTS;
- case GNOME_Evolution_Calendar_AuthenticationFailed:
- return E_CALENDAR_STATUS_AUTHENTICATION_FAILED;
- case GNOME_Evolution_Calendar_AuthenticationRequired:
- return E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
- case GNOME_Evolution_Calendar_OtherError:
- default:
- return E_CALENDAR_STATUS_OTHER_ERROR;
- }
-}
-
-/* FIXME This is duplicated from cal-listener.c */
-static GList *
-build_object_list (const GNOME_Evolution_Calendar_stringlist *seq)
-{
- GList *list;
- int i;
-
- list = NULL;
- for (i = 0; i < seq->_length; i++) {
- icalcomponent *comp;
-
- comp = icalcomponent_new_from_string (seq->_buffer[i]);
- if (!comp)
- continue;
-
- list = g_list_prepend (list, comp);
- }
-
- return list;
-}
-
-static GList *
-build_uid_list (const GNOME_Evolution_Calendar_CalObjUIDSeq *seq)
-{
- GList *list;
- int i;
-
- list = NULL;
- for (i = 0; i < seq->_length; i++)
- list = g_list_prepend (list, g_strdup (seq->_buffer[i]));
-
- return list;
-}
-
-static void
-impl_notifyObjectsAdded (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_stringlist *objects,
- CORBA_Environment *ev)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
- GList *object_list, *l;
-
- ql = QUERY_LISTENER (bonobo_object_from_servant (servant));
- priv = ql->priv;
-
- object_list = build_object_list (objects);
-
- g_signal_emit (G_OBJECT (ql), signals[OBJECTS_ADDED], 0, object_list);
-
- for (l = object_list; l; l = l->next)
- icalcomponent_free (l->data);
- g_list_free (object_list);
-}
-
-static void
-impl_notifyObjectsModified (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_stringlist *objects,
- CORBA_Environment *ev)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
- GList *object_list, *l;
-
- ql = QUERY_LISTENER (bonobo_object_from_servant (servant));
- priv = ql->priv;
-
- object_list = build_object_list (objects);
-
- g_signal_emit (G_OBJECT (ql), signals[OBJECTS_MODIFIED], 0, object_list);
-
- for (l = object_list; l; l = l->next)
- icalcomponent_free (l->data);
- g_list_free (object_list);
-}
-
-static void
-impl_notifyObjectsRemoved (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObjUIDSeq *uids,
- CORBA_Environment *ev)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
- GList *uid_list, *l;
-
- ql = QUERY_LISTENER (bonobo_object_from_servant (servant));
- priv = ql->priv;
-
- uid_list = build_uid_list (uids);
-
- g_signal_emit (G_OBJECT (ql), signals[OBJECTS_REMOVED], 0, uid_list);
-
- for (l = uid_list; l; l = l->next)
- g_free (l->data);
- g_list_free (uid_list);
-}
-
-static void
-impl_notifyQueryProgress (PortableServer_Servant servant,
- const CORBA_char *message,
- const CORBA_short percent,
- CORBA_Environment *ev)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
-
- ql = QUERY_LISTENER (bonobo_object_from_servant (servant));
- priv = ql->priv;
-
- g_signal_emit (G_OBJECT (ql), signals[QUERY_PROGRESS], 0, message, percent);
-}
-
-static void
-impl_notifyQueryDone (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CallStatus status,
- CORBA_Environment *ev)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
-
- ql = QUERY_LISTENER (bonobo_object_from_servant (servant));
- priv = ql->priv;
-
- g_signal_emit (G_OBJECT (ql), signals[QUERY_DONE], 0, convert_status (status));
-}
-
-/* Object initialization function for the live search query listener */
-static void
-query_listener_init (QueryListener *ql, QueryListenerClass *class)
-{
- QueryListenerPrivate *priv;
-
- priv = g_new0 (QueryListenerPrivate, 1);
- ql->priv = priv;
-}
-
-/* Finalize handler for the live search query listener */
-static void
-query_listener_finalize (GObject *object)
-{
- QueryListener *ql;
- QueryListenerPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_QUERY_LISTENER (object));
-
- ql = QUERY_LISTENER (object);
- priv = ql->priv;
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Class initialization function for the live search query listener */
-static void
-query_listener_class_init (QueryListenerClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = query_listener_finalize;
-
- klass->epv.notifyObjectsAdded = impl_notifyObjectsAdded;
- klass->epv.notifyObjectsModified = impl_notifyObjectsModified;
- klass->epv.notifyObjectsRemoved = impl_notifyObjectsRemoved;
- klass->epv.notifyQueryProgress = impl_notifyQueryProgress;
- klass->epv.notifyQueryDone = impl_notifyQueryDone;
-
- signals[OBJECTS_ADDED] =
- g_signal_new ("objects_added",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (QueryListenerClass, objects_added),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[OBJECTS_MODIFIED] =
- g_signal_new ("objects_modified",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (QueryListenerClass, objects_modified),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[OBJECTS_REMOVED] =
- g_signal_new ("objects_removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (QueryListenerClass, objects_removed),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[QUERY_PROGRESS] =
- g_signal_new ("query_progress",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (QueryListenerClass, query_progress),
- NULL, NULL,
- cal_marshal_VOID__POINTER,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT);
- signals[QUERY_DONE] =
- g_signal_new ("query_done",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (QueryListenerClass, query_done),
- NULL, NULL,
- cal_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-}
-
-BONOBO_TYPE_FUNC_FULL (QueryListener,
- GNOME_Evolution_Calendar_QueryListener,
- BONOBO_TYPE_OBJECT,
- query_listener);
-
-QueryListener *
-query_listener_new (void)
-{
- QueryListener *ql;
-
- ql = g_object_new (QUERY_LISTENER_TYPE, NULL);
-
- return ql;
-}
diff --git a/calendar/cal-client/query-listener.h b/calendar/cal-client/query-listener.h
deleted file mode 100644
index 6a204bbf77..0000000000
--- a/calendar/cal-client/query-listener.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Evolution calendar - Live search query listener implementation
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef QUERY_LISTENER_H
-#define QUERY_LISTENER_H
-
-#include <bonobo/bonobo-object.h>
-#include "cal-client-types.h"
-#include "evolution-calendar.h"
-
-G_BEGIN_DECLS
-
-
-
-#define QUERY_LISTENER_TYPE (query_listener_get_type ())
-#define QUERY_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QUERY_LISTENER_TYPE, QueryListener))
-#define QUERY_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QUERY_LISTENER_TYPE, \
- QueryListenerClass))
-#define IS_QUERY_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QUERY_LISTENER_TYPE))
-#define IS_QUERY_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUERY_LISTENER_TYPE))
-
-typedef struct _QueryListenerPrivate QueryListenerPrivate;
-
-typedef struct {
- BonoboObject xobject;
-
- /* Private data */
- QueryListenerPrivate *priv;
-} QueryListener;
-
-typedef struct {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_QueryListener__epv epv;
-
- void (*objects_added) (QueryListener *listener, GList *objects);
- void (*objects_modified) (QueryListener *listener, GList *objects);
- void (*objects_removed) (QueryListener *listener, GList *uids);
- void (*query_progress) (QueryListener *listener, const char *message, int percent);
- void (*query_done) (QueryListener *listener, ECalendarStatus status);
-} QueryListenerClass;
-
-/* Notification functions */
-
-GType query_listener_get_type (void);
-QueryListener *query_listener_new (void);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-client/test.ics b/calendar/cal-client/test.ics
deleted file mode 100644
index 128251ee11..0000000000
--- a/calendar/cal-client/test.ics
+++ /dev/null
@@ -1,318 +0,0 @@
-BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//hacksw/handcal//NONSGML v1.0//EN
-
-BEGIN:VEVENT
-DTSTART:19970714T170000Z
-DTEND:19970715T035959Z
-SUMMARY:Bastille Day Party
-END:VEVENT
-
-BEGIN:VEVENT
-UID:19970901T130000Z-123401@host.com
-DTSTAMP:19970901T1300Z
-DTSTART:19970903T163000Z
-DTEND:19970903T190000Z
-SUMMARY:Annual Employee Review
-CLASS:PRIVATE
-CATEGORIES:BUSINESS,HUMAN RESOURCES
-END:VEVENT
-
-BEGIN:VEVENT
-UID:19970901T130000Z-123402@host.com
-DTSTAMP:19970901T1300Z
-DTSTART:19970401T163000Z
-DTEND:19970402T010000Z
-SUMMARY:Laurel is in sensitivity awareness class.
-CLASS:PUBLIC
-CATEGORIES:BUSINESS,HUMAN RESOURCES
-TRANSP:TRANSPARENT
-END:VEVENT
-
-BEGIN:VEVENT
-UID:19970901T130000Z-123403@host.com
-DTSTAMP:19970901T1300Z
-DTSTART:19971102
-SUMMARY:Our Blissful Anniversary
-CLASS:CONFIDENTIAL
-CATEGORIES:ANNIVERSARY,PERSONAL,SPECIAL OCCASION
-RRULE:FREQ=YEARLY
-END:VEVENT
-
-BEGIN:VTODO
-UID:19970901T130000Z-123404@host.com
-DTSTAMP:19970901T1300Z
-DTSTART:19970415T133000Z
-DUE:19970416T045959Z
-SUMMARY:1996 Income Tax Preparation
-CLASS:CONFIDENTIAL
-CATEGORIES:FAMILY,FINANCE
-PRIORITY:1
-STATUS:NEEDS-ACTION
-END:VTODO
-
-BEGIN:VJOURNAL
-UID:19970901T130000Z-123405@host.com
-DTSTAMP:19970901T1300Z
-DTSTART;VALUE=DATE:19970317
-SUMMARY:Staff meeting minutes
-DESCRIPTION:1. Staff meeting: Participants include Joe\, Lisa
- and Bob. Aurora project plans were reviewed. There is currently
- no budget reserves for this project. Lisa will escalate to
- management. Next meeting on Tuesday.\n
- 2. Telephone Conference: ABC Corp. sales representative called
- to discuss new printer. Promised to get us a demo by Friday.\n
- 3. Henry Miller (Handsoff Insurance): Car was totaled by tree.
- Is looking into a loaner car. 654-2323 (tel).
-END:VJOURNAL
-
-BEGIN:VFREEBUSY
-ORGANIZER:MAILTO:jane_doe@host1.com
-ATTENDEE:MAILTO:john_public@host2.com
-DTSTART:19971015T050000Z
-DTEND:19971016T050000Z
-DTSTAMP:19970901T083000Z
-END:VFREEBUSY
-
-BEGIN:VFREEBUSY
-ORGANIZER:MAILTO:jane_doe@host1.com
-ATTENDEE:MAILTO:john_public@host2.com
-DTSTAMP:19970901T100000Z
-FREEBUSY;VALUE=PERIOD:19971015T050000Z/PT8H30M,
- 19971015T160000Z/PT5H30M,19971015T223000Z/PT6H30M
-URL:http://host2.com/pub/busy/jpublic-01.ifb
-COMMENT:This iCalendar file contains busy time information for
- the next three months.
-END:VFREEBUSY
-
-BEGIN:VFREEBUSY
-ORGANIZER:jsmith@host.com
-DTSTART:19980313T141711Z
-DTEND:19980410T141711Z
-FREEBUSY:19980314T233000Z/19980315T003000Z
-FREEBUSY:19980316T153000Z/19980316T163000Z
-FREEBUSY:19980318T030000Z/19980318T040000Z
-URL:http://www.host.com/calendar/busytime/jsmith.ifb
-END:VFREEBUSY
-
-BEGIN:VTIMEZONE
-TZID:US-Eastern
-LAST-MODIFIED:19870101T000000Z
-BEGIN:STANDARD
-DTSTART:19971026T020000
-RDATE:19971026T020000
-TZOFFSETFROM:-0400
-TZOFFSETTO:-0500
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:19971026T020000
-RDATE:19970406T020000
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
-
-BEGIN:VTIMEZONE
-TZID:US-Eastern
-LAST-MODIFIED:19870101T000000Z
-TZURL:http://zones.stds_r_us.net/tz/US-Eastern
-BEGIN:STANDARD
-DTSTART:19671029T020000
-RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
-TZOFFSETFROM:-0400
-TZOFFSETTO:-0500
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:19870405T020000
-RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
-
-BEGIN:VTIMEZONE
-TZID:US--Fictitious-Eastern
-LAST-MODIFIED:19870101T000000Z
-BEGIN:STANDARD
-DTSTART:19671029T020000
-RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
-TZOFFSETFROM:-0400
-TZOFFSETTO:-0500
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:19870405T020000
-RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
-
-BEGIN:VTIMEZONE
-TZID:US--Fictitious-Eastern
-LAST-MODIFIED:19870101T000000Z
-BEGIN:STANDARD
-DTSTART:19671029T020000
-RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
-TZOFFSETFROM:-0400
-TZOFFSETTO:-0500
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:19870405T020000
-RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-BEGIN:DAYLIGHT
-DTSTART:19990424T020000
-RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=4
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
-
-BEGIN:VALARM
-TRIGGER;VALUE=DATE-TIME:19970317T133000Z
-REPEAT:4
-DURATION:PT15M
-ACTION:AUDIO
-ATTACH;FMTTYPE=audio/basic:ftp://host.com/pub/sounds/bell-01.aud
-END:VALARM
-BEGIN:VALARM
-TRIGGER:-PT30M
-REPEAT:2
-DURATION:PT15M
-ACTION:DISPLAY
-DESCRIPTION:Breakfast meeting with executive\n
- team at 8:30 AM EST.
-END:VALARM
-
-BEGIN:VALARM
-TRIGGER:-P2D
-ACTION:EMAIL
-ATTENDEE:MAILTO:john_doe@host.com
-SUMMARY:*** REMINDER: SEND AGENDA FOR WEEKLY STAFF MEETING ***
-DESCRIPTION:A draft agenda needs to be sent out to the attendees
- to the weekly managers meeting (MGR-LIST). Attached is a
- pointer the document template for the agenda file.
-ATTACH;FMTTYPE=application/binary:http://host.com/templates/agen
- da.doc
-END:VALARM
-
-BEGIN:VALARM
-TRIGGER;VALUE=DATE-TIME:19980101T050000Z
-REPEAT:23
-DURATION:PT1H
-ACTION:PROCEDURE
-ATTACH;FMTTYPE=application/binary:ftp://host.com/novo-
- procs/felizano.exe
-END:VALARM
-
-BEGIN:VTIMEZONE
-TZID:US-Eastern
-BEGIN:STANDARD
-DTSTART:19981025T020000
-RDATE:19981025T020000
-TZOFFSETFROM:-0400
-TZOFFSETTO:-0500
-TZNAME:EST
-END:STANDARD
-BEGIN:DAYLIGHT
-DTSTART:19990404T020000
-RDATE:19990404T020000
-TZOFFSETFROM:-0500
-TZOFFSETTO:-0400
-TZNAME:EDT
-END:DAYLIGHT
-END:VTIMEZONE
-
-BEGIN:VEVENT
-DTSTAMP:19980309T231000Z
-UID:guid-1.host1.com
-ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com
-ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:
- MAILTO:employee-A@host.com
-DESCRIPTION:Project XYZ Review Meeting
-CATEGORIES:MEETING
-CLASS:PUBLIC
-CREATED:19980309T130000Z
-SUMMARY:XYZ Project Review
-DTSTART;TZID=US-Eastern:19980312T083000
-DTEND;TZID=US-Eastern:19980312T093000
-LOCATION:1CP Conference Room 4350
-END:VEVENT
-
-BEGIN:VEVENT
-DTSTAMP:19970324T1200Z
-SEQUENCE:0
-UID:uid3@host1.com
-ORGANIZER:MAILTO:jdoe@host1.com
-DTSTART:19970324T123000Z
-DTEND:19970324T210000Z
-CATEGORIES:MEETING,PROJECT
-CLASS:PUBLIC
-SUMMARY:Calendaring Interoperability Planning Meeting
-DESCRIPTION:Discuss how we can test c&s interoperability\n
- using iCalendar and other IETF standards.
-LOCATION:LDB Lobby
-ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/
- conf/bkgrnd.ps
-END:VEVENT
-
-BEGIN:VTODO
-DTSTAMP:19980130T134500Z
-SEQUENCE:2
-UID:uid4@host1.com
-ORGANIZER:MAILTO:unclesam@us.gov
-ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@host.com
-DUE:19980415T235959
-STATUS:NEEDS-ACTION
-SUMMARY:Submit Income Taxes
-BEGIN:VALARM
-ACTION:AUDIO
-TRIGGER:19980403T120000
-ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio-
- files/ssbanner.aud
-REPEAT:4
-DURATION:PT1H
-END:VALARM
-END:VTODO
-
-BEGIN:VJOURNAL
-DTSTAMP:19970324T120000Z
-UID:uid5@host1.com
-ORGANIZER:MAILTO:jsmith@host.com
-STATUS:DRAFT
-CLASS:PUBLIC
-CATEGORIES:Project Report, XYZ, Weekly Meeting
-DESCRIPTION:Project xyz Review Meeting Minutes\n
- Agenda\n1. Review of project version 1.0 requirements.\n2.
- Definition
- of project processes.\n3. Review of project schedule.\n
- Participants: John Smith\, Jane Doe\, Jim Dandy\n-It was
- decided that the requirements need to be signed off by
- product marketing.\n-Project processes were accepted.\n
- -Project schedule needs to account for scheduled holidays
- and employee vacation time. Check with HR for specific
- dates.\n-New schedule will be distributed by Friday.\n-
- Next weeks meeting is cancelled. No meeting until 3/23.
-END:VJOURNAL
-
-BEGIN:VFREEBUSY
-ORGANIZER:MAILTO:jsmith@host.com
-DTSTART:19980313T141711Z
-DTEND:19980410T141711Z
-FREEBUSY:19980314T233000Z/19980315T003000Z
-FREEBUSY:19980316T153000Z/19980316T163000Z
-FREEBUSY:19980318T030000Z/19980318T040000Z
-URL:http://www.host.com/calendar/busytime/jsmith.ifb
-END:VFREEBUSY
-END:VCALENDAR
diff --git a/calendar/cal-util/.cvsignore b/calendar/cal-util/.cvsignore
deleted file mode 100644
index fdcaeeafc5..0000000000
--- a/calendar/cal-util/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.libs
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-test-recur
-cal-util-marshal.c
-cal-util-marshal.h
diff --git a/calendar/cal-util/Makefile.am b/calendar/cal-util/Makefile.am
deleted file mode 100644
index 35bf23965b..0000000000
--- a/calendar/cal-util/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"cal-util\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/calendar \
- -I. \
- -I.. \
- -I$(top_builddir) \
- -I$(top_srcdir)/libical/src \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-AM_CFLAGS = \
- -DGTK_DISABLE_DEPRECATED=1 \
- -DGDK_DISABLE_DEPRECATED=1 \
- -DG_DISABLE_DEPRECATED=1 \
- -DGNOME_DISABLE_DEPRECATED=1
-
-noinst_PROGRAMS = test-recur
-
-#
-# cal util library
-#
-
-privlib_LTLIBRARIES = libcal-util.la
-
-libcal_util_la_SOURCES = \
- cal-util-marshal.c \
- cal-util-marshal.h \
- cal-component.c \
- cal-recur.c \
- cal-util.c \
- timeutil.c
-
-libcal_util_la_LIBADD = \
- $(top_builddir)/libical/src/libical/libical-evolution.la
-
-libcal_utilincludedir = $(privincludedir)/cal-util
-
-libcal_utilinclude_HEADERS = \
- cal-component.h \
- cal-recur.h \
- cal-util.h \
- timeutil.h
-
-MARSHAL_GENERATED = cal-util-marshal.c cal-util-marshal.h
-@EVO_MARSHAL_RULE@
-
-BUILT_SOURCES = $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-test_recur_SOURCES = \
- test-recur.c
-
-test_recur_LDADD = \
- libcal-util.la \
- $(EVOLUTION_CALENDAR_LIBS)
-
-EXTRA_DIST = \
- cal-util-marshal.list
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
deleted file mode 100644
index 22b9ee310f..0000000000
--- a/calendar/cal-util/cal-component.c
+++ /dev/null
@@ -1,5504 +0,0 @@
-/* Evolution calendar - iCalendar component object
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <glib.h>
-#include <libgnome/gnome-i18n.h>
-#include "cal-component.h"
-#include "timeutil.h"
-
-
-
-/* Extension property for alarm components so that we can reference them by UID */
-#define EVOLUTION_ALARM_UID_PROPERTY "X-EVOLUTION-ALARM-UID"
-
-
-struct attendee {
- icalproperty *prop;
- icalparameter *cutype_param;
- icalparameter *member_param;
- icalparameter *role_param;
- icalparameter *partstat_param;
- icalparameter *rsvp_param;
- icalparameter *delto_param;
- icalparameter *delfrom_param;
- icalparameter *sentby_param;
- icalparameter *cn_param;
- icalparameter *language_param;
-};
-
-/* Private part of the CalComponent structure */
-struct _CalComponentPrivate {
- /* The icalcomponent we wrap */
- icalcomponent *icalcomp;
-
- /* Properties */
-
- icalproperty *uid;
-
- icalproperty *status;
- GSList *attendee_list;
-
- icalproperty *categories;
-
- icalproperty *classification;
-
- struct text {
- icalproperty *prop;
- icalparameter *altrep_param;
- };
-
- GSList *comment_list; /* list of struct text */
-
- icalproperty *completed;
-
- GSList *contact_list; /* list of struct text */
-
- icalproperty *created;
-
- GSList *description_list; /* list of struct text */
-
- struct datetime {
- icalproperty *prop;
- icalparameter *tzid_param;
- };
-
- struct datetime dtstart;
- struct datetime dtend;
-
- icalproperty *dtstamp;
-
- /* The DURATION property can be used instead of the VEVENT DTEND or
- the VTODO DUE dates. We do not use it directly ourselves, but we
- must be able to handle it from incoming data. If a DTEND or DUE
- is requested, we convert the DURATION if necessary. If DTEND or
- DUE is set, we remove any DURATION. */
- icalproperty *duration;
-
- struct datetime due;
-
- GSList *exdate_list; /* list of struct datetime */
- GSList *exrule_list; /* list of icalproperty objects */
-
- struct organizer {
- icalproperty *prop;
- icalparameter *sentby_param;
- icalparameter *cn_param;
- icalparameter *language_param;
- };
-
- struct organizer organizer;
-
- icalproperty *geo;
- icalproperty *last_modified;
- icalproperty *percent;
- icalproperty *priority;
-
- struct period {
- icalproperty *prop;
- icalparameter *value_param;
- };
-
- struct recur_id {
- struct datetime recur_time;
-
- icalparameter *range_param;
- };
-
- struct recur_id recur_id;
-
- GSList *rdate_list; /* list of struct period */
-
- GSList *rrule_list; /* list of icalproperty objects */
-
- icalproperty *sequence;
-
- struct {
- icalproperty *prop;
- icalparameter *altrep_param;
- } summary;
-
- icalproperty *transparency;
- icalproperty *url;
- icalproperty *location;
-
- /* Subcomponents */
-
- GHashTable *alarm_uid_hash;
-
- /* Whether we should increment the sequence number when piping the
- * object over the wire.
- */
- guint need_sequence_inc : 1;
-};
-
-/* Private structure for alarms */
-struct _CalComponentAlarm {
- /* Alarm icalcomponent we wrap */
- icalcomponent *icalcomp;
-
- /* Our extension UID property */
- icalproperty *uid;
-
- /* Properties */
-
- icalproperty *action;
- icalproperty *attach; /* FIXME: see scan_alarm_property() below */
-
- struct {
- icalproperty *prop;
- icalparameter *altrep_param;
- } description;
-
- icalproperty *duration;
- icalproperty *repeat;
- icalproperty *trigger;
-
- GSList *attendee_list;
-};
-
-
-
-static void cal_component_class_init (CalComponentClass *klass);
-static void cal_component_init (CalComponent *comp, CalComponentClass *klass);
-static void cal_component_finalize (GObject *object);
-
-static GObjectClass *parent_class;
-
-
-
-/**
- * cal_component_get_type:
- *
- * Registers the #CalComponent class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalComponent class.
- **/
-GType
-cal_component_get_type (void)
-{
- static GType cal_component_type = 0;
-
- if (!cal_component_type) {
- static GTypeInfo info = {
- sizeof (CalComponentClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_component_class_init,
- NULL, NULL,
- sizeof (CalComponent),
- 0,
- (GInstanceInitFunc) cal_component_init
- };
- cal_component_type = g_type_register_static (G_TYPE_OBJECT, "CalComponent", &info, 0);
- }
-
- return cal_component_type;
-}
-
-/* Class initialization function for the calendar component object */
-static void
-cal_component_class_init (CalComponentClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = cal_component_finalize;
-}
-
-/* Object initialization function for the calendar component object */
-static void
-cal_component_init (CalComponent *comp, CalComponentClass *klass)
-{
- CalComponentPrivate *priv;
-
- priv = g_new0 (CalComponentPrivate, 1);
- comp->priv = priv;
-
- priv->alarm_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-/* Does a simple g_free() of the elements of a GSList and then frees the list
- * itself. Returns NULL.
- */
-static GSList *
-free_slist (GSList *slist)
-{
- GSList *l;
-
- for (l = slist; l; l = l->next)
- g_free (l->data);
-
- g_slist_free (slist);
- return NULL;
-}
-
-/* Used from g_hash_table_foreach_remove() to free the alarm UIDs hash table.
- * We do not need to do anything to individual elements since we were storing
- * the UID pointers inside the icalproperties themselves.
- */
-static gboolean
-free_alarm_cb (gpointer key, gpointer value, gpointer data)
-{
- return TRUE;
-}
-
-/* Frees the internal icalcomponent only if it does not have a parent. If it
- * does, it means we don't own it and we shouldn't free it.
- */
-static void
-free_icalcomponent (CalComponent *comp, gboolean free)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- priv = comp->priv;
-
- if (!priv->icalcomp)
- return;
-
- /* Free the icalcomponent */
-
- if (free && icalcomponent_get_parent (priv->icalcomp) == NULL) {
- icalcomponent_free (priv->icalcomp);
- priv->icalcomp = NULL;
- }
-
- /* Free the mappings */
-
- priv->uid = NULL;
-
- priv->status = NULL;
-
- for (l = priv->attendee_list; l != NULL; l = l->next)
- g_free (l->data);
- g_slist_free (priv->attendee_list);
- priv->attendee_list = NULL;
-
- priv->categories = NULL;
-
- priv->classification = NULL;
- priv->comment_list = NULL;
- priv->completed = NULL;
- priv->contact_list = NULL;
- priv->created = NULL;
-
- priv->description_list = free_slist (priv->description_list);
-
- priv->dtend.prop = NULL;
- priv->dtend.tzid_param = NULL;
-
- priv->dtstamp = NULL;
-
- priv->dtstart.prop = NULL;
- priv->dtstart.tzid_param = NULL;
-
- priv->due.prop = NULL;
- priv->due.tzid_param = NULL;
-
- priv->duration = NULL;
-
- priv->exdate_list = free_slist (priv->exdate_list);
-
- g_slist_free (priv->exrule_list);
- priv->exrule_list = NULL;
-
- priv->geo = NULL;
- priv->last_modified = NULL;
- priv->percent = NULL;
- priv->priority = NULL;
-
- priv->rdate_list = free_slist (priv->rdate_list);
-
- g_slist_free (priv->rrule_list);
- priv->rrule_list = NULL;
-
- priv->sequence = NULL;
-
- priv->summary.prop = NULL;
- priv->summary.altrep_param = NULL;
-
- priv->transparency = NULL;
- priv->url = NULL;
- priv->location = NULL;
-
- /* Free the subcomponents */
-
- g_hash_table_foreach_remove (priv->alarm_uid_hash, free_alarm_cb, NULL);
-
- /* Clean up */
-
- priv->need_sequence_inc = FALSE;
-}
-
-/* Finalize handler for the calendar component object */
-static void
-cal_component_finalize (GObject *object)
-{
- CalComponent *comp;
- CalComponentPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (object));
-
- comp = CAL_COMPONENT (object);
- priv = comp->priv;
-
- free_icalcomponent (comp, TRUE);
- g_hash_table_destroy (priv->alarm_uid_hash);
- priv->alarm_uid_hash = NULL;
-
- g_free (priv);
- comp->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-
-/**
- * cal_component_gen_uid:
- *
- * Generates a unique identifier suitable for calendar components.
- *
- * Return value: A unique identifier string. Every time this function is called
- * a different string is returned.
- **/
-char *
-cal_component_gen_uid (void)
-{
- char *iso, *ret;
- static char *hostname;
- time_t t = time (NULL);
- static int serial;
-
- if (!hostname) {
- static char buffer [512];
-
- if ((gethostname (buffer, sizeof (buffer) - 1) == 0) &&
- (buffer [0] != 0))
- hostname = buffer;
- else
- hostname = "localhost";
- }
-
- iso = isodate_from_time_t (t);
- ret = g_strdup_printf ("%s-%d-%d-%d-%d@%s",
- iso,
- getpid (),
- getgid (),
- getppid (),
- serial++,
- hostname);
- g_free (iso);
-
- return ret;
-}
-
-/**
- * cal_component_new:
- *
- * Creates a new empty calendar component object. You should set it from an
- * #icalcomponent structure by using cal_component_set_icalcomponent() or with a
- * new empty component type by using cal_component_set_new_vtype().
- *
- * Return value: A newly-created calendar component object.
- **/
-CalComponent *
-cal_component_new (void)
-{
- return CAL_COMPONENT (g_object_new (CAL_COMPONENT_TYPE, NULL));
-}
-
-/**
- * cal_component_clone:
- * @comp: A calendar component object.
- *
- * Creates a new calendar component object by copying the information from
- * another one.
- *
- * Return value: A newly-created calendar component with the same values as the
- * original one.
- **/
-CalComponent *
-cal_component_clone (CalComponent *comp)
-{
- CalComponentPrivate *priv;
- CalComponent *new_comp;
- icalcomponent *new_icalcomp;
-
- g_return_val_if_fail (comp != NULL, NULL);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
-
- new_comp = cal_component_new ();
-
- if (priv->icalcomp) {
- new_icalcomp = icalcomponent_new_clone (priv->icalcomp);
- cal_component_set_icalcomponent (new_comp, new_icalcomp);
- }
-
- return new_comp;
-}
-
-/* Scans an attendee property */
-static void
-scan_attendee (GSList **attendee_list, icalproperty *prop)
-{
- struct attendee *attendee;
-
- attendee = g_new (struct attendee, 1);
- attendee->prop = prop;
-
- attendee->cutype_param = icalproperty_get_first_parameter (prop, ICAL_CUTYPE_PARAMETER);
- attendee->member_param = icalproperty_get_first_parameter (prop, ICAL_MEMBER_PARAMETER);
- attendee->role_param = icalproperty_get_first_parameter (prop, ICAL_ROLE_PARAMETER);
- attendee->partstat_param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
- attendee->rsvp_param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER);
- attendee->delto_param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDTO_PARAMETER);
- attendee->delfrom_param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER);
- attendee->sentby_param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
- attendee->cn_param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
- attendee->language_param = icalproperty_get_first_parameter (prop, ICAL_LANGUAGE_PARAMETER);
-
- *attendee_list = g_slist_append (*attendee_list, attendee);
-}
-
-/* Scans a date/time and timezone pair property */
-static void
-scan_datetime (CalComponent *comp, struct datetime *datetime, icalproperty *prop)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
-
- datetime->prop = prop;
- datetime->tzid_param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
-}
-
-/* Scans an exception date property */
-static void
-scan_exdate (CalComponent *comp, icalproperty *prop)
-{
- CalComponentPrivate *priv;
- struct datetime *dt;
-
- priv = comp->priv;
-
- dt = g_new (struct datetime, 1);
- dt->prop = prop;
- dt->tzid_param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
-
- priv->exdate_list = g_slist_append (priv->exdate_list, dt);
-}
-
-/* Scans and attendee property */
-static void
-scan_organizer (CalComponent *comp, struct organizer *organizer, icalproperty *prop)
-{
- organizer->prop = prop;
-
- organizer->sentby_param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
- organizer->cn_param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
- organizer->language_param = icalproperty_get_first_parameter (prop, ICAL_LANGUAGE_PARAMETER);
-}
-
-/* Scans an icalperiodtype property */
-static void
-scan_period (CalComponent *comp, GSList **list, icalproperty *prop)
-{
- struct period *period;
-
- period = g_new (struct period, 1);
- period->prop = prop;
- period->value_param = icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER);
-
- *list = g_slist_append (*list, period);
-}
-
-
-/* Scans an icalrecurtype property */
-static void
-scan_recur_id (CalComponent *comp, struct recur_id *recur_id, icalproperty *prop)
-{
- scan_datetime (comp, &recur_id->recur_time, prop);
-
- recur_id->range_param = icalproperty_get_first_parameter (prop, ICAL_RANGE_PARAMETER);
-}
-
-/* Scans an icalrecurtype property */
-static void
-scan_recur (CalComponent *comp, GSList **list, icalproperty *prop)
-{
- *list = g_slist_append (*list, prop);
-}
-
-/* Scans the summary property */
-static void
-scan_summary (CalComponent *comp, icalproperty *prop)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
-
- priv->summary.prop = prop;
- priv->summary.altrep_param = icalproperty_get_first_parameter (prop, ICAL_ALTREP_PARAMETER);
-}
-
-/* Scans a text (i.e. text + altrep) property */
-static void
-scan_text (CalComponent *comp, GSList **text_list, icalproperty *prop)
-{
- struct text *text;
-
- text = g_new (struct text, 1);
- text->prop = prop;
- text->altrep_param = icalproperty_get_first_parameter (prop, ICAL_ALTREP_PARAMETER);
-
- *text_list = g_slist_append (*text_list, text);
-}
-
-/* Scans an icalproperty and adds its mapping to the component */
-static void
-scan_property (CalComponent *comp, icalproperty *prop)
-{
- CalComponentPrivate *priv;
- icalproperty_kind kind;
-
- priv = comp->priv;
-
- kind = icalproperty_isa (prop);
-
- switch (kind) {
- case ICAL_STATUS_PROPERTY:
- priv->status = prop;
- break;
-
- case ICAL_ATTENDEE_PROPERTY:
- scan_attendee (&priv->attendee_list, prop);
- break;
-
- case ICAL_CATEGORIES_PROPERTY:
- priv->categories = prop;
- break;
-
- case ICAL_CLASS_PROPERTY:
- priv->classification = prop;
- break;
-
- case ICAL_COMMENT_PROPERTY:
- scan_text (comp, &priv->comment_list, prop);
- break;
-
- case ICAL_COMPLETED_PROPERTY:
- priv->completed = prop;
- break;
-
- case ICAL_CONTACT_PROPERTY:
- scan_text (comp, &priv->contact_list, prop);
- break;
-
- case ICAL_CREATED_PROPERTY:
- priv->created = prop;
- break;
-
- case ICAL_DESCRIPTION_PROPERTY:
- scan_text (comp, &priv->description_list, prop);
- break;
-
- case ICAL_DTEND_PROPERTY:
- scan_datetime (comp, &priv->dtend, prop);
- break;
-
- case ICAL_DTSTAMP_PROPERTY:
- priv->dtstamp = prop;
- break;
-
- case ICAL_DTSTART_PROPERTY:
- scan_datetime (comp, &priv->dtstart, prop);
- break;
-
- case ICAL_DUE_PROPERTY:
- scan_datetime (comp, &priv->due, prop);
- break;
-
- case ICAL_DURATION_PROPERTY:
- priv->duration = prop;
- break;
-
- case ICAL_EXDATE_PROPERTY:
- scan_exdate (comp, prop);
- break;
-
- case ICAL_EXRULE_PROPERTY:
- scan_recur (comp, &priv->exrule_list, prop);
- break;
-
- case ICAL_GEO_PROPERTY:
- priv->geo = prop;
- break;
-
- case ICAL_LASTMODIFIED_PROPERTY:
- priv->last_modified = prop;
- break;
-
- case ICAL_ORGANIZER_PROPERTY:
- scan_organizer (comp, &priv->organizer, prop);
- break;
-
- case ICAL_PERCENTCOMPLETE_PROPERTY:
- priv->percent = prop;
- break;
-
- case ICAL_PRIORITY_PROPERTY:
- priv->priority = prop;
- break;
-
- case ICAL_RECURRENCEID_PROPERTY:
- scan_recur_id (comp, &priv->recur_id, prop);
- break;
-
- case ICAL_RDATE_PROPERTY:
- scan_period (comp, &priv->rdate_list, prop);
- break;
-
- case ICAL_RRULE_PROPERTY:
- scan_recur (comp, &priv->rrule_list, prop);
- break;
-
- case ICAL_SEQUENCE_PROPERTY:
- priv->sequence = prop;
- break;
-
- case ICAL_SUMMARY_PROPERTY:
- scan_summary (comp, prop);
- break;
-
- case ICAL_TRANSP_PROPERTY:
- priv->transparency = prop;
- break;
-
- case ICAL_UID_PROPERTY:
- priv->uid = prop;
- break;
-
- case ICAL_URL_PROPERTY:
- priv->url = prop;
- break;
-
- case ICAL_LOCATION_PROPERTY :
- priv->location = prop;
- break;
-
- default:
- break;
- }
-}
-
-/* Gets our alarm UID string from a property that is known to contain it */
-static const char *
-alarm_uid_from_prop (icalproperty *prop)
-{
- const char *xstr;
-
- g_assert (icalproperty_isa (prop) == ICAL_X_PROPERTY);
-
- xstr = icalproperty_get_x (prop);
- g_assert (xstr != NULL);
-
- return xstr;
-}
-
-/* Sets our alarm UID extension property on an alarm component. Returns a
- * pointer to the UID string inside the property itself.
- */
-static const char *
-set_alarm_uid (icalcomponent *alarm, const char *auid)
-{
- icalproperty *prop;
- const char *inprop_auid;
-
- /* Create the new property */
-
- prop = icalproperty_new_x ((char *) auid);
- icalproperty_set_x_name (prop, EVOLUTION_ALARM_UID_PROPERTY);
-
- icalcomponent_add_property (alarm, prop);
-
- inprop_auid = alarm_uid_from_prop (prop);
- return inprop_auid;
-}
-
-/* Removes any alarm UID extension properties from an alarm subcomponent */
-static void
-remove_alarm_uid (icalcomponent *alarm)
-{
- icalproperty *prop;
- GSList *list, *l;
-
- list = NULL;
-
- for (prop = icalcomponent_get_first_property (alarm, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (alarm, ICAL_X_PROPERTY)) {
- const char *xname;
-
- xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
-
- if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0)
- list = g_slist_prepend (list, prop);
- }
-
- for (l = list; l; l = l->next) {
- prop = l->data;
- icalcomponent_remove_property (alarm, prop);
- icalproperty_free (prop);
- }
-
- g_slist_free (list);
-}
-
-/* Adds an alarm subcomponent to the calendar component's mapping table. The
- * actual UID with which it gets added may not be the same as the specified one;
- * this function will change it if the table already had an alarm subcomponent
- * with the specified UID. Returns the actual UID used.
- */
-static const char *
-add_alarm (CalComponent *comp, icalcomponent *alarm, const char *auid)
-{
- CalComponentPrivate *priv;
- icalcomponent *old_alarm;
-
- priv = comp->priv;
-
- /* First we see if we already have an alarm with the requested UID. In
- * that case, we need to change the new UID to something else. This
- * should never happen, but who knows.
- */
-
- old_alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid);
- if (old_alarm != NULL) {
- char *new_auid;
-
- g_message ("add_alarm(): Got alarm with duplicated UID `%s', changing it...", auid);
-
- remove_alarm_uid (alarm);
-
- new_auid = cal_component_gen_uid ();
- auid = set_alarm_uid (alarm, new_auid);
- g_free (new_auid);
- }
-
- g_hash_table_insert (priv->alarm_uid_hash, (char *) auid, alarm);
- return auid;
-}
-
-/* Scans an alarm subcomponent, adds an UID extension property to it (so that we
- * can reference alarms by unique IDs), and adds its mapping to the component. */
-static void
-scan_alarm (CalComponent *comp, icalcomponent *alarm)
-{
- CalComponentPrivate *priv;
- icalproperty *prop;
- const char *auid;
- char *new_auid;
-
- priv = comp->priv;
-
- for (prop = icalcomponent_get_first_property (alarm, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (alarm, ICAL_X_PROPERTY)) {
- const char *xname;
-
- xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
-
- if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) {
- auid = alarm_uid_from_prop (prop);
- add_alarm (comp, alarm, auid);
- return;
- }
- }
-
- /* The component has no alarm UID property, so we create one. */
-
- new_auid = cal_component_gen_uid ();
- auid = set_alarm_uid (alarm, new_auid);
- g_free (new_auid);
-
- add_alarm (comp, alarm, auid);
-}
-
-/* Scans an icalcomponent for its properties so that we can provide
- * random-access to them. It also builds a hash table of the component's alarm
- * subcomponents.
- */
-static void
-scan_icalcomponent (CalComponent *comp)
-{
- CalComponentPrivate *priv;
- icalproperty *prop;
- icalcompiter iter;
-
- priv = comp->priv;
-
- g_assert (priv->icalcomp != NULL);
-
- /* Scan properties */
-
- for (prop = icalcomponent_get_first_property (priv->icalcomp, ICAL_ANY_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (priv->icalcomp, ICAL_ANY_PROPERTY))
- scan_property (comp, prop);
-
- /* Scan subcomponents */
-
- for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_VALARM_COMPONENT);
- icalcompiter_deref (&iter) != NULL;
- icalcompiter_next (&iter)) {
- icalcomponent *subcomp;
-
- subcomp = icalcompiter_deref (&iter);
- scan_alarm (comp, subcomp);
- }
-}
-
-/* Ensures that the mandatory calendar component properties (uid, dtstamp) do
- * exist. If they don't exist, it creates them automatically.
- */
-static void
-ensure_mandatory_properties (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
- g_assert (priv->icalcomp != NULL);
-
- if (!priv->uid) {
- char *uid;
-
- uid = cal_component_gen_uid ();
- priv->uid = icalproperty_new_uid (uid);
- g_free (uid);
-
- icalcomponent_add_property (priv->icalcomp, priv->uid);
- }
-
- if (!priv->dtstamp) {
- struct icaltimetype t;
-
- t = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-
- priv->dtstamp = icalproperty_new_dtstamp (t);
- icalcomponent_add_property (priv->icalcomp, priv->dtstamp);
- }
-}
-
-/**
- * cal_component_set_new_vtype:
- * @comp: A calendar component object.
- * @type: Type of calendar component to create.
- *
- * Clears any existing component data from a calendar component object and
- * creates a new #icalcomponent of the specified type for it. The only property
- * that will be set in the new component will be its unique identifier.
- **/
-void
-cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type)
-{
- CalComponentPrivate *priv;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
-
- free_icalcomponent (comp, TRUE);
-
- if (type == CAL_COMPONENT_NO_TYPE)
- return;
-
- /* Figure out the kind and create the icalcomponent */
-
- switch (type) {
- case CAL_COMPONENT_EVENT:
- kind = ICAL_VEVENT_COMPONENT;
- break;
-
- case CAL_COMPONENT_TODO:
- kind = ICAL_VTODO_COMPONENT;
- break;
-
- case CAL_COMPONENT_JOURNAL:
- kind = ICAL_VJOURNAL_COMPONENT;
- break;
-
- case CAL_COMPONENT_FREEBUSY:
- kind = ICAL_VFREEBUSY_COMPONENT;
- break;
-
- case CAL_COMPONENT_TIMEZONE:
- kind = ICAL_VTIMEZONE_COMPONENT;
- break;
-
- default:
- g_assert_not_reached ();
- kind = ICAL_NO_COMPONENT;
- }
-
- icalcomp = icalcomponent_new (kind);
- if (!icalcomp) {
- g_message ("cal_component_set_new_vtype(): Could not create the icalcomponent!");
- return;
- }
-
- /* Scan the component to build our mapping table */
-
- priv->icalcomp = icalcomp;
- scan_icalcomponent (comp);
-
- /* Add missing stuff */
-
- ensure_mandatory_properties (comp);
-}
-
-/**
- * cal_component_set_icalcomponent:
- * @comp: A calendar component object.
- * @icalcomp: An #icalcomponent.
- *
- * Sets the contents of a calendar component object from an #icalcomponent
- * structure. If the @comp already had an #icalcomponent set into it, it will
- * will be freed automatically if the #icalcomponent does not have a parent
- * component itself.
- *
- * Supported component types are VEVENT, VTODO, VJOURNAL, VFREEBUSY, and VTIMEZONE.
- *
- * Return value: TRUE on success, FALSE if @icalcomp is an unsupported component
- * type.
- **/
-gboolean
-cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp)
-{
- CalComponentPrivate *priv;
- icalcomponent_kind kind;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
-
- if (priv->icalcomp == icalcomp)
- return TRUE;
-
- free_icalcomponent (comp, TRUE);
-
- if (!icalcomp) {
- priv->icalcomp = NULL;
- return TRUE;
- }
-
- kind = icalcomponent_isa (icalcomp);
-
- if (!(kind == ICAL_VEVENT_COMPONENT
- || kind == ICAL_VTODO_COMPONENT
- || kind == ICAL_VJOURNAL_COMPONENT
- || kind == ICAL_VFREEBUSY_COMPONENT
- || kind == ICAL_VTIMEZONE_COMPONENT))
- return FALSE;
-
- priv->icalcomp = icalcomp;
-
- scan_icalcomponent (comp);
- ensure_mandatory_properties (comp);
-
- return TRUE;
-}
-
-/**
- * cal_component_get_icalcomponent:
- * @comp: A calendar component object.
- *
- * Queries the #icalcomponent structure that a calendar component object is
- * wrapping.
- *
- * Return value: An #icalcomponent structure, or NULL if the @comp has no
- * #icalcomponent set to it.
- **/
-icalcomponent *
-cal_component_get_icalcomponent (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, NULL);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
-
- return priv->icalcomp;
-}
-
-void
-cal_component_rescan (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
-
- /* Clear everything out */
- free_icalcomponent (comp, FALSE);
-
- /* Rescan */
- scan_icalcomponent (comp);
- ensure_mandatory_properties (comp);
-}
-
-void
-cal_component_strip_errors (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
-
- icalcomponent_strip_errors (priv->icalcomp);
-}
-
-/**
- * cal_component_get_vtype:
- * @comp: A calendar component object.
- *
- * Queries the type of a calendar component object.
- *
- * Return value: The type of the component, as defined by RFC 2445.
- **/
-CalComponentVType
-cal_component_get_vtype (CalComponent *comp)
-{
- CalComponentPrivate *priv;
- icalcomponent_kind kind;
-
- g_return_val_if_fail (comp != NULL, CAL_COMPONENT_NO_TYPE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), CAL_COMPONENT_NO_TYPE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, CAL_COMPONENT_NO_TYPE);
-
- kind = icalcomponent_isa (priv->icalcomp);
- switch (kind) {
- case ICAL_VEVENT_COMPONENT:
- return CAL_COMPONENT_EVENT;
-
- case ICAL_VTODO_COMPONENT:
- return CAL_COMPONENT_TODO;
-
- case ICAL_VJOURNAL_COMPONENT:
- return CAL_COMPONENT_JOURNAL;
-
- case ICAL_VFREEBUSY_COMPONENT:
- return CAL_COMPONENT_FREEBUSY;
-
- case ICAL_VTIMEZONE_COMPONENT:
- return CAL_COMPONENT_TIMEZONE;
-
- default:
- /* We should have been loaded with a supported type! */
- g_assert_not_reached ();
- return CAL_COMPONENT_NO_TYPE;
- }
-}
-
-/**
- * cal_component_get_as_string:
- * @comp: A calendar component.
- *
- * Gets the iCalendar string representation of a calendar component. You should
- * call cal_component_commit_sequence() before this function to ensure that the
- * component's sequence number is consistent with the state of the object.
- *
- * Return value: String representation of the calendar component according to
- * RFC 2445.
- **/
-char *
-cal_component_get_as_string (CalComponent *comp)
-{
- CalComponentPrivate *priv;
- char *str, *buf;
-
- g_return_val_if_fail (comp != NULL, NULL);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
- /* Ensure that the user has committed the new SEQUENCE */
- g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
-
- /* We dup the string; libical owns that memory */
-
- str = icalcomponent_as_ical_string (priv->icalcomp);
-
- if (str)
- buf = g_strdup (str);
- else
- buf = NULL;
-
- return buf;
-}
-
-/* Used from g_hash_table_foreach(); ensures that an alarm subcomponent
- * has the mandatory properties it needs.
- */
-static void
-ensure_alarm_properties_cb (gpointer key, gpointer value, gpointer data)
-{
- CalComponent *comp;
- CalComponentPrivate *priv;
- icalcomponent *alarm;
- icalproperty *prop;
- enum icalproperty_action action;
- const char *str;
-
- alarm = value;
-
- comp = CAL_COMPONENT (data);
- priv = comp->priv;
-
- prop = icalcomponent_get_first_property (alarm, ICAL_ACTION_PROPERTY);
- if (!prop)
- return;
-
- action = icalproperty_get_action (prop);
-
- switch (action) {
- case ICAL_ACTION_DISPLAY:
- /* Ensure we have a DESCRIPTION property */
- prop = icalcomponent_get_first_property (alarm, ICAL_DESCRIPTION_PROPERTY);
- if (prop)
- break;
-
- if (!priv->summary.prop)
- str = _("Untitled appointment");
- else
- str = icalproperty_get_summary (priv->summary.prop);
-
- prop = icalproperty_new_description (str);
- icalcomponent_add_property (alarm, prop);
-
- break;
-
- default:
- break;
- /* FIXME: add other action types here */
- }
-}
-
-/* Ensures that alarm subcomponents have the mandatory properties they need,
- * even when clients may not have set them properly.
- */
-static void
-ensure_alarm_properties (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
-
- g_hash_table_foreach (priv->alarm_uid_hash, ensure_alarm_properties_cb, comp);
-}
-
-/**
- * cal_component_commit_sequence:
- * @comp:
- *
- * Increments the sequence number property in a calendar component object if it
- * needs it. This needs to be done when any of a number of properties listed in
- * RFC 2445 change values, such as the start and end dates of a component.
- *
- * This function must be called before calling cal_component_get_as_string() to
- * ensure that the component is fully consistent.
- **/
-void
-cal_component_commit_sequence (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- ensure_alarm_properties (comp);
-
- if (!priv->need_sequence_inc)
- return;
-
- if (priv->sequence) {
- int seq;
-
- seq = icalproperty_get_sequence (priv->sequence);
- icalproperty_set_sequence (priv->sequence, seq + 1);
- } else {
- /* The component had no SEQUENCE property, so assume that the
- * default would have been zero. Since it needed incrementing
- * anyways, we use a value of 1 here.
- */
- priv->sequence = icalproperty_new_sequence (1);
- icalcomponent_add_property (priv->icalcomp, priv->sequence);
- }
-
- priv->need_sequence_inc = FALSE;
-}
-
-void
-cal_component_abort_sequence (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
-
- priv->need_sequence_inc = FALSE;
-}
-
-/**
- * cal_component_get_uid:
- * @comp: A calendar component object.
- * @uid: Return value for the UID string.
- *
- * Queries the unique identifier of a calendar component object.
- **/
-void
-cal_component_get_uid (CalComponent *comp, const char **uid)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (uid != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- /* This MUST exist, since we ensured that it did */
- g_assert (priv->uid != NULL);
-
- *uid = icalproperty_get_uid (priv->uid);
-}
-
-/**
- * cal_component_set_uid:
- * @comp: A calendar component object.
- * @uid: Unique identifier.
- *
- * Sets the unique identifier string of a calendar component object.
- **/
-void
-cal_component_set_uid (CalComponent *comp, const char *uid)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (uid != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- /* This MUST exist, since we ensured that it did */
- g_assert (priv->uid != NULL);
-
- icalproperty_set_uid (priv->uid, (char *) uid);
-}
-
-/**
- * cal_component_get_categories:
- * @comp: A calendar component object.
- * @categories:
- *
- *
- **/
-void
-cal_component_get_categories (CalComponent *comp, const char **categories)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (categories != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->categories)
- *categories = icalproperty_get_categories (priv->categories);
- else
- *categories = NULL;
-}
-
-/**
- * cal_component_set_categories:
- * @comp: A calendar component object.
- * @categories:
- *
- *
- **/
-void
-cal_component_set_categories (CalComponent *comp, const char *categories)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!categories || !(*categories)) {
- if (priv->categories) {
- icalcomponent_remove_property (priv->icalcomp, priv->categories);
- icalproperty_free (priv->categories);
- priv->url = NULL;
- }
-
- return;
- }
-
- if (priv->categories)
- icalproperty_set_categories (priv->categories, (char *) categories);
- else {
- priv->categories = icalproperty_new_categories ((char *) categories);
- icalcomponent_add_property (priv->icalcomp, priv->categories);
- }
-}
-
-
-/**
- * cal_component_get_categories_list:
- * @comp: A calendar component object.
- * @categ_list: Return value for the list of strings, where each string is a
- * category. This should be freed using cal_component_free_categories_list().
- *
- * Queries the list of categories of a calendar component object. Each element
- * in the returned categ_list is a string with the corresponding category.
- **/
-void
-cal_component_get_categories_list (CalComponent *comp, GSList **categ_list)
-{
- CalComponentPrivate *priv;
- const char *categories;
- const char *p;
- const char *cat_start;
- char *str;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (categ_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->categories) {
- *categ_list = NULL;
- return;
- }
-
- categories = icalproperty_get_categories (priv->categories);
- g_assert (categories != NULL);
-
- cat_start = categories;
- *categ_list = NULL;
-
- for (p = categories; *p; p++)
- if (*p == ',') {
- str = g_strndup (cat_start, p - cat_start);
- *categ_list = g_slist_prepend (*categ_list, str);
-
- cat_start = p + 1;
- }
-
- str = g_strndup (cat_start, p - cat_start);
- *categ_list = g_slist_prepend (*categ_list, str);
-
- *categ_list = g_slist_reverse (*categ_list);
-}
-
-/* Creates a comma-delimited string of categories */
-static char *
-stringify_categories (GSList *categ_list)
-{
- GString *s;
- GSList *l;
- char *str;
-
- s = g_string_new (NULL);
-
- for (l = categ_list; l; l = l->next) {
- g_string_append (s, l->data);
-
- if (l->next != NULL)
- g_string_append (s, ",");
- }
-
- str = s->str;
- g_string_free (s, FALSE);
-
- return str;
-}
-
-/**
- * cal_component_set_categories_list:
- * @comp: A calendar component object.
- * @categ_list: List of strings, one for each category.
- *
- * Sets the list of categories of a calendar component object.
- **/
-void
-cal_component_set_categories_list (CalComponent *comp, GSList *categ_list)
-{
- CalComponentPrivate *priv;
- char *categories_str;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!categ_list) {
- if (priv->categories) {
- icalcomponent_remove_property (priv->icalcomp, priv->categories);
- icalproperty_free (priv->categories);
- }
-
- return;
- }
-
- /* Create a single string of categories */
- categories_str = stringify_categories (categ_list);
-
- /* Set the categories */
- priv->categories = icalproperty_new_categories (categories_str);
- g_free (categories_str);
-
- icalcomponent_add_property (priv->icalcomp, priv->categories);
-}
-
-/**
- * cal_component_get_classification:
- * @comp: A calendar component object.
- * @classif: Return value for the classification.
- *
- * Queries the classification of a calendar component object. If the
- * classification property is not set on this component, this function returns
- * #CAL_COMPONENT_CLASS_NONE.
- **/
-void
-cal_component_get_classification (CalComponent *comp, CalComponentClassification *classif)
-{
- CalComponentPrivate *priv;
- icalproperty_class class;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (classif != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->classification) {
- *classif = CAL_COMPONENT_CLASS_NONE;
- return;
- }
-
- class = icalproperty_get_class (priv->classification);
-
- switch (class)
- {
- case ICAL_CLASS_PUBLIC:
- *classif = CAL_COMPONENT_CLASS_PUBLIC;
- break;
- case ICAL_CLASS_PRIVATE:
- *classif = CAL_COMPONENT_CLASS_PRIVATE;
- break;
- case ICAL_CLASS_CONFIDENTIAL:
- *classif = CAL_COMPONENT_CLASS_CONFIDENTIAL;
- break;
- default:
- *classif = CAL_COMPONENT_CLASS_UNKNOWN;
- break;
- }
-}
-
-/**
- * cal_component_set_classification:
- * @comp: A calendar component object.
- * @classif: Classification to use.
- *
- * Sets the classification property of a calendar component object. To unset
- * the property, specify CAL_COMPONENT_CLASS_NONE for @classif.
- **/
-void
-cal_component_set_classification (CalComponent *comp, CalComponentClassification classif)
-{
- CalComponentPrivate *priv;
- icalproperty_class class;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (classif != CAL_COMPONENT_CLASS_UNKNOWN);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (classif == CAL_COMPONENT_CLASS_NONE) {
- if (priv->classification) {
- icalcomponent_remove_property (priv->icalcomp, priv->classification);
- icalproperty_free (priv->classification);
- priv->classification = NULL;
- }
-
- return;
- }
-
- switch (classif) {
- case CAL_COMPONENT_CLASS_PUBLIC:
- class = ICAL_CLASS_PUBLIC;
- break;
-
- case CAL_COMPONENT_CLASS_PRIVATE:
- class = ICAL_CLASS_PRIVATE;
- break;
-
- case CAL_COMPONENT_CLASS_CONFIDENTIAL:
- class = ICAL_CLASS_CONFIDENTIAL;
- break;
-
- default:
- g_assert_not_reached ();
- class = ICAL_CLASS_NONE;
- }
-
- if (priv->classification)
- icalproperty_set_class (priv->classification, class);
- else {
- priv->classification = icalproperty_new_class (class);
- icalcomponent_add_property (priv->icalcomp, priv->classification);
- }
-}
-
-/* Gets a text list value */
-static void
-get_text_list (GSList *text_list,
- const char *(* get_prop_func) (const icalproperty *prop),
- GSList **tl)
-{
- GSList *l;
-
- *tl = NULL;
-
- if (!text_list)
- return;
-
- for (l = text_list; l; l = l->next) {
- struct text *text;
- CalComponentText *t;
-
- text = l->data;
- g_assert (text->prop != NULL);
-
- t = g_new (CalComponentText, 1);
- t->value = (* get_prop_func) (text->prop);
-
- if (text->altrep_param)
- t->altrep = icalparameter_get_altrep (text->altrep_param);
- else
- t->altrep = NULL;
-
- *tl = g_slist_prepend (*tl, t);
- }
-
- *tl = g_slist_reverse (*tl);
-}
-
-/* Sets a text list value */
-static void
-set_text_list (CalComponent *comp,
- icalproperty *(* new_prop_func) (const char *value),
- GSList **text_list,
- GSList *tl)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- priv = comp->priv;
-
- /* Remove old texts */
-
- for (l = *text_list; l; l = l->next) {
- struct text *text;
-
- text = l->data;
- g_assert (text->prop != NULL);
-
- icalcomponent_remove_property (priv->icalcomp, text->prop);
- icalproperty_free (text->prop);
- g_free (text);
- }
-
- g_slist_free (*text_list);
- *text_list = NULL;
-
- /* Add in new texts */
-
- for (l = tl; l; l = l->next) {
- CalComponentText *t;
- struct text *text;
-
- t = l->data;
- g_return_if_fail (t->value != NULL);
-
- text = g_new (struct text, 1);
-
- text->prop = (* new_prop_func) ((char *) t->value);
- icalcomponent_add_property (priv->icalcomp, text->prop);
-
- if (t->altrep) {
- text->altrep_param = icalparameter_new_altrep ((char *) t->altrep);
- icalproperty_add_parameter (text->prop, text->altrep_param);
- } else
- text->altrep_param = NULL;
-
- *text_list = g_slist_prepend (*text_list, text);
- }
-
- *text_list = g_slist_reverse (*text_list);
-}
-
-/**
- * cal_component_get_comment_list:
- * @comp: A calendar component object.
- * @text_list: Return value for the comment properties and their parameters, as
- * a list of #CalComponentText structures. This should be freed using the
- * cal_component_free_text_list() function.
- *
- * Queries the comment of a calendar component object. The comment property can
- * appear several times inside a calendar component, and so a list of
- * #CalComponentText is returned.
- **/
-void
-cal_component_get_comment_list (CalComponent *comp, GSList **text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (text_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_text_list (priv->comment_list, icalproperty_get_comment, text_list);
-}
-
-/**
- * cal_component_set_comment_list:
- * @comp: A calendar component object.
- * @text_list: List of #CalComponentText structures.
- *
- * Sets the comment of a calendar component object. The comment property can
- * appear several times inside a calendar component, and so a list of
- * #CalComponentText structures is used.
- **/
-void
-cal_component_set_comment_list (CalComponent *comp, GSList *text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_text_list (comp, icalproperty_new_comment, &priv->comment_list, text_list);
-}
-
-/**
- * cal_component_get_contact_list:
- * @comp: A calendar component object.
- * @text_list: Return value for the contact properties and their parameters, as
- * a list of #CalComponentText structures. This should be freed using the
- * cal_component_free_text_list() function.
- *
- * Queries the contact of a calendar component object. The contact property can
- * appear several times inside a calendar component, and so a list of
- * #CalComponentText is returned.
- **/
-void
-cal_component_get_contact_list (CalComponent *comp, GSList **text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (text_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_text_list (priv->contact_list, icalproperty_get_contact, text_list);
-}
-
-/**
- * cal_component_set_contact_list:
- * @comp: A calendar component object.
- * @text_list: List of #CalComponentText structures.
- *
- * Sets the contact of a calendar component object. The contact property can
- * appear several times inside a calendar component, and so a list of
- * #CalComponentText structures is used.
- **/
-void
-cal_component_set_contact_list (CalComponent *comp, GSList *text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_text_list (comp, icalproperty_new_contact, &priv->contact_list, text_list);
-}
-
-/* Gets a struct icaltimetype value */
-static void
-get_icaltimetype (icalproperty *prop,
- struct icaltimetype (* get_prop_func) (const icalproperty *prop),
- struct icaltimetype **t)
-{
- if (!prop) {
- *t = NULL;
- return;
- }
-
- *t = g_new (struct icaltimetype, 1);
- **t = (* get_prop_func) (prop);
-}
-
-/* Sets a struct icaltimetype value */
-static void
-set_icaltimetype (CalComponent *comp, icalproperty **prop,
- icalproperty *(* prop_new_func) (struct icaltimetype v),
- void (* prop_set_func) (icalproperty *prop, struct icaltimetype v),
- struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
-
- if (!t) {
- if (*prop) {
- icalcomponent_remove_property (priv->icalcomp, *prop);
- icalproperty_free (*prop);
- *prop = NULL;
- }
-
- return;
- }
-
- if (*prop)
- (* prop_set_func) (*prop, *t);
- else {
- *prop = (* prop_new_func) (*t);
- icalcomponent_add_property (priv->icalcomp, *prop);
- }
-}
-
-/**
- * cal_component_get_completed:
- * @comp: A calendar component object.
- * @t: Return value for the completion date. This should be freed using the
- * cal_component_free_icaltimetype() function.
- *
- * Queries the date at which a calendar compoment object was completed.
- **/
-void
-cal_component_get_completed (CalComponent *comp, struct icaltimetype **t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_icaltimetype (priv->completed, icalproperty_get_completed, t);
-}
-
-/**
- * cal_component_set_completed:
- * @comp: A calendar component object.
- * @t: Value for the completion date.
- *
- * Sets the date at which a calendar component object was completed.
- **/
-void
-cal_component_set_completed (CalComponent *comp, struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_icaltimetype (comp, &priv->completed,
- icalproperty_new_completed,
- icalproperty_set_completed,
- t);
-}
-
-
-/**
- * cal_component_get_created:
- * @comp: A calendar component object.
- * @t: Return value for the creation date. This should be freed using the
- * cal_component_free_icaltimetype() function.
- *
- * Queries the date in which a calendar component object was created in the
- * calendar store.
- **/
-void
-cal_component_get_created (CalComponent *comp, struct icaltimetype **t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_icaltimetype (priv->created, icalproperty_get_created, t);
-}
-
-/**
- * cal_component_set_created:
- * @comp: A calendar component object.
- * @t: Value for the creation date.
- *
- * Sets the date in which a calendar component object is created in the calendar
- * store. This should only be used inside a calendar store application, i.e.
- * not by calendar user agents.
- **/
-void
-cal_component_set_created (CalComponent *comp, struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_icaltimetype (comp, &priv->created,
- icalproperty_new_created,
- icalproperty_set_created,
- t);
-}
-
-/**
- * cal_component_get_description_list:
- * @comp: A calendar component object.
- * @text_list: Return value for the description properties and their parameters,
- * as a list of #CalComponentText structures. This should be freed using the
- * cal_component_free_text_list() function.
- *
- * Queries the description of a calendar component object. Journal components
- * may have more than one description, and as such this function returns a list
- * of #CalComponentText structures. All other types of components can have at
- * most one description.
- **/
-void
-cal_component_get_description_list (CalComponent *comp, GSList **text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (text_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_text_list (priv->description_list, icalproperty_get_description, text_list);
-}
-
-/**
- * cal_component_set_description_list:
- * @comp: A calendar component object.
- * @text_list: List of #CalComponentSummary structures.
- *
- * Sets the description of a calendar component object. Journal components may
- * have more than one description, and as such this function takes in a list of
- * #CalComponentDescription structures. All other types of components can have
- * at most one description.
- **/
-void
-cal_component_set_description_list (CalComponent *comp, GSList *text_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_text_list (comp, icalproperty_new_description, &priv->description_list, text_list);
-}
-
-/* Gets a date/time and timezone pair */
-static void
-get_datetime (struct datetime *datetime,
- struct icaltimetype (* get_prop_func) (const icalproperty *prop),
- CalComponentDateTime *dt)
-{
- if (datetime->prop) {
- dt->value = g_new (struct icaltimetype, 1);
- *dt->value = (* get_prop_func) (datetime->prop);
- } else
- dt->value = NULL;
-
- /* If the icaltimetype has is_utc set, we set "UTC" as the TZID.
- This makes the timezone code simpler. */
- if (datetime->tzid_param)
- dt->tzid = g_strdup (icalparameter_get_tzid (datetime->tzid_param));
- else if (dt->value && dt->value->is_utc)
- dt->tzid = g_strdup ("UTC");
- else
- dt->tzid = NULL;
-}
-
-/* Sets a date/time and timezone pair */
-static void
-set_datetime (CalComponent *comp, struct datetime *datetime,
- icalproperty *(* prop_new_func) (struct icaltimetype v),
- void (* prop_set_func) (icalproperty * prop, struct icaltimetype v),
- CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- priv = comp->priv;
-
- /* If we are setting the property to NULL (i.e. removing it), then
- we remove it if it exists. */
- if (!dt) {
- if (datetime->prop) {
- icalcomponent_remove_property (priv->icalcomp, datetime->prop);
- icalproperty_free (datetime->prop);
-
- datetime->prop = NULL;
- datetime->tzid_param = NULL;
- }
-
- return;
- }
-
- g_return_if_fail (dt->value != NULL);
-
- /* If the TZID is set to "UTC", we set the is_utc flag. */
- if (dt->tzid && !strcmp (dt->tzid, "UTC"))
- dt->value->is_utc = 1;
- else
- dt->value->is_utc = 0;
-
- if (datetime->prop) {
- (* prop_set_func) (datetime->prop, *dt->value);
- } else {
- datetime->prop = (* prop_new_func) (*dt->value);
- icalcomponent_add_property (priv->icalcomp, datetime->prop);
- }
-
- /* If the TZID is set to "UTC", we don't want to save the TZID. */
- if (dt->tzid && strcmp (dt->tzid, "UTC")) {
- g_assert (datetime->prop != NULL);
-
- if (datetime->tzid_param) {
- icalparameter_set_tzid (datetime->tzid_param, (char *) dt->tzid);
- } else {
- datetime->tzid_param = icalparameter_new_tzid ((char *) dt->tzid);
- icalproperty_add_parameter (datetime->prop, datetime->tzid_param);
- }
- } else if (datetime->tzid_param) {
- icalproperty_remove_parameter (datetime->prop, ICAL_TZID_PARAMETER);
- icalparameter_free (datetime->tzid_param);
- datetime->tzid_param = NULL;
- }
-}
-
-
-/* This tries to get the DTSTART + DURATION for a VEVENT or VTODO. In a
- VEVENT this is used for the DTEND if no DTEND exists, In a VTOTO it is
- used for the DUE date if DUE doesn't exist. */
-static void
-cal_component_get_start_plus_duration (CalComponent *comp,
- CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
- struct icaldurationtype duration;
-
- priv = comp->priv;
-
- if (!priv->duration)
- return;
-
- /* Get the DTSTART time. */
- get_datetime (&priv->dtstart, icalproperty_get_dtstart, dt);
- if (!dt->value)
- return;
-
- duration = icalproperty_get_duration (priv->duration);
-
- /* The DURATION shouldn't be negative, but just return DTSTART if it
- is, i.e. assume it is 0. */
- if (duration.is_neg)
- return;
-
- /* If DTSTART is a DATE value, then we need to check if the DURATION
- includes any hours, minutes or seconds. If it does, we need to
- make the DTEND/DUE a DATE-TIME value. */
- duration.days += duration.weeks * 7;
- if (dt->value->is_date) {
- if (duration.hours != 0 || duration.minutes != 0
- || duration.seconds != 0) {
- dt->value->is_date = 0;
- }
- }
-
- /* Add on the DURATION. */
- icaltime_adjust (dt->value, duration.days, duration.hours,
- duration.minutes, duration.seconds);
-}
-
-
-/**
- * cal_component_get_dtend:
- * @comp: A calendar component object.
- * @dt: Return value for the date/time end. This should be freed with the
- * cal_component_free_datetime() function.
- *
- * Queries the date/time end of a calendar component object.
- **/
-void
-cal_component_get_dtend (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (dt != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_datetime (&priv->dtend, icalproperty_get_dtend, dt);
-
- /* If we don't have a DTEND property, then we try to get DTSTART
- + DURATION. */
- if (!dt->value)
- cal_component_get_start_plus_duration (comp, dt);
-}
-
-/**
- * cal_component_set_dtend:
- * @comp: A calendar component object.
- * @dt: End date/time.
- *
- * Sets the date/time end property of a calendar component object.
- **/
-void
-cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_datetime (comp, &priv->dtend,
- icalproperty_new_dtend,
- icalproperty_set_dtend,
- dt);
-
- /* Make sure we remove any existing DURATION property, as it can't be
- used with a DTEND. If DTEND is set to NULL, i.e. removed, we also
- want to remove any DURATION. */
- if (priv->duration) {
- icalcomponent_remove_property (priv->icalcomp, priv->duration);
- icalproperty_free (priv->duration);
- priv->duration = NULL;
- }
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_get_dtstamp:
- * @comp: A calendar component object.
- * @t: A value for the date/timestamp.
- *
- * Queries the date/timestamp property of a calendar component object, which is
- * the last time at which the object was modified by a calendar user agent.
- **/
-void
-cal_component_get_dtstamp (CalComponent *comp, struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- /* This MUST exist, since we ensured that it did */
- g_assert (priv->dtstamp != NULL);
-
- *t = icalproperty_get_dtstamp (priv->dtstamp);
-}
-
-/**
- * cal_component_set_dtstamp:
- * @comp: A calendar component object.
- * @t: Date/timestamp value.
- *
- * Sets the date/timestamp of a calendar component object. This should be
- * called whenever a calendar user agent makes a change to a component's
- * properties.
- **/
-void
-cal_component_set_dtstamp (CalComponent *comp, struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- /* This MUST exist, since we ensured that it did */
- g_assert (priv->dtstamp != NULL);
-
- icalproperty_set_dtstamp (priv->dtstamp, *t);
-}
-
-/**
- * cal_component_get_dtstart:
- * @comp: A calendar component object.
- * @dt: Return value for the date/time start. This should be freed with the
- * cal_component_free_datetime() function.
- *
- * Queries the date/time start of a calendar component object.
- **/
-void
-cal_component_get_dtstart (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (dt != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_datetime (&priv->dtstart, icalproperty_get_dtstart, dt);
-}
-
-/**
- * cal_component_set_dtstart:
- * @comp: A calendar component object.
- * @dt: Start date/time.
- *
- * Sets the date/time start property of a calendar component object.
- **/
-void
-cal_component_set_dtstart (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_datetime (comp, &priv->dtstart,
- icalproperty_new_dtstart,
- icalproperty_set_dtstart,
- dt);
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_get_due:
- * @comp: A calendar component object.
- * @dt: Return value for the due date/time. This should be freed with the
- * cal_component_free_datetime() function.
- *
- * Queries the due date/time of a calendar component object.
- **/
-void
-cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (dt != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_datetime (&priv->due, icalproperty_get_due, dt);
-
- /* If we don't have a DTEND property, then we try to get DTSTART
- + DURATION. */
- if (!dt->value)
- cal_component_get_start_plus_duration (comp, dt);
-}
-
-/**
- * cal_component_set_due:
- * @comp: A calendar component object.
- * @dt: End date/time.
- *
- * Sets the due date/time property of a calendar component object.
- **/
-void
-cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_datetime (comp, &priv->due,
- icalproperty_new_due,
- icalproperty_set_due,
- dt);
-
- /* Make sure we remove any existing DURATION property, as it can't be
- used with a DTEND. If DTEND is set to NULL, i.e. removed, we also
- want to remove any DURATION. */
- if (priv->duration) {
- icalcomponent_remove_property (priv->icalcomp, priv->duration);
- icalproperty_free (priv->duration);
- priv->duration = NULL;
- }
-
- priv->need_sequence_inc = TRUE;
-}
-
-/* Builds a list of CalComponentPeriod structures based on a list of icalproperties */
-static void
-get_period_list (GSList *period_list,
- struct icaldatetimeperiodtype (* get_prop_func) (const icalproperty *prop),
- GSList **list)
-{
- GSList *l;
-
- *list = NULL;
-
- if (!period_list)
- return;
-
- for (l = period_list; l; l = l->next) {
- struct period *period;
- CalComponentPeriod *p;
- struct icaldatetimeperiodtype ip;
-
- period = l->data;
- g_assert (period->prop != NULL);
-
- p = g_new (CalComponentPeriod, 1);
-
- /* Get value parameter */
-
- if (period->value_param) {
- icalparameter_value value_type;
-
- value_type = icalparameter_get_value (period->value_param);
-
- if (value_type == ICAL_VALUE_DATE || value_type == ICAL_VALUE_DATETIME)
- p->type = CAL_COMPONENT_PERIOD_DATETIME;
- else if (value_type == ICAL_VALUE_DURATION)
- p->type = CAL_COMPONENT_PERIOD_DURATION;
- else {
- g_message ("get_period_list(): Unknown value for period %d; "
- "using DATETIME", value_type);
- p->type = CAL_COMPONENT_PERIOD_DATETIME;
- }
- } else
- p->type = CAL_COMPONENT_PERIOD_DATETIME;
-
- /* Get start and end/duration */
-
- ip = (* get_prop_func) (period->prop);
-
- p->start = ip.period.start;
-
- if (p->type == CAL_COMPONENT_PERIOD_DATETIME)
- p->u.end = ip.period.end;
- else if (p->type == CAL_COMPONENT_PERIOD_DURATION)
- p->u.duration = ip.period.duration;
- else
- g_assert_not_reached ();
-
- /* Put in list */
-
- *list = g_slist_prepend (*list, p);
- }
-
- *list = g_slist_reverse (*list);
-}
-
-/* Sets a period list value */
-static void
-set_period_list (CalComponent *comp,
- icalproperty *(* new_prop_func) (struct icaldatetimeperiodtype period),
- GSList **period_list,
- GSList *pl)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- priv = comp->priv;
-
- /* Remove old periods */
-
- for (l = *period_list; l; l = l->next) {
- struct period *period;
-
- period = l->data;
- g_assert (period->prop != NULL);
-
- icalcomponent_remove_property (priv->icalcomp, period->prop);
- icalproperty_free (period->prop);
- g_free (period);
- }
-
- g_slist_free (*period_list);
- *period_list = NULL;
-
- /* Add in new periods */
-
- for (l = pl; l; l = l->next) {
- CalComponentPeriod *p;
- struct period *period;
- struct icaldatetimeperiodtype ip;
- icalparameter_value value_type;
-
- g_assert (l->data != NULL);
- p = l->data;
-
- /* Create libical value */
-
- ip.period.start = p->start;
-
- if (p->type == CAL_COMPONENT_PERIOD_DATETIME) {
- value_type = ICAL_VALUE_DATETIME;
- ip.period.end = p->u.end;
- } else if (p->type == CAL_COMPONENT_PERIOD_DURATION) {
- value_type = ICAL_VALUE_DURATION;
- ip.period.duration = p->u.duration;
- } else {
- g_assert_not_reached ();
- return;
- }
-
- /* Create property */
-
- period = g_new (struct period, 1);
-
- period->prop = (* new_prop_func) (ip);
- period->value_param = icalparameter_new_value (value_type);
- icalproperty_add_parameter (period->prop, period->value_param);
-
- /* Add to list */
-
- *period_list = g_slist_prepend (*period_list, period);
- }
-
- *period_list = g_slist_reverse (*period_list);
-}
-
-/**
- * cal_component_get_exdate_list:
- * @comp: A calendar component object.
- * @exdate_list: Return value for the list of exception dates, as a list of
- * #CalComponentDateTime structures. This should be freed using the
- * cal_component_free_exdate_list() function.
- *
- * Queries the list of exception date properties in a calendar component object.
- **/
-void
-cal_component_get_exdate_list (CalComponent *comp, GSList **exdate_list)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (exdate_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- *exdate_list = NULL;
-
- for (l = priv->exdate_list; l; l = l->next) {
- struct datetime *dt;
- CalComponentDateTime *cdt;
-
- dt = l->data;
-
- cdt = g_new (CalComponentDateTime, 1);
- cdt->value = g_new (struct icaltimetype, 1);
-
- *cdt->value = icalproperty_get_exdate (dt->prop);
-
- if (dt->tzid_param)
- cdt->tzid = g_strdup (icalparameter_get_tzid (dt->tzid_param));
- else
- cdt->tzid = NULL;
-
- *exdate_list = g_slist_prepend (*exdate_list, cdt);
- }
-
- *exdate_list = g_slist_reverse (*exdate_list);
-}
-
-/**
- * cal_component_set_exdate_list:
- * @comp: A calendar component object.
- * @exdate_list: List of #CalComponentDateTime structures.
- *
- * Sets the list of exception dates in a calendar component object.
- **/
-void
-cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- /* Remove old exception dates */
-
- for (l = priv->exdate_list; l; l = l->next) {
- struct datetime *dt;
-
- dt = l->data;
-
- /* Removing the DATE or DATE-TIME property will also remove
- any TZID parameter. */
- icalcomponent_remove_property (priv->icalcomp, dt->prop);
- icalproperty_free (dt->prop);
- g_free (dt);
- }
-
- g_slist_free (priv->exdate_list);
- priv->exdate_list = NULL;
-
- /* Add in new exception dates */
-
- for (l = exdate_list; l; l = l->next) {
- CalComponentDateTime *cdt;
- struct datetime *dt;
-
- g_assert (l->data != NULL);
- cdt = l->data;
-
- g_assert (cdt->value != NULL);
-
- dt = g_new (struct datetime, 1);
- dt->prop = icalproperty_new_exdate (*cdt->value);
-
- if (cdt->tzid) {
- dt->tzid_param = icalparameter_new_tzid ((char *) cdt->tzid);
- icalproperty_add_parameter (dt->prop, dt->tzid_param);
- } else
- dt->tzid_param = NULL;
-
- icalcomponent_add_property (priv->icalcomp, dt->prop);
- priv->exdate_list = g_slist_prepend (priv->exdate_list, dt);
- }
-
- priv->exdate_list = g_slist_reverse (priv->exdate_list);
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_has_exdates:
- * @comp: A calendar component object.
- *
- * Queries whether a calendar component object has any exception dates defined
- * for it.
- *
- * Return value: TRUE if the component has exception dates, FALSE otherwise.
- **/
-gboolean
-cal_component_has_exdates (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
-
- return (priv->exdate_list != NULL);
-}
-
-/* Gets a list of recurrence rules */
-static void
-get_recur_list (GSList *recur_list,
- struct icalrecurrencetype (* get_prop_func) (const icalproperty *prop),
- GSList **list)
-{
- GSList *l;
-
- *list = NULL;
-
- for (l = recur_list; l; l = l->next) {
- icalproperty *prop;
- struct icalrecurrencetype *r;
-
- prop = l->data;
-
- r = g_new (struct icalrecurrencetype, 1);
- *r = (* get_prop_func) (prop);
-
- *list = g_slist_prepend (*list, r);
- }
-
- *list = g_slist_reverse (*list);
-}
-
-/* Sets a list of recurrence rules */
-static void
-set_recur_list (CalComponent *comp,
- icalproperty *(* new_prop_func) (struct icalrecurrencetype recur),
- GSList **recur_list,
- GSList *rl)
-{
- CalComponentPrivate *priv;
- GSList *l;
-
- priv = comp->priv;
-
- /* Remove old recurrences */
-
- for (l = *recur_list; l; l = l->next) {
- icalproperty *prop;
-
- prop = l->data;
- icalcomponent_remove_property (priv->icalcomp, prop);
- icalproperty_free (prop);
- }
-
- g_slist_free (*recur_list);
- *recur_list = NULL;
-
- /* Add in new recurrences */
-
- for (l = rl; l; l = l->next) {
- icalproperty *prop;
- struct icalrecurrencetype *recur;
-
- g_assert (l->data != NULL);
- recur = l->data;
-
- prop = (* new_prop_func) (*recur);
- icalcomponent_add_property (priv->icalcomp, prop);
-
- *recur_list = g_slist_prepend (*recur_list, prop);
- }
-
- *recur_list = g_slist_reverse (*recur_list);
-}
-
-/**
- * cal_component_get_exrule_list:
- * @comp: A calendar component object.
- * @recur_list: List of exception rules as struct #icalrecurrencetype
- * structures. This should be freed using the cal_component_free_recur_list()
- * function.
- *
- * Queries the list of exception rule properties of a calendar component
- * object.
- **/
-void
-cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_recur_list (priv->exrule_list, icalproperty_get_exrule, recur_list);
-}
-
-/**
- * cal_component_get_exrule_property_list:
- * @comp: A calendar component object.
- * @recur_list: Returns a list of exception rule properties.
- *
- * Queries the list of exception rule properties of a calendar component object.
- **/
-void
-cal_component_get_exrule_property_list (CalComponent *comp, GSList **recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- *recur_list = priv->exrule_list;
-}
-
-/**
- * cal_component_set_exrule_list:
- * @comp: A calendar component object.
- * @recur_list: List of struct #icalrecurrencetype structures.
- *
- * Sets the list of exception rules in a calendar component object.
- **/
-void
-cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_recur_list (comp, icalproperty_new_exrule, &priv->exrule_list, recur_list);
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_has_exrules:
- * @comp: A calendar component object.
- *
- * Queries whether a calendar component object has any exception rules defined
- * for it.
- *
- * Return value: TRUE if the component has exception rules, FALSE otherwise.
- **/
-gboolean
-cal_component_has_exrules (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
-
- return (priv->exrule_list != NULL);
-}
-
-/**
- * cal_component_has_exceptions:
- * @comp: A calendar component object
- *
- * Queries whether a calendar component object has any exception dates
- * or exception rules.
- *
- * Return value: TRUE if the component has exceptions, FALSE otherwise.
- **/
-gboolean
-cal_component_has_exceptions (CalComponent *comp)
-{
- return cal_component_has_exdates (comp) || cal_component_has_exrules (comp);
-}
-
-/**
- * cal_component_get_geo:
- * @comp: A calendar component object.
- * @geo: Return value for the geographic position property. This should be
- * freed using the cal_component_free_geo() function.
- *
- * Sets the geographic position property of a calendar component object.
- **/
-void
-cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (geo != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->geo) {
- *geo = g_new (struct icalgeotype, 1);
- **geo = icalproperty_get_geo (priv->geo);
- } else
- *geo = NULL;
-}
-
-/**
- * cal_component_set_geo:
- * @comp: A calendar component object.
- * @geo: Value for the geographic position property.
- *
- * Sets the geographic position property on a calendar component object.
- **/
-void
-cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!geo) {
- if (priv->geo) {
- icalcomponent_remove_property (priv->icalcomp, priv->geo);
- icalproperty_free (priv->geo);
- priv->geo = NULL;
- }
-
- return;
- }
-
- if (priv->geo)
- icalproperty_set_geo (priv->geo, *geo);
- else {
- priv->geo = icalproperty_new_geo (*geo);
- icalcomponent_add_property (priv->icalcomp, priv->geo);
- }
-}
-
-/**
- * cal_component_get_last_modified:
- * @comp: A calendar component object.
- * @t: Return value for the last modified time value.
- *
- * Queries the time at which a calendar component object was last modified in
- * the calendar store.
- **/
-void
-cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_icaltimetype (priv->last_modified, icalproperty_get_lastmodified, t);
-}
-
-/**
- * cal_component_set_last_modified:
- * @comp: A calendar component object.
- * @t: Value for the last time modified.
- *
- * Sets the time at which a calendar component object was last stored in the
- * calendar store. This should not be called by plain calendar user agents.
- **/
-void
-cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_icaltimetype (comp, &priv->last_modified,
- icalproperty_new_lastmodified,
- icalproperty_set_lastmodified,
- t);
-}
-
-/**
- * cal_component_get_organizer:
- * @comp: A calendar component object
- * @organizer: A value for the organizer
- *
- * Queries the organizer property of a calendar component object
- **/
-void
-cal_component_get_organizer (CalComponent *comp, CalComponentOrganizer *organizer)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (organizer != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->organizer.prop)
- organizer->value = icalproperty_get_organizer (priv->organizer.prop);
- else
- organizer->value = NULL;
-
- if (priv->organizer.sentby_param)
- organizer->sentby = icalparameter_get_sentby (priv->organizer.sentby_param);
- else
- organizer->sentby = NULL;
-
- if (priv->organizer.cn_param)
- organizer->cn = icalparameter_get_sentby (priv->organizer.cn_param);
- else
- organizer->cn = NULL;
-
- if (priv->organizer.language_param)
- organizer->language = icalparameter_get_sentby (priv->organizer.language_param);
- else
- organizer->language = NULL;
-
-}
-
-/**
- * cal_component_set_organizer:
- * @comp: A calendar component object.
- * @organizer: Value for the organizer property
- *
- * Sets the organizer of a calendar component object
- **/
-void
-cal_component_set_organizer (CalComponent *comp, CalComponentOrganizer *organizer)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!organizer) {
- if (priv->organizer.prop) {
- icalcomponent_remove_property (priv->icalcomp, priv->organizer.prop);
- icalproperty_free (priv->organizer.prop);
-
- priv->organizer.prop = NULL;
- priv->organizer.sentby_param = NULL;
- priv->organizer.cn_param = NULL;
- priv->organizer.language_param = NULL;
- }
-
- return;
- }
-
- g_return_if_fail (organizer->value != NULL);
-
- if (priv->organizer.prop)
- icalproperty_set_organizer (priv->organizer.prop, (char *) organizer->value);
- else {
- priv->organizer.prop = icalproperty_new_organizer ((char *) organizer->value);
- icalcomponent_add_property (priv->icalcomp, priv->organizer.prop);
- }
-
- if (organizer->sentby) {
- g_assert (priv->organizer.prop != NULL);
-
- if (priv->organizer.sentby_param)
- icalparameter_set_sentby (priv->organizer.sentby_param,
- (char *) organizer->sentby);
- else {
- priv->organizer.sentby_param = icalparameter_new_sentby (
- (char *) organizer->sentby);
- icalproperty_add_parameter (priv->organizer.prop,
- priv->organizer.sentby_param);
- }
- } else if (priv->organizer.sentby_param) {
- icalproperty_remove_parameter (priv->organizer.prop, ICAL_SENTBY_PARAMETER);
- icalparameter_free (priv->organizer.sentby_param);
- priv->organizer.sentby_param = NULL;
- }
-
- if (organizer->cn) {
- g_assert (priv->organizer.prop != NULL);
-
- if (priv->organizer.cn_param)
- icalparameter_set_cn (priv->organizer.cn_param,
- (char *) organizer->cn);
- else {
- priv->organizer.cn_param = icalparameter_new_cn (
- (char *) organizer->cn);
- icalproperty_add_parameter (priv->organizer.prop,
- priv->organizer.cn_param);
- }
- } else if (priv->organizer.cn_param) {
- icalproperty_remove_parameter (priv->organizer.prop, ICAL_CN_PARAMETER);
- icalparameter_free (priv->organizer.cn_param);
- priv->organizer.cn_param = NULL;
- }
-
- if (organizer->language) {
- g_assert (priv->organizer.prop != NULL);
-
- if (priv->organizer.language_param)
- icalparameter_set_language (priv->organizer.language_param,
- (char *) organizer->language);
- else {
- priv->organizer.language_param = icalparameter_new_language (
- (char *) organizer->language);
- icalproperty_add_parameter (priv->organizer.prop,
- priv->organizer.language_param);
- }
- } else if (priv->organizer.language_param) {
- icalproperty_remove_parameter (priv->organizer.prop, ICAL_LANGUAGE_PARAMETER);
- icalparameter_free (priv->organizer.language_param);
- priv->organizer.language_param = NULL;
- }
-
-
-}
-
-
-/**
- * cal_component_has_organizer:
- * @comp:
- *
- *
- *
- * Return value:
- **/
-gboolean
-cal_component_has_organizer (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
-
- return priv->organizer.prop != NULL;
-}
-
-/**
- * cal_component_get_percent:
- * @comp: A calendar component object.
- * @percent: Return value for the percent-complete property. This should be
- * freed using the cal_component_free_percent() function.
- *
- * Queries the percent-complete property of a calendar component object.
- **/
-void
-cal_component_get_percent (CalComponent *comp, int **percent)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (percent != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->percent) {
- *percent = g_new (int, 1);
- **percent = icalproperty_get_percentcomplete (priv->percent);
- } else
- *percent = NULL;
-}
-
-/**
- * cal_component_set_percent:
- * @comp: A calendar component object.
- * @percent: Value for the percent-complete property.
- *
- * Sets the percent-complete property of a calendar component object.
- **/
-void
-cal_component_set_percent (CalComponent *comp, int *percent)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!percent) {
- if (priv->percent) {
- icalcomponent_remove_property (priv->icalcomp, priv->percent);
- icalproperty_free (priv->percent);
- priv->percent = NULL;
- }
-
- return;
- }
-
- g_return_if_fail (*percent >= 0 && *percent <= 100);
-
- if (priv->percent)
- icalproperty_set_percentcomplete (priv->percent, *percent);
- else {
- priv->percent = icalproperty_new_percentcomplete (*percent);
- icalcomponent_add_property (priv->icalcomp, priv->percent);
- }
-}
-
-/**
- * cal_component_get_priority:
- * @comp: A calendar component object.
- * @priority: Return value for the priority property. This should be freed using
- * the cal_component_free_priority() function.
- *
- * Queries the priority property of a calendar component object.
- **/
-void
-cal_component_get_priority (CalComponent *comp, int **priority)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (priority != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->priority) {
- *priority = g_new (int, 1);
- **priority = icalproperty_get_priority (priv->priority);
- } else
- *priority = NULL;
-}
-
-/**
- * cal_component_set_priority:
- * @comp: A calendar component object.
- * @priority: Value for the priority property.
- *
- * Sets the priority property of a calendar component object.
- **/
-void
-cal_component_set_priority (CalComponent *comp, int *priority)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priority) {
- if (priv->priority) {
- icalcomponent_remove_property (priv->icalcomp, priv->priority);
- icalproperty_free (priv->priority);
- priv->priority = NULL;
- }
-
- return;
- }
-
- g_return_if_fail (*priority >= 0 && *priority <= 9);
-
- if (priv->priority)
- icalproperty_set_priority (priv->priority, *priority);
- else {
- priv->priority = icalproperty_new_priority (*priority);
- icalcomponent_add_property (priv->icalcomp, priv->priority);
- }
-}
-
-/**
- * cal_component_get_recurid:
- * @comp: A calendar component object.
- * @recur_id: Return value for the recurrence id property
- *
- * Queries the recurrence id property of a calendar component object
- **/
-void
-cal_component_get_recurid (CalComponent *comp, CalComponentRange *recur_id)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_id != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_datetime (&priv->recur_id.recur_time,
- icalproperty_get_recurrenceid,
- &recur_id->datetime);
-}
-
-/**
- * cal_component_set_recurid:
- * @comp: A calendar component object.
- * @recur_id: Value for the recurrence id property.
- *
- * Sets the recurrence id property of a calendar component object.
- **/
-void
-cal_component_set_recurid (CalComponent *comp, CalComponentRange *recur_id)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_datetime (comp, &priv->recur_id.recur_time,
- icalproperty_new_recurrenceid,
- icalproperty_set_recurrenceid,
- recur_id ? &recur_id->datetime : NULL);
-}
-
-/**
- * cal_component_get_rdate_list:
- * @comp: A calendar component object.
- * @period_list: Return value for the list of recurrence dates, as a list of
- * #CalComponentPeriod structures. This should be freed using the
- * cal_component_free_period_list() function.
- *
- * Queries the list of recurrence date properties in a calendar component
- * object.
- **/
-void
-cal_component_get_rdate_list (CalComponent *comp, GSList **period_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (period_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_period_list (priv->rdate_list, icalproperty_get_rdate, period_list);
-}
-
-/**
- * cal_component_set_rdate_list:
- * @comp: A calendar component object.
- * @period_list: List of #CalComponentPeriod structures.
- *
- * Sets the list of recurrence dates in a calendar component object.
- **/
-void
-cal_component_set_rdate_list (CalComponent *comp, GSList *period_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_period_list (comp, icalproperty_new_rdate, &priv->rdate_list, period_list);
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_has_rdates:
- * @comp: A calendar component object.
- *
- * Queries whether a calendar component object has any recurrence dates defined
- * for it.
- *
- * Return value: TRUE if the component has recurrence dates, FALSE otherwise.
- **/
-gboolean
-cal_component_has_rdates (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
-
- return (priv->rdate_list != NULL);
-}
-
-/**
- * cal_component_get_rrule_list:
- * @comp: A calendar component object.
- * @recur_list: List of recurrence rules as struct #icalrecurrencetype
- * structures. This should be freed using the cal_component_free_recur_list()
- * function.
- *
- * Queries the list of recurrence rule properties of a calendar component
- * object.
- **/
-void
-cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_recur_list (priv->rrule_list, icalproperty_get_rrule, recur_list);
-}
-
-/**
- * cal_component_get_rrule_property_list:
- * @comp: A calendar component object.
- * @recur_list: Returns a list of recurrence rule properties.
- *
- * Queries a list of recurrence rule properties of a calendar component object.
- **/
-void
-cal_component_get_rrule_property_list (CalComponent *comp, GSList **recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- *recur_list = priv->rrule_list;
-}
-
-/**
- * cal_component_set_rrule_list:
- * @comp: A calendar component object.
- * @recur_list: List of struct #icalrecurrencetype structures.
- *
- * Sets the list of recurrence rules in a calendar component object.
- **/
-void
-cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_recur_list (comp, icalproperty_new_rrule, &priv->rrule_list, recur_list);
-
- priv->need_sequence_inc = TRUE;
-}
-
-/**
- * cal_component_has_rrules:
- * @comp: A calendar component object.
- *
- * Queries whether a calendar component object has any recurrence rules defined
- * for it.
- *
- * Return value: TRUE if the component has recurrence rules, FALSE otherwise.
- **/
-gboolean
-cal_component_has_rrules (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
-
- return (priv->rrule_list != NULL);
-}
-
-/**
- * cal_component_has_recurrences:
- * @comp: A calendar component object
- *
- * Queries whether a calendar component object has any recurrence dates or
- * recurrence rules.
- *
- * Return value: TRUE if the component has recurrences, FALSE otherwise.
- **/
-gboolean
-cal_component_has_recurrences (CalComponent *comp)
-{
- return cal_component_has_rdates (comp) || cal_component_has_rrules (comp);
-}
-
-/* Counts the elements in the by_xxx fields of an icalrecurrencetype */
-static int
-count_by_xxx (short *field, int max_elements)
-{
- int i;
-
- for (i = 0; i < max_elements; i++)
- if (field[i] == ICAL_RECURRENCE_ARRAY_MAX)
- break;
-
- return i;
-}
-
-gboolean
-cal_component_has_simple_recurrence (CalComponent *comp)
-{
- GSList *rrule_list;
- struct icalrecurrencetype *r;
- int n_by_second, n_by_minute, n_by_hour;
- int n_by_day, n_by_month_day, n_by_year_day;
- int n_by_week_no, n_by_month, n_by_set_pos;
- int len, i;
- gboolean simple = FALSE;
-
- if (!cal_component_has_recurrences (comp))
- return TRUE;
-
- cal_component_get_rrule_list (comp, &rrule_list);
- len = g_slist_length (rrule_list);
- if (len > 1
- || cal_component_has_rdates (comp)
- || cal_component_has_exrules (comp))
- goto cleanup;
-
- /* Down to one rule, so test that one */
- r = rrule_list->data;
-
- /* Any funky frequency? */
- if (r->freq == ICAL_SECONDLY_RECURRENCE
- || r->freq == ICAL_MINUTELY_RECURRENCE
- || r->freq == ICAL_HOURLY_RECURRENCE)
- goto cleanup;
-
- /* Any funky BY_* */
-#define N_HAS_BY(field) (count_by_xxx (field, sizeof (field) / sizeof (field[0])))
-
- n_by_second = N_HAS_BY (r->by_second);
- n_by_minute = N_HAS_BY (r->by_minute);
- n_by_hour = N_HAS_BY (r->by_hour);
- n_by_day = N_HAS_BY (r->by_day);
- n_by_month_day = N_HAS_BY (r->by_month_day);
- n_by_year_day = N_HAS_BY (r->by_year_day);
- n_by_week_no = N_HAS_BY (r->by_week_no);
- n_by_month = N_HAS_BY (r->by_month);
- n_by_set_pos = N_HAS_BY (r->by_set_pos);
-
- if (n_by_second != 0
- || n_by_minute != 0
- || n_by_hour != 0)
- goto cleanup;
-
- switch (r->freq) {
- case ICAL_DAILY_RECURRENCE:
- if (n_by_day != 0
- || n_by_month_day != 0
- || n_by_year_day != 0
- || n_by_week_no != 0
- || n_by_month != 0
- || n_by_set_pos != 0)
- goto cleanup;
-
- simple = TRUE;
- break;
-
- case ICAL_WEEKLY_RECURRENCE:
- if (n_by_month_day != 0
- || n_by_year_day != 0
- || n_by_week_no != 0
- || n_by_month != 0
- || n_by_set_pos != 0)
- goto cleanup;
-
- for (i = 0; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
- int pos;
- pos = icalrecurrencetype_day_position (r->by_day[i]);
-
- if (pos != 0)
- goto cleanup;
- }
-
- simple = TRUE;
- break;
-
- case ICAL_MONTHLY_RECURRENCE:
- if (n_by_year_day != 0
- || n_by_week_no != 0
- || n_by_month != 0
- || n_by_set_pos > 1)
- goto cleanup;
-
- if (n_by_month_day == 1) {
- int nth;
-
- if (n_by_set_pos != 0)
- goto cleanup;
-
- nth = r->by_month_day[0];
- if (nth < 1 && nth != -1)
- goto cleanup;
-
- simple = TRUE;
-
- } else if (n_by_day == 1) {
- enum icalrecurrencetype_weekday weekday;
- int pos;
-
- /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not
- accept BYDAY=2TU. So we now use the same as Outlook
- by default. */
-
- weekday = icalrecurrencetype_day_day_of_week (r->by_day[0]);
- pos = icalrecurrencetype_day_position (r->by_day[0]);
-
- if (pos == 0) {
- if (n_by_set_pos != 1)
- goto cleanup;
- pos = r->by_set_pos[0];
- } else if (pos < 0) {
- goto cleanup;
- }
-
- switch (weekday) {
- case ICAL_MONDAY_WEEKDAY:
- case ICAL_TUESDAY_WEEKDAY:
- case ICAL_WEDNESDAY_WEEKDAY:
- case ICAL_THURSDAY_WEEKDAY:
- case ICAL_FRIDAY_WEEKDAY:
- case ICAL_SATURDAY_WEEKDAY:
- case ICAL_SUNDAY_WEEKDAY:
- break;
-
- default:
- goto cleanup;
- }
- } else {
- goto cleanup;
- }
-
- simple = TRUE;
- break;
-
- case ICAL_YEARLY_RECURRENCE:
- if (n_by_day != 0
- || n_by_month_day != 0
- || n_by_year_day != 0
- || n_by_week_no != 0
- || n_by_month != 0
- || n_by_set_pos != 0)
- goto cleanup;
-
- simple = TRUE;
- break;
-
- default:
- goto cleanup;
- }
-
- cleanup:
- cal_component_free_recur_list (rrule_list);
-
- return simple;
-}
-
-gboolean
-cal_component_is_instance (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
-
- return !(priv->recur_id.recur_time.prop == NULL);
-}
-
-/**
- * cal_component_get_sequence:
- * @comp: A calendar component object.
- * @sequence: Return value for the sequence number. This should be freed using
- * cal_component_free_sequence().
- *
- * Queries the sequence number of a calendar component object.
- **/
-void
-cal_component_get_sequence (CalComponent *comp, int **sequence)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (sequence != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->sequence) {
- *sequence = NULL;
- return;
- }
-
- *sequence = g_new (int, 1);
- **sequence = icalproperty_get_sequence (priv->sequence);
-}
-
-/**
- * cal_component_set_sequence:
- * @comp: A calendar component object.
- * @sequence: Sequence number value.
- *
- * Sets the sequence number of a calendar component object. Normally this
- * function should not be called, since the sequence number is incremented
- * automatically at the proper times.
- **/
-void
-cal_component_set_sequence (CalComponent *comp, int *sequence)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- priv->need_sequence_inc = FALSE;
-
- if (!sequence) {
- if (priv->sequence) {
- icalcomponent_remove_property (priv->icalcomp, priv->sequence);
- icalproperty_free (priv->sequence);
- priv->sequence = NULL;
- }
-
- return;
- }
-
- if (priv->sequence)
- icalproperty_set_sequence (priv->sequence, *sequence);
- else {
- priv->sequence = icalproperty_new_sequence (*sequence);
- icalcomponent_add_property (priv->icalcomp, priv->sequence);
- }
-}
-
-/**
- * cal_component_get_status:
- * @comp: A calendar component object.
- * @status: Return value for the status value. It is set to #ICAL_STATUS_NONE
- * if the component has no status property.
- *
- * Queries the status property of a calendar component object.
- **/
-void
-cal_component_get_status (CalComponent *comp, icalproperty_status *status)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (status != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->status) {
- *status = ICAL_STATUS_NONE;
- return;
- }
-
- *status = icalproperty_get_status (priv->status);
-}
-
-/**
- * cal_component_set_status:
- * @comp: A calendar component object.
- * @status: Status value. You should use #ICAL_STATUS_NONE if you want to unset
- * this property.
- *
- * Sets the status property of a calendar component object.
- **/
-void
-cal_component_set_status (CalComponent *comp, icalproperty_status status)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- priv->need_sequence_inc = TRUE;
-
- if (status == ICAL_STATUS_NONE) {
- if (priv->status) {
- icalcomponent_remove_property (priv->icalcomp, priv->status);
- icalproperty_free (priv->status);
- priv->status = NULL;
- }
-
- return;
- }
-
- if (priv->status) {
- icalproperty_set_status (priv->status, status);
- } else {
- priv->status = icalproperty_new_status (status);
- icalcomponent_add_property (priv->icalcomp, priv->status);
- }
-}
-
-/**
- * cal_component_get_summary:
- * @comp: A calendar component object.
- * @summary: Return value for the summary property and its parameters.
- *
- * Queries the summary of a calendar component object.
- **/
-void
-cal_component_get_summary (CalComponent *comp, CalComponentText *summary)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (summary != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->summary.prop)
- summary->value = icalproperty_get_summary (priv->summary.prop);
- else
- summary->value = NULL;
-
- if (priv->summary.altrep_param)
- summary->altrep = icalparameter_get_altrep (priv->summary.altrep_param);
- else
- summary->altrep = NULL;
-}
-
-/**
- * cal_component_set_summary:
- * @comp: A calendar component object.
- * @summary: Summary property and its parameters.
- *
- * Sets the summary of a calendar component object.
- **/
-void
-cal_component_set_summary (CalComponent *comp, CalComponentText *summary)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!summary) {
- if (priv->summary.prop) {
- icalcomponent_remove_property (priv->icalcomp, priv->summary.prop);
- icalproperty_free (priv->summary.prop);
-
- priv->summary.prop = NULL;
- priv->summary.altrep_param = NULL;
- }
-
- return;
- }
-
- g_return_if_fail (summary->value != NULL);
-
- if (priv->summary.prop)
- icalproperty_set_summary (priv->summary.prop, (char *) summary->value);
- else {
- priv->summary.prop = icalproperty_new_summary ((char *) summary->value);
- icalcomponent_add_property (priv->icalcomp, priv->summary.prop);
- }
-
- if (summary->altrep) {
- g_assert (priv->summary.prop != NULL);
-
- if (priv->summary.altrep_param)
- icalparameter_set_altrep (priv->summary.altrep_param,
- (char *) summary->altrep);
- else {
- priv->summary.altrep_param = icalparameter_new_altrep (
- (char *) summary->altrep);
- icalproperty_add_parameter (priv->summary.prop,
- priv->summary.altrep_param);
- }
- } else if (priv->summary.altrep_param) {
- icalproperty_remove_parameter (priv->summary.prop, ICAL_ALTREP_PARAMETER);
- icalparameter_free (priv->summary.altrep_param);
- priv->summary.altrep_param = NULL;
- }
-}
-
-/**
- * cal_component_get_transparency:
- * @comp: A calendar component object.
- * @transp: Return value for the time transparency.
- *
- * Queries the time transparency of a calendar component object.
- **/
-void
-cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp)
-{
- CalComponentPrivate *priv;
- icalproperty_transp ical_transp;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (transp != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->transparency) {
- *transp = CAL_COMPONENT_TRANSP_NONE;
- return;
- }
-
- ical_transp = icalproperty_get_transp (priv->transparency);
-
- switch (ical_transp)
- {
- case ICAL_TRANSP_TRANSPARENT:
- case ICAL_TRANSP_TRANSPARENTNOCONFLICT:
- *transp = CAL_COMPONENT_TRANSP_TRANSPARENT;
- break;
-
- case ICAL_TRANSP_OPAQUE:
- case ICAL_TRANSP_OPAQUENOCONFLICT:
- *transp = CAL_COMPONENT_TRANSP_OPAQUE;
- break;
-
- default:
- *transp = CAL_COMPONENT_TRANSP_UNKNOWN;
- break;
- }
-}
-
-/**
- * cal_component_set_transparency:
- * @comp: A calendar component object.
- * @transp: Time transparency value.
- *
- * Sets the time transparency of a calendar component object.
- **/
-void
-cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp)
-{
- CalComponentPrivate *priv;
- icalproperty_transp ical_transp;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (transp != CAL_COMPONENT_TRANSP_UNKNOWN);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
-
- if (transp == CAL_COMPONENT_TRANSP_NONE) {
- if (priv->transparency) {
- icalcomponent_remove_property (priv->icalcomp, priv->transparency);
- icalproperty_free (priv->transparency);
- priv->transparency = NULL;
- }
-
- return;
- }
-
- switch (transp) {
- case CAL_COMPONENT_TRANSP_TRANSPARENT:
- ical_transp = ICAL_TRANSP_TRANSPARENT;
- break;
-
- case CAL_COMPONENT_TRANSP_OPAQUE:
- ical_transp = ICAL_TRANSP_OPAQUE;
- break;
-
- default:
- g_assert_not_reached ();
- ical_transp = ICAL_TRANSP_NONE;
- }
-
- if (priv->transparency)
- icalproperty_set_transp (priv->transparency, ical_transp);
- else {
- priv->transparency = icalproperty_new_transp (ical_transp);
- icalcomponent_add_property (priv->icalcomp, priv->transparency);
- }
-}
-
-/**
- * cal_component_get_url:
- * @comp: A calendar component object.
- * @url: Return value for the URL.
- *
- * Queries the uniform resource locator property of a calendar component object.
- **/
-void
-cal_component_get_url (CalComponent *comp, const char **url)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (url != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->url)
- *url = icalproperty_get_url (priv->url);
- else
- *url = NULL;
-}
-
-/**
- * cal_component_set_url:
- * @comp: A calendar component object.
- * @url: URL value.
- *
- * Sets the uniform resource locator property of a calendar component object.
- **/
-void
-cal_component_set_url (CalComponent *comp, const char *url)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!url || !(*url)) {
- if (priv->url) {
- icalcomponent_remove_property (priv->icalcomp, priv->url);
- icalproperty_free (priv->url);
- priv->url = NULL;
- }
-
- return;
- }
-
- if (priv->url)
- icalproperty_set_url (priv->url, (char *) url);
- else {
- priv->url = icalproperty_new_url ((char *) url);
- icalcomponent_add_property (priv->icalcomp, priv->url);
- }
-}
-
-/* Gets a text list value */
-static void
-get_attendee_list (GSList *attendee_list, GSList **al)
-{
- GSList *l;
-
- *al = NULL;
-
- if (!attendee_list)
- return;
-
- for (l = attendee_list; l; l = l->next) {
- struct attendee *attendee;
- CalComponentAttendee *a;
-
- attendee = l->data;
- g_assert (attendee->prop != NULL);
-
- a = g_new0 (CalComponentAttendee, 1);
- a->value = icalproperty_get_attendee (attendee->prop);
-
- if (attendee->member_param)
- a->member = icalparameter_get_member (attendee->member_param);
- if (attendee->cutype_param)
- a->cutype = icalparameter_get_cutype (attendee->cutype_param);
- if (attendee->role_param)
- a->role = icalparameter_get_role (attendee->role_param);
- if (attendee->partstat_param)
- a->status = icalparameter_get_role (attendee->partstat_param);
- if (attendee->rsvp_param && icalparameter_get_rsvp (attendee->rsvp_param) == ICAL_RSVP_TRUE)
- a->rsvp = TRUE;
- else
- a->rsvp = FALSE;
- if (attendee->delfrom_param)
- a->delfrom = icalparameter_get_sentby (attendee->delfrom_param);
- if (attendee->delto_param)
- a->delto = icalparameter_get_sentby (attendee->delto_param);
- if (attendee->sentby_param)
- a->sentby = icalparameter_get_sentby (attendee->sentby_param);
- if (attendee->cn_param)
- a->cn = icalparameter_get_sentby (attendee->cn_param);
- if (attendee->language_param)
- a->language = icalparameter_get_sentby (attendee->language_param);
-
- *al = g_slist_prepend (*al, a);
- }
-
- *al = g_slist_reverse (*al);
-}
-
-
-/* Sets a text list value */
-static void
-set_attendee_list (icalcomponent *icalcomp,
- GSList **attendee_list,
- GSList *al)
-{
- GSList *l;
-
- /* Remove old attendees */
-
- for (l = *attendee_list; l; l = l->next) {
- struct attendee *attendee;
-
- attendee = l->data;
- g_assert (attendee->prop != NULL);
-
- icalcomponent_remove_property (icalcomp, attendee->prop);
- icalproperty_free (attendee->prop);
- g_free (attendee);
- }
-
- g_slist_free (*attendee_list);
- *attendee_list = NULL;
-
- /* Add in new attendees */
-
- for (l = al; l; l = l->next) {
- CalComponentAttendee *a;
- struct attendee *attendee;
-
- a = l->data;
- g_return_if_fail (a->value != NULL);
-
- attendee = g_new0 (struct attendee, 1);
-
- attendee->prop = icalproperty_new_attendee (a->value);
- icalcomponent_add_property (icalcomp, attendee->prop);
-
- if (a->member) {
- attendee->member_param = icalparameter_new_member (a->member);
- icalproperty_add_parameter (attendee->prop, attendee->member_param);
- }
-
- attendee->cutype_param = icalparameter_new_cutype (a->cutype);
- icalproperty_add_parameter (attendee->prop, attendee->cutype_param);
-
- attendee->role_param = icalparameter_new_role (a->role);
- icalproperty_add_parameter (attendee->prop, attendee->role_param);
-
- attendee->partstat_param = icalparameter_new_partstat (a->status);
- icalproperty_add_parameter (attendee->prop, attendee->partstat_param);
-
- if (a->rsvp)
- attendee->rsvp_param = icalparameter_new_rsvp (ICAL_RSVP_TRUE);
- else
- attendee->rsvp_param = icalparameter_new_rsvp (ICAL_RSVP_FALSE);
- icalproperty_add_parameter (attendee->prop, attendee->rsvp_param);
-
- if (a->delfrom) {
- attendee->delfrom_param = icalparameter_new_delegatedfrom (a->delfrom);
- icalproperty_add_parameter (attendee->prop, attendee->delfrom_param);
- }
- if (a->delto) {
- attendee->delto_param = icalparameter_new_delegatedto (a->delto);
- icalproperty_add_parameter (attendee->prop, attendee->delto_param);
- }
- if (a->sentby) {
- attendee->sentby_param = icalparameter_new_sentby (a->sentby);
- icalproperty_add_parameter (attendee->prop, attendee->sentby_param);
- }
- if (a->cn) {
- attendee->cn_param = icalparameter_new_cn (a->cn);
- icalproperty_add_parameter (attendee->prop, attendee->cn_param);
- }
- if (a->language) {
- attendee->language_param = icalparameter_new_language (a->language);
- icalproperty_add_parameter (attendee->prop, attendee->language_param);
- }
-
- *attendee_list = g_slist_prepend (*attendee_list, attendee);
- }
-
- *attendee_list = g_slist_reverse (*attendee_list);
-}
-
-/**
- * cal_component_get_attendee_list:
- * @comp: A calendar component object.
- * @attendee_list: Return value for the attendee property.
- * This should be freed using the cal_component_free_attendee_list ()
- * function.
- *
- * Queries the attendee properties of the calendar component object
- **/
-void
-cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (attendee_list != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_attendee_list (priv->attendee_list, attendee_list);
-}
-
-/**
- * cal_component_set_attendee_list:
- * @comp: A calendar component object.
- * @attendee_list: Values for attendee properties
- *
- * Sets the attendees of a calendar component object
- **/
-void
-cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- set_attendee_list (priv->icalcomp, &priv->attendee_list, attendee_list);
-}
-
-gboolean
-cal_component_has_attendees (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
-
- if (g_slist_length (priv->attendee_list) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * cal_component_get_location:
- * @comp: A calendar component object.
- * @url: Return value for the location.
- *
- * Queries the location property of a calendar component object.
- **/
-void
-cal_component_get_location (CalComponent *comp, const char **location)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (location != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (priv->location)
- *location = icalproperty_get_location (priv->location);
- else
- *location = NULL;
-}
-
-/**
- * cal_component_set_location:
- * @comp: A calendar component object.
- * @url: Location value.
- *
- * Sets the location property of a calendar component object.
- **/
-void
-cal_component_set_location (CalComponent *comp, const char *location)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!location || !(*location)) {
- if (priv->location) {
- icalcomponent_remove_property (priv->icalcomp, priv->location);
- icalproperty_free (priv->location);
- priv->location = NULL;
- }
-
- return;
- }
-
- if (priv->location)
- icalproperty_set_location (priv->location, (char *) location);
- else {
- priv->location = icalproperty_new_location ((char *) location);
- icalcomponent_add_property (priv->icalcomp, priv->location);
- }
-}
-
-
-
-/**
- * cal_component_free_categories_list:
- * @categ_list: List of category strings.
- *
- * Frees a list of category strings.
- **/
-void
-cal_component_free_categories_list (GSList *categ_list)
-{
- GSList *l;
-
- for (l = categ_list; l; l = l->next)
- g_free (l->data);
-
- g_slist_free (categ_list);
-}
-
-/**
- * cal_component_free_datetime:
- * @dt: A date/time structure.
- *
- * Frees a date/time structure.
- **/
-void
-cal_component_free_datetime (CalComponentDateTime *dt)
-{
- g_return_if_fail (dt != NULL);
-
- g_free (dt->value);
- g_free ((char*)dt->tzid);
-}
-
-void
-cal_component_free_range (CalComponentRange *range)
-{
- g_return_if_fail (range != NULL);
-
- cal_component_free_datetime (&range->datetime);
-}
-
-/**
- * cal_component_free_exdate_list:
- * @exdate_list: List of #CalComponentDateTime structures.
- *
- * Frees a list of #CalComponentDateTime structures as returned by the
- * cal_component_get_exdate_list() function.
- **/
-void
-cal_component_free_exdate_list (GSList *exdate_list)
-{
- GSList *l;
-
- for (l = exdate_list; l; l = l->next) {
- CalComponentDateTime *cdt;
-
- g_assert (l->data != NULL);
- cdt = l->data;
-
- g_assert (cdt->value != NULL);
- g_free (cdt->value);
- g_free ((char*)cdt->tzid);
-
- g_free (cdt);
- }
-
- g_slist_free (exdate_list);
-}
-
-/**
- * cal_component_free_geo:
- * @geo: An #icalgeotype structure.
- *
- * Frees a struct #icalgeotype structure as returned by the calendar component
- * functions.
- **/
-void
-cal_component_free_geo (struct icalgeotype *geo)
-{
- g_return_if_fail (geo != NULL);
-
- g_free (geo);
-}
-
-/**
- * cal_component_free_icaltimetype:
- * @t: An #icaltimetype structure.
- *
- * Frees a struct #icaltimetype value as returned by the calendar component
- * functions.
- **/
-void
-cal_component_free_icaltimetype (struct icaltimetype *t)
-{
- g_return_if_fail (t != NULL);
-
- g_free (t);
-}
-
-/**
- * cal_component_free_percent:
- * @percent: Percent value.
- *
- * Frees a percent value as returned by the cal_component_get_percent()
- * function.
- **/
-void
-cal_component_free_percent (int *percent)
-{
- g_return_if_fail (percent != NULL);
-
- g_free (percent);
-}
-
-/**
- * cal_component_free_priority:
- * @priority: Priority value.
- *
- * Frees a priority value as returned by the cal_component_get_priority()
- * function.
- **/
-void
-cal_component_free_priority (int *priority)
-{
- g_return_if_fail (priority != NULL);
-
- g_free (priority);
-}
-
-/**
- * cal_component_free_period_list:
- * @period_list: List of #CalComponentPeriod structures.
- *
- * Frees a list of #CalComponentPeriod structures.
- **/
-void
-cal_component_free_period_list (GSList *period_list)
-{
- GSList *l;
-
- for (l = period_list; l; l = l->next) {
- CalComponentPeriod *period;
-
- g_assert (l->data != NULL);
-
- period = l->data;
- g_free (period);
- }
-
- g_slist_free (period_list);
-}
-
-/**
- * cal_component_free_recur_list:
- * @recur_list: List of struct #icalrecurrencetype structures.
- *
- * Frees a list of struct #icalrecurrencetype structures.
- **/
-void
-cal_component_free_recur_list (GSList *recur_list)
-{
- GSList *l;
-
- for (l = recur_list; l; l = l->next) {
- struct icalrecurrencetype *r;
-
- g_assert (l->data != NULL);
- r = l->data;
-
- g_free (r);
- }
-
- g_slist_free (recur_list);
-}
-
-/**
- * cal_component_free_sequence:
- * @sequence: Sequence number value.
- *
- * Frees a sequence number value.
- **/
-void
-cal_component_free_sequence (int *sequence)
-{
- g_return_if_fail (sequence != NULL);
-
- g_free (sequence);
-}
-
-/**
- * cal_component_free_text_list:
- * @text_list: List of #CalComponentText structures.
- *
- * Frees a list of #CalComponentText structures. This function should only be
- * used to free lists of text values as returned by the other getter functions
- * of #CalComponent.
- **/
-void
-cal_component_free_text_list (GSList *text_list)
-{
- GSList *l;
-
- for (l = text_list; l; l = l->next) {
- CalComponentText *text;
-
- g_assert (l->data != NULL);
-
- text = l->data;
- g_return_if_fail (text != NULL);
- g_free (text);
- }
-
- g_slist_free (text_list);
-}
-
-/**
- * cal_component_free_attendee_list:
- * @attendee_list:
- *
- *
- **/
-void
-cal_component_free_attendee_list (GSList *attendee_list)
-{
- GSList *l;
-
- for (l = attendee_list; l; l = l->next) {
- CalComponentAttendee *attendee;
-
- g_assert (l->data != NULL);
-
- attendee = l->data;
- g_return_if_fail (attendee != NULL);
- g_free (attendee);
- }
-
- g_slist_free (attendee_list);
-}
-
-
-
-/**
- * cal_component_has_alarms:
- * @comp: A calendar component object.
- *
- * Checks whether the component has any alarms.
- *
- * Return value: TRUE if the component has any alarms.
- **/
-gboolean
-cal_component_has_alarms (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
-
- return g_hash_table_size (priv->alarm_uid_hash) != 0;
-}
-
-/**
- * cal_component_add_alarm:
- * @comp: A calendar component.
- * @alarm: An alarm.
- *
- * Adds an alarm subcomponent to a calendar component. You should have created
- * the @alarm by using cal_component_alarm_new(); it is invalid to use a
- * #CalComponentAlarm structure that came from cal_component_get_alarm(). After
- * adding the alarm, the @alarm structure is no longer valid because the
- * internal structures may change and you should get rid of it by using
- * cal_component_alarm_free().
- **/
-void
-cal_component_add_alarm (CalComponent *comp, CalComponentAlarm *alarm)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (alarm != NULL);
-
- priv = comp->priv;
-
- add_alarm (comp, alarm->icalcomp, icalproperty_get_x (alarm->uid));
- icalcomponent_add_component (priv->icalcomp, alarm->icalcomp);
-}
-
-/**
- * cal_component_remove_alarm:
- * @comp: A calendar component.
- * @auid: UID of the alarm to remove.
- *
- * Removes an alarm subcomponent from a calendar component. If the alarm that
- * corresponds to the specified @auid had been fetched with
- * cal_component_get_alarm(), then those alarm structures will be invalid; you
- * should get rid of them with cal_component_alarm_free() before using this
- * function.
- **/
-void
-cal_component_remove_alarm (CalComponent *comp, const char *auid)
-{
- CalComponentPrivate *priv;
- icalcomponent *alarm;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (auid != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid);
- if (!alarm)
- return;
-
- g_hash_table_remove (priv->alarm_uid_hash, auid);
- icalcomponent_remove_component (priv->icalcomp, alarm);
- icalcomponent_free (alarm);
-}
-
-static gboolean
-for_each_remove_all_alarms (gpointer key, gpointer value, gpointer data)
-{
- CalComponent *comp = CAL_COMPONENT (data);
- CalComponentPrivate *priv;
- icalcomponent *alarm = value;
-
- priv = comp->priv;
-
- icalcomponent_remove_component (priv->icalcomp, alarm);
- icalcomponent_free (alarm);
-
- return TRUE;
-}
-
-/**
- * cal_component_remove_all_alarms:
- * @comp: A calendar component
- *
- * Remove all alarms from the calendar component
- **/
-void
-cal_component_remove_all_alarms (CalComponent *comp)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- g_hash_table_foreach_remove (priv->alarm_uid_hash, for_each_remove_all_alarms, comp);
-}
-
-
-/* Scans an icalproperty from a calendar component and adds its mapping to our
- * own alarm structure.
- */
-static void
-scan_alarm_property (CalComponentAlarm *alarm, icalproperty *prop)
-{
- icalproperty_kind kind;
- const char *xname;
-
- kind = icalproperty_isa (prop);
-
- switch (kind) {
- case ICAL_ACTION_PROPERTY:
- alarm->action = prop;
- break;
-
- case ICAL_ATTACH_PROPERTY:
- /* FIXME: mail alarms may have any number of these, not just one */
- alarm->attach = prop;
- break;
-
- case ICAL_DESCRIPTION_PROPERTY:
- alarm->description.prop = prop;
- alarm->description.altrep_param = icalproperty_get_first_parameter (
- prop, ICAL_ALTREP_PARAMETER);
- break;
-
- case ICAL_DURATION_PROPERTY:
- alarm->duration = prop;
- break;
-
- case ICAL_REPEAT_PROPERTY:
- alarm->repeat = prop;
- break;
-
- case ICAL_TRIGGER_PROPERTY:
- alarm->trigger = prop;
- break;
-
- case ICAL_ATTENDEE_PROPERTY:
- scan_attendee (&alarm->attendee_list, prop);
- break;
-
- case ICAL_X_PROPERTY:
- xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
-
- if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0)
- alarm->uid = prop;
-
- break;
-
- default:
- break;
- }
-}
-
-/* Creates a CalComponentAlarm from a libical alarm subcomponent */
-static CalComponentAlarm *
-make_alarm (icalcomponent *subcomp)
-{
- CalComponentAlarm *alarm;
- icalproperty *prop;
-
- alarm = g_new (CalComponentAlarm, 1);
-
- alarm->icalcomp = subcomp;
- alarm->uid = NULL;
-
- alarm->action = NULL;
- alarm->attach = NULL;
- alarm->description.prop = NULL;
- alarm->description.altrep_param = NULL;
- alarm->duration = NULL;
- alarm->repeat = NULL;
- alarm->trigger = NULL;
- alarm->attendee_list = NULL;
-
- for (prop = icalcomponent_get_first_property (subcomp, ICAL_ANY_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (subcomp, ICAL_ANY_PROPERTY))
- scan_alarm_property (alarm, prop);
-
- g_assert (alarm->uid != NULL);
-
- return alarm;
-}
-
-/**
- * cal_component_get_alarm_uids:
- * @comp: A calendar component.
- *
- * Builds a list of the unique identifiers of the alarm subcomponents inside a
- * calendar component.
- *
- * Return value: List of unique identifiers for alarms. This should be freed
- * using cal_obj_uid_list_free().
- **/
-GList *
-cal_component_get_alarm_uids (CalComponent *comp)
-{
- CalComponentPrivate *priv;
- icalcompiter iter;
- GList *l;
-
- g_return_val_if_fail (comp != NULL, NULL);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
- l = NULL;
- for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_VALARM_COMPONENT);
- icalcompiter_deref (&iter) != NULL;
- icalcompiter_next (&iter)) {
- icalcomponent *subcomp;
- icalproperty *prop;
-
- subcomp = icalcompiter_deref (&iter);
- for (prop = icalcomponent_get_first_property (subcomp, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (subcomp, ICAL_X_PROPERTY)) {
- const char *xname;
-
- xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
-
- if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) {
- const char *auid;
-
- auid = alarm_uid_from_prop (prop);
- l = g_list_append (l, g_strdup (auid));
- }
- }
- }
-
- return l;
-}
-
-/**
- * cal_component_get_alarm:
- * @comp: A calendar component.
- * @auid: Unique identifier for the sought alarm subcomponent.
- *
- * Queries a particular alarm subcomponent of a calendar component.
- *
- * Return value: The alarm subcomponent that corresponds to the specified @auid,
- * or #NULL if no alarm exists with that UID. This should be freed using
- * cal_component_alarm_free().
- **/
-CalComponentAlarm *
-cal_component_get_alarm (CalComponent *comp, const char *auid)
-{
- CalComponentPrivate *priv;
- icalcomponent *alarm;
-
- g_return_val_if_fail (comp != NULL, NULL);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
-
- priv = comp->priv;
- g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
- g_return_val_if_fail (auid != NULL, NULL);
-
- alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid);
-
- if (alarm)
- return make_alarm (alarm);
- else
- return NULL;
-}
-
-/**
- * cal_component_alarms_free:
- * @alarms: Component alarms structure.
- *
- * Frees a #CalComponentAlarms structure.
- **/
-void
-cal_component_alarms_free (CalComponentAlarms *alarms)
-{
- GSList *l;
-
- g_return_if_fail (alarms != NULL);
-
- g_assert (alarms->comp != NULL);
- g_object_unref (G_OBJECT (alarms->comp));
-
- for (l = alarms->alarms; l; l = l->next) {
- CalAlarmInstance *instance;
-
- instance = l->data;
- g_assert (instance != NULL);
- g_free (instance);
- }
-
- g_slist_free (alarms->alarms);
- g_free (alarms);
-}
-
-/**
- * cal_component_alarm_new:
- *
- *
- *
- * Return value: a new alarm component
- **/
-CalComponentAlarm *
-cal_component_alarm_new (void)
-{
- CalComponentAlarm *alarm;
- char *new_auid ;
-
- alarm = g_new (CalComponentAlarm, 1);
-
- alarm->icalcomp = icalcomponent_new (ICAL_VALARM_COMPONENT);
-
- new_auid = cal_component_gen_uid ();
- alarm->uid = icalproperty_new_x (new_auid);
- icalproperty_set_x_name (alarm->uid, EVOLUTION_ALARM_UID_PROPERTY);
- icalcomponent_add_property (alarm->icalcomp, alarm->uid);
- g_free (new_auid);
-
- alarm->action = NULL;
- alarm->attach = NULL;
- alarm->description.prop = NULL;
- alarm->description.altrep_param = NULL;
- alarm->duration = NULL;
- alarm->repeat = NULL;
- alarm->trigger = NULL;
- alarm->attendee_list = NULL;
-
- return alarm;
-}
-
-/**
- * cal_component_alarm_clone:
- * @alarm: An alarm subcomponent.
- *
- * Creates a new alarm subcomponent by copying the information from another one.
- *
- * Return value: A newly-created alarm subcomponent with the same values as the
- * original one. Should be freed with cal_component_alarm_free().
- **/
-CalComponentAlarm *
-cal_component_alarm_clone (CalComponentAlarm *alarm)
-{
- icalcomponent *icalcomp;
-
- g_return_val_if_fail (alarm != NULL, NULL);
-
- icalcomp = icalcomponent_new_clone (alarm->icalcomp);
- return make_alarm (icalcomp);
-}
-
-/**
- * cal_component_alarm_free:
- * @alarm: A calendar alarm.
- *
- * Frees an alarm structure.
- **/
-void
-cal_component_alarm_free (CalComponentAlarm *alarm)
-{
- GSList *l;
-
- g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (icalcomponent_get_parent (alarm->icalcomp) == NULL)
- icalcomponent_free (alarm->icalcomp);
-
- alarm->icalcomp = NULL;
- alarm->uid = NULL;
- alarm->action = NULL;
- alarm->attach = NULL;
- alarm->description.prop = NULL;
- alarm->description.altrep_param = NULL;
- alarm->duration = NULL;
- alarm->repeat = NULL;
- alarm->trigger = NULL;
-
- for (l = alarm->attendee_list; l != NULL; l = l->next)
- g_free (l->data);
- g_slist_free (alarm->attendee_list);
- alarm->attendee_list = NULL;
-
- g_free (alarm);
-}
-
-/**
- * cal_component_alarm_get_uid:
- * @alarm: An alarm subcomponent.
- *
- * Queries the unique identifier of an alarm subcomponent.
- *
- * Return value: UID of the alarm.
- **/
-const char *
-cal_component_alarm_get_uid (CalComponentAlarm *alarm)
-{
- g_return_val_if_fail (alarm != NULL, NULL);
-
- return alarm_uid_from_prop (alarm->uid);
-}
-
-/**
- * cal_component_alarm_get_action:
- * @alarm: An alarm.
- * @action: Return value for the alarm's action type.
- *
- * Queries the action type of an alarm.
- **/
-void
-cal_component_alarm_get_action (CalComponentAlarm *alarm, CalAlarmAction *action)
-{
- enum icalproperty_action ipa;
-
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (action != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (!alarm->action) {
- *action = CAL_ALARM_NONE;
- return;
- }
-
- ipa = icalproperty_get_action (alarm->action);
-
- switch (ipa) {
- case ICAL_ACTION_AUDIO:
- *action = CAL_ALARM_AUDIO;
- break;
-
- case ICAL_ACTION_DISPLAY:
- *action = CAL_ALARM_DISPLAY;
- break;
-
- case ICAL_ACTION_EMAIL:
- *action = CAL_ALARM_EMAIL;
- break;
-
- case ICAL_ACTION_PROCEDURE:
- *action = CAL_ALARM_PROCEDURE;
- break;
-
- case ICAL_ACTION_NONE:
- *action = CAL_ALARM_NONE;
- break;
-
- default:
- *action = CAL_ALARM_UNKNOWN;
- }
-}
-
-/**
- * cal_component_alarm_set_action:
- * @alarm: An alarm.
- * @action: Action type.
- *
- * Sets the action type for an alarm.
- **/
-void
-cal_component_alarm_set_action (CalComponentAlarm *alarm, CalAlarmAction action)
-{
- enum icalproperty_action ipa;
-
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (action != CAL_ALARM_NONE);
- g_return_if_fail (action != CAL_ALARM_UNKNOWN);
-
- g_assert (alarm->icalcomp != NULL);
-
- switch (action) {
- case CAL_ALARM_AUDIO:
- ipa = ICAL_ACTION_AUDIO;
- break;
-
- case CAL_ALARM_DISPLAY:
- ipa = ICAL_ACTION_DISPLAY;
- break;
-
- case CAL_ALARM_EMAIL:
- ipa = ICAL_ACTION_EMAIL;
- break;
-
- case CAL_ALARM_PROCEDURE:
- ipa = ICAL_ACTION_PROCEDURE;
- break;
-
- default:
- g_assert_not_reached ();
- ipa = ICAL_ACTION_NONE;
- }
-
- if (alarm->action)
- icalproperty_set_action (alarm->action, ipa);
- else {
- alarm->action = icalproperty_new_action (ipa);
- icalcomponent_add_property (alarm->icalcomp, alarm->action);
- }
-}
-
-/**
- * cal_component_alarm_get_attach:
- * @alarm: An alarm.
- * @attach: Return value for the attachment; should be freed using icalattach_unref().
- *
- * Queries the attachment property of an alarm.
- **/
-void
-cal_component_alarm_get_attach (CalComponentAlarm *alarm, icalattach **attach)
-{
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (attach != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (alarm->attach) {
- *attach = icalproperty_get_attach (alarm->attach);
- icalattach_ref (*attach);
- } else
- *attach = NULL;
-}
-
-/**
- * cal_component_alarm_set_attach:
- * @alarm: An alarm.
- * @attach: Attachment property or NULL to remove an existing property.
- *
- * Sets the attachment property of an alarm.
- **/
-void
-cal_component_alarm_set_attach (CalComponentAlarm *alarm, icalattach *attach)
-{
- g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (alarm->attach) {
- icalcomponent_remove_property (alarm->icalcomp, alarm->attach);
- icalproperty_free (alarm->attach);
- alarm->attach = NULL;
- }
-
- if (attach) {
- alarm->attach = icalproperty_new_attach (attach);
- icalcomponent_add_property (alarm->icalcomp, alarm->attach);
- }
-}
-
-/**
- * cal_component_alarm_get_description:
- * @alarm: An alarm.
- * @description: Return value for the description property and its parameters.
- *
- * Queries the description property of an alarm.
- **/
-void
-cal_component_alarm_get_description (CalComponentAlarm *alarm, CalComponentText *description)
-{
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (description != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (alarm->description.prop)
- description->value = icalproperty_get_description (alarm->description.prop);
- else
- description->value = NULL;
-
- if (alarm->description.altrep_param)
- description->altrep = icalparameter_get_altrep (alarm->description.altrep_param);
- else
- description->altrep = NULL;
-}
-
-/**
- * cal_component_alarm_set_description:
- * @alarm: An alarm.
- * @description: Description property and its parameters, or NULL for no description.
- *
- * Sets the description property of an alarm.
- **/
-void
-cal_component_alarm_set_description (CalComponentAlarm *alarm, CalComponentText *description)
-{
- g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (alarm->description.prop) {
- icalcomponent_remove_property (alarm->icalcomp, alarm->description.prop);
- icalproperty_free (alarm->description.prop);
-
- alarm->description.prop = NULL;
- alarm->description.altrep_param = NULL;
- }
-
- if (!description)
- return;
-
- g_return_if_fail (description->value != NULL);
-
- alarm->description.prop = icalproperty_new_description (description->value);
- icalcomponent_add_property (alarm->icalcomp, alarm->description.prop);
-
- if (description->altrep) {
- alarm->description.altrep_param = icalparameter_new_altrep (
- (char *) description->altrep);
- icalproperty_add_parameter (alarm->description.prop,
- alarm->description.altrep_param);
- }
-}
-
-/**
- * cal_component_alarm_get_repeat:
- * @alarm: An alarm.
- * @repeat: Return value for the repeat/duration properties.
- *
- * Queries the repeat/duration properties of an alarm.
- **/
-void
-cal_component_alarm_get_repeat (CalComponentAlarm *alarm, CalAlarmRepeat *repeat)
-{
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (repeat != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (!(alarm->repeat && alarm->duration)) {
- repeat->repetitions = 0;
- memset (&repeat->duration, 0, sizeof (repeat->duration));
- return;
- }
-
- repeat->repetitions = icalproperty_get_repeat (alarm->repeat);
- repeat->duration = icalproperty_get_duration (alarm->duration);
-}
-
-/**
- * cal_component_alarm_set_repeat:
- * @alarm: An alarm.
- * @repeat: Repeat/duration values. To remove any repetitions from the alarm,
- * set the @repeat.repetitions to 0.
- *
- * Sets the repeat/duration values for an alarm.
- **/
-void
-cal_component_alarm_set_repeat (CalComponentAlarm *alarm, CalAlarmRepeat repeat)
-{
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (repeat.repetitions >= 0);
-
- g_assert (alarm->icalcomp != NULL);
-
- /* Delete old properties */
-
- if (alarm->repeat) {
- icalcomponent_remove_property (alarm->icalcomp, alarm->repeat);
- icalproperty_free (alarm->repeat);
- alarm->repeat = NULL;
- }
-
- if (alarm->duration) {
- icalcomponent_remove_property (alarm->icalcomp, alarm->duration);
- icalproperty_free (alarm->duration);
- alarm->duration = NULL;
- }
-
- /* Set the new properties */
-
- if (repeat.repetitions == 0)
- return; /* For zero extra repetitions the properties should not exist */
-
- alarm->repeat = icalproperty_new_repeat (repeat.repetitions);
- icalcomponent_add_property (alarm->icalcomp, alarm->repeat);
-
- alarm->duration = icalproperty_new_duration (repeat.duration);
- icalcomponent_add_property (alarm->icalcomp, alarm->duration);
-}
-
-/**
- * cal_component_alarm_get_trigger:
- * @alarm: An alarm.
- * @trigger: Return value for the trigger time.
- *
- * Queries the trigger time for an alarm.
- **/
-void
-cal_component_alarm_get_trigger (CalComponentAlarm *alarm, CalAlarmTrigger *trigger)
-{
- icalparameter *param;
- struct icaltriggertype t;
- gboolean relative;
-
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (trigger != NULL);
-
- g_assert (alarm->icalcomp != NULL);
-
- if (!alarm->trigger) {
- trigger->type = CAL_ALARM_TRIGGER_NONE;
- return;
- }
-
- /* Get trigger type */
-
- param = icalproperty_get_first_parameter (alarm->trigger, ICAL_VALUE_PARAMETER);
- if (param) {
- icalparameter_value value;
-
- value = icalparameter_get_value (param);
-
- switch (value) {
- case ICAL_VALUE_DURATION:
- relative = TRUE;
- break;
-
- case ICAL_VALUE_DATETIME:
- relative = FALSE;
- break;
-
- default:
- g_message ("cal_component_alarm_get_trigger(): Unknown value for trigger "
- "value %d; using RELATIVE", value);
-
- relative = TRUE;
- break;
- }
- } else
- relative = TRUE;
-
- /* Get trigger value and the RELATED parameter */
-
- t = icalproperty_get_trigger (alarm->trigger);
-
- if (relative) {
- trigger->u.rel_duration = t.duration;
-
- param = icalproperty_get_first_parameter (alarm->trigger, ICAL_RELATED_PARAMETER);
- if (param) {
- icalparameter_related rel;
-
- rel = icalparameter_get_related (param);
-
- switch (rel) {
- case ICAL_RELATED_START:
- trigger->type = CAL_ALARM_TRIGGER_RELATIVE_START;
- break;
-
- case ICAL_RELATED_END:
- trigger->type = CAL_ALARM_TRIGGER_RELATIVE_END;
- break;
-
- default:
- g_assert_not_reached ();
- }
- } else
- trigger->type = CAL_ALARM_TRIGGER_RELATIVE_START;
- } else {
- trigger->u.abs_time = t.time;
- trigger->type = CAL_ALARM_TRIGGER_ABSOLUTE;
- }
-}
-
-/**
- * cal_component_alarm_set_trigger:
- * @alarm: An alarm.
- * @trigger: Trigger time structure.
- *
- * Sets the trigger time of an alarm.
- **/
-void
-cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigger)
-{
- struct icaltriggertype t;
- icalparameter *param;
- icalparameter_value value_type;
- icalparameter_related related;
-
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (trigger.type != CAL_ALARM_TRIGGER_NONE);
-
- g_assert (alarm->icalcomp != NULL);
-
- /* Delete old trigger */
-
- if (alarm->trigger) {
- icalcomponent_remove_property (alarm->icalcomp, alarm->trigger);
- icalproperty_free (alarm->trigger);
- alarm->trigger = NULL;
- }
-
- /* Set the value */
-
- related = ICAL_RELATED_START; /* Keep GCC happy */
-
- t.time = icaltime_null_time ();
- t.duration = icaldurationtype_null_duration ();
- switch (trigger.type) {
- case CAL_ALARM_TRIGGER_RELATIVE_START:
- t.duration = trigger.u.rel_duration;
- value_type = ICAL_VALUE_DURATION;
- related = ICAL_RELATED_START;
- break;
-
- case CAL_ALARM_TRIGGER_RELATIVE_END:
- t.duration = trigger.u.rel_duration;
- value_type = ICAL_VALUE_DURATION;
- related = ICAL_RELATED_END;
- break;
-
- case CAL_ALARM_TRIGGER_ABSOLUTE:
- t.time = trigger.u.abs_time;
- value_type = ICAL_VALUE_DATETIME;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- alarm->trigger = icalproperty_new_trigger (t);
- icalcomponent_add_property (alarm->icalcomp, alarm->trigger);
-
- /* Value parameters */
-
- param = icalproperty_get_first_parameter (alarm->trigger, ICAL_VALUE_PARAMETER);
- if (param)
- icalparameter_set_value (param, value_type);
- else {
- param = icalparameter_new_value (value_type);
- icalproperty_add_parameter (alarm->trigger, param);
- }
-
- /* Related parameter */
-
- if (trigger.type != CAL_ALARM_TRIGGER_ABSOLUTE) {
- param = icalproperty_get_first_parameter (alarm->trigger, ICAL_RELATED_PARAMETER);
-
- if (param)
- icalparameter_set_related (param, related);
- else {
- param = icalparameter_new_related (related);
- icalproperty_add_parameter (alarm->trigger, param);
- }
- }
-}
-
-void
-cal_component_alarm_get_attendee_list (CalComponentAlarm *alarm, GSList **attendee_list)
-{
- g_return_if_fail (alarm != NULL);
-
- get_attendee_list (alarm->attendee_list, attendee_list);
-}
-
-void
-cal_component_alarm_set_attendee_list (CalComponentAlarm *alarm, GSList *attendee_list)
-{
- g_return_if_fail (alarm != NULL);
-
- set_attendee_list (alarm->icalcomp, &alarm->attendee_list, attendee_list);
-}
-
-gboolean
-cal_component_alarm_has_attendees (CalComponentAlarm *alarm)
-{
-
- g_return_val_if_fail (alarm != NULL, FALSE);
-
- if (g_slist_length (alarm->attendee_list) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-/**
- * cal_component_alarm_get_icalcomponent
- * @alarm: An alarm.
- *
- * Get the icalcomponent associated with the given #CalComponentAlarm.
- *
- * Returns: the icalcomponent.
- */
-icalcomponent *
-cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm)
-{
- g_return_val_if_fail (alarm != NULL, NULL);
- return alarm->icalcomp;
-}
-
-/* Returns TRUE if both strings match, i.e. they are both NULL or the
- strings are equal. */
-static gboolean
-cal_component_strings_match (const gchar *string1,
- const gchar *string2)
-{
- if (string1 == NULL || string2 == NULL)
- return (string1 == string2) ? TRUE : FALSE;
-
- if (!strcmp (string1, string2))
- return TRUE;
-
- return FALSE;
-}
-
-
-/**
- * cal_component_event_dates_match:
- * @comp1: A calendar component object.
- * @comp2: A calendar component object.
- *
- * Checks if the DTSTART and DTEND properties of the 2 components match.
- * Note that the events may have different recurrence properties which are not
- * taken into account here.
- *
- * Returns: TRUE if the DTSTART and DTEND properties of the 2 components match.
- **/
-gboolean
-cal_component_event_dates_match (CalComponent *comp1,
- CalComponent *comp2)
-{
- CalComponentDateTime comp1_dtstart, comp1_dtend;
- CalComponentDateTime comp2_dtstart, comp2_dtend;
- gboolean retval = TRUE;
-
- cal_component_get_dtstart (comp1, &comp1_dtstart);
- cal_component_get_dtend (comp1, &comp1_dtend);
- cal_component_get_dtstart (comp2, &comp2_dtstart);
- cal_component_get_dtend (comp2, &comp2_dtend);
-
- /* If either value is NULL they must both be NULL to match. */
- if (comp1_dtstart.value == NULL || comp2_dtstart.value == NULL) {
- if (comp1_dtstart.value != comp2_dtstart.value) {
- retval = FALSE;
- goto out;
- }
- } else {
- if (icaltime_compare (*comp1_dtstart.value,
- *comp2_dtstart.value)) {
- retval = FALSE;
- goto out;
- }
- }
-
- if (comp1_dtend.value == NULL || comp2_dtend.value == NULL) {
- if (comp1_dtend.value != comp2_dtend.value) {
- retval = FALSE;
- goto out;
- }
- } else {
- if (icaltime_compare (*comp1_dtend.value,
- *comp2_dtend.value)) {
- retval = FALSE;
- goto out;
- }
- }
-
- /* Now check the timezones. */
- if (!cal_component_strings_match (comp1_dtstart.tzid,
- comp2_dtstart.tzid)) {
- retval = FALSE;
- goto out;
- }
-
- if (!cal_component_strings_match (comp1_dtend.tzid,
- comp2_dtend.tzid)) {
- retval = FALSE;
- }
-
- out:
-
- cal_component_free_datetime (&comp1_dtstart);
- cal_component_free_datetime (&comp1_dtend);
- cal_component_free_datetime (&comp2_dtstart);
- cal_component_free_datetime (&comp2_dtend);
-
- return retval;
-}
-
-
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
deleted file mode 100644
index 3296c7b31c..0000000000
--- a/calendar/cal-util/cal-component.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/* Evolution calendar - iCalendar component object
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_COMPONENT_H
-#define CAL_COMPONENT_H
-
-#include <glib/gmacros.h>
-#include <time.h>
-#include <glib-object.h>
-#include <libical/ical.h>
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_COMPONENT_TYPE (cal_component_get_type ())
-#define CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_COMPONENT_TYPE, CalComponent))
-#define CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_COMPONENT_TYPE, \
- CalComponentClass))
-#define IS_CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_COMPONENT_TYPE))
-#define IS_CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_COMPONENT_TYPE))
-
-/* Types of calendar components to be stored by a CalComponent, as per RFC 2445.
- * We don't put the alarm component type here since we store alarms as separate
- * structures inside the other "real" components.
- */
-typedef enum {
- CAL_COMPONENT_NO_TYPE,
- CAL_COMPONENT_EVENT,
- CAL_COMPONENT_TODO,
- CAL_COMPONENT_JOURNAL,
- CAL_COMPONENT_FREEBUSY,
- CAL_COMPONENT_TIMEZONE
-} CalComponentVType;
-
-/* Field identifiers for a calendar component; these are used by the data model
- * for ETable.
- *
- * NOTE: These are also used in the ETable specification, and the column
- * numbers are saved in the user settings file. So don't reorder them!
- */
-typedef enum {
- CAL_COMPONENT_FIELD_CATEGORIES, /* concatenation of the categories list */
- CAL_COMPONENT_FIELD_CLASSIFICATION,
- CAL_COMPONENT_FIELD_COMPLETED,
- CAL_COMPONENT_FIELD_DTEND,
- CAL_COMPONENT_FIELD_DTSTART,
- CAL_COMPONENT_FIELD_DUE,
- CAL_COMPONENT_FIELD_GEO,
- CAL_COMPONENT_FIELD_PERCENT,
- CAL_COMPONENT_FIELD_PRIORITY,
- CAL_COMPONENT_FIELD_SUMMARY,
- CAL_COMPONENT_FIELD_TRANSPARENCY,
- CAL_COMPONENT_FIELD_URL,
- CAL_COMPONENT_FIELD_HAS_ALARMS, /* not a real field */
- CAL_COMPONENT_FIELD_ICON, /* not a real field */
- CAL_COMPONENT_FIELD_COMPLETE, /* not a real field */
- CAL_COMPONENT_FIELD_RECURRING, /* not a real field */
- CAL_COMPONENT_FIELD_OVERDUE, /* not a real field */
- CAL_COMPONENT_FIELD_COLOR, /* not a real field */
- CAL_COMPONENT_FIELD_STATUS,
- CAL_COMPONENT_FIELD_COMPONENT, /* not a real field */
-#if 0
- CAL_COMPONENT_FIELD_LOCATION,
-#endif
- CAL_COMPONENT_FIELD_NUM_FIELDS
-} CalComponentField;
-
-/* Structures and enumerations to return properties and their parameters */
-
-/* CLASSIFICATION property */
-typedef enum {
- CAL_COMPONENT_CLASS_NONE,
- CAL_COMPONENT_CLASS_PUBLIC,
- CAL_COMPONENT_CLASS_PRIVATE,
- CAL_COMPONENT_CLASS_CONFIDENTIAL,
- CAL_COMPONENT_CLASS_UNKNOWN
-} CalComponentClassification;
-
-/* Properties that have time and timezone information */
-typedef struct {
- /* Actual date/time value */
- struct icaltimetype *value;
-
- /* Timezone ID */
- const char *tzid;
-} CalComponentDateTime;
-
-/* Way in which a period of time is specified */
-typedef enum {
- CAL_COMPONENT_PERIOD_DATETIME,
- CAL_COMPONENT_PERIOD_DURATION
-} CalComponentPeriodType;
-
-/* Period of time, can have explicit start/end times or start/duration instead */
-typedef struct {
- CalComponentPeriodType type;
-
- struct icaltimetype start;
-
- union {
- struct icaltimetype end;
- struct icaldurationtype duration;
- } u;
-} CalComponentPeriod;
-
-/* The type of range */
-typedef enum {
- CAL_COMPONENT_RANGE_SINGLE,
- CAL_COMPONENT_RANGE_THISPRIOR,
- CAL_COMPONENT_RANGE_THISFUTURE,
-} CalComponentRangeType;
-
-typedef struct {
- CalComponentRangeType type;
-
- CalComponentDateTime datetime;
-} CalComponentRange;
-
-/* Text properties */
-typedef struct {
- /* Description string */
- const char *value;
-
- /* Alternate representation URI */
- const char *altrep;
-} CalComponentText;
-
-/* Time transparency */
-typedef enum {
- CAL_COMPONENT_TRANSP_NONE,
- CAL_COMPONENT_TRANSP_TRANSPARENT,
- CAL_COMPONENT_TRANSP_OPAQUE,
- CAL_COMPONENT_TRANSP_UNKNOWN
-} CalComponentTransparency;
-
-/* Organizer & Attendee */
-typedef struct {
- const char *value;
-
- const char *member;
- icalparameter_cutype cutype;
- icalparameter_role role;
- icalparameter_partstat status;
- gboolean rsvp;
-
- const char *delto;
- const char *delfrom;
- const char *sentby;
- const char *cn;
- const char *language;
-} CalComponentAttendee;
-
-typedef struct {
- const char *value;
- const char *sentby;
- const char *cn;
- const char *language;
-} CalComponentOrganizer;
-
-/* Main calendar component object */
-
-typedef struct _CalComponent CalComponent;
-typedef struct _CalComponentClass CalComponentClass;
-
-typedef struct _CalComponentPrivate CalComponentPrivate;
-
-struct _CalComponent {
- GObject object;
-
- /* Private data */
- CalComponentPrivate *priv;
-};
-
-struct _CalComponentClass {
- GObjectClass parent_class;
-};
-
-/* Calendar component */
-
-GType cal_component_get_type (void);
-
-char *cal_component_gen_uid (void);
-
-CalComponent *cal_component_new (void);
-
-CalComponent *cal_component_clone (CalComponent *comp);
-
-void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type);
-
-gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp);
-icalcomponent *cal_component_get_icalcomponent (CalComponent *comp);
-void cal_component_rescan (CalComponent *comp);
-void cal_component_strip_errors (CalComponent *comp);
-
-CalComponentVType cal_component_get_vtype (CalComponent *comp);
-
-char *cal_component_get_as_string (CalComponent *comp);
-
-void cal_component_commit_sequence (CalComponent *comp);
-void cal_component_abort_sequence (CalComponent *comp);
-
-void cal_component_get_uid (CalComponent *comp, const char **uid);
-void cal_component_set_uid (CalComponent *comp, const char *uid);
-
-void cal_component_get_categories (CalComponent *comp, const char **categories);
-void cal_component_set_categories (CalComponent *comp, const char *categories);
-void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list);
-void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list);
-
-void cal_component_get_classification (CalComponent *comp, CalComponentClassification *classif);
-void cal_component_set_classification (CalComponent *comp, CalComponentClassification classif);
-
-void cal_component_get_comment_list (CalComponent *comp, GSList **text_list);
-void cal_component_set_comment_list (CalComponent *comp, GSList *text_list);
-
-void cal_component_get_completed (CalComponent *comp, struct icaltimetype **t);
-void cal_component_set_completed (CalComponent *comp, struct icaltimetype *t);
-
-void cal_component_get_contact_list (CalComponent *comp, GSList **text_list);
-void cal_component_set_contact_list (CalComponent *comp, GSList *text_list);
-
-void cal_component_get_created (CalComponent *comp, struct icaltimetype **t);
-void cal_component_set_created (CalComponent *comp, struct icaltimetype *t);
-
-void cal_component_get_description_list (CalComponent *comp, GSList **text_list);
-void cal_component_set_description_list (CalComponent *comp, GSList *text_list);
-
-void cal_component_get_dtend (CalComponent *comp, CalComponentDateTime *dt);
-void cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt);
-
-void cal_component_get_dtstamp (CalComponent *comp, struct icaltimetype *t);
-void cal_component_set_dtstamp (CalComponent *comp, struct icaltimetype *t);
-
-void cal_component_get_dtstart (CalComponent *comp, CalComponentDateTime *dt);
-void cal_component_set_dtstart (CalComponent *comp, CalComponentDateTime *dt);
-
-void cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt);
-void cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt);
-
-void cal_component_get_exdate_list (CalComponent *comp, GSList **exdate_list);
-void cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list);
-gboolean cal_component_has_exdates (CalComponent *comp);
-
-void cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list);
-void cal_component_get_exrule_property_list (CalComponent *comp, GSList **recur_list);
-void cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list);
-gboolean cal_component_has_exrules (CalComponent *comp);
-
-gboolean cal_component_has_exceptions (CalComponent *comp);
-
-void cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo);
-void cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo);
-
-void cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t);
-void cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t);
-
-void cal_component_get_organizer (CalComponent *comp, CalComponentOrganizer *organizer);
-void cal_component_set_organizer (CalComponent *comp, CalComponentOrganizer *organizer);
-gboolean cal_component_has_organizer (CalComponent *comp);
-
-void cal_component_get_percent (CalComponent *comp, int **percent);
-void cal_component_set_percent (CalComponent *comp, int *percent);
-
-void cal_component_get_priority (CalComponent *comp, int **priority);
-void cal_component_set_priority (CalComponent *comp, int *priority);
-
-void cal_component_get_recurid (CalComponent *comp, CalComponentRange *recur_id);
-void cal_component_set_recurid (CalComponent *comp, CalComponentRange *recur_id);
-
-void cal_component_get_rdate_list (CalComponent *comp, GSList **period_list);
-void cal_component_set_rdate_list (CalComponent *comp, GSList *period_list);
-gboolean cal_component_has_rdates (CalComponent *comp);
-
-void cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list);
-void cal_component_get_rrule_property_list (CalComponent *comp, GSList **recur_list);
-void cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list);
-gboolean cal_component_has_rrules (CalComponent *comp);
-
-gboolean cal_component_has_recurrences (CalComponent *comp);
-gboolean cal_component_has_simple_recurrence (CalComponent *comp);
-gboolean cal_component_is_instance (CalComponent *comp);
-
-void cal_component_get_sequence (CalComponent *comp, int **sequence);
-void cal_component_set_sequence (CalComponent *comp, int *sequence);
-
-void cal_component_get_status (CalComponent *comp, icalproperty_status *status);
-void cal_component_set_status (CalComponent *comp, icalproperty_status status);
-
-void cal_component_get_summary (CalComponent *comp, CalComponentText *summary);
-void cal_component_set_summary (CalComponent *comp, CalComponentText *summary);
-
-void cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp);
-void cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp);
-
-void cal_component_get_url (CalComponent *comp, const char **url);
-void cal_component_set_url (CalComponent *comp, const char *url);
-
-void cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list);
-void cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list);
-gboolean cal_component_has_attendees (CalComponent *comp);
-
-void cal_component_get_location (CalComponent *comp, const char **location);
-void cal_component_set_location (CalComponent *comp, const char *location);
-
-gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2);
-
-
-/* Functions to free returned values */
-
-void cal_component_free_categories_list (GSList *categ_list);
-void cal_component_free_datetime (CalComponentDateTime *dt);
-void cal_component_free_range (CalComponentRange *range);
-void cal_component_free_exdate_list (GSList *exdate_list);
-void cal_component_free_geo (struct icalgeotype *geo);
-void cal_component_free_icaltimetype (struct icaltimetype *t);
-void cal_component_free_percent (int *percent);
-void cal_component_free_priority (int *priority);
-void cal_component_free_period_list (GSList *period_list);
-void cal_component_free_recur_list (GSList *recur_list);
-void cal_component_free_sequence (int *sequence);
-void cal_component_free_text_list (GSList *text_list);
-void cal_component_free_attendee_list (GSList *attendee_list);
-
-/* Alarms */
-
-/* Opaque structure used to represent alarm subcomponents */
-typedef struct _CalComponentAlarm CalComponentAlarm;
-
-/* An alarm occurrence, i.e. a trigger instance */
-typedef struct {
- /* UID of the alarm that triggered */
- const char *auid;
-
- /* Trigger time, i.e. "5 minutes before the appointment" */
- time_t trigger;
-
- /* Actual event occurrence to which this trigger corresponds */
- time_t occur_start;
- time_t occur_end;
-} CalAlarmInstance;
-
-/* Alarm trigger instances for a particular component */
-typedef struct {
- /* The actual component */
- CalComponent *comp;
-
- /* List of CalAlarmInstance structures */
- GSList *alarms;
-} CalComponentAlarms;
-
-/* Alarm types */
-typedef enum {
- CAL_ALARM_NONE,
- CAL_ALARM_AUDIO,
- CAL_ALARM_DISPLAY,
- CAL_ALARM_EMAIL,
- CAL_ALARM_PROCEDURE,
- CAL_ALARM_UNKNOWN
-} CalAlarmAction;
-
-/* Whether a trigger is relative to the start or end of an event occurrence, or
- * whether it is specified to occur at an absolute time.
- */
-typedef enum {
- CAL_ALARM_TRIGGER_NONE,
- CAL_ALARM_TRIGGER_RELATIVE_START,
- CAL_ALARM_TRIGGER_RELATIVE_END,
- CAL_ALARM_TRIGGER_ABSOLUTE
-} CalAlarmTriggerType;
-
-typedef struct {
- CalAlarmTriggerType type;
-
- union {
- struct icaldurationtype rel_duration;
- struct icaltimetype abs_time;
- } u;
-} CalAlarmTrigger;
-
-typedef struct {
- /* Number of extra repetitions, zero for none */
- int repetitions;
-
- /* Interval between repetitions */
- struct icaldurationtype duration;
-} CalAlarmRepeat;
-
-gboolean cal_component_has_alarms (CalComponent *comp);
-void cal_component_add_alarm (CalComponent *comp, CalComponentAlarm *alarm);
-void cal_component_remove_alarm (CalComponent *comp, const char *auid);
-void cal_component_remove_all_alarms (CalComponent *comp);
-
-GList *cal_component_get_alarm_uids (CalComponent *comp);
-CalComponentAlarm *cal_component_get_alarm (CalComponent *comp, const char *auid);
-
-void cal_component_alarms_free (CalComponentAlarms *alarms);
-
-/* CalComponentAlarms */
-CalComponentAlarm *cal_component_alarm_new (void);
-CalComponentAlarm *cal_component_alarm_clone (CalComponentAlarm *alarm);
-void cal_component_alarm_free (CalComponentAlarm *alarm);
-
-const char *cal_component_alarm_get_uid (CalComponentAlarm *alarm);
-
-void cal_component_alarm_get_action (CalComponentAlarm *alarm, CalAlarmAction *action);
-void cal_component_alarm_set_action (CalComponentAlarm *alarm, CalAlarmAction action);
-
-void cal_component_alarm_get_attach (CalComponentAlarm *alarm, icalattach **attach);
-void cal_component_alarm_set_attach (CalComponentAlarm *alarm, icalattach *attach);
-
-void cal_component_alarm_get_description (CalComponentAlarm *alarm, CalComponentText *description);
-void cal_component_alarm_set_description (CalComponentAlarm *alarm, CalComponentText *description);
-
-void cal_component_alarm_get_repeat (CalComponentAlarm *alarm, CalAlarmRepeat *repeat);
-void cal_component_alarm_set_repeat (CalComponentAlarm *alarm, CalAlarmRepeat repeat);
-
-void cal_component_alarm_get_trigger (CalComponentAlarm *alarm, CalAlarmTrigger *trigger);
-void cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigger);
-
-void cal_component_alarm_get_attendee_list (CalComponentAlarm *alarm, GSList **attendee_list);
-void cal_component_alarm_set_attendee_list (CalComponentAlarm *alarm, GSList *attendee_list);
-gboolean cal_component_alarm_has_attendees (CalComponentAlarm *alarm);
-
-icalcomponent *cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c
deleted file mode 100644
index 6decd3eae2..0000000000
--- a/calendar/cal-util/cal-recur.c
+++ /dev/null
@@ -1,4021 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Evolution calendar recurrence rule functions
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Damon Chaplin <damon@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <libgnome/gnome-i18n.h>
-#include <cal-util/cal-recur.h>
-#include <cal-util/timeutil.h>
-
-
-/*
- * Introduction to The Recurrence Generation Functions:
- *
- * Note: This is pretty complicated. See the iCalendar spec (RFC 2445) for
- * the specification of the recurrence rules and lots of examples
- * (sections 4.3.10 & 4.8.5). We also want to support the older
- * vCalendar spec, though this should be easy since it is basically a
- * subset of iCalendar.
- *
- * o An iCalendar event can have any number of recurrence rules specifying
- * occurrences of the event, as well as dates & times of specific
- * occurrences. It can also have any number of recurrence rules and
- * specific dates & times specifying exceptions to the occurrences.
- * So we first merge all the occurrences generated, eliminating any
- * duplicates, then we generate all the exceptions and remove these to
- * form the final set of occurrences.
- *
- * o There are 7 frequencies of occurrences: YEARLY, MONTHLY, WEEKLY, DAILY,
- * HOURLY, MINUTELY & SECONDLY. The 'interval' property specifies the
- * multiples of the frequency which we step by. We generate a 'set' of
- * occurrences for each period defined by the frequency & interval.
- * So for a YEARLY frequency with an interval of 3, we generate a set of
- * occurrences for every 3rd year. We use complete years here - any
- * generated occurrences that occur before the event's start (or after its
- * end) are just discarded.
- *
- * o There are 8 frequency modifiers: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY,
- * BYDAY, BYHOUR, BYMINUTE & BYSECOND. These can either add extra occurrences
- * or filter out occurrences. For example 'FREQ=YEARLY;BYMONTH=1,2' produces
- * 2 occurrences for each year rather than the default 1. And
- * 'FREQ=DAILY;BYMONTH=1' filters out all occurrences except those in Jan.
- * If the modifier works on periods which are less than the recurrence
- * frequency, then extra occurrences are added, otherwise occurrences are
- * filtered. So we have 2 functions for each modifier - one to expand events
- * and the other to filter. We use a table of functions for each frequency
- * which points to the appropriate function to use for each modifier.
- *
- * o Any number of frequency modifiers can be used in a recurrence rule.
- * (Though the iCalendar spec says that BYWEEKNO can only be used in a YEARLY
- * rule, and some modifiers aren't appropriate for some frequencies - e.g.
- * BYMONTHDAY is not really useful in a WEEKLY frequency, and BYYEARDAY is
- * not useful in a MONTHLY or WEEKLY frequency).
- * The frequency modifiers are applied in the order given above. The first 5
- * modifier rules (BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY & BYDAY) all
- * produce the days on which the occurrences take place, and so we have to
- * compute some of these in parallel rather than sequentially, or we may end
- * up with too many days.
- *
- * o Note that some expansion functions may produce days which are invalid,
- * e.g. 31st September, 30th Feb. These invalid days are removed before the
- * BYHOUR, BYMINUTE & BYSECOND modifier functions are applied.
- *
- * o After the set of occurrences for the frequency interval are generated,
- * the BYSETPOS property is used to select which of the occurrences are
- * finally output. If BYSETPOS is not specified then all the occurrences are
- * output.
- *
- *
- * FIXME: I think there are a few errors in this code:
- *
- * 1) I'm not sure it should be generating events in parallel like it says
- * above. That needs to be checked.
- *
- * 2) I didn't think about timezone changes when implementing this. I just
- * assumed all the occurrences of the event would be in local time.
- * But when clocks go back or forwards due to daylight-saving time, some
- * special handling may be needed, especially for the shorter frequencies.
- * e.g. for a MINUTELY frequency it should probably iterate over all the
- * minutes before and after clocks go back (i.e. some may be the same local
- * time but have different UTC offsets). For longer frequencies, if an
- * occurrence lands on the overlapping or non-existant time when clocks
- * go back/forward, then it may need to choose which of the times to use
- * or move the time forward or something. I'm not sure this is clear in the
- * spec.
- */
-
-/* This is the maximum year we will go up to (inclusive). Since we use time_t
- values we can't go past 2037 anyway, and some of our VTIMEZONEs may stop
- at 2037 as well. */
-#define MAX_YEAR 2037
-
-/* Define this for some debugging output. */
-#if 0
-#define CAL_OBJ_DEBUG 1
-#endif
-
-/* We will use icalrecurrencetype instead of this eventually. */
-typedef struct {
- icalrecurrencetype_frequency freq;
-
- int interval;
-
- /* Specifies the end of the recurrence, inclusive. No occurrences are
- generated after this date. If it is 0, the event recurs forever. */
- time_t enddate;
-
- /* WKST property - the week start day: 0 = Monday to 6 = Sunday. */
- gint week_start_day;
-
-
- /* NOTE: I've used GList's here, but it doesn't matter if we use
- other data structures like arrays. The code should be easy to
- change. So long as it is easy to see if the modifier is set. */
-
- /* For BYMONTH modifier. A list of GINT_TO_POINTERs, 0-11. */
- GList *bymonth;
-
- /* For BYWEEKNO modifier. A list of GINT_TO_POINTERs, [+-]1-53. */
- GList *byweekno;
-
- /* For BYYEARDAY modifier. A list of GINT_TO_POINTERs, [+-]1-366. */
- GList *byyearday;
-
- /* For BYMONTHDAY modifier. A list of GINT_TO_POINTERs, [+-]1-31. */
- GList *bymonthday;
-
- /* For BYDAY modifier. A list of GINT_TO_POINTERs, in pairs.
- The first of each pair is the weekday, 0 = Monday to 6 = Sunday.
- The second of each pair is the week number [+-]0-53. */
- GList *byday;
-
- /* For BYHOUR modifier. A list of GINT_TO_POINTERs, 0-23. */
- GList *byhour;
-
- /* For BYMINUTE modifier. A list of GINT_TO_POINTERs, 0-59. */
- GList *byminute;
-
- /* For BYSECOND modifier. A list of GINT_TO_POINTERs, 0-60. */
- GList *bysecond;
-
- /* For BYSETPOS modifier. A list of GINT_TO_POINTERs, +ve or -ve. */
- GList *bysetpos;
-} CalRecurrence;
-
-/* This is what we use to pass to all the filter functions. */
-typedef struct _RecurData RecurData;
-struct _RecurData {
- CalRecurrence *recur;
-
- /* This is used for the WEEKLY frequency. It is the offset from the
- week_start_day. */
- gint weekday_offset;
-
- /* This is used for fast lookup in BYMONTH filtering. */
- guint8 months[12];
-
- /* This is used for fast lookup in BYYEARDAY filtering. */
- guint8 yeardays[367], neg_yeardays[367]; /* Days are 1 - 366. */
-
- /* This is used for fast lookup in BYMONTHDAY filtering. */
- guint8 monthdays[32], neg_monthdays[32]; /* Days are 1 to 31. */
-
- /* This is used for fast lookup in BYDAY filtering. */
- guint8 weekdays[7];
-
- /* This is used for fast lookup in BYHOUR filtering. */
- guint8 hours[24];
-
- /* This is used for fast lookup in BYMINUTE filtering. */
- guint8 minutes[60];
-
- /* This is used for fast lookup in BYSECOND filtering. */
- guint8 seconds[62];
-};
-
-/* This is what we use to represent a date & time. */
-typedef struct _CalObjTime CalObjTime;
-struct _CalObjTime {
- guint16 year;
- guint8 month; /* 0 - 11 */
- guint8 day; /* 1 - 31 */
- guint8 hour; /* 0 - 23 */
- guint8 minute; /* 0 - 59 */
- guint8 second; /* 0 - 59 (maybe up to 61 for leap seconds) */
- guint8 flags; /* The meaning of this depends on where the
- CalObjTime is used. In most cases this is
- set to TRUE to indicate that this is an
- RDATE with an end or a duration set.
- In the exceptions code, this is set to TRUE
- to indicate that this is an EXDATE with a
- DATE value. */
-};
-
-/* This is what we use to represent specific recurrence dates.
- Note that we assume it starts with a CalObjTime when sorting. */
-typedef struct _CalObjRecurrenceDate CalObjRecurrenceDate;
-struct _CalObjRecurrenceDate {
- CalObjTime start;
- CalComponentPeriod *period;
-};
-
-/* The paramter we use to store the enddate in RRULE and EXRULE properties. */
-#define EVOLUTION_END_DATE_PARAMETER "X-EVOLUTION-ENDDATE"
-
-typedef gboolean (*CalObjFindStartFn) (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-typedef gboolean (*CalObjFindNextFn) (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-typedef GArray* (*CalObjFilterFn) (RecurData *recur_data,
- GArray *occs);
-
-typedef struct _CalRecurVTable CalRecurVTable;
-struct _CalRecurVTable {
- CalObjFindStartFn find_start_position;
- CalObjFindNextFn find_next_position;
-
- CalObjFilterFn bymonth_filter;
- CalObjFilterFn byweekno_filter;
- CalObjFilterFn byyearday_filter;
- CalObjFilterFn bymonthday_filter;
- CalObjFilterFn byday_filter;
- CalObjFilterFn byhour_filter;
- CalObjFilterFn byminute_filter;
- CalObjFilterFn bysecond_filter;
-};
-
-
-/* This is used to specify which parts of the CalObjTime to compare in
- cal_obj_time_compare(). */
-typedef enum {
- CALOBJ_YEAR,
- CALOBJ_MONTH,
- CALOBJ_DAY,
- CALOBJ_HOUR,
- CALOBJ_MINUTE,
- CALOBJ_SECOND
-} CalObjTimeComparison;
-
-static void cal_recur_generate_instances_of_rule (CalComponent *comp,
- icalproperty *prop,
- time_t start,
- time_t end,
- CalRecurInstanceFn cb,
- gpointer cb_data,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data,
- icaltimezone *default_timezone);
-
-static CalRecurrence * cal_recur_from_icalproperty (icalproperty *prop,
- gboolean exception,
- icaltimezone *zone,
- gboolean convert_end_date);
-static gint cal_recur_ical_weekday_to_weekday (enum icalrecurrencetype_weekday day);
-static void cal_recur_free (CalRecurrence *r);
-
-
-static gboolean cal_object_get_rdate_end (CalObjTime *occ,
- GArray *rdate_periods);
-static void cal_object_compute_duration (CalObjTime *start,
- CalObjTime *end,
- gint *days,
- gint *seconds);
-
-static gboolean generate_instances_for_chunk (CalComponent *comp,
- time_t comp_dtstart,
- icaltimezone *zone,
- GSList *rrules,
- GSList *rdates,
- GSList *exrules,
- GSList *exdates,
- gboolean single_rule,
- CalObjTime *event_start,
- time_t interval_start,
- CalObjTime *chunk_start,
- CalObjTime *chunk_end,
- gint duration_days,
- gint duration_seconds,
- gboolean convert_end_date,
- CalRecurInstanceFn cb,
- gpointer cb_data);
-
-static GArray* cal_obj_expand_recurrence (CalObjTime *event_start,
- icaltimezone *zone,
- CalRecurrence *recur,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- gboolean *finished);
-
-static GArray* cal_obj_generate_set_yearly (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ);
-static GArray* cal_obj_generate_set_monthly (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ);
-static GArray* cal_obj_generate_set_default (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ);
-
-
-static CalRecurVTable* cal_obj_get_vtable (icalrecurrencetype_frequency recur_type);
-static void cal_obj_initialize_recur_data (RecurData *recur_data,
- CalRecurrence *recur,
- CalObjTime *event_start);
-static void cal_obj_sort_occurrences (GArray *occs);
-static gint cal_obj_time_compare_func (const void *arg1,
- const void *arg2);
-static void cal_obj_remove_duplicates_and_invalid_dates (GArray *occs);
-static void cal_obj_remove_exceptions (GArray *occs,
- GArray *ex_occs);
-static GArray* cal_obj_bysetpos_filter (CalRecurrence *recur,
- GArray *occs);
-
-
-static gboolean cal_obj_yearly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_yearly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_monthly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_monthly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_weekly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_weekly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_daily_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_daily_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_hourly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_hourly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_minutely_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_minutely_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static gboolean cal_obj_secondly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime);
-static gboolean cal_obj_secondly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end);
-
-static GArray* cal_obj_bymonth_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_bymonth_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byweekno_expand (RecurData *recur_data,
- GArray *occs);
-#if 0
-/* This isn't used at present. */
-static GArray* cal_obj_byweekno_filter (RecurData *recur_data,
- GArray *occs);
-#endif
-static GArray* cal_obj_byyearday_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byyearday_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_bymonthday_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_bymonthday_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byday_expand_yearly (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byday_expand_monthly (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byday_expand_weekly (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byday_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byhour_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byhour_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byminute_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_byminute_filter (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_bysecond_expand (RecurData *recur_data,
- GArray *occs);
-static GArray* cal_obj_bysecond_filter (RecurData *recur_data,
- GArray *occs);
-
-static void cal_obj_time_add_months (CalObjTime *cotime,
- gint months);
-static void cal_obj_time_add_days (CalObjTime *cotime,
- gint days);
-static void cal_obj_time_add_hours (CalObjTime *cotime,
- gint hours);
-static void cal_obj_time_add_minutes (CalObjTime *cotime,
- gint minutes);
-static void cal_obj_time_add_seconds (CalObjTime *cotime,
- gint seconds);
-static gint cal_obj_time_compare (CalObjTime *cotime1,
- CalObjTime *cotime2,
- CalObjTimeComparison type);
-static gint cal_obj_time_weekday (CalObjTime *cotime);
-static gint cal_obj_time_weekday_offset (CalObjTime *cotime,
- CalRecurrence *recur);
-static gint cal_obj_time_day_of_year (CalObjTime *cotime);
-static void cal_obj_time_find_first_week (CalObjTime *cotime,
- RecurData *recur_data);
-static void cal_object_time_from_time (CalObjTime *cotime,
- time_t t,
- icaltimezone *zone);
-static gint cal_obj_date_only_compare_func (const void *arg1,
- const void *arg2);
-
-
-
-static gboolean cal_recur_ensure_end_dates (CalComponent *comp,
- gboolean refresh,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data);
-static gboolean cal_recur_ensure_rule_end_date (CalComponent *comp,
- icalproperty *prop,
- gboolean exception,
- gboolean refresh,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data);
-static gboolean cal_recur_ensure_rule_end_date_cb (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data);
-static time_t cal_recur_get_rule_end_date (icalproperty *prop,
- icaltimezone *default_timezone);
-static void cal_recur_set_rule_end_date (icalproperty *prop,
- time_t end_date);
-
-
-#ifdef CAL_OBJ_DEBUG
-static char* cal_obj_time_to_string (CalObjTime *cotime);
-#endif
-
-
-CalRecurVTable cal_obj_yearly_vtable = {
- cal_obj_yearly_find_start_position,
- cal_obj_yearly_find_next_position,
-
- cal_obj_bymonth_expand,
- cal_obj_byweekno_expand,
- cal_obj_byyearday_expand,
- cal_obj_bymonthday_expand,
- cal_obj_byday_expand_yearly,
- cal_obj_byhour_expand,
- cal_obj_byminute_expand,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_monthly_vtable = {
- cal_obj_monthly_find_start_position,
- cal_obj_monthly_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- NULL, /* BYYEARDAY is not useful in a MONTHLY frequency. */
- cal_obj_bymonthday_expand,
- cal_obj_byday_expand_monthly,
- cal_obj_byhour_expand,
- cal_obj_byminute_expand,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_weekly_vtable = {
- cal_obj_weekly_find_start_position,
- cal_obj_weekly_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- NULL, /* BYYEARDAY is not useful in a WEEKLY frequency. */
- NULL, /* BYMONTHDAY is not useful in a WEEKLY frequency. */
- cal_obj_byday_expand_weekly,
- cal_obj_byhour_expand,
- cal_obj_byminute_expand,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_daily_vtable = {
- cal_obj_daily_find_start_position,
- cal_obj_daily_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- cal_obj_byyearday_filter,
- cal_obj_bymonthday_filter,
- cal_obj_byday_filter,
- cal_obj_byhour_expand,
- cal_obj_byminute_expand,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_hourly_vtable = {
- cal_obj_hourly_find_start_position,
- cal_obj_hourly_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- cal_obj_byyearday_filter,
- cal_obj_bymonthday_filter,
- cal_obj_byday_filter,
- cal_obj_byhour_filter,
- cal_obj_byminute_expand,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_minutely_vtable = {
- cal_obj_minutely_find_start_position,
- cal_obj_minutely_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- cal_obj_byyearday_filter,
- cal_obj_bymonthday_filter,
- cal_obj_byday_filter,
- cal_obj_byhour_filter,
- cal_obj_byminute_filter,
- cal_obj_bysecond_expand
-};
-
-CalRecurVTable cal_obj_secondly_vtable = {
- cal_obj_secondly_find_start_position,
- cal_obj_secondly_find_next_position,
-
- cal_obj_bymonth_filter,
- NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */
- cal_obj_byyearday_filter,
- cal_obj_bymonthday_filter,
- cal_obj_byday_filter,
- cal_obj_byhour_filter,
- cal_obj_byminute_filter,
- cal_obj_bysecond_filter
-};
-
-/*
- * Calls the given callback function for each occurrence of the event that
- * intersects the range between the given start and end times (the end time is
- * not included). Note that the occurrences may start before the given start
- * time.
- *
- * If the callback routine returns FALSE the occurrence generation stops.
- *
- * Both start and end can be -1, in which case we start at the events first
- * instance and continue until it ends, or forever if it has no enddate.
- */
-void
-cal_recur_generate_instances (CalComponent *comp,
- time_t start,
- time_t end,
- CalRecurInstanceFn cb,
- gpointer cb_data,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data,
- icaltimezone *default_timezone)
-{
-#if 0
- g_print ("In cal_recur_generate_instances comp: %p\n", comp);
- g_print (" start: %li - %s", start, ctime (&start));
- g_print (" end : %li - %s", end, ctime (&end));
-#endif
- cal_recur_generate_instances_of_rule (comp, NULL, start, end,
- cb, cb_data, tz_cb, tz_cb_data,
- default_timezone);
-}
-
-
-/*
- * Calls the given callback function for each occurrence of the given
- * recurrence rule between the given start and end times. If the rule is NULL
- * it uses all the rules from the component.
- *
- * If the callback routine returns FALSE the occurrence generation stops.
- *
- * The use of the specific rule is for determining the end of a rule when
- * COUNT is set. The callback will count instances and store the enddate
- * when COUNT is reached.
- *
- * Both start and end can be -1, in which case we start at the events first
- * instance and continue until it ends, or forever if it has no enddate.
- */
-static void
-cal_recur_generate_instances_of_rule (CalComponent *comp,
- icalproperty *prop,
- time_t start,
- time_t end,
- CalRecurInstanceFn cb,
- gpointer cb_data,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data,
- icaltimezone *default_timezone)
-{
- CalComponentDateTime dtstart, dtend;
- time_t dtstart_time, dtend_time;
- GSList *rrules = NULL, *rdates = NULL, elem;
- GSList *exrules = NULL, *exdates = NULL;
- CalObjTime interval_start, interval_end, event_start, event_end;
- CalObjTime chunk_start, chunk_end;
- gint days, seconds, year;
- gboolean single_rule, convert_end_date = FALSE;
- icaltimezone *start_zone = NULL, *end_zone = NULL;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (cb != NULL);
- g_return_if_fail (tz_cb != NULL);
- g_return_if_fail (start >= -1);
- g_return_if_fail (end >= -1);
-
- /* Get dtstart, dtend, recurrences, and exceptions. Note that
- cal_component_get_dtend() will convert a DURATION property to a
- DTEND so we don't need to worry about that. */
-
- cal_component_get_dtstart (comp, &dtstart);
- cal_component_get_dtend (comp, &dtend);
-
- if (!dtstart.value) {
- g_message ("cal_recur_generate_instances_of_rule(): bogus "
- "component, does not have DTSTART. Skipping...");
- goto out;
- }
-
- /* For DATE-TIME values with a TZID, we use the supplied callback to
- resolve the TZID. For DATE values and DATE-TIME values without a
- TZID (i.e. floating times) we use the default timezone. */
- if (dtstart.tzid && !dtstart.value->is_date) {
- start_zone = (*tz_cb) (dtstart.tzid, tz_cb_data);
- } else {
- start_zone = default_timezone;
-
- /* Flag that we need to convert the saved ENDDATE property
- to the default timezone. */
- convert_end_date = TRUE;
- }
-
- dtstart_time = icaltime_as_timet_with_zone (*dtstart.value,
- start_zone);
- if (start == -1)
- start = dtstart_time;
-
- if (dtend.value) {
- /* If both DTSTART and DTEND are DATE values, and they are the
- same day, we add 1 day to DTEND. This means that most
- events created with the old Evolution behavior will still
- work OK. I'm not sure what Outlook does in this case. */
- if (dtstart.value->is_date && dtend.value->is_date) {
- if (icaltime_compare_date_only (*dtstart.value,
- *dtend.value) == 0) {
- icaltime_adjust (dtend.value, 1, 0, 0, 0);
- }
- }
- } else {
- /* If there is no DTEND, then if DTSTART is a DATE-TIME value
- we use the same time (so we have a single point in time).
- If DTSTART is a DATE value we add 1 day. */
- dtend.value = g_new (struct icaltimetype, 1);
- *dtend.value = *dtstart.value;
-
- if (dtstart.value->is_date) {
- icaltime_adjust (dtend.value, 1, 0, 0, 0);
- }
- }
-
- if (dtend.tzid && !dtend.value->is_date) {
- end_zone = (*tz_cb) (dtend.tzid, tz_cb_data);
- } else {
- end_zone = default_timezone;
- }
-
- /* We don't do this any more, since Outlook assumes that the DTEND
- date is not included. */
-#if 0
- /* If DTEND is a DATE value, we add 1 day to it so that it includes
- the entire day. */
- if (dtend.value->is_date) {
- dtend.value->hour = 0;
- dtend.value->minute = 0;
- dtend.value->second = 0;
- icaltime_adjust (dtend.value, 1, 0, 0, 0);
- }
-#endif
- dtend_time = icaltime_as_timet_with_zone (*dtend.value, end_zone);
-
- /* If there is no recurrence, just call the callback if the event
- intersects the given interval. */
- if (!(cal_component_has_recurrences (comp)
- || cal_component_has_exceptions (comp))) {
- if ((end == -1 || dtstart_time < end) && dtend_time > start) {
- (* cb) (comp, dtstart_time, dtend_time, cb_data);
- }
-
- goto out;
- }
-
- /* If a specific recurrence rule is being used, set up a simple list,
- else get the recurrence rules from the component. */
- if (prop) {
- single_rule = TRUE;
-
- elem.data = prop;
- elem.next = NULL;
- rrules = &elem;
- } else if (cal_component_is_instance (comp)) {
- single_rule = FALSE;
- } else {
- single_rule = FALSE;
-
- /* Make sure all the enddates for the rules are set. */
- cal_recur_ensure_end_dates (comp, FALSE, tz_cb, tz_cb_data);
-
- cal_component_get_rrule_property_list (comp, &rrules);
- cal_component_get_rdate_list (comp, &rdates);
- cal_component_get_exrule_property_list (comp, &exrules);
- cal_component_get_exdate_list (comp, &exdates);
- }
-
- /* Convert the interval start & end to CalObjTime. Note that if end
- is -1 interval_end won't be set, so don't use it!
- Also note that we use end - 1 since we want the interval to be
- inclusive as it makes the code simpler. We do all calculation
- in the timezone of the DTSTART. */
- cal_object_time_from_time (&interval_start, start, start_zone);
- if (end != -1)
- cal_object_time_from_time (&interval_end, end - 1, start_zone);
-
- cal_object_time_from_time (&event_start, dtstart_time, start_zone);
- cal_object_time_from_time (&event_end, dtend_time, start_zone);
-
- /* Calculate the duration of the event, which we use for all
- occurrences. We can't just subtract start from end since that may
- be affected by daylight-saving time. So we want a value of days
- + seconds. */
- cal_object_compute_duration (&event_start, &event_end,
- &days, &seconds);
-
- /* Take off the duration from interval_start, so we get occurrences
- that start just before the start time but overlap it. But only do
- that if the interval is after the event's start time. */
- if (start > dtstart_time) {
- cal_obj_time_add_days (&interval_start, -days);
- cal_obj_time_add_seconds (&interval_start, -seconds);
- }
-
- /* Expand the recurrence for each year between start & end, or until
- the callback returns 0 if end is 0. We do a year at a time to
- give the callback function a chance to break out of the loop, and
- so we don't get into problems with infinite recurrences. Since we
- have to work on complete sets of occurrences, if there is a yearly
- frequency it wouldn't make sense to break it into smaller chunks,
- since we would then be calculating the same sets several times.
- Though this does mean that we sometimes do a lot more work than
- is necessary, e.g. if COUNT is set to something quite low. */
- for (year = interval_start.year;
- (end == -1 || year <= interval_end.year) && year <= MAX_YEAR;
- year++) {
- chunk_start = interval_start;
- chunk_start.year = year;
- if (end != -1)
- chunk_end = interval_end;
- chunk_end.year = year;
-
- if (year != interval_start.year) {
- chunk_start.month = 0;
- chunk_start.day = 1;
- chunk_start.hour = 0;
- chunk_start.minute = 0;
- chunk_start.second = 0;
- }
- if (end == -1 || year != interval_end.year) {
- chunk_end.month = 11;
- chunk_end.day = 31;
- chunk_end.hour = 23;
- chunk_end.minute = 59;
- chunk_end.second = 61;
- chunk_end.flags = FALSE;
- }
-
- if (!generate_instances_for_chunk (comp, dtstart_time,
- start_zone,
- rrules, rdates,
- exrules, exdates,
- single_rule,
- &event_start,
- start,
- &chunk_start, &chunk_end,
- days, seconds,
- convert_end_date,
- cb, cb_data))
- break;
- }
-
- if (!prop) {
- cal_component_free_period_list (rdates);
- cal_component_free_exdate_list (exdates);
- }
-
- out:
- cal_component_free_datetime (&dtstart);
- cal_component_free_datetime (&dtend);
-}
-
-/* Builds a list of GINT_TO_POINTER() elements out of a short array from a
- * struct icalrecurrencetype.
- */
-static GList *
-array_to_list (short *array, int max_elements)
-{
- GList *l;
- int i;
-
- l = NULL;
-
- for (i = 0; i < max_elements && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++)
- l = g_list_prepend (l, GINT_TO_POINTER ((int) (array[i])));
- return g_list_reverse (l);
-}
-
-/**
- * cal_recur_from_icalproperty:
- * @prop: An RRULE or EXRULE #icalproperty.
- * @exception: TRUE if this is an EXRULE rather than an RRULE.
- * @zone: The DTSTART timezone, used for converting the UNTIL property if it
- * is given as a DATE value.
- * @convert_end_date: TRUE if the saved end date needs to be converted to the
- * given @zone timezone. This is needed if the DTSTART is a DATE or floating
- * time.
- *
- * Converts an #icalproperty to a #CalRecurrence. This should be
- * freed using the cal_recur_free() function.
- *
- * Return value: #CalRecurrence structure.
- **/
-static CalRecurrence *
-cal_recur_from_icalproperty (icalproperty *prop, gboolean exception,
- icaltimezone *zone, gboolean convert_end_date)
-{
- struct icalrecurrencetype ir;
- CalRecurrence *r;
- gint max_elements, i;
- GList *elem;
-
- g_return_val_if_fail (prop != NULL, NULL);
-
- r = g_new (CalRecurrence, 1);
-
- if (exception)
- ir = icalproperty_get_exrule (prop);
- else
- ir = icalproperty_get_rrule (prop);
-
- r->freq = ir.freq;
- r->interval = ir.interval;
-
- if (ir.count != 0) {
- /* If COUNT is set, we use the pre-calculated enddate.
- Note that this can be 0 if the RULE doesn't actually
- generate COUNT instances. */
- r->enddate = cal_recur_get_rule_end_date (prop, convert_end_date ? zone : NULL);
- } else {
- if (icaltime_is_null_time (ir.until)) {
- /* If neither COUNT or UNTIL is set, the event
- recurs forever. */
- r->enddate = 0;
- } else if (ir.until.is_date) {
- /* If UNTIL is a DATE, we stop at the end of
- the day, in local time (with the DTSTART timezone).
- Note that UNTIL is inclusive so we stop before
- midnight. */
- ir.until.hour = 23;
- ir.until.minute = 59;
- ir.until.second = 59;
- ir.until.is_date = FALSE;
-
- r->enddate = icaltime_as_timet_with_zone (ir.until,
- zone);
-#if 0
- g_print (" until: %li - %s", r->enddate, ctime (&r->enddate));
-#endif
-
- } else {
- /* If UNTIL is a DATE-TIME, it must be in UTC. */
- icaltimezone *utc_zone;
- utc_zone = icaltimezone_get_utc_timezone ();
- r->enddate = icaltime_as_timet_with_zone (ir.until,
- utc_zone);
- }
- }
-
- r->week_start_day = cal_recur_ical_weekday_to_weekday (ir.week_start);
-
- r->bymonth = array_to_list (ir.by_month,
- sizeof (ir.by_month) / sizeof (ir.by_month[0]));
- for (elem = r->bymonth; elem; elem = elem->next) {
- /* We need to convert from 1-12 to 0-11, i.e. subtract 1. */
- int month = GPOINTER_TO_INT (elem->data) - 1;
- elem->data = GINT_TO_POINTER (month);
- }
-
- r->byweekno = array_to_list (ir.by_week_no,
- sizeof (ir.by_week_no) / sizeof (ir.by_week_no[0]));
-
- r->byyearday = array_to_list (ir.by_year_day,
- sizeof (ir.by_year_day) / sizeof (ir.by_year_day[0]));
-
- r->bymonthday = array_to_list (ir.by_month_day,
- sizeof (ir.by_month_day) / sizeof (ir.by_month_day[0]));
-
- /* FIXME: libical only supports 8 values, out of possible 107 * 7. */
- r->byday = NULL;
- max_elements = sizeof (ir.by_day) / sizeof (ir.by_day[0]);
- for (i = 0; i < max_elements && ir.by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
- enum icalrecurrencetype_weekday day;
- gint weeknum, weekday;
-
- day = icalrecurrencetype_day_day_of_week (ir.by_day[i]);
- weeknum = icalrecurrencetype_day_position (ir.by_day[i]);
-
- weekday = cal_recur_ical_weekday_to_weekday (day);
-
- r->byday = g_list_prepend (r->byday,
- GINT_TO_POINTER (weeknum));
- r->byday = g_list_prepend (r->byday,
- GINT_TO_POINTER (weekday));
- }
-
- r->byhour = array_to_list (ir.by_hour,
- sizeof (ir.by_hour) / sizeof (ir.by_hour[0]));
-
- r->byminute = array_to_list (ir.by_minute,
- sizeof (ir.by_minute) / sizeof (ir.by_minute[0]));
-
- r->bysecond = array_to_list (ir.by_second,
- sizeof (ir.by_second) / sizeof (ir.by_second[0]));
-
- r->bysetpos = array_to_list (ir.by_set_pos,
- sizeof (ir.by_set_pos) / sizeof (ir.by_set_pos[0]));
-
- return r;
-}
-
-
-static gint
-cal_recur_ical_weekday_to_weekday (enum icalrecurrencetype_weekday day)
-{
- gint weekday;
-
- switch (day) {
- case ICAL_NO_WEEKDAY: /* Monday is the default in RFC2445. */
- case ICAL_MONDAY_WEEKDAY:
- weekday = 0;
- break;
- case ICAL_TUESDAY_WEEKDAY:
- weekday = 1;
- break;
- case ICAL_WEDNESDAY_WEEKDAY:
- weekday = 2;
- break;
- case ICAL_THURSDAY_WEEKDAY:
- weekday = 3;
- break;
- case ICAL_FRIDAY_WEEKDAY:
- weekday = 4;
- break;
- case ICAL_SATURDAY_WEEKDAY:
- weekday = 5;
- break;
- case ICAL_SUNDAY_WEEKDAY:
- weekday = 6;
- break;
- default:
- g_warning ("cal_recur_ical_weekday_to_weekday(): Unknown week day %d",
- day);
- weekday = 0;
- }
-
- return weekday;
-}
-
-
-/**
- * cal_recur_free:
- * @r: A #CalRecurrence structure.
- *
- * Frees a #CalRecurrence structure.
- **/
-static void
-cal_recur_free (CalRecurrence *r)
-{
- g_return_if_fail (r != NULL);
-
- g_list_free (r->bymonth);
- g_list_free (r->byweekno);
- g_list_free (r->byyearday);
- g_list_free (r->bymonthday);
- g_list_free (r->byday);
- g_list_free (r->byhour);
- g_list_free (r->byminute);
- g_list_free (r->bysecond);
- g_list_free (r->bysetpos);
-
- g_free (r);
-}
-
-/* Generates one year's worth of recurrence instances. Returns TRUE if all the
- * callback invocations returned TRUE, or FALSE when any one of them returns
- * FALSE, i.e. meaning that the instance generation should be stopped.
- *
- * This should only output instances whose start time is between chunk_start
- * and chunk_end (inclusive), or we may generate duplicates when we do the next
- * chunk. (This applies mainly to weekly recurrences, since weeks can span 2
- * years.)
- *
- * It should also only output instances that are on or after the event's
- * DTSTART property and that intersect the required interval, between
- * interval_start and interval_end.
- */
-static gboolean
-generate_instances_for_chunk (CalComponent *comp,
- time_t comp_dtstart,
- icaltimezone *zone,
- GSList *rrules,
- GSList *rdates,
- GSList *exrules,
- GSList *exdates,
- gboolean single_rule,
- CalObjTime *event_start,
- time_t interval_start,
- CalObjTime *chunk_start,
- CalObjTime *chunk_end,
- gint duration_days,
- gint duration_seconds,
- gboolean convert_end_date,
- CalRecurInstanceFn cb,
- gpointer cb_data)
-{
- GArray *occs, *ex_occs, *tmp_occs, *rdate_periods;
- CalObjTime cotime, *occ;
- GSList *elem;
- gint i;
- time_t start_time, end_time;
- struct icaltimetype start_tt, end_tt;
- gboolean cb_status = TRUE, rule_finished, finished = TRUE;
-
-#if 0
- g_print ("In generate_instances_for_chunk rrules: %p\n"
- " %i/%i/%i %02i:%02i:%02i - %i/%i/%i %02i:%02i:%02i\n",
- rrules,
- chunk_start->day, chunk_start->month + 1,
- chunk_start->year, chunk_start->hour,
- chunk_start->minute, chunk_start->second,
- chunk_end->day, chunk_end->month + 1,
- chunk_end->year, chunk_end->hour,
- chunk_end->minute, chunk_end->second);
-#endif
-
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- ex_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- rdate_periods = g_array_new (FALSE, FALSE,
- sizeof (CalObjRecurrenceDate));
-
- /* The original DTSTART property is included in the occurrence set,
- but not if we are just generating occurrences for a single rule. */
- if (!single_rule) {
- /* We add it if it is in this chunk. If it is after this chunk
- we set finished to FALSE, since we know we aren't finished
- yet. */
- if (cal_obj_time_compare_func (event_start, chunk_end) >= 0)
- finished = FALSE;
- else if (cal_obj_time_compare_func (event_start, chunk_start) >= 0)
- g_array_append_vals (occs, event_start, 1);
- }
-
- /* Expand each of the recurrence rules. */
- for (elem = rrules; elem; elem = elem->next) {
- icalproperty *prop;
- CalRecurrence *r;
-
- prop = elem->data;
- r = cal_recur_from_icalproperty (prop, FALSE, zone,
- convert_end_date);
-
- tmp_occs = cal_obj_expand_recurrence (event_start, zone, r,
- chunk_start,
- chunk_end,
- &rule_finished);
- cal_recur_free (r);
-
- /* If any of the rules return FALSE for finished, we know we
- have to carry on so we set finished to FALSE. */
- if (!rule_finished)
- finished = FALSE;
-
- g_array_append_vals (occs, tmp_occs->data, tmp_occs->len);
- g_array_free (tmp_occs, TRUE);
- }
-
- /* Add on specific RDATE occurrence dates. If they have an end time
- or duration set, flag them as RDATEs, and store a pointer to the
- period in the rdate_periods array. Otherwise we can just treat them
- as normal occurrences. */
- for (elem = rdates; elem; elem = elem->next) {
- CalComponentPeriod *p;
- CalObjRecurrenceDate rdate;
-
- p = elem->data;
-
- /* FIXME: We currently assume RDATEs are in the same timezone
- as DTSTART. We should get the RDATE timezone and convert
- to the DTSTART timezone first. */
- cotime.year = p->start.year;
- cotime.month = p->start.month - 1;
- cotime.day = p->start.day;
- cotime.hour = p->start.hour;
- cotime.minute = p->start.minute;
- cotime.second = p->start.second;
- cotime.flags = FALSE;
-
- /* If the rdate is after the current chunk we set finished
- to FALSE, and we skip it. */
- if (cal_obj_time_compare_func (&cotime, chunk_end) >= 0) {
- finished = FALSE;
- continue;
- }
-
- /* Check if the end date or duration is set. If it is we need
- to store it so we can get it later. (libical seems to set
- second to -1 to denote an unset time. See icalvalue.c)
- FIXME. */
- if (p->type != CAL_COMPONENT_PERIOD_DATETIME
- || p->u.end.second != -1) {
- cotime.flags = TRUE;
-
- rdate.start = cotime;
- rdate.period = p;
- g_array_append_val (rdate_periods, rdate);
- }
-
- g_array_append_val (occs, cotime);
- }
-
- /* Expand each of the exception rules. */
- for (elem = exrules; elem; elem = elem->next) {
- icalproperty *prop;
- CalRecurrence *r;
-
- prop = elem->data;
- r = cal_recur_from_icalproperty (prop, FALSE, zone,
- convert_end_date);
-
- tmp_occs = cal_obj_expand_recurrence (event_start, zone, r,
- chunk_start,
- chunk_end,
- &rule_finished);
- cal_recur_free (r);
-
- g_array_append_vals (ex_occs, tmp_occs->data, tmp_occs->len);
- g_array_free (tmp_occs, TRUE);
- }
-
- /* Add on specific exception dates. */
- for (elem = exdates; elem; elem = elem->next) {
- CalComponentDateTime *cdt;
-
- cdt = elem->data;
-
- /* FIXME: We currently assume EXDATEs are in the same timezone
- as DTSTART. We should get the EXDATE timezone and convert
- to the DTSTART timezone first. */
- cotime.year = cdt->value->year;
- cotime.month = cdt->value->month - 1;
- cotime.day = cdt->value->day;
-
- /* If the EXDATE has a DATE value, set the time to the start
- of the day and set flags to TRUE so we know to skip all
- occurrences on that date. */
- if (cdt->value->is_date) {
- cotime.hour = 0;
- cotime.minute = 0;
- cotime.second = 0;
- cotime.flags = TRUE;
- } else {
- cotime.hour = cdt->value->hour;
- cotime.minute = cdt->value->minute;
- cotime.second = cdt->value->second;
- cotime.flags = FALSE;
- }
-
- g_array_append_val (ex_occs, cotime);
- }
-
-
- /* Sort all the arrays. */
- cal_obj_sort_occurrences (occs);
- cal_obj_sort_occurrences (ex_occs);
-
- qsort (rdate_periods->data, rdate_periods->len,
- sizeof (CalObjRecurrenceDate), cal_obj_time_compare_func);
-
- /* Create the final array, by removing the exceptions from the
- occurrences, and removing any duplicates. */
- cal_obj_remove_exceptions (occs, ex_occs);
-
- /* Call the callback for each occurrence. If it returns 0 we break
- out of the loop. */
- for (i = 0; i < occs->len; i++) {
- /* Convert each CalObjTime into a start & end time_t, and
- check it is within the bounds of the event & interval. */
- occ = &g_array_index (occs, CalObjTime, i);
-#if 0
- g_print ("Checking occurrence: %s\n",
- cal_obj_time_to_string (occ));
-#endif
- start_tt = icaltime_null_time ();
- start_tt.year = occ->year;
- start_tt.month = occ->month + 1;
- start_tt.day = occ->day;
- start_tt.hour = occ->hour;
- start_tt.minute = occ->minute;
- start_tt.second = occ->second;
- start_time = icaltime_as_timet_with_zone (start_tt, zone);
-
- if (start_time == -1) {
- g_warning ("time_t out of range");
- finished = TRUE;
- break;
- }
-
- /* Check to ensure that the start time is at or after the
- event's DTSTART time, and that it is inside the chunk that
- we are currently working on. (Note that the chunk_end time
- is never after the interval end time, so this also tests
- that we don't go past the end of the required interval). */
- if (start_time < comp_dtstart
- || cal_obj_time_compare_func (occ, chunk_start) < 0
- || cal_obj_time_compare_func (occ, chunk_end) > 0) {
-#if 0
- g_print (" start time invalid\n");
-#endif
- continue;
- }
-
- if (occ->flags) {
- /* If it is an RDATE, we see if the end date or
- duration was set. If not, we use the same duration
- as the original occurrence. */
- if (!cal_object_get_rdate_end (occ, rdate_periods)) {
- cal_obj_time_add_days (occ, duration_days);
- cal_obj_time_add_seconds (occ,
- duration_seconds);
- }
- } else {
- cal_obj_time_add_days (occ, duration_days);
- cal_obj_time_add_seconds (occ, duration_seconds);
- }
-
- end_tt = icaltime_null_time ();
- end_tt.year = occ->year;
- end_tt.month = occ->month + 1;
- end_tt.day = occ->day;
- end_tt.hour = occ->hour;
- end_tt.minute = occ->minute;
- end_tt.second = occ->second;
- end_time = icaltime_as_timet_with_zone (end_tt, zone);
-
- if (end_time == -1) {
- g_warning ("time_t out of range");
- finished = TRUE;
- break;
- }
-
- /* Check that the end time is after the interval start, so we
- know that it intersects the required interval. */
- if (end_time <= interval_start) {
-#if 0
- g_print (" end time invalid\n");
-#endif
- continue;
- }
-
- cb_status = (*cb) (comp, start_time, end_time, cb_data);
- if (!cb_status)
- break;
- }
-
- g_array_free (occs, TRUE);
- g_array_free (ex_occs, TRUE);
- g_array_free (rdate_periods, TRUE);
-
- /* We return TRUE (i.e. carry on) only if the callback has always
- returned TRUE and we know that we have more occurrences to generate
- (i.e. finished is FALSE). */
- return cb_status && !finished;
-}
-
-
-/* This looks up the occurrence time in the sorted rdate_periods array, and
- tries to compute the end time of the occurrence. If no end time or duration
- is set it returns FALSE and the default duration will be used. */
-static gboolean
-cal_object_get_rdate_end (CalObjTime *occ,
- GArray *rdate_periods)
-{
- CalObjRecurrenceDate *rdate = NULL;
- CalComponentPeriod *p;
- gint lower, upper, middle, cmp = 0;
-
- lower = 0;
- upper = rdate_periods->len;
-
- while (lower < upper) {
- middle = (lower + upper) >> 1;
-
- rdate = &g_array_index (rdate_periods, CalObjRecurrenceDate,
- middle);
-
- cmp = cal_obj_time_compare_func (occ, &rdate->start);
-
- if (cmp == 0)
- break;
- else if (cmp < 0)
- upper = middle;
- else
- lower = middle + 1;
- }
-
- /* This should never happen. */
- if (cmp == 0) {
- g_warning ("Recurrence date not found");
- return FALSE;
- }
-
- p = rdate->period;
- if (p->type == CAL_COMPONENT_PERIOD_DATETIME) {
- /* FIXME: We currently assume RDATEs are in the same timezone
- as DTSTART. We should get the RDATE timezone and convert
- to the DTSTART timezone first. */
- occ->year = p->u.end.year;
- occ->month = p->u.end.month - 1;
- occ->day = p->u.end.day;
- occ->hour = p->u.end.hour;
- occ->minute = p->u.end.minute;
- occ->second = p->u.end.second;
- occ->flags = FALSE;
- } else {
- cal_obj_time_add_days (occ, p->u.duration.weeks * 7
- + p->u.duration.days);
- cal_obj_time_add_hours (occ, p->u.duration.hours);
- cal_obj_time_add_minutes (occ, p->u.duration.minutes);
- cal_obj_time_add_seconds (occ, p->u.duration.seconds);
- }
-
- return TRUE;
-}
-
-
-static void
-cal_object_compute_duration (CalObjTime *start,
- CalObjTime *end,
- gint *days,
- gint *seconds)
-{
- GDate start_date, end_date;
- gint start_seconds, end_seconds;
-
- g_date_clear (&start_date, 1);
- g_date_clear (&end_date, 1);
- g_date_set_dmy (&start_date, start->day, start->month + 1,
- start->year);
- g_date_set_dmy (&end_date, end->day, end->month + 1,
- end->year);
-
- *days = g_date_get_julian (&end_date) - g_date_get_julian (&start_date);
- start_seconds = start->hour * 3600 + start->minute * 60
- + start->second;
- end_seconds = end->hour * 3600 + end->minute * 60 + end->second;
-
- *seconds = end_seconds - start_seconds;
- if (*seconds < 0) {
- *days = *days - 1;
- *seconds += 24 * 60 * 60;
- }
-}
-
-
-/* Returns an unsorted GArray of CalObjTime's resulting from expanding the
- given recurrence rule within the given interval. Note that it doesn't
- clip the generated occurrences to the interval, i.e. if the interval
- starts part way through the year this function still returns all the
- occurrences for the year. Clipping is done later.
- The finished flag is set to FALSE if there are more occurrences to generate
- after the given interval.*/
-static GArray*
-cal_obj_expand_recurrence (CalObjTime *event_start,
- icaltimezone *zone,
- CalRecurrence *recur,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- gboolean *finished)
-{
- CalRecurVTable *vtable;
- CalObjTime *event_end = NULL, event_end_cotime;
- RecurData recur_data;
- CalObjTime occ, *cotime;
- GArray *all_occs, *occs;
- gint len;
-
- /* This is the resulting array of CalObjTime elements. */
- all_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- *finished = TRUE;
-
- vtable = cal_obj_get_vtable (recur->freq);
- if (!vtable)
- return all_occs;
-
- /* Calculate some useful data such as some fast lookup tables. */
- cal_obj_initialize_recur_data (&recur_data, recur, event_start);
-
- /* Compute the event_end, if the recur's enddate is set. */
- if (recur->enddate > 0) {
- cal_object_time_from_time (&event_end_cotime,
- recur->enddate, zone);
- event_end = &event_end_cotime;
-
- /* If the enddate is before the requested interval return. */
- if (cal_obj_time_compare_func (event_end, interval_start) < 0)
- return all_occs;
- }
-
- /* Set finished to FALSE if we know there will be more occurrences to
- do after this interval. */
- if (!interval_end || !event_end
- || cal_obj_time_compare_func (event_end, interval_end) > 0)
- *finished = FALSE;
-
- /* Get the first period based on the frequency and the interval that
- intersects the interval between start and end. */
- if ((*vtable->find_start_position) (event_start, event_end,
- &recur_data,
- interval_start, interval_end,
- &occ))
- return all_occs;
-
- /* Loop until the event ends or we go past the end of the required
- interval. */
- for (;;) {
- /* Generate the set of occurrences for this period. */
- switch (recur->freq) {
- case ICAL_YEARLY_RECURRENCE:
- occs = cal_obj_generate_set_yearly (&recur_data,
- vtable, &occ);
- break;
- case ICAL_MONTHLY_RECURRENCE:
- occs = cal_obj_generate_set_monthly (&recur_data,
- vtable, &occ);
- break;
- default:
- occs = cal_obj_generate_set_default (&recur_data,
- vtable, &occ);
- break;
- }
-
- /* Sort the occurrences and remove duplicates. */
- cal_obj_sort_occurrences (occs);
- cal_obj_remove_duplicates_and_invalid_dates (occs);
-
- /* Apply the BYSETPOS property. */
- occs = cal_obj_bysetpos_filter (recur, occs);
-
- /* Remove any occs after event_end. */
- len = occs->len - 1;
- if (event_end) {
- while (len >= 0) {
- cotime = &g_array_index (occs, CalObjTime,
- len);
- if (cal_obj_time_compare_func (cotime,
- event_end) <= 0)
- break;
- len--;
- }
- }
-
- /* Add the occurrences onto the main array. */
- if (len >= 0)
- g_array_append_vals (all_occs, occs->data, len + 1);
-
- g_array_free (occs, TRUE);
-
- /* Skip to the next period, or exit the loop if finished. */
- if ((*vtable->find_next_position) (&occ, event_end,
- &recur_data, interval_end))
- break;
- }
-
- return all_occs;
-}
-
-
-static GArray*
-cal_obj_generate_set_yearly (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ)
-{
- CalRecurrence *recur = recur_data->recur;
- GArray *occs_arrays[4], *occs, *occs2;
- gint num_occs_arrays = 0, i;
-
- /* This is a bit complicated, since the iCalendar spec says that
- several BYxxx modifiers can be used simultaneously. So we have to
- be quite careful when determining the days of the occurrences.
- The BYHOUR, BYMINUTE & BYSECOND modifiers are no problem at all.
-
- The modifiers we have to worry about are: BYMONTH, BYWEEKNO,
- BYYEARDAY, BYMONTHDAY & BYDAY. We can't do these sequentially
- since each filter will mess up the results of the previous one.
- But they aren't all completely independant, e.g. BYMONTHDAY and
- BYDAY are related to BYMONTH, and BYDAY is related to BYWEEKNO.
-
- BYDAY & BYMONTHDAY can also be applied independently, which makes
- it worse. So we assume that if BYMONTH or BYWEEKNO is used, then
- the BYDAY modifier applies to those, else it is applied
- independantly.
-
- We expand the occurrences in parallel into the occs_arrays[] array,
- and then merge them all into one GArray before expanding BYHOUR,
- BYMINUTE & BYSECOND. */
-
- if (recur->bymonth) {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->bymonth_filter) (recur_data, occs);
-
- /* If BYMONTHDAY & BYDAY are both set we need to expand them
- in parallel and add the results. */
- if (recur->bymonthday && recur->byday) {
- /* Copy the occs array. */
- occs2 = g_array_new (FALSE, FALSE,
- sizeof (CalObjTime));
- g_array_append_vals (occs2, occs->data, occs->len);
-
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
- /* Note that we explicitly call the monthly version
- of the BYDAY expansion filter. */
- occs2 = cal_obj_byday_expand_monthly (recur_data,
- occs2);
-
- /* Add the 2 resulting arrays together. */
- g_array_append_vals (occs, occs2->data, occs2->len);
- g_array_free (occs2, TRUE);
- } else {
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
- /* Note that we explicitly call the monthly version
- of the BYDAY expansion filter. */
- occs = cal_obj_byday_expand_monthly (recur_data, occs);
- }
-
- occs_arrays[num_occs_arrays++] = occs;
- }
-
- if (recur->byweekno) {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->byweekno_filter) (recur_data, occs);
- /* Note that we explicitly call the weekly version of the
- BYDAY expansion filter. */
- occs = cal_obj_byday_expand_weekly (recur_data, occs);
-
- occs_arrays[num_occs_arrays++] = occs;
- }
-
- if (recur->byyearday) {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->byyearday_filter) (recur_data, occs);
-
- occs_arrays[num_occs_arrays++] = occs;
- }
-
- /* If BYMONTHDAY is set, and BYMONTH is not set, we need to
- expand BYMONTHDAY independantly. */
- if (recur->bymonthday && !recur->bymonth) {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
-
- occs_arrays[num_occs_arrays++] = occs;
- }
-
- /* If BYDAY is set, and BYMONTH and BYWEEKNO are not set, we need to
- expand BYDAY independantly. */
- if (recur->byday && !recur->bymonth && !recur->byweekno) {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->byday_filter) (recur_data, occs);
-
- occs_arrays[num_occs_arrays++] = occs;
- }
-
- /* Add all the arrays together. If no filters were used we just
- create an array with one element. */
- if (num_occs_arrays > 0) {
- occs = occs_arrays[0];
- for (i = 1; i < num_occs_arrays; i++) {
- occs2 = occs_arrays[i];
- g_array_append_vals (occs, occs2->data, occs2->len);
- g_array_free (occs2, TRUE);
- }
- } else {
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
- }
-
- /* Now expand BYHOUR, BYMINUTE & BYSECOND. */
- occs = (*vtable->byhour_filter) (recur_data, occs);
- occs = (*vtable->byminute_filter) (recur_data, occs);
- occs = (*vtable->bysecond_filter) (recur_data, occs);
-
- return occs;
-}
-
-
-static GArray*
-cal_obj_generate_set_monthly (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ)
-{
- GArray *occs, *occs2;
-
- /* We start with just the one time in each set. */
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->bymonth_filter) (recur_data, occs);
-
- /* We need to combine the output of BYMONTHDAY & BYDAY, by doing them
- in parallel rather than sequentially. If we did them sequentially
- then we would lose the occurrences generated by BYMONTHDAY, and
- instead have repetitions of the occurrences from BYDAY. */
- if (recur_data->recur->bymonthday && recur_data->recur->byday) {
- occs2 = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs2, occs->data, occs->len);
-
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
- occs2 = (*vtable->byday_filter) (recur_data, occs2);
-
- g_array_append_vals (occs, occs2->data, occs2->len);
- g_array_free (occs2, TRUE);
- } else {
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
- occs = (*vtable->byday_filter) (recur_data, occs);
- }
-
- occs = (*vtable->byhour_filter) (recur_data, occs);
- occs = (*vtable->byminute_filter) (recur_data, occs);
- occs = (*vtable->bysecond_filter) (recur_data, occs);
-
- return occs;
-}
-
-
-static GArray*
-cal_obj_generate_set_default (RecurData *recur_data,
- CalRecurVTable *vtable,
- CalObjTime *occ)
-{
- GArray *occs;
-
-#if 0
- g_print ("Generating set for %i/%i/%i %02i:%02i:%02i\n",
- occ->day, occ->month + 1, occ->year, occ->hour, occ->minute,
- occ->second);
-#endif
-
- /* We start with just the one time in the set. */
- occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
- g_array_append_vals (occs, occ, 1);
-
- occs = (*vtable->bymonth_filter) (recur_data, occs);
- if (vtable->byweekno_filter)
- occs = (*vtable->byweekno_filter) (recur_data, occs);
- if (vtable->byyearday_filter)
- occs = (*vtable->byyearday_filter) (recur_data, occs);
- if (vtable->bymonthday_filter)
- occs = (*vtable->bymonthday_filter) (recur_data, occs);
- occs = (*vtable->byday_filter) (recur_data, occs);
-
- occs = (*vtable->byhour_filter) (recur_data, occs);
- occs = (*vtable->byminute_filter) (recur_data, occs);
- occs = (*vtable->bysecond_filter) (recur_data, occs);
-
- return occs;
-}
-
-
-
-/* Returns the function table corresponding to the recurrence frequency. */
-static CalRecurVTable* cal_obj_get_vtable (icalrecurrencetype_frequency recur_type)
-{
- CalRecurVTable* vtable;
-
- switch (recur_type) {
- case ICAL_YEARLY_RECURRENCE:
- vtable = &cal_obj_yearly_vtable;
- break;
- case ICAL_MONTHLY_RECURRENCE:
- vtable = &cal_obj_monthly_vtable;
- break;
- case ICAL_WEEKLY_RECURRENCE:
- vtable = &cal_obj_weekly_vtable;
- break;
- case ICAL_DAILY_RECURRENCE:
- vtable = &cal_obj_daily_vtable;
- break;
- case ICAL_HOURLY_RECURRENCE:
- vtable = &cal_obj_hourly_vtable;
- break;
- case ICAL_MINUTELY_RECURRENCE:
- vtable = &cal_obj_minutely_vtable;
- break;
- case ICAL_SECONDLY_RECURRENCE:
- vtable = &cal_obj_secondly_vtable;
- break;
- default:
- g_warning ("Unknown recurrence frequency");
- vtable = NULL;
- }
-
- return vtable;
-}
-
-
-/* This creates a number of fast lookup tables used when filtering with the
- modifier properties BYMONTH, BYYEARDAY etc. */
-static void
-cal_obj_initialize_recur_data (RecurData *recur_data,
- CalRecurrence *recur,
- CalObjTime *event_start)
-{
- GList *elem;
- gint month, yearday, monthday, weekday, week_num, hour, minute, second;
-
- /* Clear the entire RecurData. */
- memset (recur_data, 0, sizeof (RecurData));
-
- recur_data->recur = recur;
-
- /* Set the weekday, used for the WEEKLY frequency and the BYWEEKNO
- modifier. */
- recur_data->weekday_offset = cal_obj_time_weekday_offset (event_start,
- recur);
-
- /* Create an array of months from bymonths for fast lookup. */
- elem = recur->bymonth;
- while (elem) {
- month = GPOINTER_TO_INT (elem->data);
- recur_data->months[month] = 1;
- elem = elem->next;
- }
-
- /* Create an array of yeardays from byyearday for fast lookup.
- We create a second array to handle the negative values. The first
- element there corresponds to the last day of the year. */
- elem = recur->byyearday;
- while (elem) {
- yearday = GPOINTER_TO_INT (elem->data);
- if (yearday >= 0)
- recur_data->yeardays[yearday] = 1;
- else
- recur_data->neg_yeardays[-yearday] = 1;
- elem = elem->next;
- }
-
- /* Create an array of monthdays from bymonthday for fast lookup.
- We create a second array to handle the negative values. The first
- element there corresponds to the last day of the month. */
- elem = recur->bymonthday;
- while (elem) {
- monthday = GPOINTER_TO_INT (elem->data);
- if (monthday >= 0)
- recur_data->monthdays[monthday] = 1;
- else
- recur_data->neg_monthdays[-monthday] = 1;
- elem = elem->next;
- }
-
- /* Create an array of weekdays from byday for fast lookup. */
- elem = recur->byday;
- while (elem) {
- weekday = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
- /* The week number is not used when filtering. */
- week_num = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
-
- recur_data->weekdays[weekday] = 1;
- }
-
- /* Create an array of hours from byhour for fast lookup. */
- elem = recur->byhour;
- while (elem) {
- hour = GPOINTER_TO_INT (elem->data);
- recur_data->hours[hour] = 1;
- elem = elem->next;
- }
-
- /* Create an array of minutes from byminutes for fast lookup. */
- elem = recur->byminute;
- while (elem) {
- minute = GPOINTER_TO_INT (elem->data);
- recur_data->minutes[minute] = 1;
- elem = elem->next;
- }
-
- /* Create an array of seconds from byseconds for fast lookup. */
- elem = recur->bysecond;
- while (elem) {
- second = GPOINTER_TO_INT (elem->data);
- recur_data->seconds[second] = 1;
- elem = elem->next;
- }
-}
-
-
-static void
-cal_obj_sort_occurrences (GArray *occs)
-{
- qsort (occs->data, occs->len, sizeof (CalObjTime),
- cal_obj_time_compare_func);
-}
-
-
-static void
-cal_obj_remove_duplicates_and_invalid_dates (GArray *occs)
-{
- static const int days_in_month[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
- };
-
- CalObjTime *occ, *prev_occ = NULL;
- gint len, i, j = 0, year, month, days;
- gboolean keep_occ;
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- keep_occ = TRUE;
-
- if (prev_occ && cal_obj_time_compare_func (occ,
- prev_occ) == 0)
- keep_occ = FALSE;
-
- year = occ->year;
- month = occ->month;
- days = days_in_month[occ->month];
- /* If it is february and a leap year, add a day. */
- if (month == 1 && (year % 4 == 0
- && (year % 100 != 0
- || year % 400 == 0)))
- days++;
- if (occ->day > days)
- keep_occ = FALSE;
-
- if (keep_occ) {
- if (i != j)
- g_array_index (occs, CalObjTime, j)
- = g_array_index (occs, CalObjTime, i);
- j++;
- }
-
- prev_occ = occ;
- }
-
- g_array_set_size (occs, j);
-}
-
-
-/* Removes the exceptions from the ex_occs array from the occurrences in the
- occs array, and removes any duplicates. Both arrays are sorted. */
-static void
-cal_obj_remove_exceptions (GArray *occs,
- GArray *ex_occs)
-{
- CalObjTime *occ, *prev_occ = NULL, *ex_occ = NULL, *last_occ_kept;
- gint i, j = 0, cmp, ex_index, occs_len, ex_occs_len;
- gboolean keep_occ, current_time_is_exception = FALSE;
-
- if (occs->len == 0)
- return;
-
- ex_index = 0;
- occs_len = occs->len;
- ex_occs_len = ex_occs->len;
-
- if (ex_occs_len > 0)
- ex_occ = &g_array_index (ex_occs, CalObjTime, ex_index);
-
- for (i = 0; i < occs_len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- keep_occ = TRUE;
-
- /* If the occurrence is a duplicate of the previous one, skip
- it. */
- if (prev_occ
- && cal_obj_time_compare_func (occ, prev_occ) == 0) {
- keep_occ = FALSE;
-
- /* If this occurrence is an RDATE with an end or
- duration set, and the previous occurrence in the
- array was kept, set the RDATE flag of the last one,
- so we still use the end date or duration. */
- if (occ->flags && !current_time_is_exception) {
- last_occ_kept = &g_array_index (occs,
- CalObjTime,
- j - 1);
- last_occ_kept->flags = TRUE;
- }
- } else {
- /* We've found a new occurrence time. Reset the flag
- to indicate that it hasn't been found in the
- exceptions array (yet). */
- current_time_is_exception = FALSE;
-
- if (ex_occ) {
- /* Step through the exceptions until we come
- to one that matches or follows this
- occurrence. */
- while (ex_occ) {
- /* If the exception is an EXDATE with
- a DATE value, we only have to
- compare the date. */
- if (ex_occ->flags)
- cmp = cal_obj_date_only_compare_func (ex_occ, occ);
- else
- cmp = cal_obj_time_compare_func (ex_occ, occ);
-
- if (cmp > 0)
- break;
-
- /* Move to the next exception, or set
- ex_occ to NULL when we reach the
- end of array. */
- ex_index++;
- if (ex_index < ex_occs_len)
- ex_occ = &g_array_index (ex_occs, CalObjTime, ex_index);
- else
- ex_occ = NULL;
-
- /* If the exception did match this
- occurrence we remove it, and set the
- flag to indicate that the current
- time is an exception. */
- if (cmp == 0) {
- current_time_is_exception = TRUE;
- keep_occ = FALSE;
- break;
- }
- }
- }
- }
-
- if (keep_occ) {
- /* We are keeping this occurrence, so we move it to
- the next free space, unless its position hasn't
- changed (i.e. all previous occurrences were also
- kept). */
- if (i != j)
- g_array_index (occs, CalObjTime, j)
- = g_array_index (occs, CalObjTime, i);
- j++;
- }
-
- prev_occ = occ;
- }
-
- g_array_set_size (occs, j);
-}
-
-
-
-static GArray*
-cal_obj_bysetpos_filter (CalRecurrence *recur,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, pos;
-
- /* If BYSETPOS has not been specified, or the array is empty, just
- return the array. */
- elem = recur->bysetpos;
- if (!elem || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- /* Iterate over the indices given in bysetpos, adding the corresponding
- element from occs to new_occs. */
- len = occs->len;
- while (elem) {
- pos = GPOINTER_TO_INT (elem->data);
-
- /* Negative values count back from the end of the array. */
- if (pos < 0)
- pos += len;
- /* Positive values need to be decremented since the array is
- 0-based. */
- else
- pos--;
-
- if (pos >= 0 && pos < len) {
- occ = &g_array_index (occs, CalObjTime, pos);
- g_array_append_vals (new_occs, occ, 1);
- }
- elem = elem->next;
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-
-/* Finds the first year from the event_start, counting in multiples of the
- recurrence interval, that intersects the given interval. It returns TRUE
- if there is no intersection. */
-static gboolean
-cal_obj_yearly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- *cotime = *event_start;
-
- /* Move on to the next interval, if the event starts before the
- given interval. */
- if (cotime->year < interval_start->year) {
- gint years = interval_start->year - cotime->year
- + recur_data->recur->interval - 1;
- years -= years % recur_data->recur->interval;
- /* NOTE: The day may now be invalid, e.g. 29th Feb. */
- cotime->year += years;
- }
-
- if ((event_end && cotime->year > event_end->year)
- || (interval_end && cotime->year > interval_end->year))
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_yearly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- /* NOTE: The day may now be invalid, e.g. 29th Feb. */
- cotime->year += recur_data->recur->interval;
-
- if ((event_end && cotime->year > event_end->year)
- || (interval_end && cotime->year > interval_end->year))
- return TRUE;
-
- return FALSE;
-}
-
-
-
-static gboolean
-cal_obj_monthly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- *cotime = *event_start;
-
- /* Move on to the next interval, if the event starts before the
- given interval. */
- if (cal_obj_time_compare (cotime, interval_start, CALOBJ_MONTH) < 0) {
- gint months = (interval_start->year - cotime->year) * 12
- + interval_start->month - cotime->month
- + recur_data->recur->interval - 1;
- months -= months % recur_data->recur->interval;
- /* NOTE: The day may now be invalid, e.g. 31st Sep. */
- cal_obj_time_add_months (cotime, months);
- }
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_MONTH) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_MONTH) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_monthly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- /* NOTE: The day may now be invalid, e.g. 31st Sep. */
- cal_obj_time_add_months (cotime, recur_data->recur->interval);
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_MONTH) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_MONTH) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-
-static gboolean
-cal_obj_weekly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- GDate event_start_date, interval_start_date;
- guint32 event_start_julian, interval_start_julian;
- gint interval_start_weekday_offset;
- CalObjTime week_start;
-
- if (event_end && cal_obj_time_compare (event_end, interval_start,
- CALOBJ_DAY) < 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (event_start, interval_end,
- CALOBJ_DAY) > 0)
- return TRUE;
-
- *cotime = *event_start;
-
- /* Convert the event start and interval start to GDates, so we can
- easily find the number of days between them. */
- g_date_clear (&event_start_date, 1);
- g_date_set_dmy (&event_start_date, event_start->day,
- event_start->month + 1, event_start->year);
- g_date_clear (&interval_start_date, 1);
- g_date_set_dmy (&interval_start_date, interval_start->day,
- interval_start->month + 1, interval_start->year);
-
- /* Calculate the start of the weeks corresponding to the event start
- and interval start. */
- event_start_julian = g_date_get_julian (&event_start_date);
- event_start_julian -= recur_data->weekday_offset;
-
- interval_start_julian = g_date_get_julian (&interval_start_date);
- interval_start_weekday_offset = cal_obj_time_weekday_offset (interval_start, recur_data->recur);
- interval_start_julian -= interval_start_weekday_offset;
-
- /* We want to find the first full week using the recurrence interval
- that intersects the given interval dates. */
- if (event_start_julian < interval_start_julian) {
- gint weeks = (interval_start_julian - event_start_julian) / 7;
- weeks += recur_data->recur->interval - 1;
- weeks -= weeks % recur_data->recur->interval;
- cal_obj_time_add_days (cotime, weeks * 7);
- }
-
- week_start = *cotime;
- cal_obj_time_add_days (&week_start, -recur_data->weekday_offset);
-
- if (event_end && cal_obj_time_compare (&week_start, event_end,
- CALOBJ_DAY) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (&week_start, interval_end,
- CALOBJ_DAY) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_weekly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- CalObjTime week_start;
-
- cal_obj_time_add_days (cotime, recur_data->recur->interval * 7);
-
- /* Return TRUE if the start of this week is after the event finishes
- or is after the end of the required interval. */
- week_start = *cotime;
- cal_obj_time_add_days (&week_start, -recur_data->weekday_offset);
-
-#ifdef CAL_OBJ_DEBUG
- g_print ("Next day: %s\n", cal_obj_time_to_string (cotime));
- g_print ("Week Start: %s\n", cal_obj_time_to_string (&week_start));
-#endif
-
- if (event_end && cal_obj_time_compare (&week_start, event_end,
- CALOBJ_DAY) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (&week_start, interval_end,
- CALOBJ_DAY) > 0) {
-#ifdef CAL_OBJ_DEBUG
- g_print ("Interval end reached: %s\n",
- cal_obj_time_to_string (interval_end));
-#endif
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_daily_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- GDate event_start_date, interval_start_date;
- guint32 event_start_julian, interval_start_julian, days;
-
- if (interval_end && cal_obj_time_compare (event_start, interval_end,
- CALOBJ_DAY) > 0)
- return TRUE;
- if (event_end && cal_obj_time_compare (event_end, interval_start,
- CALOBJ_DAY) < 0)
- return TRUE;
-
- *cotime = *event_start;
-
- /* Convert the event start and interval start to GDates, so we can
- easily find the number of days between them. */
- g_date_clear (&event_start_date, 1);
- g_date_set_dmy (&event_start_date, event_start->day,
- event_start->month + 1, event_start->year);
- g_date_clear (&interval_start_date, 1);
- g_date_set_dmy (&interval_start_date, interval_start->day,
- interval_start->month + 1, interval_start->year);
-
- event_start_julian = g_date_get_julian (&event_start_date);
- interval_start_julian = g_date_get_julian (&interval_start_date);
-
- if (event_start_julian < interval_start_julian) {
- days = interval_start_julian - event_start_julian
- + recur_data->recur->interval - 1;
- days -= days % recur_data->recur->interval;
- cal_obj_time_add_days (cotime, days);
- }
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_DAY) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_DAY) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_daily_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- cal_obj_time_add_days (cotime, recur_data->recur->interval);
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_DAY) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_DAY) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_hourly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- GDate event_start_date, interval_start_date;
- guint32 event_start_julian, interval_start_julian, hours;
-
- if (interval_end && cal_obj_time_compare (event_start, interval_end,
- CALOBJ_HOUR) > 0)
- return TRUE;
- if (event_end && cal_obj_time_compare (event_end, interval_start,
- CALOBJ_HOUR) < 0)
- return TRUE;
-
- *cotime = *event_start;
-
- if (cal_obj_time_compare (event_start, interval_start,
- CALOBJ_HOUR) < 0) {
- /* Convert the event start and interval start to GDates, so we
- can easily find the number of days between them. */
- g_date_clear (&event_start_date, 1);
- g_date_set_dmy (&event_start_date, event_start->day,
- event_start->month + 1, event_start->year);
- g_date_clear (&interval_start_date, 1);
- g_date_set_dmy (&interval_start_date, interval_start->day,
- interval_start->month + 1,
- interval_start->year);
-
- event_start_julian = g_date_get_julian (&event_start_date);
- interval_start_julian = g_date_get_julian (&interval_start_date);
-
- hours = (interval_start_julian - event_start_julian) * 24;
- hours += interval_start->hour - event_start->hour;
- hours += recur_data->recur->interval - 1;
- hours -= hours % recur_data->recur->interval;
- cal_obj_time_add_hours (cotime, hours);
- }
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_HOUR) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_HOUR) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_hourly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- cal_obj_time_add_hours (cotime, recur_data->recur->interval);
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_HOUR) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_HOUR) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_minutely_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- GDate event_start_date, interval_start_date;
- guint32 event_start_julian, interval_start_julian, minutes;
-
- if (interval_end && cal_obj_time_compare (event_start, interval_end,
- CALOBJ_MINUTE) > 0)
- return TRUE;
- if (event_end && cal_obj_time_compare (event_end, interval_start,
- CALOBJ_MINUTE) < 0)
- return TRUE;
-
- *cotime = *event_start;
-
- if (cal_obj_time_compare (event_start, interval_start,
- CALOBJ_MINUTE) < 0) {
- /* Convert the event start and interval start to GDates, so we
- can easily find the number of days between them. */
- g_date_clear (&event_start_date, 1);
- g_date_set_dmy (&event_start_date, event_start->day,
- event_start->month + 1, event_start->year);
- g_date_clear (&interval_start_date, 1);
- g_date_set_dmy (&interval_start_date, interval_start->day,
- interval_start->month + 1,
- interval_start->year);
-
- event_start_julian = g_date_get_julian (&event_start_date);
- interval_start_julian = g_date_get_julian (&interval_start_date);
-
- minutes = (interval_start_julian - event_start_julian)
- * 24 * 60;
- minutes += (interval_start->hour - event_start->hour) * 24;
- minutes += interval_start->minute - event_start->minute;
- minutes += recur_data->recur->interval - 1;
- minutes -= minutes % recur_data->recur->interval;
- cal_obj_time_add_minutes (cotime, minutes);
- }
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_MINUTE) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_MINUTE) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_minutely_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- cal_obj_time_add_minutes (cotime, recur_data->recur->interval);
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_MINUTE) > 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_MINUTE) > 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_secondly_find_start_position (CalObjTime *event_start,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_start,
- CalObjTime *interval_end,
- CalObjTime *cotime)
-{
- GDate event_start_date, interval_start_date;
- guint32 event_start_julian, interval_start_julian, seconds;
-
- if (interval_end && cal_obj_time_compare (event_start, interval_end,
- CALOBJ_SECOND) > 0)
- return TRUE;
- if (event_end && cal_obj_time_compare (event_end, interval_start,
- CALOBJ_SECOND) < 0)
- return TRUE;
-
- *cotime = *event_start;
-
- if (cal_obj_time_compare (event_start, interval_start,
- CALOBJ_SECOND) < 0) {
- /* Convert the event start and interval start to GDates, so we
- can easily find the number of days between them. */
- g_date_clear (&event_start_date, 1);
- g_date_set_dmy (&event_start_date, event_start->day,
- event_start->month + 1, event_start->year);
- g_date_clear (&interval_start_date, 1);
- g_date_set_dmy (&interval_start_date, interval_start->day,
- interval_start->month + 1,
- interval_start->year);
-
- event_start_julian = g_date_get_julian (&event_start_date);
- interval_start_julian = g_date_get_julian (&interval_start_date);
-
- seconds = (interval_start_julian - event_start_julian)
- * 24 * 60 * 60;
- seconds += (interval_start->hour - event_start->hour)
- * 24 * 60;
- seconds += (interval_start->minute - event_start->minute) * 60;
- seconds += interval_start->second - event_start->second;
- seconds += recur_data->recur->interval - 1;
- seconds -= seconds % recur_data->recur->interval;
- cal_obj_time_add_seconds (cotime, seconds);
- }
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_SECOND) >= 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_SECOND) >= 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-static gboolean
-cal_obj_secondly_find_next_position (CalObjTime *cotime,
- CalObjTime *event_end,
- RecurData *recur_data,
- CalObjTime *interval_end)
-{
- cal_obj_time_add_seconds (cotime, recur_data->recur->interval);
-
- if (event_end && cal_obj_time_compare (cotime, event_end,
- CALOBJ_SECOND) >= 0)
- return TRUE;
- if (interval_end && cal_obj_time_compare (cotime, interval_end,
- CALOBJ_SECOND) >= 0)
- return TRUE;
-
- return FALSE;
-}
-
-
-
-
-
-/* If the BYMONTH rule is specified it expands each occurrence in occs, by
- using each of the months in the bymonth list. */
-static GArray*
-cal_obj_bymonth_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i;
-
- /* If BYMONTH has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bymonth || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->bymonth;
- while (elem) {
- /* NOTE: The day may now be invalid, e.g. 31st Feb. */
- occ->month = GPOINTER_TO_INT (elem->data);
- g_array_append_vals (new_occs, occ, 1);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* If the BYMONTH rule is specified it filters out all occurrences in occs
- which do not match one of the months in the bymonth list. */
-static GArray*
-cal_obj_bymonth_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i;
-
- /* If BYMONTH has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bymonth || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- if (recur_data->months[occ->month])
- g_array_append_vals (new_occs, occ, 1);
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-static GArray*
-cal_obj_byweekno_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ, year_start_cotime, year_end_cotime, cotime;
- GList *elem;
- gint len, i, weekno;
-
- /* If BYWEEKNO has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byweekno || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- /* Find the day that would correspond to week 1 (note that
- week 1 is the first week starting from the specified week
- start day that has 4 days in the new year). */
- year_start_cotime = *occ;
- cal_obj_time_find_first_week (&year_start_cotime,
- recur_data);
-
- /* Find the day that would correspond to week 1 of the next
- year, which we use for -ve week numbers. */
- year_end_cotime = *occ;
- year_end_cotime.year++;
- cal_obj_time_find_first_week (&year_end_cotime,
- recur_data);
-
- /* Now iterate over the week numbers in byweekno, generating a
- new occurrence for each one. */
- elem = recur_data->recur->byweekno;
- while (elem) {
- weekno = GPOINTER_TO_INT (elem->data);
- if (weekno > 0) {
- cotime = year_start_cotime;
- cal_obj_time_add_days (&cotime,
- (weekno - 1) * 7);
- } else {
- cotime = year_end_cotime;
- cal_obj_time_add_days (&cotime, weekno * 7);
- }
-
- /* Skip occurrences if they fall outside the year. */
- if (cotime.year == occ->year)
- g_array_append_val (new_occs, cotime);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-#if 0
-/* This isn't used at present. */
-static GArray*
-cal_obj_byweekno_filter (RecurData *recur_data,
- GArray *occs)
-{
-
- return occs;
-}
-#endif
-
-
-static GArray*
-cal_obj_byyearday_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ, year_start_cotime, year_end_cotime, cotime;
- GList *elem;
- gint len, i, dayno;
-
- /* If BYYEARDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byyearday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- /* Find the day that would correspond to day 1. */
- year_start_cotime = *occ;
- year_start_cotime.month = 0;
- year_start_cotime.day = 1;
-
- /* Find the day that would correspond to day 1 of the next
- year, which we use for -ve day numbers. */
- year_end_cotime = *occ;
- year_end_cotime.year++;
- year_end_cotime.month = 0;
- year_end_cotime.day = 1;
-
- /* Now iterate over the day numbers in byyearday, generating a
- new occurrence for each one. */
- elem = recur_data->recur->byyearday;
- while (elem) {
- dayno = GPOINTER_TO_INT (elem->data);
- if (dayno > 0) {
- cotime = year_start_cotime;
- cal_obj_time_add_days (&cotime, dayno - 1);
- } else {
- cotime = year_end_cotime;
- cal_obj_time_add_days (&cotime, dayno);
- }
-
- /* Skip occurrences if they fall outside the year. */
- if (cotime.year == occ->year)
- g_array_append_val (new_occs, cotime);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* Note: occs must not contain invalid dates, e.g. 31st September. */
-static GArray*
-cal_obj_byyearday_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint yearday, len, i, days_in_year;
-
- /* If BYYEARDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byyearday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- yearday = cal_obj_time_day_of_year (occ);
- if (recur_data->yeardays[yearday]) {
- g_array_append_vals (new_occs, occ, 1);
- } else {
- days_in_year = g_date_is_leap_year (occ->year)
- ? 366 : 365;
- if (recur_data->neg_yeardays[days_in_year + 1
- - yearday])
- g_array_append_vals (new_occs, occ, 1);
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-static GArray*
-cal_obj_bymonthday_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ, month_start_cotime, month_end_cotime, cotime;
- GList *elem;
- gint len, i, dayno;
-
- /* If BYMONTHDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bymonthday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- /* Find the day that would correspond to day 1. */
- month_start_cotime = *occ;
- month_start_cotime.day = 1;
-
- /* Find the day that would correspond to day 1 of the next
- month, which we use for -ve day numbers. */
- month_end_cotime = *occ;
- month_end_cotime.month++;
- month_end_cotime.day = 1;
-
- /* Now iterate over the day numbers in bymonthday, generating a
- new occurrence for each one. */
- elem = recur_data->recur->bymonthday;
- while (elem) {
- dayno = GPOINTER_TO_INT (elem->data);
- if (dayno > 0) {
- cotime = month_start_cotime;
- cal_obj_time_add_days (&cotime, dayno - 1);
- } else {
- cotime = month_end_cotime;
- cal_obj_time_add_days (&cotime, dayno);
- }
-
- /* Skip occurrences if they fall outside the month. */
- if (cotime.month == occ->month)
- g_array_append_val (new_occs, cotime);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-static GArray*
-cal_obj_bymonthday_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i, days_in_month;
-
- /* If BYMONTHDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bymonthday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- if (recur_data->monthdays[occ->day]) {
- g_array_append_vals (new_occs, occ, 1);
- } else {
- days_in_month = time_days_in_month (occ->year,
- occ->month);
- if (recur_data->neg_monthdays[days_in_month + 1
- - occ->day])
- g_array_append_vals (new_occs, occ, 1);
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-static GArray*
-cal_obj_byday_expand_yearly (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i, weekday, week_num;
- gint first_weekday, last_weekday, offset;
- guint16 year;
-
- /* If BYDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->byday;
- while (elem) {
- weekday = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
- week_num = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
-
- year = occ->year;
- if (week_num == 0) {
- /* Expand to every Mon/Tue/etc. in the year. */
- occ->month = 0;
- occ->day = 1;
- first_weekday = cal_obj_time_weekday (occ);
- offset = (weekday + 7 - first_weekday) % 7;
- cal_obj_time_add_days (occ, offset);
-
- while (occ->year == year) {
- g_array_append_vals (new_occs, occ, 1);
- cal_obj_time_add_days (occ, 7);
- }
-
- } else if (week_num > 0) {
- /* Add the nth Mon/Tue/etc. in the year. */
- occ->month = 0;
- occ->day = 1;
- first_weekday = cal_obj_time_weekday (occ);
- offset = (weekday + 7 - first_weekday) % 7;
- offset += (week_num - 1) * 7;
- cal_obj_time_add_days (occ, offset);
- if (occ->year == year)
- g_array_append_vals (new_occs, occ, 1);
-
- } else {
- /* Add the -nth Mon/Tue/etc. in the year. */
- occ->month = 11;
- occ->day = 31;
- last_weekday = cal_obj_time_weekday (occ);
- offset = (last_weekday + 7 - weekday) % 7;
- offset += (week_num - 1) * 7;
- cal_obj_time_add_days (occ, -offset);
- if (occ->year == year)
- g_array_append_vals (new_occs, occ, 1);
- }
-
- /* Reset the year, as we may have gone past the end. */
- occ->year = year;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-static GArray*
-cal_obj_byday_expand_monthly (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i, weekday, week_num;
- gint first_weekday, last_weekday, offset;
- guint16 year;
- guint8 month;
-
- /* If BYDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->byday;
- while (elem) {
- weekday = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
- week_num = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
-
- year = occ->year;
- month = occ->month;
- if (week_num == 0) {
- /* Expand to every Mon/Tue/etc. in the month.*/
- occ->day = 1;
- first_weekday = cal_obj_time_weekday (occ);
- offset = (weekday + 7 - first_weekday) % 7;
- cal_obj_time_add_days (occ, offset);
-
- while (occ->year == year
- && occ->month == month) {
- g_array_append_vals (new_occs, occ, 1);
- cal_obj_time_add_days (occ, 7);
- }
-
- } else if (week_num > 0) {
- /* Add the nth Mon/Tue/etc. in the month. */
- occ->day = 1;
- first_weekday = cal_obj_time_weekday (occ);
- offset = (weekday + 7 - first_weekday) % 7;
- offset += (week_num - 1) * 7;
- cal_obj_time_add_days (occ, offset);
- if (occ->year == year && occ->month == month)
- g_array_append_vals (new_occs, occ, 1);
-
- } else {
- /* Add the -nth Mon/Tue/etc. in the month. */
- occ->day = time_days_in_month (occ->year,
- occ->month);
- last_weekday = cal_obj_time_weekday (occ);
-
- /* This calculates the number of days to step
- backwards from the last day of the month
- to the weekday we want. */
- offset = (last_weekday + 7 - weekday) % 7;
-
- /* This adds on the weeks. */
- offset += (-week_num - 1) * 7;
-
- cal_obj_time_add_days (occ, -offset);
- if (occ->year == year && occ->month == month)
- g_array_append_vals (new_occs, occ, 1);
- }
-
- /* Reset the year & month, as we may have gone past
- the end. */
- occ->year = year;
- occ->month = month;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* Note: occs must not contain invalid dates, e.g. 31st September. */
-static GArray*
-cal_obj_byday_expand_weekly (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i, weekday, week_num;
- gint weekday_offset, new_weekday_offset;
-
- /* If BYDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->byday;
- while (elem) {
- weekday = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
-
- /* FIXME: Currently we just ignore this, but maybe we
- should skip all elements where week_num != 0.
- The spec isn't clear about this. */
- week_num = GPOINTER_TO_INT (elem->data);
- elem = elem->next;
-
- weekday_offset = cal_obj_time_weekday_offset (occ, recur_data->recur);
- new_weekday_offset = (weekday + 7 - recur_data->recur->week_start_day) % 7;
- cal_obj_time_add_days (occ, new_weekday_offset - weekday_offset);
- g_array_append_vals (new_occs, occ, 1);
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* Note: occs must not contain invalid dates, e.g. 31st September. */
-static GArray*
-cal_obj_byday_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i, weekday;
-
- /* If BYDAY has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byday || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- weekday = cal_obj_time_weekday (occ);
-
- /* See if the weekday on its own is set. */
- if (recur_data->weekdays[weekday])
- g_array_append_vals (new_occs, occ, 1);
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-/* If the BYHOUR rule is specified it expands each occurrence in occs, by
- using each of the hours in the byhour list. */
-static GArray*
-cal_obj_byhour_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i;
-
- /* If BYHOUR has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byhour || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->byhour;
- while (elem) {
- occ->hour = GPOINTER_TO_INT (elem->data);
- g_array_append_vals (new_occs, occ, 1);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* If the BYHOUR rule is specified it filters out all occurrences in occs
- which do not match one of the hours in the byhour list. */
-static GArray*
-cal_obj_byhour_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i;
-
- /* If BYHOUR has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byhour || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- if (recur_data->hours[occ->hour])
- g_array_append_vals (new_occs, occ, 1);
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-/* If the BYMINUTE rule is specified it expands each occurrence in occs, by
- using each of the minutes in the byminute list. */
-static GArray*
-cal_obj_byminute_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i;
-
- /* If BYMINUTE has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byminute || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->byminute;
- while (elem) {
- occ->minute = GPOINTER_TO_INT (elem->data);
- g_array_append_vals (new_occs, occ, 1);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* If the BYMINUTE rule is specified it filters out all occurrences in occs
- which do not match one of the minutes in the byminute list. */
-static GArray*
-cal_obj_byminute_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i;
-
- /* If BYMINUTE has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->byminute || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- if (recur_data->minutes[occ->minute])
- g_array_append_vals (new_occs, occ, 1);
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-/* If the BYSECOND rule is specified it expands each occurrence in occs, by
- using each of the seconds in the bysecond list. */
-static GArray*
-cal_obj_bysecond_expand (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- GList *elem;
- gint len, i;
-
- /* If BYSECOND has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bysecond || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
-
- elem = recur_data->recur->bysecond;
- while (elem) {
- occ->second = GPOINTER_TO_INT (elem->data);
- g_array_append_vals (new_occs, occ, 1);
- elem = elem->next;
- }
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-/* If the BYSECOND rule is specified it filters out all occurrences in occs
- which do not match one of the seconds in the bysecond list. */
-static GArray*
-cal_obj_bysecond_filter (RecurData *recur_data,
- GArray *occs)
-{
- GArray *new_occs;
- CalObjTime *occ;
- gint len, i;
-
- /* If BYSECOND has not been specified, or the array is empty, just
- return the array. */
- if (!recur_data->recur->bysecond || occs->len == 0)
- return occs;
-
- new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
-
- len = occs->len;
- for (i = 0; i < len; i++) {
- occ = &g_array_index (occs, CalObjTime, i);
- if (recur_data->seconds[occ->second])
- g_array_append_vals (new_occs, occ, 1);
- }
-
- g_array_free (occs, TRUE);
-
- return new_occs;
-}
-
-
-
-
-
-/* Adds a positive or negative number of months to the given CalObjTime,
- updating the year appropriately so we end up with a valid month.
- Note that the day may be invalid, e.g. 30th Feb. */
-static void
-cal_obj_time_add_months (CalObjTime *cotime,
- gint months)
-{
- guint month, years;
-
- /* We use a guint to avoid overflow on the guint8. */
- month = cotime->month + months;
- cotime->month = month % 12;
- if (month > 0) {
- cotime->year += month / 12;
- } else {
- years = month / 12;
- if (cotime->month != 0) {
- cotime->month += 12;
- years -= 1;
- }
- cotime->year += years;
- }
-}
-
-
-/* Adds a positive or negative number of days to the given CalObjTime,
- updating the month and year appropriately so we end up with a valid day. */
-static void
-cal_obj_time_add_days (CalObjTime *cotime,
- gint days)
-{
- gint day, days_in_month;
-
- /* We use a guint to avoid overflow on the guint8. */
- day = cotime->day;
- day += days;
-
- if (days >= 0) {
- for (;;) {
- days_in_month = time_days_in_month (cotime->year,
- cotime->month);
- if (day <= days_in_month)
- break;
-
- cotime->month++;
- if (cotime->month >= 12) {
- cotime->year++;
- cotime->month = 0;
- }
-
- day -= days_in_month;
- }
-
- cotime->day = (guint8) day;
- } else {
- while (day <= 0) {
- if (cotime->month == 0) {
- cotime->year--;
- cotime->month = 11;
- } else {
- cotime->month--;
- }
-
- days_in_month = time_days_in_month (cotime->year,
- cotime->month);
- day += days_in_month;
- }
-
- cotime->day = (guint8) day;
- }
-}
-
-
-/* Adds a positive or negative number of hours to the given CalObjTime,
- updating the day, month & year appropriately so we end up with a valid
- time. */
-static void
-cal_obj_time_add_hours (CalObjTime *cotime,
- gint hours)
-{
- gint hour, days;
-
- /* We use a gint to avoid overflow on the guint8. */
- hour = cotime->hour + hours;
- cotime->hour = hour % 24;
- if (hour >= 0) {
- if (hour >= 24)
- cal_obj_time_add_days (cotime, hour / 24);
- } else {
- days = hour / 24;
- if (cotime->hour != 0) {
- cotime->hour += 24;
- days -= 1;
- }
- cal_obj_time_add_days (cotime, days);
- }
-}
-
-
-/* Adds a positive or negative number of minutes to the given CalObjTime,
- updating the rest of the CalObjTime appropriately. */
-static void
-cal_obj_time_add_minutes (CalObjTime *cotime,
- gint minutes)
-{
- gint minute, hours;
-
- /* We use a gint to avoid overflow on the guint8. */
- minute = cotime->minute + minutes;
- cotime->minute = minute % 60;
- if (minute >= 0) {
- if (minute >= 60)
- cal_obj_time_add_hours (cotime, minute / 60);
- } else {
- hours = minute / 60;
- if (cotime->minute != 0) {
- cotime->minute += 60;
- hours -= 1;
- }
- cal_obj_time_add_hours (cotime, hours);
- }
-}
-
-
-/* Adds a positive or negative number of seconds to the given CalObjTime,
- updating the rest of the CalObjTime appropriately. */
-static void
-cal_obj_time_add_seconds (CalObjTime *cotime,
- gint seconds)
-{
- gint second, minutes;
-
- /* We use a gint to avoid overflow on the guint8. */
- second = cotime->second + seconds;
- cotime->second = second % 60;
- if (second >= 0) {
- if (second >= 60)
- cal_obj_time_add_minutes (cotime, second / 60);
- } else {
- minutes = second / 60;
- if (cotime->second != 0) {
- cotime->second += 60;
- minutes -= 1;
- }
- cal_obj_time_add_minutes (cotime, minutes);
- }
-}
-
-
-/* Compares 2 CalObjTimes. Returns -1 if the cotime1 is before cotime2, 0 if
- they are the same, or 1 if cotime1 is after cotime2. The comparison type
- specifies which parts of the times we are interested in, e.g. if CALOBJ_DAY
- is used we only want to know if the days are different. */
-static gint
-cal_obj_time_compare (CalObjTime *cotime1,
- CalObjTime *cotime2,
- CalObjTimeComparison type)
-{
- if (cotime1->year < cotime2->year)
- return -1;
- if (cotime1->year > cotime2->year)
- return 1;
-
- if (type == CALOBJ_YEAR)
- return 0;
-
- if (cotime1->month < cotime2->month)
- return -1;
- if (cotime1->month > cotime2->month)
- return 1;
-
- if (type == CALOBJ_MONTH)
- return 0;
-
- if (cotime1->day < cotime2->day)
- return -1;
- if (cotime1->day > cotime2->day)
- return 1;
-
- if (type == CALOBJ_DAY)
- return 0;
-
- if (cotime1->hour < cotime2->hour)
- return -1;
- if (cotime1->hour > cotime2->hour)
- return 1;
-
- if (type == CALOBJ_HOUR)
- return 0;
-
- if (cotime1->minute < cotime2->minute)
- return -1;
- if (cotime1->minute > cotime2->minute)
- return 1;
-
- if (type == CALOBJ_MINUTE)
- return 0;
-
- if (cotime1->second < cotime2->second)
- return -1;
- if (cotime1->second > cotime2->second)
- return 1;
-
- return 0;
-}
-
-
-/* This is the same as the above function, but without the comparison type.
- It is used for qsort(). */
-static gint
-cal_obj_time_compare_func (const void *arg1,
- const void *arg2)
-{
- CalObjTime *cotime1, *cotime2;
- gint retval;
-
- cotime1 = (CalObjTime*) arg1;
- cotime2 = (CalObjTime*) arg2;
-
- if (cotime1->year < cotime2->year)
- retval = -1;
- else if (cotime1->year > cotime2->year)
- retval = 1;
-
- else if (cotime1->month < cotime2->month)
- retval = -1;
- else if (cotime1->month > cotime2->month)
- retval = 1;
-
- else if (cotime1->day < cotime2->day)
- retval = -1;
- else if (cotime1->day > cotime2->day)
- retval = 1;
-
- else if (cotime1->hour < cotime2->hour)
- retval = -1;
- else if (cotime1->hour > cotime2->hour)
- retval = 1;
-
- else if (cotime1->minute < cotime2->minute)
- retval = -1;
- else if (cotime1->minute > cotime2->minute)
- retval = 1;
-
- else if (cotime1->second < cotime2->second)
- retval = -1;
- else if (cotime1->second > cotime2->second)
- retval = 1;
-
- else
- retval = 0;
-
-#if 0
- g_print ("%s - ", cal_obj_time_to_string (cotime1));
- g_print ("%s : %i\n", cal_obj_time_to_string (cotime2), retval);
-#endif
-
- return retval;
-}
-
-
-static gint
-cal_obj_date_only_compare_func (const void *arg1,
- const void *arg2)
-{
- CalObjTime *cotime1, *cotime2;
-
- cotime1 = (CalObjTime*) arg1;
- cotime2 = (CalObjTime*) arg2;
-
- if (cotime1->year < cotime2->year)
- return -1;
- if (cotime1->year > cotime2->year)
- return 1;
-
- if (cotime1->month < cotime2->month)
- return -1;
- if (cotime1->month > cotime2->month)
- return 1;
-
- if (cotime1->day < cotime2->day)
- return -1;
- if (cotime1->day > cotime2->day)
- return 1;
-
- return 0;
-}
-
-
-/* Returns the weekday of the given CalObjTime, from 0 (Mon) - 6 (Sun). */
-static gint
-cal_obj_time_weekday (CalObjTime *cotime)
-{
- GDate date;
- gint weekday;
-
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year);
-
- /* This results in a value of 0 (Monday) - 6 (Sunday). */
- weekday = g_date_get_weekday (&date) - 1;
-
- return weekday;
-}
-
-
-/* Returns the weekday of the given CalObjTime, from 0 - 6. The week start
- day is Monday by default, but can be set in the recurrence rule. */
-static gint
-cal_obj_time_weekday_offset (CalObjTime *cotime,
- CalRecurrence *recur)
-{
- GDate date;
- gint weekday, offset;
-
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year);
-
- /* This results in a value of 0 (Monday) - 6 (Sunday). */
- weekday = g_date_get_weekday (&date) - 1;
-
- /* This calculates the offset of our day from the start of the week.
- We just add on a week (to avoid any possible negative values) and
- then subtract the specified week start day, then convert it into a
- value from 0-6. */
- offset = (weekday + 7 - recur->week_start_day) % 7;
-
- return offset;
-}
-
-
-/* Returns the day of the year of the given CalObjTime, from 1 - 366. */
-static gint
-cal_obj_time_day_of_year (CalObjTime *cotime)
-{
- GDate date;
-
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year);
-
- return g_date_get_day_of_year (&date);
-}
-
-
-/* Finds the first week in the given CalObjTime's year, using the same weekday
- as the event start day (i.e. from the RecurData).
- The first week of the year is the first week starting from the specified
- week start day that has 4 days in the new year. It may be in the previous
- year. */
-static void
-cal_obj_time_find_first_week (CalObjTime *cotime,
- RecurData *recur_data)
-{
- GDate date;
- gint weekday, week_start_day, first_full_week_start_offset, offset;
-
- /* Find out the weekday of the 1st of the year, 0 (Mon) - 6 (Sun). */
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, 1, 1, cotime->year);
- weekday = g_date_get_weekday (&date) - 1;
-
- /* Calculate the first day of the year that starts a new week, i.e. the
- first week_start_day after weekday, using 0 = 1st Jan.
- e.g. if the 1st Jan is a Tuesday (1) and week_start_day is a
- Monday (0), the result will be (0 + 7 - 1) % 7 = 6 (7th Jan). */
- week_start_day = recur_data->recur->week_start_day;
- first_full_week_start_offset = (week_start_day + 7 - weekday) % 7;
-
- /* Now see if we have to move backwards 1 week, i.e. if the week
- starts on or after Jan 5th (since the previous week has 4 days in
- this year and so will be the first week of the year). */
- if (first_full_week_start_offset >= 4)
- first_full_week_start_offset -= 7;
-
- /* Now add the days to get to the event's weekday. */
- offset = first_full_week_start_offset + recur_data->weekday_offset;
-
- /* Now move the cotime to the appropriate day. */
- cotime->month = 0;
- cotime->day = 1;
- cal_obj_time_add_days (cotime, offset);
-}
-
-
-static void
-cal_object_time_from_time (CalObjTime *cotime,
- time_t t,
- icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- tt = icaltime_from_timet_with_zone (t, FALSE, zone);
-
- cotime->year = tt.year;
- cotime->month = tt.month - 1;
- cotime->day = tt.day;
- cotime->hour = tt.hour;
- cotime->minute = tt.minute;
- cotime->second = tt.second;
- cotime->flags = FALSE;
-}
-
-
-/* Debugging function to convert a CalObjTime to a string. It uses a static
- buffer so beware. */
-#ifdef CAL_OBJ_DEBUG
-static char*
-cal_obj_time_to_string (CalObjTime *cotime)
-{
- static char buffer[20];
- char *weekdays[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
- " " };
- gint weekday;
-
- weekday = cal_obj_time_weekday (cotime);
-
- sprintf (buffer, "%s %02i/%02i/%04i %02i:%02i:%02i",
- weekdays[weekday],
- cotime->day, cotime->month + 1, cotime->year,
- cotime->hour, cotime->minute, cotime->second);
- return buffer;
-}
-#endif
-
-
-/* This recalculates the end dates for recurrence & exception rules which use
- the COUNT property. If refresh is TRUE it will recalculate all enddates
- for rules which use COUNT. If refresh is FALSE, it will only calculate
- the enddate if it hasn't already been set. It returns TRUE if the component
- was changed, i.e. if the component should be saved at some point.
- We store the enddate in the "X-EVOLUTION-ENDDATE" parameter of the RRULE
- or EXRULE. */
-static gboolean
-cal_recur_ensure_end_dates (CalComponent *comp,
- gboolean refresh,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data)
-{
- GSList *rrules, *exrules, *elem;
- gboolean changed = FALSE;
-
- /* Do the RRULEs. */
- cal_component_get_rrule_property_list (comp, &rrules);
- for (elem = rrules; elem; elem = elem->next) {
- changed |= cal_recur_ensure_rule_end_date (comp, elem->data,
- FALSE, refresh,
- tz_cb, tz_cb_data);
- }
-
- /* Do the EXRULEs. */
- cal_component_get_exrule_property_list (comp, &exrules);
- for (elem = exrules; elem; elem = elem->next) {
- changed |= cal_recur_ensure_rule_end_date (comp, elem->data,
- TRUE, refresh,
- tz_cb, tz_cb_data);
- }
-
- return changed;
-}
-
-
-typedef struct _CalRecurEnsureEndDateData CalRecurEnsureEndDateData;
-struct _CalRecurEnsureEndDateData {
- gint count;
- gint instances;
- time_t end_date;
-};
-
-
-static gboolean
-cal_recur_ensure_rule_end_date (CalComponent *comp,
- icalproperty *prop,
- gboolean exception,
- gboolean refresh,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data)
-{
- struct icalrecurrencetype rule;
- CalRecurEnsureEndDateData cb_data;
-
- if (exception)
- rule = icalproperty_get_exrule (prop);
- else
- rule = icalproperty_get_rrule (prop);
-
- /* If the rule doesn't use COUNT just return. */
- if (rule.count == 0)
- return FALSE;
-
- /* If refresh is FALSE, we check if the enddate is already set, and
- if it is we just return. */
- if (!refresh) {
- if (cal_recur_get_rule_end_date (prop, NULL) != -1)
- return FALSE;
- }
-
- /* Calculate the end date. Note that we initialize end_date to 0, so
- if the RULE doesn't generate COUNT instances we save a time_t of 0.
- Also note that we use the UTC timezone as the default timezone.
- In get_end_date() if the DTSTART is a DATE or floating time, we will
- convert the ENDDATE to the current timezone. */
- cb_data.count = rule.count;
- cb_data.instances = 0;
- cb_data.end_date = 0;
- cal_recur_generate_instances_of_rule (comp, prop, -1, -1,
- cal_recur_ensure_rule_end_date_cb,
- &cb_data, tz_cb, tz_cb_data,
- icaltimezone_get_utc_timezone ());
-
- /* Store the end date in the "X-EVOLUTION-ENDDATE" parameter of the
- rule. */
- cal_recur_set_rule_end_date (prop, cb_data.end_date);
-
- return TRUE;
-}
-
-
-static gboolean
-cal_recur_ensure_rule_end_date_cb (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
-{
- CalRecurEnsureEndDateData *cb_data;
-
- cb_data = (CalRecurEnsureEndDateData*) data;
-
- cb_data->instances++;
-
- if (cb_data->instances == cb_data->count) {
- cb_data->end_date = instance_start;
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* If default_timezone is set, the saved ENDDATE parameter is assumed to be
- in that timezone. This is used when the DTSTART is a DATE or floating
- value, since the RRULE end date will change depending on the timezone that
- it is evaluated in. */
-static time_t
-cal_recur_get_rule_end_date (icalproperty *prop,
- icaltimezone *default_timezone)
-{
- icalparameter *param;
- const char *xname, *xvalue;
- icalvalue *value;
- struct icaltimetype icaltime;
- icaltimezone *zone;
-
- param = icalproperty_get_first_parameter (prop, ICAL_X_PARAMETER);
- while (param) {
- xname = icalparameter_get_xname (param);
- if (xname && !strcmp (xname, EVOLUTION_END_DATE_PARAMETER)) {
- xvalue = icalparameter_get_x (param);
- value = icalvalue_new_from_string (ICAL_DATETIME_VALUE,
- xvalue);
- if (value) {
- icaltime = icalvalue_get_datetime (value);
- icalvalue_free (value);
-
- zone = default_timezone ? default_timezone :
- icaltimezone_get_utc_timezone ();
- return icaltime_as_timet_with_zone (icaltime,
- zone);
- }
- }
-
- param = icalproperty_get_next_parameter (prop,
- ICAL_X_PARAMETER);
- }
-
- return -1;
-}
-
-
-static void
-cal_recur_set_rule_end_date (icalproperty *prop,
- time_t end_date)
-{
- icalparameter *param;
- icalvalue *value;
- icaltimezone *utc_zone;
- struct icaltimetype icaltime;
- const char *end_date_string, *xname;
-
- /* We save the value as a UTC DATE-TIME. */
- utc_zone = icaltimezone_get_utc_timezone ();
- icaltime = icaltime_from_timet_with_zone (end_date, FALSE, utc_zone);
- value = icalvalue_new_datetime (icaltime);
- end_date_string = icalvalue_as_ical_string (value);
- icalvalue_free (value);
-
- /* If we already have an X-EVOLUTION-ENDDATE parameter, set the value
- to the new date-time. */
- param = icalproperty_get_first_parameter (prop, ICAL_X_PARAMETER);
- while (param) {
- xname = icalparameter_get_xname (param);
- if (xname && !strcmp (xname, EVOLUTION_END_DATE_PARAMETER)) {
- icalparameter_set_x (param, end_date_string);
- return;
- }
- param = icalproperty_get_next_parameter (prop, ICAL_X_PARAMETER);
- }
-
- /* Create a new X-EVOLUTION-ENDDATE and add it to the property. */
- param = icalparameter_new_x (end_date_string);
- icalparameter_set_xname (param, EVOLUTION_END_DATE_PARAMETER);
- icalproperty_add_parameter (prop, param);
-}
-
-const char *cal_recur_nth[31] = {
- N_("1st"),
- N_("2nd"),
- N_("3rd"),
- N_("4th"),
- N_("5th"),
- N_("6th"),
- N_("7th"),
- N_("8th"),
- N_("9th"),
- N_("10th"),
- N_("11th"),
- N_("12th"),
- N_("13th"),
- N_("14th"),
- N_("15th"),
- N_("16th"),
- N_("17th"),
- N_("18th"),
- N_("19th"),
- N_("20th"),
- N_("21st"),
- N_("22nd"),
- N_("23rd"),
- N_("24th"),
- N_("25th"),
- N_("26th"),
- N_("27th"),
- N_("28th"),
- N_("29th"),
- N_("30th"),
- N_("31st")
-};
-
diff --git a/calendar/cal-util/cal-recur.h b/calendar/cal-util/cal-recur.h
deleted file mode 100644
index 294107d618..0000000000
--- a/calendar/cal-util/cal-recur.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Evolution calendar recurrence rule functions
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Damon Chaplin <damon@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_RECUR_H
-#define CAL_RECUR_H
-
-#include <glib.h>
-#include <cal-util/cal-component.h>
-
-G_BEGIN_DECLS
-
-typedef gboolean (* CalRecurInstanceFn) (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data);
-
-typedef icaltimezone* (* CalRecurResolveTimezoneFn) (const char *tzid,
- gpointer data);
-
-/*
- * Calls the given callback function for each occurrence of the event that
- * intersects the range between the given start and end times (the end time is
- * not included). Note that the occurrences may start before the given start
- * time.
- *
- * If the callback routine returns FALSE the occurrence generation stops.
- *
- * Both start and end can be -1, in which case we start at the events first
- * instance and continue until it ends, or forever if it has no enddate.
- *
- * The tz_cb is used to resolve references to timezones. It is passed a TZID
- * and should return the icaltimezone* corresponding to that TZID. We need to
- * do this as we access timezones in different ways on the client & server.
- *
- * The default_timezone argument is used for DTSTART or DTEND properties that
- * are DATE values or do not have a TZID (i.e. floating times).
- */
-void cal_recur_generate_instances (CalComponent *comp,
- time_t start,
- time_t end,
- CalRecurInstanceFn cb,
- gpointer cb_data,
- CalRecurResolveTimezoneFn tz_cb,
- gpointer tz_cb_data,
- icaltimezone *default_timezone);
-
-/* Localized nth-day-of-month strings. (Use with _() ) */
-extern const char *cal_recur_nth[31];
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/cal-util/cal-util-marshal.list b/calendar/cal-util/cal-util-marshal.list
deleted file mode 100644
index 77509b1c50..0000000000
--- a/calendar/cal-util/cal-util-marshal.list
+++ /dev/null
@@ -1,9 +0,0 @@
-NONE:INT,INT
-NONE:ENUM,ENUM
-NONE:ENUM,STRING
-NONE:STRING,BOOL,INT,INT
-NONE:STRING,STRING
-NONE:STRING,STRING,STRING
-NONE:POINTER,ENUM
-NONE:POINTER,STRING
-NONE:POINTER,POINTER
diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c
deleted file mode 100644
index f6ad0d4007..0000000000
--- a/calendar/cal-util/cal-util.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/* Evolution calendar utilities and types
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gstrfuncs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-#include "cal-util.h"
-
-
-
-/**
- * cal_obj_instance_list_free:
- * @list: List of #CalObjInstance structures.
- *
- * Frees a list of #CalObjInstance structures.
- **/
-void
-cal_obj_instance_list_free (GList *list)
-{
- CalObjInstance *i;
- GList *l;
-
- for (l = list; l; l = l->next) {
- i = l->data;
-
- g_assert (i != NULL);
- g_assert (i->uid != NULL);
-
- g_free (i->uid);
- g_free (i);
- }
-
- g_list_free (list);
-}
-
-/**
- * cal_obj_uid_list_free:
- * @list: List of strings with unique identifiers.
- *
- * Frees a list of unique identifiers for calendar objects.
- **/
-void
-cal_obj_uid_list_free (GList *list)
-{
- GList *l;
-
- for (l = list; l; l = l->next) {
- char *uid;
-
- uid = l->data;
-
- g_assert (uid != NULL);
- g_free (uid);
- }
-
- g_list_free (list);
-}
-
-icalcomponent *
-cal_util_new_top_level (void)
-{
- icalcomponent *icalcomp;
- icalproperty *prop;
-
- icalcomp = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
-
- /* RFC 2445, section 4.7.1 */
- prop = icalproperty_new_calscale ("GREGORIAN");
- icalcomponent_add_property (icalcomp, prop);
-
- /* RFC 2445, section 4.7.3 */
- prop = icalproperty_new_prodid ("-//Ximian//NONSGML Evolution Calendar//EN");
- icalcomponent_add_property (icalcomp, prop);
-
- /* RFC 2445, section 4.7.4. This is the iCalendar spec version, *NOT*
- * the product version! Do not change this!
- */
- prop = icalproperty_new_version ("2.0");
- icalcomponent_add_property (icalcomp, prop);
-
- return icalcomp;
-}
-
-static char *
-get_line_fn (char *buf, size_t size, void *file)
-{
- return fgets (buf, size, file);
-}
-
-icalcomponent *
-cal_util_parse_ics_file (const char *filename)
-{
- icalparser *parser;
- icalcomponent *icalcomp;
- FILE *file;
-
- file = fopen (filename, "r");
- if (!file)
- return NULL;
-
- parser = icalparser_new ();
- icalparser_set_gen_data (parser, file);
-
- icalcomp = icalparser_parse (parser, get_line_fn);
- icalparser_free (parser);
- fclose (file);
-
- return icalcomp;
-}
-
-/* Computes the range of time in which recurrences should be generated for a
- * component in order to compute alarm trigger times.
- */
-static void
-compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t end,
- time_t *alarm_start, time_t *alarm_end)
-{
- GList *l;
- time_t repeat_time;
-
- *alarm_start = start;
- *alarm_end = end;
-
- repeat_time = 0;
-
- for (l = alarm_uids; l; l = l->next) {
- const char *auid;
- CalComponentAlarm *alarm;
- CalAlarmTrigger trigger;
- struct icaldurationtype *dur;
- time_t dur_time;
- CalAlarmRepeat repeat;
-
- auid = l->data;
- alarm = cal_component_get_alarm (comp, auid);
- g_assert (alarm != NULL);
-
- cal_component_alarm_get_trigger (alarm, &trigger);
- cal_component_alarm_get_repeat (alarm, &repeat);
- cal_component_alarm_free (alarm);
-
- switch (trigger.type) {
- case CAL_ALARM_TRIGGER_NONE:
- case CAL_ALARM_TRIGGER_ABSOLUTE:
- break;
-
- case CAL_ALARM_TRIGGER_RELATIVE_START:
- case CAL_ALARM_TRIGGER_RELATIVE_END:
- dur = &trigger.u.rel_duration;
- dur_time = icaldurationtype_as_int (*dur);
-
- if (repeat.repetitions != 0) {
- int rdur;
-
- rdur = repeat.repetitions * icaldurationtype_as_int (repeat.duration);
- repeat_time = MAX (repeat_time, rdur);
- }
-
- if (dur->is_neg)
- /* If the duration is negative then dur_time
- * will be negative as well; that is why we
- * subtract to expand the range.
- */
- *alarm_end = MAX (*alarm_end, end - dur_time);
- else
- *alarm_start = MIN (*alarm_start, start - dur_time);
-
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-
- *alarm_start -= repeat_time;
-
- g_assert (*alarm_start <= *alarm_end);
-}
-
-/* Closure data to generate alarm occurrences */
-struct alarm_occurrence_data {
- /* These are the info we have */
- GList *alarm_uids;
- time_t start;
- time_t end;
- CalAlarmAction *omit;
-
- /* This is what we compute */
- GSList *triggers;
- int n_triggers;
-};
-
-static void
-add_trigger (struct alarm_occurrence_data *aod, const char *auid, time_t trigger,
- time_t occur_start, time_t occur_end)
-{
- CalAlarmInstance *instance;
-
- instance = g_new (CalAlarmInstance, 1);
- instance->auid = auid;
- instance->trigger = trigger;
- instance->occur_start = occur_start;
- instance->occur_end = occur_end;
-
- aod->triggers = g_slist_prepend (aod->triggers, instance);
- aod->n_triggers++;
-}
-
-/* Callback used from cal_recur_generate_instances(); generates triggers for all
- * of a component's RELATIVE alarms.
- */
-static gboolean
-add_alarm_occurrences_cb (CalComponent *comp, time_t start, time_t end, gpointer data)
-{
- struct alarm_occurrence_data *aod;
- GList *l;
-
- aod = data;
-
- for (l = aod->alarm_uids; l; l = l->next) {
- const char *auid;
- CalComponentAlarm *alarm;
- CalAlarmAction action;
- CalAlarmTrigger trigger;
- CalAlarmRepeat repeat;
- struct icaldurationtype *dur;
- time_t dur_time;
- time_t occur_time, trigger_time;
- int i;
-
- auid = l->data;
- alarm = cal_component_get_alarm (comp, auid);
- g_assert (alarm != NULL);
-
- cal_component_alarm_get_action (alarm, &action);
- cal_component_alarm_get_trigger (alarm, &trigger);
- cal_component_alarm_get_repeat (alarm, &repeat);
- cal_component_alarm_free (alarm);
-
- for (i = 0; aod->omit[i] != -1; i++) {
- if (aod->omit[i] == action)
- break;
- }
- if (aod->omit[i] != -1)
- continue;
-
- if (trigger.type != CAL_ALARM_TRIGGER_RELATIVE_START
- && trigger.type != CAL_ALARM_TRIGGER_RELATIVE_END)
- continue;
-
- dur = &trigger.u.rel_duration;
- dur_time = icaldurationtype_as_int (*dur);
-
- if (trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START)
- occur_time = start;
- else
- occur_time = end;
-
- /* If dur->is_neg is true then dur_time will already be
- * negative. So we do not need to test for dur->is_neg here; we
- * can simply add the dur_time value to the occur_time and get
- * the correct result.
- */
-
- trigger_time = occur_time + dur_time;
-
- /* Add repeating alarms */
-
- if (repeat.repetitions != 0) {
- int i;
- time_t repeat_time;
-
- repeat_time = icaldurationtype_as_int (repeat.duration);
-
- for (i = 0; i < repeat.repetitions; i++) {
- time_t t;
-
- t = trigger_time + (i + 1) * repeat_time;
-
- if (t >= aod->start && t < aod->end)
- add_trigger (aod, auid, t, start, end);
- }
- }
-
- /* Add the trigger itself */
-
- if (trigger_time >= aod->start && trigger_time < aod->end)
- add_trigger (aod, auid, trigger_time, start, end);
- }
-
- return TRUE;
-}
-
-/* Generates the absolute triggers for a component */
-static void
-generate_absolute_triggers (CalComponent *comp, struct alarm_occurrence_data *aod,
- CalRecurResolveTimezoneFn resolve_tzid,
- gpointer user_data,
- icaltimezone *default_timezone)
-{
- GList *l;
- CalComponentDateTime dt_start, dt_end;
-
- cal_component_get_dtstart (comp, &dt_start);
- cal_component_get_dtend (comp, &dt_end);
-
- for (l = aod->alarm_uids; l; l = l->next) {
- const char *auid;
- CalComponentAlarm *alarm;
- CalAlarmAction action;
- CalAlarmRepeat repeat;
- CalAlarmTrigger trigger;
- time_t abs_time;
- time_t occur_start, occur_end;
- icaltimezone *zone;
- int i;
-
- auid = l->data;
- alarm = cal_component_get_alarm (comp, auid);
- g_assert (alarm != NULL);
-
- cal_component_alarm_get_action (alarm, &action);
- cal_component_alarm_get_trigger (alarm, &trigger);
- cal_component_alarm_get_repeat (alarm, &repeat);
- cal_component_alarm_free (alarm);
-
- for (i = 0; aod->omit[i] != -1; i++) {
- if (aod->omit[i] == action)
- break;
- }
- if (aod->omit[i] != -1)
- continue;
-
- if (trigger.type != CAL_ALARM_TRIGGER_ABSOLUTE)
- continue;
-
- /* Absolute triggers are always in UTC; see RFC 2445 section 4.8.6.3 */
- zone = icaltimezone_get_utc_timezone ();
-
- abs_time = icaltime_as_timet_with_zone (trigger.u.abs_time, zone);
-
- /* No particular occurrence, so just use the times from the component */
-
- if (dt_start.value) {
- if (dt_start.tzid && !dt_start.value->is_date)
- zone = (* resolve_tzid) (dt_start.tzid, user_data);
- else
- zone = default_timezone;
-
- occur_start = icaltime_as_timet_with_zone (*dt_start.value, zone);
- } else
- occur_start = -1;
-
- if (dt_end.value) {
- if (dt_end.tzid && !dt_end.value->is_date)
- zone = (* resolve_tzid) (dt_end.tzid, user_data);
- else
- zone = default_timezone;
-
- occur_end = icaltime_as_timet_with_zone (*dt_end.value, zone);
- } else
- occur_end = -1;
-
- /* Add repeating alarms */
-
- if (repeat.repetitions != 0) {
- int i;
- time_t repeat_time;
-
- repeat_time = icaldurationtype_as_int (repeat.duration);
-
- for (i = 0; i < repeat.repetitions; i++) {
- time_t t;
-
- t = abs_time + (i + 1) * repeat_time;
-
- if (t >= aod->start && t < aod->end)
- add_trigger (aod, auid, t, occur_start, occur_end);
- }
- }
-
- /* Add the trigger itself */
-
- if (abs_time >= aod->start && abs_time < aod->end)
- add_trigger (aod, auid, abs_time, occur_start, occur_end);
- }
-
- cal_component_free_datetime (&dt_start);
- cal_component_free_datetime (&dt_end);
-}
-
-/* Compares two alarm instances; called from g_slist_sort() */
-static gint
-compare_alarm_instance (gconstpointer a, gconstpointer b)
-{
- const CalAlarmInstance *aia, *aib;
-
- aia = a;
- aib = b;
-
- if (aia->trigger < aib->trigger)
- return -1;
- else if (aia->trigger > aib->trigger)
- return 1;
- else
- return 0;
-}
-
-/**
- * cal_util_generate_alarms_for_comp
- * @comp: the CalComponent to generate alarms from
- * @start: start time
- * @end: end time
- * @resolve_tzid: callback for resolving timezones
- * @user_data: data to be passed to the resolve_tzid callback
- * @default_timezone: the timezone used to resolve DATE and floating DATE-TIME
- * values.
- *
- * Generates alarm instances for a calendar component. Returns the instances
- * structure, or NULL if no alarm instances occurred in the specified time
- * range.
- */
-CalComponentAlarms *
-cal_util_generate_alarms_for_comp (CalComponent *comp,
- time_t start,
- time_t end,
- CalAlarmAction *omit,
- CalRecurResolveTimezoneFn resolve_tzid,
- gpointer user_data,
- icaltimezone *default_timezone)
-{
- GList *alarm_uids;
- time_t alarm_start, alarm_end;
- struct alarm_occurrence_data aod;
- CalComponentAlarms *alarms;
-
- if (!cal_component_has_alarms (comp))
- return NULL;
-
- alarm_uids = cal_component_get_alarm_uids (comp);
- compute_alarm_range (comp, alarm_uids, start, end, &alarm_start, &alarm_end);
-
- aod.alarm_uids = alarm_uids;
- aod.start = start;
- aod.end = end;
- aod.omit = omit;
- aod.triggers = NULL;
- aod.n_triggers = 0;
-
- cal_recur_generate_instances (comp, alarm_start, alarm_end,
- add_alarm_occurrences_cb, &aod,
- resolve_tzid, user_data,
- default_timezone);
-
- /* We add the ABSOLUTE triggers separately */
- generate_absolute_triggers (comp, &aod, resolve_tzid, user_data, default_timezone);
-
- if (aod.n_triggers == 0)
- return NULL;
-
- /* Create the component alarm instances structure */
-
- alarms = g_new (CalComponentAlarms, 1);
- alarms->comp = comp;
- g_object_ref (G_OBJECT (alarms->comp));
- alarms->alarms = g_slist_sort (aod.triggers, compare_alarm_instance);
-
- return alarms;
-}
-
-/**
- * cal_util_generate_alarms_for_list
- * @comps: list of CalComponent's
- * @start: start time
- * @end: end time
- * @comp_alarms: list to be returned
- * @resolve_tzid: callback for resolving timezones
- * @user_data: data to be passed to the resolve_tzid callback
- * @default_timezone: the timezone used to resolve DATE and floating DATE-TIME
- * values.
- *
- * Iterates through all the components in the comps list and generates alarm
- * instances for them; putting them in the comp_alarms list.
- *
- * Returns: the number of elements it added to that list.
- */
-int
-cal_util_generate_alarms_for_list (GList *comps,
- time_t start,
- time_t end,
- CalAlarmAction *omit,
- GSList **comp_alarms,
- CalRecurResolveTimezoneFn resolve_tzid,
- gpointer user_data,
- icaltimezone *default_timezone)
-{
- GList *l;
- int n;
-
- n = 0;
-
- for (l = comps; l; l = l->next) {
- CalComponent *comp;
- CalComponentAlarms *alarms;
-
- comp = CAL_COMPONENT (l->data);
- alarms = cal_util_generate_alarms_for_comp (comp, start, end, omit, resolve_tzid, user_data, default_timezone);
-
- if (alarms) {
- *comp_alarms = g_slist_prepend (*comp_alarms, alarms);
- n++;
- }
- }
-
- return n;
-}
-
-
-/* Converts an iCalendar PRIORITY value to a translated string. Any unknown
- priority value (i.e. not 0-9) will be returned as "" (undefined). */
-char *
-cal_util_priority_to_string (int priority)
-{
- char *retval;
-
- if (priority <= 0)
- retval = "";
- else if (priority <= 4)
- retval = _("High");
- else if (priority == 5)
- retval = _("Normal");
- else if (priority <= 9)
- retval = _("Low");
- else
- retval = "";
-
- return retval;
-}
-
-
-/* Converts a translated priority string to an iCalendar priority value.
- Returns -1 if the priority string is not valid. */
-int
-cal_util_priority_from_string (const char *string)
-{
- int priority;
-
- /* An empty string is the same as 'None'. */
- if (!string || !string[0] || !g_strcasecmp (string, _("Undefined")))
- priority = 0;
- else if (!g_strcasecmp (string, _("High")))
- priority = 3;
- else if (!g_strcasecmp (string, _("Normal")))
- priority = 5;
- else if (!g_strcasecmp (string, _("Low")))
- priority = 7;
- else
- priority = -1;
-
- return priority;
-}
-
-char *
-cal_util_expand_uri (char *uri, gboolean tasks)
-{
- return g_strdup (uri);
-}
-
-/* callback for icalcomponent_foreach_tzid */
-typedef struct {
- icalcomponent *vcal_comp;
- icalcomponent *icalcomp;
-} ForeachTzidData;
-
-static void
-add_timezone_cb (icalparameter *param, void *data)
-{
- icaltimezone *tz;
- const char *tzid;
- icalcomponent *vtz_comp;
- ForeachTzidData *f_data = (ForeachTzidData *) data;
-
- tzid = icalparameter_get_tzid (param);
- if (!tzid)
- return;
-
- tz = icalcomponent_get_timezone (f_data->vcal_comp, tzid);
- if (tz)
- return;
-
- tz = icalcomponent_get_timezone (f_data->icalcomp, tzid);
- if (!tz) {
- tz = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (!tz)
- return;
- }
-
- vtz_comp = icaltimezone_get_component (tz);
- if (!vtz_comp)
- return;
-
- icalcomponent_add_component (f_data->vcal_comp,
- icalcomponent_new_clone (vtz_comp));
-}
-
-/* Adds VTIMEZONE components to a VCALENDAR for all tzid's
- * in the given CalComponent. */
-void
-cal_util_add_timezones_from_component (icalcomponent *vcal_comp,
- icalcomponent *icalcomp)
-{
- ForeachTzidData f_data;
-
- g_return_if_fail (vcal_comp != NULL);
- g_return_if_fail (icalcomp != NULL);;
-
- f_data.vcal_comp = vcal_comp;
- f_data.icalcomp = icalcomp;
- icalcomponent_foreach_tzid (icalcomp, add_timezone_cb, &f_data);
-}
-
-gboolean
-cal_util_component_is_instance (icalcomponent *icalcomp)
-{
- icalproperty *prop;
-
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
- return prop ? TRUE : FALSE;
-}
-
-gboolean
-cal_util_component_has_alarms (icalcomponent *icalcomp)
-{
- icalcomponent *alarm;
-
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- alarm = icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT);
- return alarm ? TRUE : FALSE;
-}
-
-gboolean
-cal_util_component_has_organizer (icalcomponent *icalcomp)
-{
- icalproperty *prop;
-
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- prop = icalcomponent_get_first_property (icalcomp, ICAL_ORGANIZER_PROPERTY);
- return prop ? TRUE : FALSE;
-}
-
-gboolean
-cal_util_component_has_recurrences (icalcomponent *icalcomp)
-{
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- return cal_util_component_has_rdates (icalcomp) || cal_util_component_has_rrules (icalcomp);
-}
-
-gboolean
-cal_util_component_has_rdates (icalcomponent *icalcomp)
-{
- icalproperty *prop;
-
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- prop = icalcomponent_get_first_property (icalcomp, ICAL_RDATE_PROPERTY);
- return prop ? TRUE : FALSE;
-}
-
-gboolean
-cal_util_component_has_rrules (icalcomponent *icalcomp)
-{
- icalproperty *prop;
-
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- prop = icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY);
- return prop ? TRUE : FALSE;
-}
-
-gboolean
-cal_util_event_dates_match (icalcomponent *icalcomp1, icalcomponent *icalcomp2)
-{
- struct icaltimetype c1_dtstart, c1_dtend, c2_dtstart, c2_dtend;
-
- g_return_val_if_fail (icalcomp1 != NULL, FALSE);
- g_return_val_if_fail (icalcomp2 != NULL, FALSE);
-
- c1_dtstart = icalcomponent_get_dtstart (icalcomp1);
- c1_dtend = icalcomponent_get_dtend (icalcomp1);
- c2_dtstart = icalcomponent_get_dtstart (icalcomp2);
- c2_dtend = icalcomponent_get_dtend (icalcomp2);
-
- /* if either value is NULL, they must both be NULL to match */
- if (icaltime_is_valid_time (c1_dtstart) || icaltime_is_valid_time (c2_dtstart)) {
- if (!(icaltime_is_valid_time (c1_dtstart) && icaltime_is_valid_time (c2_dtstart)))
- return FALSE;
- } else {
- if (icaltime_compare (c1_dtstart, c2_dtstart))
- return FALSE;
- }
-
- if (icaltime_is_valid_time (c1_dtend) || icaltime_is_valid_time (c2_dtend)) {
- if (!(icaltime_is_valid_time (c1_dtend) && icaltime_is_valid_time (c2_dtend)))
- return FALSE;
- } else {
- if (icaltime_compare (c1_dtend, c2_dtend))
- return FALSE;
- }
-
-
-
- /* now match the timezones */
- if (!(!c1_dtstart.zone && !c2_dtstart.zone) ||
- (c1_dtstart.zone && c2_dtstart.zone &&
- !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtstart.zone),
- icaltimezone_get_tzid ((icaltimezone *) c2_dtstart.zone))))
- return FALSE;
-
- if (!(!c1_dtend.zone && !c2_dtend.zone) ||
- (c1_dtend.zone && c2_dtend.zone &&
- !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtend.zone),
- icaltimezone_get_tzid ((icaltimezone *) c2_dtend.zone))))
- return FALSE;
-
- return TRUE;
-}
-
-/* Individual instances management */
-
-struct instance_data {
- time_t start;
- gboolean found;
-};
-
-static void
-check_instance (icalcomponent *comp, struct icaltime_span span, void *data)
-{
- struct instance_data *instance = data;
-
- if (span.start == instance->start)
- instance->found = TRUE;
-}
-
-/**
- * cal_util_construct_instance:
- * @icalcomp: a recurring #icalcomponent
- * @rid: the RECURRENCE-ID to construct a component for
- *
- * This checks that @rid indicates a valid recurrence of @icalcomp, and
- * if so, generates a copy of @comp containing a RECURRENCE-ID of @rid.
- *
- * Return value: the instance, or %NULL
- **/
-icalcomponent *
-cal_util_construct_instance (icalcomponent *icalcomp,
- struct icaltimetype rid)
-{
- struct instance_data instance;
- struct icaltimetype start, end;
-
- g_return_val_if_fail (icalcomp != NULL, NULL);
-
- /* Make sure this is really recurring */
- if (!icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY) &&
- !icalcomponent_get_first_property (icalcomp, ICAL_RDATE_PROPERTY))
- return NULL;
-
- /* Make sure the specified instance really exists */
- /* FIXME: does the libical recurrence code work correctly now? */
- start = icaltime_convert_to_zone (rid, icaltimezone_get_utc_timezone ());
- end = start;
- icaltime_adjust (&end, 0, 0, 0, 1);
-
- instance.start = icaltime_as_timet (start);
- instance.found = FALSE;
- icalcomponent_foreach_recurrence (icalcomp, start, end,
- check_instance, &instance);
- if (!instance.found)
- return NULL;
-
- /* Make the instance */
- icalcomp = icalcomponent_new_clone (icalcomp);
- icalcomponent_set_recurrenceid (icalcomp, rid);
-
- return icalcomp;
-}
-
-static inline gboolean
-time_matches_rid (struct icaltimetype itt, struct icaltimetype rid, CalObjModType mod)
-{
- int compare;
-
- compare = icaltime_compare (itt, rid);
- if (compare == 0)
- return TRUE;
- else if (compare < 0 && (mod & CALOBJ_MOD_THISANDPRIOR))
- return TRUE;
- else if (compare > 0 && (mod & CALOBJ_MOD_THISANDFUTURE))
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * cal_util_remove_instances:
- * @icalcomp: a (recurring) #icalcomponent
- * @rid: the base RECURRENCE-ID to remove
- * @mod: how to interpret @rid
- *
- * Removes one or more instances from @comp according to @rid and @mod.
- *
- * FIXME: should probably have a return value indicating whether or not
- * @icalcomp still has any instances
- **/
-void
-cal_util_remove_instances (icalcomponent *icalcomp,
- struct icaltimetype rid,
- CalObjModType mod)
-{
- icalproperty *prop;
- struct icaltimetype itt, recur;
- struct icalrecurrencetype rule;
- icalrecur_iterator *iter;
- struct instance_data instance;
-
- g_return_if_fail (icalcomp != NULL);
- g_return_if_fail (mod != CALOBJ_MOD_ALL);
-
- /* First remove RDATEs and EXDATEs in the indicated range. */
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_RDATE_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_RDATE_PROPERTY)) {
- struct icaldatetimeperiodtype period;
-
- period = icalproperty_get_rdate (prop);
- if (time_matches_rid (period.time, rid, mod))
- icalcomponent_remove_property (icalcomp, prop);
- }
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_EXDATE_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_EXDATE_PROPERTY)) {
- itt = icalproperty_get_exdate (prop);
- if (time_matches_rid (itt, rid, mod))
- icalcomponent_remove_property (icalcomp, prop);
- }
-
- /* If we're only removing one instance, just add an EXDATE. */
- if (mod == CALOBJ_MOD_THIS) {
- prop = icalproperty_new_exdate (rid);
- icalcomponent_add_property (icalcomp, prop);
- return;
- }
-
- /* Otherwise, iterate through RRULEs */
- /* FIXME: this may generate duplicate EXRULEs */
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_RRULE_PROPERTY)) {
- rule = icalproperty_get_rrule (prop);
-
- iter = icalrecur_iterator_new (rule, rid);
- recur = icalrecur_iterator_next (iter);
-
- if (mod & CALOBJ_MOD_THISANDFUTURE) {
- /* If there is a recurrence on or after rid,
- * use the UNTIL parameter to truncate the rule
- * at rid.
- */
- if (!icaltime_is_null_time (recur)) {
- rule.count = 0;
- rule.until = rid;
- icaltime_adjust (&rule.until, 0, 0, 0, -1);
- icalproperty_set_rrule (prop, rule);
- }
- } else {
- /* (If recur == rid, skip to the next occurrence) */
- if (icaltime_compare (recur, rid) == 0)
- recur = icalrecur_iterator_next (iter);
-
- /* If there is a recurrence after rid, add
- * an EXRULE to block instances up to rid.
- * Otherwise, just remove the RRULE.
- */
- if (!icaltime_is_null_time (recur)) {
- rule.count = 0;
- /* iCalendar says we should just use rid
- * here, but Outlook/Exchange handle
- * UNTIL incorrectly.
- */
- rule.until = icaltime_add (rid, icalcomponent_get_duration (icalcomp));
- prop = icalproperty_new_exrule (rule);
- icalcomponent_add_property (icalcomp, prop);
- } else
- icalcomponent_remove_property (icalcomp, prop);
- }
-
- icalrecur_iterator_free (iter);
- }
-}
diff --git a/calendar/cal-util/cal-util.h b/calendar/cal-util/cal-util.h
deleted file mode 100644
index 0946380b36..0000000000
--- a/calendar/cal-util/cal-util.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Evolution calendar utilities and types
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_UTIL_H
-#define CAL_UTIL_H
-
-#include <libical/ical.h>
-#include <time.h>
-#include <glib.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/cal-recur.h>
-
-G_BEGIN_DECLS
-
-
-
-/* Instance of a calendar object. This can be an actual occurrence, a
- * recurrence, or an alarm trigger of a `real' calendar object.
- */
-typedef struct {
- char *uid; /* UID of the object */
- time_t start; /* Start time of instance */
- time_t end; /* End time of instance */
-} CalObjInstance;
-
-void cal_obj_instance_list_free (GList *list);
-
-/* Used for multiple UID queries */
-typedef enum {
- CALOBJ_TYPE_EVENT = 1 << 0,
- CALOBJ_TYPE_TODO = 1 << 1,
- CALOBJ_TYPE_JOURNAL = 1 << 2,
- CALOBJ_TYPE_ANY = 0x07
-} CalObjType;
-
-/* Used for modifying objects */
-typedef enum {
- CALOBJ_MOD_THIS = 1 << 0,
- CALOBJ_MOD_THISANDPRIOR = 1 << 1,
- CALOBJ_MOD_THISANDFUTURE = 1 << 2,
- CALOBJ_MOD_ALL = 0x07
-} CalObjModType;
-
-/* Used for mode stuff */
-typedef enum {
- CAL_MODE_INVALID = -1,
- CAL_MODE_LOCAL = 1 << 0,
- CAL_MODE_REMOTE = 1 << 1,
- CAL_MODE_ANY = 0x07
-} CalMode;
-
-void cal_obj_uid_list_free (GList *list);
-
-icalcomponent *cal_util_new_top_level (void);
-
-icalcomponent *cal_util_parse_ics_file (const char *filename);
-
-CalComponentAlarms *cal_util_generate_alarms_for_comp (CalComponent *comp,
- time_t start,
- time_t end,
- CalAlarmAction *omit,
- CalRecurResolveTimezoneFn resolve_tzid,
- gpointer user_data,
- icaltimezone *default_timezone);
-int cal_util_generate_alarms_for_list (GList *comps,
- time_t start,
- time_t end,
- CalAlarmAction *omit,
- GSList **comp_alarms,
- CalRecurResolveTimezoneFn resolve_tzid,
- gpointer user_data,
- icaltimezone *default_timezone);
-
-icaltimezone *cal_util_resolve_tzid (const char *tzid, gpointer data);
-
-char *cal_util_priority_to_string (int priority);
-int cal_util_priority_from_string (const char *string);
-
-char *cal_util_expand_uri (char *uri, gboolean tasks);
-
-void cal_util_add_timezones_from_component (icalcomponent *vcal_comp,
- icalcomponent *icalcomp);
-
-gboolean cal_util_component_is_instance (icalcomponent *icalcomp);
-gboolean cal_util_component_has_alarms (icalcomponent *icalcomp);
-gboolean cal_util_component_has_organizer (icalcomponent *icalcomp);
-gboolean cal_util_component_has_recurrences (icalcomponent *icalcomp);
-gboolean cal_util_component_has_rdates (icalcomponent *icalcomp);
-gboolean cal_util_component_has_rrules (icalcomponent *icalcomp);
-
-gboolean cal_util_event_dates_match (icalcomponent *icalcomp1, icalcomponent *icalcomp2);
-
-/* The static capabilities to be supported by backends */
-#define CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT "no-alarm-repeat"
-#define CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS "no-audio-alarms"
-#define CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS "no-display-alarms"
-#define CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS "no-email-alarms"
-#define CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS "no-procedure-alarms"
-#define CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT "no-task-assignment"
-#define CAL_STATIC_CAPABILITY_NO_THISANDFUTURE "no-thisandfuture"
-#define CAL_STATIC_CAPABILITY_NO_THISANDPRIOR "no-thisandprior"
-#define CAL_STATIC_CAPABILITY_NO_TRANSPARENCY "no-transparency"
-#define CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY "one-alarm-only"
-#define CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND "organizer-must-attend"
-#define CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS "organizer-not-email-address"
-#define CAL_STATIC_CAPABILITY_REMOVE_ALARMS "remove-alarms"
-#define CAL_STATIC_CAPABILITY_SAVE_SCHEDULES "save-schedules"
-
-/* Recurrent events. Management for instances */
-icalcomponent *cal_util_construct_instance (icalcomponent *icalcomp,
- struct icaltimetype rid);
-void cal_util_remove_instances (icalcomponent *icalcomp,
- struct icaltimetype rid,
- CalObjModType mod);
-
-G_END_DECLS
-
-#endif
-
diff --git a/calendar/cal-util/test-recur.c b/calendar/cal-util/test-recur.c
deleted file mode 100644
index 03f19b52bd..0000000000
--- a/calendar/cal-util/test-recur.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This tests the recurrence rule expansion functions.
- *
- * NOTE: currently it starts from the event start date and continues
- * until all recurrence rules/dates end or we reach MAX_OCCURRENCES
- * occurrences. So it does not test generating occurrences for a specific
- * interval. A nice addition might be to do this automatically and compare
- * the results from the complete set to ensure they match.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtkmain.h>
-#include <cal-util/cal-recur.h>
-#include <cal-util/cal-util.h>
-
-
-/* Since events can recur infinitely, we set a limit to the number of
- occurrences we output. */
-#define MAX_OCCURRENCES 1000
-
-static void usage (void);
-static void generate_occurrences (icalcomponent *comp);
-static gboolean occurrence_cb (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data);
-
-
-int
-main (int argc,
- char *argv[])
-{
- gchar *filename;
- icalcomponent *icalcomp;
-
- gtk_init (&argc, &argv);
-
- if (argc != 2)
- usage ();
-
- filename = argv[1];
-
- icalcomp = cal_util_parse_ics_file (filename);
- if (icalcomp)
- generate_occurrences (icalcomp);
-
- return 0;
-}
-
-
-static void
-usage (void)
-{
- g_print ("Usage: test-recur <filename>\n");
- exit (1);
-}
-
-
-/* This resolves any TZIDs in the components. The VTIMEZONEs must be in the
- file we are reading. */
-static icaltimezone*
-resolve_tzid_cb (const char *tzid,
- gpointer user_data)
-{
- icalcomponent *vcalendar_comp = user_data;
-
- if (!tzid || !tzid[0])
- return NULL;
- else if (!strcmp (tzid, "UTC"))
- return icaltimezone_get_utc_timezone ();
-
- return icalcomponent_get_timezone (vcalendar_comp, tzid);
-}
-
-
-static void
-generate_occurrences (icalcomponent *icalcomp)
-{
- icalcompiter iter;
- icaltimezone *default_timezone;
-
- /* This is the timezone we will use for DATE and floating values. */
- default_timezone = icaltimezone_get_utc_timezone ();
-
- for (iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT);
- icalcompiter_deref (&iter) != NULL;
- icalcompiter_next (&iter)) {
- icalcomponent *tmp_icalcomp;
- CalComponent *comp;
- icalcomponent_kind kind;
- gint occurrences;
-
- tmp_icalcomp = icalcompiter_deref (&iter);
- kind = icalcomponent_isa (tmp_icalcomp);
-
- if (!(kind == ICAL_VEVENT_COMPONENT
- || kind == ICAL_VTODO_COMPONENT
- || kind == ICAL_VJOURNAL_COMPONENT))
- continue;
-
- comp = cal_component_new ();
-
- if (!cal_component_set_icalcomponent (comp, tmp_icalcomp))
- continue;
-
- g_print ("#############################################################################\n");
- g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp));
- g_print ("Instances:\n");
-
- occurrences = 0;
- /* I use specific times when I am trying to pin down a bug seen
- in one of the calendar views. */
-#if 0
- cal_recur_generate_instances (comp, 982022400, 982108800,
- occurrence_cb, &occurrences,
- resolve_tzid_cb, icalcomp,
- default_timezone);
-#else
- cal_recur_generate_instances (comp, -1, -1,
- occurrence_cb, &occurrences,
- resolve_tzid_cb, icalcomp,
- default_timezone);
-#endif
-
- /* Print the component again so we can see the
- X-EVOLUTION-ENDDATE parameter (only set if COUNT is used).
- */
- g_print ("#############################################################################\n");
-#if 0
- g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp));
-#endif
- }
-}
-
-
-static gboolean
-occurrence_cb (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
-{
- char start[32], finish[32];
- gint *occurrences;
-
- occurrences = (gint*) data;
-
- strcpy (start, ctime (&instance_start));
- start[24] = '\0';
- strcpy (finish, ctime (&instance_end));
- finish[24] = '\0';
-
- g_print ("%s - %s\n", start, finish);
-
- (*occurrences)++;
- return (*occurrences == MAX_OCCURRENCES) ? FALSE : TRUE;
-}
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
deleted file mode 100644
index 32ba50c4ae..0000000000
--- a/calendar/cal-util/timeutil.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- *
- * Authors: Federico Mena <federico@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- */
-
-#include <string.h>
-#include <ctype.h>
-#include <glib.h>
-#include "timeutil.h"
-
-
-
-#define REFORMATION_DAY 639787 /* First day of the reformation, counted from 1 Jan 1 */
-#define MISSING_DAYS 11 /* They corrected out 11 days */
-#define THURSDAY 4 /* First day of reformation */
-#define SATURDAY 6 /* Offset value; 1 Jan 1 was a Saturday */
-
-
-/* Number of days in a month, using 0 (Jan) to 11 (Dec). For leap years,
- add 1 to February (month 1). */
-static const int days_in_month[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-
-
-/**************************************************************************
- * time_t manipulation functions.
- *
- * NOTE: these use the Unix timezone functions like mktime() and localtime()
- * and so should not be used in Evolution. New Evolution code should use
- * icaltimetype values rather than time_t values wherever possible.
- **************************************************************************/
-
-/* Adds a day onto the time, using local time.
- Note that if clocks go forward due to daylight savings time, there are
- some non-existent local times, so the hour may be changed to make it a
- valid time. This also means that it may not be wise to keep calling
- time_add_day() to step through a certain period - if the hour gets changed
- to make it valid time, any further calls to time_add_day() will also return
- this hour, which may not be what you want. */
-time_t
-time_add_day (time_t time, int days)
-{
- struct tm *tm;
-
- tm = localtime (&time);
- tm->tm_mday += days;
- tm->tm_isdst = -1;
-
- return mktime (tm);
-}
-
-time_t
-time_add_week (time_t time, int weeks)
-{
- return time_add_day (time, weeks * 7);
-}
-
-/* Returns the start of the day, according to the local time. */
-time_t
-time_day_begin (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-/* Returns the end of the day, according to the local time. */
-time_t
-time_day_end (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- tm.tm_mday++;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-
-/**************************************************************************
- * time_t manipulation functions, using timezones in libical.
- *
- * NOTE: these are only here to make the transition to the timezone
- * functions easier. New code should use icaltimetype values rather than
- * time_t values wherever possible.
- **************************************************************************/
-
-
-/* Adds or subtracts a number of days to/from the given time_t value, using
- the given timezone.
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_add_day_with_zone (time_t time, int days, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Add/subtract the number of days. */
- icaltime_adjust (&tt, days, 0, 0, 0);
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Adds or subtracts a number of weeks to/from the given time_t value, using
- the given timezone.
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_add_week_with_zone (time_t time, int weeks, icaltimezone *zone)
-{
- return time_add_day_with_zone (time, weeks * 7, zone);
-}
-
-
-/* Adds or subtracts a number of months to/from the given time_t value, using
- the given timezone.
-
- If the day would be off the end of the month (e.g. adding 1 month to
- 30th January, would lead to an invalid day, 30th February), it moves it
- down to the last day in the month, e.g. 28th Feb (or 29th in a leap year.)
-
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_add_month_with_zone (time_t time, int months, icaltimezone *zone)
-{
- struct icaltimetype tt;
- int day, days_in_month;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Add on the number of months. */
- tt.month += months;
-
- /* Save the day, and set it to 1, so we don't overflow into the next
- month. */
- day = tt.day;
- tt.day = 1;
-
- /* Normalize it, fixing any month overflow. */
- tt = icaltime_normalize (tt);
-
- /* If we go past the end of a month, set it to the last day. */
- days_in_month = time_days_in_month (tt.year, tt.month - 1);
- if (day > days_in_month)
- day = days_in_month;
-
- tt.day = day;
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Returns the start of the year containing the given time_t, using the given
- timezone.
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_year_begin_with_zone (time_t time, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Set it to the start of the year. */
- tt.month = 1;
- tt.day = 1;
- tt.hour = 0;
- tt.minute = 0;
- tt.second = 0;
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Returns the start of the month containing the given time_t, using the given
- timezone.
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_month_begin_with_zone (time_t time, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Set it to the start of the month. */
- tt.day = 1;
- tt.hour = 0;
- tt.minute = 0;
- tt.second = 0;
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Returns the start of the week containing the given time_t, using the given
- timezone. week_start_day should use the same values as mktime(),
- i.e. 0 (Sun) to 6 (Sat).
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_week_begin_with_zone (time_t time, int week_start_day, icaltimezone *zone)
-{
- struct icaltimetype tt;
- int weekday, offset;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Get the weekday. */
- weekday = time_day_of_week (tt.day, tt.month - 1, tt.year);
-
- /* Calculate the current offset from the week start day. */
- offset = (weekday + 7 - week_start_day) % 7;
-
- /* Set it to the start of the month. */
- tt.day -= offset;
- tt.hour = 0;
- tt.minute = 0;
- tt.second = 0;
-
- /* Normalize it, to fix any overflow. */
- tt = icaltime_normalize (tt);
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Returns the start of the day containing the given time_t, using the given
- timezone.
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_day_begin_with_zone (time_t time, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Set it to the start of the day. */
- tt.hour = 0;
- tt.minute = 0;
- tt.second = 0;
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-
-/* Returns the end of the day containing the given time_t, using the given
- timezone. (The end of the day is the start of the next day.)
- NOTE: this function is only here to make the transition to the timezone
- functions easier. New code should use icaltimetype values and
- icaltime_adjust() to add or subtract days, hours, minutes & seconds. */
-time_t
-time_day_end_with_zone (time_t time, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- /* Convert to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
-
- /* Set it to the start of the next day. */
- tt.day++;
- tt.hour = 0;
- tt.minute = 0;
- tt.second = 0;
-
- /* Normalize it, to fix any overflow. */
- tt = icaltime_normalize (tt);
-
- /* Convert back to a time_t. */
- return icaltime_as_timet_with_zone (tt, zone);
-}
-
-/**
- * time_to_gdate_with_zone:
- * @date: Destination #GDate value.
- * @time: A time value.
- * @zone: Desired timezone for destination @date, or NULL if the UTC timezone
- * is desired.
- *
- * Converts a time_t value to a #GDate structure using the specified timezone.
- * This is analogous to g_date_set_time() but takes the timezone into account.
- **/
-void
-time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone)
-{
- struct icaltimetype tt;
-
- g_return_if_fail (date != NULL);
- g_return_if_fail (time != -1);
-
- tt = icaltime_from_timet_with_zone (time, FALSE,
- zone ? zone : icaltimezone_get_utc_timezone ());
-
- g_date_set_dmy (date, tt.day, tt.month, tt.year);
-}
-
-
-/**************************************************************************
- * General time functions.
- **************************************************************************/
-
-
-/* Returns the number of days in the month. Year is the normal year, e.g. 2001.
- Month is 0 (Jan) to 11 (Dec). */
-int
-time_days_in_month (int year, int month)
-{
- int days;
-
- g_return_val_if_fail (year >= 1900, 0);
- g_return_val_if_fail ((month >= 0) && (month < 12), 0);
-
- days = days_in_month[month];
- if (month == 1 && time_is_leap_year (year))
- days++;
-
- return days;
-}
-
-
-/* Returns the 1-based day number within the year of the specified date.
- Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int
-time_day_of_year (int day, int month, int year)
-{
- int i;
-
- for (i = 0; i < month; i++) {
- day += days_in_month[i];
-
- if (i == 1 && time_is_leap_year (year))
- day++;
- }
-
- return day;
-}
-
-
-/* Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat).
- For the days that were removed on the Gregorian reformation, it returns
- Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int
-time_day_of_week (int day, int month, int year)
-{
- int n;
-
- n = (year - 1) * 365 + time_leap_years_up_to (year - 1)
- + time_day_of_year (day, month, year);
-
- if (n < REFORMATION_DAY)
- return (n - 1 + SATURDAY) % 7;
-
- if (n >= (REFORMATION_DAY + MISSING_DAYS))
- return (n - 1 + SATURDAY - MISSING_DAYS) % 7;
-
- return THURSDAY;
-}
-
-
-/* Returns whether the specified year is a leap year. Year is the normal year,
- e.g. 2001. */
-gboolean
-time_is_leap_year (int year)
-{
- if (year <= 1752)
- return !(year % 4);
- else
- return (!(year % 4) && (year % 100)) || !(year % 400);
-}
-
-
-/* Returns the number of leap years since year 1 up to (but not including) the
- specified year. Year is the normal year, e.g. 2001. */
-int
-time_leap_years_up_to (int year)
-{
- /* There is normally a leap year every 4 years, except at the turn of
- centuries since 1700. But there is a leap year on centuries since 1700
- which are divisible by 400. */
- return (year / 4
- - ((year > 1700) ? (year / 100 - 17) : 0)
- + ((year > 1600) ? ((year - 1600) / 400) : 0));
-}
-
-
-/**
- * isodate_from_time_t:
- * @t: A time value.
- *
- * Creates an ISO 8601 UTC representation from a time value.
- *
- * Return value: String with the ISO 8601 representation of the UTC time.
- **/
-char *
-isodate_from_time_t (time_t t)
-{
- gchar *ret;
-
- ret = g_malloc (17); /* 4+2+2+1+2+2+2+1 + 1 */
- strftime (ret, 17, "%Y%m%dT%H%M%SZ", gmtime (&t));
-
- return ret;
-}
-
-/**
- * time_from_isodate:
- * @str: Date/time value in ISO 8601 format.
- *
- * Converts an ISO 8601 UTC time string into a time_t value.
- *
- * Return value: Time_t corresponding to the specified ISO string.
- * Note that we only allow UTC times at present.
- **/
-time_t
-time_from_isodate (const char *str)
-{
- struct icaltimetype tt = icaltime_null_time ();
- icaltimezone *utc_zone;
- int len, i;
-
- g_return_val_if_fail (str != NULL, -1);
-
- /* yyyymmdd[Thhmmss[Z]] */
-
- len = strlen (str);
-
- if (!(len == 8 || len == 15 || len == 16))
- return -1;
-
- for (i = 0; i < len; i++)
- if (!((i != 8 && i != 15 && isdigit (str[i]))
- || (i == 8 && str[i] == 'T')
- || (i == 15 && str[i] == 'Z')))
- return -1;
-
-#define digit_at(x,y) (x[y] - '0')
-
- tt.year = digit_at (str, 0) * 1000
- + digit_at (str, 1) * 100
- + digit_at (str, 2) * 10
- + digit_at (str, 3);
-
- tt.month = digit_at (str, 4) * 10
- + digit_at (str, 5);
-
- tt.day = digit_at (str, 6) * 10
- + digit_at (str, 7);
-
- if (len > 8) {
- tt.hour = digit_at (str, 9) * 10
- + digit_at (str, 10);
- tt.minute = digit_at (str, 11) * 10
- + digit_at (str, 12);
- tt.second = digit_at (str, 13) * 10
- + digit_at (str, 14);
- }
-
- utc_zone = icaltimezone_get_utc_timezone ();
-
- return icaltime_as_timet_with_zone (tt, utc_zone);
-}
-
-struct tm
-icaltimetype_to_tm (struct icaltimetype *itt)
-{
- struct tm tm;
-
- memset (&tm, 0, sizeof (struct tm));
-
- if (!itt->is_date) {
- tm.tm_sec = itt->second;
- tm.tm_min = itt->minute;
- tm.tm_hour = itt->hour;
- }
-
- tm.tm_mday = itt->day;
- tm.tm_mon = itt->month - 1;
- tm.tm_year = itt->year - 1900;
- tm.tm_wday = time_day_of_week (itt->day, itt->month - 1, itt->year);
- tm.tm_isdst = -1;
-
- return tm;
-}
-
-/**
- * icaltimetype_to_tm_with_zone:
- * @itt: A time value.
- * @from_zone: Source timezone.
- * @to_zone: Destination timezone.
- *
- * Converts a time value from one timezone to another, and returns a struct tm
- * representation of the time.
- *
- * Return value: The converted time as a struct tm. All fields will be
- * set properly except for tm.tm_yday.
- **/
-struct tm
-icaltimetype_to_tm_with_zone (struct icaltimetype *itt,
- icaltimezone *from_zone,
- icaltimezone *to_zone)
-{
- struct tm tm;
- struct icaltimetype itt_copy;
-
- memset (&tm, 0, sizeof (tm));
- tm.tm_isdst = -1;
-
- g_return_val_if_fail (itt != NULL, tm);
-
- itt_copy = *itt;
-
- icaltimezone_convert_time (&itt_copy, from_zone, to_zone);
- tm = icaltimetype_to_tm (&itt_copy);
-
- return tm;
-}
-
-struct icaltimetype
-tm_to_icaltimetype (struct tm *tm, gboolean is_date)
-{
- struct icaltimetype itt;
-
- memset (&itt, 0, sizeof (struct icaltimetype));
-
- if (!is_date) {
- itt.second = tm->tm_sec;
- itt.minute = tm->tm_min;
- itt.hour = tm->tm_hour;
- }
-
- itt.day = tm->tm_mday;
- itt.month = tm->tm_mon + 1;
- itt.year = tm->tm_year+ 1900;
-
- itt.is_utc = 0;
- itt.is_date = is_date;
-
- return itt;
-}
-
diff --git a/calendar/cal-util/timeutil.h b/calendar/cal-util/timeutil.h
deleted file mode 100644
index df5d2db91c..0000000000
--- a/calendar/cal-util/timeutil.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 1998 The Free Software Foundation
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena <federico@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- */
-
-#ifndef TIMEUTIL_H
-#define TIMEUTIL_H
-
-
-#include <time.h>
-#include <libical/ical.h>
-#include <glib.h>
-
-
-/**************************************************************************
- * General time functions.
- **************************************************************************/
-
-/* Returns the number of days in the month. Year is the normal year, e.g. 2001.
- Month is 0 (Jan) to 11 (Dec). */
-int time_days_in_month (int year, int month);
-
-/* Returns the 1-based day number within the year of the specified date.
- Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int time_day_of_year (int day, int month, int year);
-
-/* Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat).
- For the days that were removed on the Gregorian reformation, it returns
- Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int time_day_of_week (int day, int month, int year);
-
-/* Returns whether the specified year is a leap year. Year is the normal year,
- e.g. 2001. */
-gboolean time_is_leap_year (int year);
-
-/* Returns the number of leap years since year 1 up to (but not including) the
- specified year. Year is the normal year, e.g. 2001. */
-int time_leap_years_up_to (int year);
-
-/* Convert to or from an ISO 8601 representation of a time, in UTC,
- e.g. "20010708T183000Z". */
-char *isodate_from_time_t (time_t t);
-time_t time_from_isodate (const char *str);
-
-
-/**************************************************************************
- * time_t manipulation functions.
- *
- * NOTE: these use the Unix timezone functions like mktime() and localtime()
- * and so should not be used in Evolution. New Evolution code should use
- * icaltimetype values rather than time_t values wherever possible.
- **************************************************************************/
-
-/* Add or subtract a number of days, weeks or months. */
-time_t time_add_day (time_t time, int days);
-time_t time_add_week (time_t time, int weeks);
-
-/* Returns the beginning or end of the day. */
-time_t time_day_begin (time_t t);
-time_t time_day_end (time_t t);
-
-
-/**************************************************************************
- * time_t manipulation functions, using timezones in libical.
- *
- * NOTE: these are only here to make the transition to the timezone
- * functions easier. New code should use icaltimetype values rather than
- * time_t values wherever possible.
- **************************************************************************/
-
-/* Adds or subtracts a number of days to/from the given time_t value, using
- the given timezone. */
-time_t time_add_day_with_zone (time_t time, int days, icaltimezone *zone);
-
-/* Adds or subtracts a number of weeks to/from the given time_t value, using
- the given timezone. */
-time_t time_add_week_with_zone (time_t time, int weeks, icaltimezone *zone);
-
-/* Adds or subtracts a number of months to/from the given time_t value, using
- the given timezone. */
-time_t time_add_month_with_zone (time_t time, int months, icaltimezone *zone);
-
-/* Returns the start of the year containing the given time_t, using the given
- timezone. */
-time_t time_year_begin_with_zone (time_t time, icaltimezone *zone);
-
-/* Returns the start of the month containing the given time_t, using the given
- timezone. */
-time_t time_month_begin_with_zone (time_t time, icaltimezone *zone);
-
-/* Returns the start of the week containing the given time_t, using the given
- timezone. week_start_day should use the same values as mktime(),
- i.e. 0 (Sun) to 6 (Sat). */
-time_t time_week_begin_with_zone (time_t time, int week_start_day,
- icaltimezone *zone);
-
-/* Returns the start of the day containing the given time_t, using the given
- timezone. */
-time_t time_day_begin_with_zone (time_t time, icaltimezone *zone);
-
-/* Returns the end of the day containing the given time_t, using the given
- timezone. (The end of the day is the start of the next day.) */
-time_t time_day_end_with_zone (time_t time, icaltimezone *zone);
-
-void time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone);
-
-/**************************************************************************
- * struct tm manipulation
- **************************************************************************/
-
-struct tm icaltimetype_to_tm (struct icaltimetype *itt);
-struct tm icaltimetype_to_tm_with_zone (struct icaltimetype *itt,
- icaltimezone *from_zone,
- icaltimezone *to_zone);
-struct icaltimetype tm_to_icaltimetype (struct tm *tm, gboolean is_date);
-
-#endif
diff --git a/calendar/conduits/calendar/Makefile.am b/calendar/conduits/calendar/Makefile.am
index a3644d15d9..7d521ccc6a 100644
--- a/calendar/conduits/calendar/Makefile.am
+++ b/calendar/conduits/calendar/Makefile.am
@@ -1,8 +1,4 @@
INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/calendar \
- -I$(top_builddir)/calendar/cal-client \
- -I$(top_srcdir)/libical/src \
-I$(top_srcdir)/e-util \
-I$(top_builddir)/e-util \
$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
@@ -17,10 +13,6 @@ libecalendar_conduit_la_SOURCES = \
libecalendar_conduit_la_LDFLAGS = -module -avoid-version
libecalendar_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/calendar/cal-client/libcal-client.la \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/libical/src/libical/libical-evolution.la \
$(top_builddir)/e-util/libeconduit.la \
$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 7a30262e6c..c1d0e45134 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -25,9 +25,9 @@
#define G_LOG_DOMAIN "ecalconduit"
-#include <cal-client/cal-client-types.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-types.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-time-util.h>
#include <pi-source.h>
#include <pi-socket.h>
#include <pi-dlp.h>
@@ -74,7 +74,7 @@ struct _ECalLocalRecord {
GnomePilotDesktopRecord local;
/* The corresponding Comp object */
- CalComponent *comp;
+ ECalComponent *comp;
/* pilot-link appointment structure */
struct Appointment *appt;
@@ -249,10 +249,10 @@ struct _ECalConduitContext {
struct AppointmentAppInfo ai;
- CalClient *client;
+ ECal *client;
icaltimezone *timezone;
- CalComponent *default_comp;
+ ECalComponent *default_comp;
GList *comps;
GList *changed;
GHashTable *changed_hash;
@@ -318,7 +318,7 @@ e_calendar_context_destroy (ECalConduitContext *ctxt)
}
if (ctxt->changed != NULL)
- cal_client_change_list_free (ctxt->changed);
+ e_cal_change_list_free (ctxt->changed);
if (ctxt->changed_hash != NULL) {
g_hash_table_foreach_remove (ctxt->changed_hash, e_calendar_context_foreach_change, NULL);
@@ -388,13 +388,13 @@ static char *print_remote (GnomePilotRecord *remote)
/* Calendar Server routines */
static void
-start_calendar_server_cb (CalClient *cal_client,
- CalClientOpenStatus status,
+start_calendar_server_cb (ECal *e_cal,
+ ECalOpenStatus status,
gpointer data)
{
gboolean *success = data;
- if (status == CAL_CLIENT_OPEN_SUCCESS) {
+ if (status == E_CAL_OPEN_SUCCESS) {
*success = TRUE;
} else {
*success = FALSE;
@@ -415,7 +415,7 @@ start_calendar_server (ECalConduitContext *ctxt)
/* FIXME Need a mechanism for the user to select uri's */
/* FIXME Can we use the cal model? */
uri = g_strdup_printf ("file://%s/local/Calendar/", g_get_home_dir ());
- ctxt->client = cal_client_new (uri, CALOBJ_TYPE_EVENT);
+ ctxt->client = e_cal_new (uri, CALOBJ_TYPE_EVENT);
g_free (uri);
if (!ctxt->client)
@@ -424,7 +424,7 @@ start_calendar_server (ECalConduitContext *ctxt)
g_signal_connect (ctxt->client, "cal_opened",
G_CALLBACK (start_calendar_server_cb), &success);
- if (!cal_client_open (ctxt->client, FALSE, NULL))
+ if (!e_cal_open (ctxt->client, FALSE, NULL))
return -1;
/* run a sub event loop to turn cal-client's async load
@@ -439,13 +439,13 @@ start_calendar_server (ECalConduitContext *ctxt)
/* Utility routines */
static icaltimezone *
-get_timezone (CalClient *client, const char *tzid)
+get_timezone (ECal *client, const char *tzid)
{
icaltimezone *timezone = NULL;
timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (timezone == NULL)
- cal_client_get_timezone (client, tzid, &timezone, NULL);
+ e_cal_get_timezone (client, tzid, &timezone, NULL);
return timezone;
}
@@ -542,7 +542,7 @@ is_empty_time (struct tm time)
}
static gboolean
-is_all_day (CalClient *client, CalComponentDateTime *dt_start, CalComponentDateTime *dt_end)
+is_all_day (ECal *client, ECalComponentDateTime *dt_start, ECalComponentDateTime *dt_end)
{
time_t dt_start_time, dt_end_time;
icaltimezone *timezone;
@@ -561,9 +561,9 @@ is_all_day (CalClient *client, CalComponentDateTime *dt_start, CalComponentDateT
}
static gboolean
-process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_comp, GList **multi_ccc)
+process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp, GList **multi_ccc)
{
- CalComponentDateTime dt_start, dt_end;
+ ECalComponentDateTime dt_start, dt_end;
icaltimezone *tz_start, *tz_end;
time_t event_start, event_end, day_end;
struct icaltimetype *old_start_value, *old_end_value;
@@ -575,18 +575,18 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
*multi_ccc = NULL;
*multi_comp = NULL;
- if (ccc->type == CAL_CLIENT_CHANGE_DELETED)
+ if (ccc->type == E_CAL_CHANGE_DELETED)
return FALSE;
/* Start time */
- cal_component_get_dtstart (ccc->comp, &dt_start);
+ e_cal_component_get_dtstart (ccc->comp, &dt_start);
if (dt_start.value->is_date)
tz_start = ctxt->timezone;
else
tz_start = get_timezone (ctxt->client, dt_start.tzid);
event_start = icaltime_as_timet_with_zone (*dt_start.value, tz_start);
- cal_component_get_dtend (ccc->comp, &dt_end);
+ e_cal_component_get_dtend (ccc->comp, &dt_end);
if (dt_end.value->is_date)
tz_end = ctxt->timezone;
else
@@ -597,7 +597,7 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
if (day_end >= event_end) {
ret = FALSE;
goto cleanup;
- } else if (cal_component_has_recurrences (ccc->comp) || !ctxt->cfg->multi_day_split) {
+ } else if (e_cal_component_has_recurrences (ccc->comp) || !ctxt->cfg->multi_day_split) {
ret = TRUE;
goto cleanup;
}
@@ -608,31 +608,31 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
old_start_value = dt_start.value;
old_end_value = dt_end.value;
while (!last) {
- CalComponent *clone = cal_component_clone (ccc->comp);
- char *new_uid = cal_component_gen_uid ();
+ ECalComponent *clone = e_cal_component_clone (ccc->comp);
+ char *new_uid = e_cal_component_gen_uid ();
struct icaltimetype start_value, end_value;
- CalClientChange *c = g_new0 (CalClientChange, 1);
+ ECalChange *c = g_new0 (ECalChange, 1);
if (day_end >= event_end) {
day_end = event_end;
last = TRUE;
}
- cal_component_set_uid (clone, new_uid);
+ e_cal_component_set_uid (clone, new_uid);
start_value = icaltime_from_timet_with_zone (event_start, is_date, tz_start);
dt_start.value = &start_value;
- cal_component_set_dtstart (clone, &dt_start);
+ e_cal_component_set_dtstart (clone, &dt_start);
end_value = icaltime_from_timet_with_zone (day_end, is_date, tz_end);
dt_end.value = &end_value;
- cal_component_set_dtend (clone, &dt_end);
+ e_cal_component_set_dtend (clone, &dt_end);
/* FIXME Error handling */
- cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (clone), NULL, NULL);
+ e_cal_create_object (ctxt->client, e_cal_component_get_icalcomponent (clone), NULL, NULL);
c->comp = clone;
- c->type = CAL_CLIENT_CHANGE_ADDED;
+ c->type = E_CAL_CHANGE_ADDED;
*multi_ccc = g_list_prepend (*multi_ccc, c);
*multi_comp = g_list_prepend (*multi_comp, g_object_ref (c->comp));
@@ -643,14 +643,14 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
dt_start.value = old_start_value;
dt_end.value = old_end_value;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
/* FIXME Error handling */
- cal_client_remove_object (ctxt->client, uid, NULL);
- ccc->type = CAL_CLIENT_CHANGE_DELETED;
+ e_cal_remove_object (ctxt->client, uid, NULL);
+ ccc->type = E_CAL_CHANGE_DELETED;
cleanup:
- cal_component_free_datetime (&dt_start);
- cal_component_free_datetime (&dt_end);
+ e_cal_component_free_datetime (&dt_start);
+ e_cal_component_free_datetime (&dt_end);
return ret;
}
@@ -666,7 +666,7 @@ nth_weekday (int pos, icalrecurrencetype_weekday weekday)
static GList *
next_changed_item (ECalConduitContext *ctxt, GList *changes)
{
- CalClientChange *ccc;
+ ECalChange *ccc;
GList *l;
for (l = changes; l != NULL; l = l->next) {
@@ -674,7 +674,7 @@ next_changed_item (ECalConduitContext *ctxt, GList *changes)
ccc = l->data;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
if (g_hash_table_lookup (ctxt->changed_hash, uid))
return l;
}
@@ -685,7 +685,7 @@ next_changed_item (ECalConduitContext *ctxt, GList *changes)
static void
compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *uid)
{
- CalClientChange *ccc;
+ ECalChange *ccc;
local->local.archived = FALSE;
local->local.secret = FALSE;
@@ -698,15 +698,15 @@ compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *ui
}
switch (ccc->type) {
- case CAL_CLIENT_CHANGE_ADDED:
+ case E_CAL_CHANGE_ADDED:
local->local.attr = GnomePilotRecordNew;
break;
- case CAL_CLIENT_CHANGE_MODIFIED:
+ case E_CAL_CHANGE_MODIFIED:
local->local.attr = GnomePilotRecordModified;
break;
- case CAL_CLIENT_CHANGE_DELETED:
+ case E_CAL_CHANGE_DELETED:
local->local.attr = GnomePilotRecordDeleted;
break;
}
@@ -730,7 +730,7 @@ rrules_mostly_equal (struct icalrecurrencetype *a, struct icalrecurrencetype *b)
}
static gboolean
-find_last_cb (CalComponent *comp, time_t start, time_t end, gpointer data)
+find_last_cb (ECalComponent *comp, time_t start, time_t end, gpointer data)
{
time_t *last = data;
@@ -763,17 +763,17 @@ local_record_to_pilot_record (ECalLocalRecord *local,
}
/*
- * converts a CalComponent object to a ECalLocalRecord
+ * converts a ECalComponent object to a ECalLocalRecord
*/
static void
-local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitContext *ctxt)
+local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduitContext *ctxt)
{
const char *uid;
- CalComponentText summary;
+ ECalComponentText summary;
GSList *d_list = NULL, *edl = NULL, *l;
- CalComponentText *description;
- CalComponentDateTime dt_start, dt_end;
- CalComponentClassification classif;
+ ECalComponentText *description;
+ ECalComponentDateTime dt_start, dt_end;
+ ECalComponentClassification classif;
icaltimezone *default_tz = ctxt->timezone;
int i;
@@ -783,7 +783,7 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->comp = comp;
g_object_ref (comp);
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE);
compute_status (ctxt, local, uid);
@@ -813,13 +813,13 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
/* STOP: don't replace these with g_strdup, since free_Appointment
uses free to deallocate */
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
if (summary.value)
local->appt->description = e_pilot_utf8_to_pchar (summary.value);
- cal_component_get_description_list (comp, &d_list);
+ e_cal_component_get_description_list (comp, &d_list);
if (d_list) {
- description = (CalComponentText *) d_list->data;
+ description = (ECalComponentText *) d_list->data;
if (description && description->value)
local->appt->note = e_pilot_utf8_to_pchar (description->value);
else
@@ -829,8 +829,8 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
}
/* Start/End */
- cal_component_get_dtstart (comp, &dt_start);
- cal_component_get_dtend (comp, &dt_end);
+ e_cal_component_get_dtstart (comp, &dt_start);
+ e_cal_component_get_dtend (comp, &dt_end);
if (dt_start.value) {
icaltimezone_convert_time (dt_start.value,
get_timezone (ctxt->client, dt_start.tzid),
@@ -851,18 +851,18 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
} else {
local->appt->event = 1;
}
- cal_component_free_datetime (&dt_start);
- cal_component_free_datetime (&dt_end);
+ e_cal_component_free_datetime (&dt_start);
+ e_cal_component_free_datetime (&dt_end);
/* Recurrence Rules */
local->appt->repeatType = repeatNone;
- if (!cal_component_is_instance (comp)) {
- if (cal_component_has_rrules (comp)) {
+ if (!e_cal_component_is_instance (comp)) {
+ if (e_cal_component_has_rrules (comp)) {
GSList *list;
struct icalrecurrencetype *recur;
- cal_component_get_rrule_list (comp, &list);
+ e_cal_component_get_rrule_list (comp, &list);
recur = list->data;
switch (recur->freq) {
@@ -928,8 +928,8 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
/* The palm does not support count recurrences */
local->appt->repeatForever = 0;
- cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last,
- cal_client_resolve_tzid_cb, ctxt->client,
+ e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last,
+ e_cal_resolve_tzid_cb, ctxt->client,
default_tz);
itt = icaltime_from_timet_with_zone (last, TRUE, default_tz);
local->appt->repeatEnd = icaltimetype_to_tm (&itt);
@@ -937,37 +937,37 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->appt->repeatForever = 1;
}
- cal_component_free_recur_list (list);
+ e_cal_component_free_recur_list (list);
}
/* Exceptions */
- cal_component_get_exdate_list (comp, &edl);
+ e_cal_component_get_exdate_list (comp, &edl);
local->appt->exceptions = g_slist_length (edl);
local->appt->exception = g_new0 (struct tm, local->appt->exceptions);
for (l = edl, i = 0; l != NULL; l = l->next, i++) {
- CalComponentDateTime *dt = l->data;
+ ECalComponentDateTime *dt = l->data;
icaltimezone_convert_time (dt->value,
icaltimezone_get_utc_timezone (),
default_tz);
*local->appt->exception = icaltimetype_to_tm (dt->value);
}
- cal_component_free_exdate_list (edl);
+ e_cal_component_free_exdate_list (edl);
}
/* Alarm */
local->appt->alarm = 0;
- if (cal_component_has_alarms (comp)) {
+ if (e_cal_component_has_alarms (comp)) {
GList *uids, *l;
- CalComponentAlarm *alarm;
- CalAlarmTrigger trigger;
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmTrigger trigger;
- uids = cal_component_get_alarm_uids (comp);
+ uids = e_cal_component_get_alarm_uids (comp);
for (l = uids; l != NULL; l = l->next) {
- alarm = cal_component_get_alarm (comp, l->data);
- cal_component_alarm_get_trigger (alarm, &trigger);
+ alarm = e_cal_component_get_alarm (comp, l->data);
+ e_cal_component_alarm_get_trigger (alarm, &trigger);
- if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START
+ if ((trigger.type == E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START
&& trigger.u.rel_duration.is_neg)) {
local->appt->advanceUnits = advMinutes;
local->appt->advance =
@@ -998,14 +998,14 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->appt->alarm = 1;
break;
}
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_free (alarm);
}
cal_obj_uid_list_free (uids);
}
- cal_component_get_classification (comp, &classif);
+ e_cal_component_get_classification (comp, &classif);
- if (classif == CAL_COMPONENT_CLASS_PRIVATE)
+ if (classif == E_CAL_COMPONENT_CLASS_PRIVATE)
local->local.secret = 1;
else
local->local.secret = 0;
@@ -1018,15 +1018,15 @@ local_record_from_uid (ECalLocalRecord *local,
const char *uid,
ECalConduitContext *ctxt)
{
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
GError *error = NULL;
g_assert(local!=NULL);
- if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ if (e_cal_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return;
@@ -1035,9 +1035,9 @@ local_record_from_uid (ECalLocalRecord *local,
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
} else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
- cal_component_set_uid (comp, uid);
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
+ e_cal_component_set_uid (comp, uid);
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
} else {
@@ -1047,19 +1047,19 @@ local_record_from_uid (ECalLocalRecord *local,
g_clear_error (&error);
}
-static CalComponent *
+static ECalComponent *
comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
- CalComponent *in_comp,
- CalClient *client,
+ ECalComponent *in_comp,
+ ECal *client,
icaltimezone *timezone)
{
- CalComponent *comp;
+ ECalComponent *comp;
struct Appointment appt;
struct icaltimetype now = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone), it;
struct icalrecurrencetype recur;
- CalComponentText summary = {NULL, NULL};
- CalComponentDateTime dt = {NULL, NULL};
+ ECalComponentText summary = {NULL, NULL};
+ ECalComponentDateTime dt = {NULL, NULL};
GSList *edl = NULL;
char *txt;
int pos, i;
@@ -1070,32 +1070,32 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
unpack_Appointment (&appt, remote->record, remote->length);
if (in_comp == NULL) {
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
- cal_component_set_created (comp, &now);
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
+ e_cal_component_set_created (comp, &now);
} else {
- comp = cal_component_clone (in_comp);
+ comp = e_cal_component_clone (in_comp);
}
- cal_component_set_last_modified (comp, &now);
+ e_cal_component_set_last_modified (comp, &now);
summary.value = txt = e_pilot_utf8_from_pchar (appt.description);
- cal_component_set_summary (comp, &summary);
+ e_cal_component_set_summary (comp, &summary);
free (txt);
/* The iCal description field */
if (!appt.note) {
- cal_component_set_description_list (comp, NULL);
+ e_cal_component_set_description_list (comp, NULL);
} else {
GSList l;
- CalComponentText text;
+ ECalComponentText text;
text.value = txt = e_pilot_utf8_from_pchar (appt.note);
text.altrep = NULL;
l.data = &text;
l.next = NULL;
- cal_component_set_description_list (comp, &l);
+ e_cal_component_set_description_list (comp, &l);
free (txt);
}
@@ -1103,21 +1103,21 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
it = tm_to_icaltimetype (&appt.begin, TRUE);
dt.value = &it;
dt.tzid = NULL;
- cal_component_set_dtstart (comp, &dt);
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
} else {
dt.tzid = icaltimezone_get_tzid (timezone);
if (!is_empty_time (appt.begin)) {
it = tm_to_icaltimetype (&appt.begin, FALSE);
dt.value = &it;
- cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
}
if (!is_empty_time (appt.end)) {
it = tm_to_icaltimetype (&appt.end, FALSE);
dt.value = &it;
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
}
}
@@ -1183,12 +1183,12 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
list = g_slist_append (list, &recur);
- cal_component_set_rrule_list (comp, list);
+ e_cal_component_set_rrule_list (comp, list);
/* If the desktop uses count and rrules are
* equivalent, use count still on the desktop */
- if (!appt.repeatForever && cal_component_has_rrules (in_comp)) {
- cal_component_get_rrule_list (in_comp, &existing);
+ if (!appt.repeatForever && e_cal_component_has_rrules (in_comp)) {
+ e_cal_component_get_rrule_list (in_comp, &existing);
erecur = existing->data;
/* If the rules are otherwise the same and the existing uses count,
@@ -1197,31 +1197,31 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
icaltime_is_null_time (erecur->until) && erecur->count > 0) {
time_t last, elast;
- cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last,
- cal_client_resolve_tzid_cb, client,
+ e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last,
+ e_cal_resolve_tzid_cb, client,
timezone);
- cal_recur_generate_instances (in_comp, -1, -1, find_last_cb, &elast,
- cal_client_resolve_tzid_cb, client,
+ e_cal_recur_generate_instances (in_comp, -1, -1, find_last_cb, &elast,
+ e_cal_resolve_tzid_cb, client,
timezone);
if (last == elast) {
recur.until = icaltime_null_time ();
recur.count = erecur->count;
- cal_component_set_rrule_list (comp, list);
+ e_cal_component_set_rrule_list (comp, list);
}
}
}
g_slist_free (list);
} else {
- cal_component_set_rrule_list (comp, NULL);
+ e_cal_component_set_rrule_list (comp, NULL);
}
/* Exceptions */
for (i = 0; i < appt.exceptions; i++) {
struct tm ex;
- CalComponentDateTime *dt = g_new0 (CalComponentDateTime, 1);
+ ECalComponentDateTime *dt = g_new0 (ECalComponentDateTime, 1);
dt->value = g_new0 (struct icaltimetype, 1);
dt->tzid = NULL;
@@ -1231,36 +1231,36 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
edl = g_slist_prepend (edl, dt);
}
- cal_component_set_exdate_list (comp, edl);
- cal_component_free_exdate_list (edl);
+ e_cal_component_set_exdate_list (comp, edl);
+ e_cal_component_free_exdate_list (edl);
/* Alarm */
if (appt.alarm) {
- CalComponentAlarm *alarm = NULL;
- CalAlarmTrigger trigger;
+ ECalComponentAlarm *alarm = NULL;
+ ECalComponentAlarmTrigger trigger;
gboolean found = FALSE;
- if (cal_component_has_alarms (comp)) {
+ if (e_cal_component_has_alarms (comp)) {
GList *uids, *l;
- uids = cal_component_get_alarm_uids (comp);
+ uids = e_cal_component_get_alarm_uids (comp);
for (l = uids; l != NULL; l = l->next) {
- alarm = cal_component_get_alarm (comp, l->data);
- cal_component_alarm_get_trigger (alarm, &trigger);
- if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START
+ alarm = e_cal_component_get_alarm (comp, l->data);
+ e_cal_component_alarm_get_trigger (alarm, &trigger);
+ if ((trigger.type == E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START
&& trigger.u.rel_duration.is_neg)) {
found = TRUE;
break;
}
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_free (alarm);
}
cal_obj_uid_list_free (uids);
}
if (!found)
- alarm = cal_component_alarm_new ();
+ alarm = e_cal_component_alarm_new ();
- memset (&trigger, 0, sizeof (CalAlarmTrigger));
- trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START;
+ memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger));
+ trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
trigger.u.rel_duration.is_neg = 1;
switch (appt.advanceUnits) {
case advMinutes:
@@ -1273,22 +1273,22 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
trigger.u.rel_duration.days = appt.advance;
break;
}
- cal_component_alarm_set_trigger (alarm, trigger);
- cal_component_alarm_set_action (alarm, CAL_ALARM_DISPLAY);
+ e_cal_component_alarm_set_trigger (alarm, trigger);
+ e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
if (!found)
- cal_component_add_alarm (comp, alarm);
- cal_component_alarm_free (alarm);
+ e_cal_component_add_alarm (comp, alarm);
+ e_cal_component_alarm_free (alarm);
}
- cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE);
+ e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE);
if (remote->secret)
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE);
+ e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE);
else
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC);
+ e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC);
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
free_Appointment (&appt);
@@ -1308,7 +1308,7 @@ check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt)
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
/* Or if the URI's don't match */
- uri = cal_client_get_uri (ctxt->client);
+ uri = e_cal_get_uri (ctxt->client);
LOG (g_message ( " Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>" ));
if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
@@ -1359,23 +1359,23 @@ pre_sync (GnomePilotConduit *conduit,
/* Set the default timezone on the backend. */
if (ctxt->timezone) {
- if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
+ if (!e_cal_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
return -1;
}
/* Get the default component */
- if (!cal_client_get_default_object (ctxt->client, &icalcomp, NULL))
+ if (!e_cal_get_default_object (ctxt->client, &icalcomp, NULL))
return -1;
- ctxt->default_comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
+ ctxt->default_comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
g_object_unref (ctxt->default_comp);
icalcomponent_free (icalcomp);
return -1;
}
- ctxt->default_comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
+ ctxt->default_comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
g_object_unref (ctxt->default_comp);
icalcomponent_free (icalcomp);
return -1;
@@ -1387,19 +1387,19 @@ pre_sync (GnomePilotConduit *conduit,
g_free (filename);
/* Get the local database */
- if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
+ if (!e_cal_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
return -1;
/* Find the added, modified and deleted items */
change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id);
- if (!cal_client_get_changes (ctxt->client, change_id, &ctxt->changed, NULL))
+ if (!e_cal_get_changes (ctxt->client, change_id, &ctxt->changed, NULL))
return -1;
ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal);
g_free (change_id);
/* See if we need to split up any events */
for (l = ctxt->changed; l != NULL; l = l->next) {
- CalClientChange *ccc = l->data;
+ ECalChange *ccc = l->data;
GList *multi_comp = NULL, *multi_ccc = NULL;
if (process_multi_day (ctxt, ccc, &multi_comp, &multi_ccc)) {
@@ -1413,10 +1413,10 @@ pre_sync (GnomePilotConduit *conduit,
/* Remove the events that were split up */
g_list_concat (ctxt->changed, added);
for (l = removed; l != NULL; l = l->next) {
- CalClientChange *ccc = l->data;
+ ECalChange *ccc = l->data;
const char *uid;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
if (e_pilot_map_lookup_pid (ctxt->map, uid, FALSE) == 0) {
ctxt->changed = g_list_remove (ctxt->changed, ccc);
g_object_unref (ccc->comp);
@@ -1426,26 +1426,26 @@ pre_sync (GnomePilotConduit *conduit,
g_list_free (removed);
for (l = ctxt->changed; l != NULL; l = l->next) {
- CalClientChange *ccc = l->data;
+ ECalChange *ccc = l->data;
const char *uid;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) {
g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc);
switch (ccc->type) {
- case CAL_CLIENT_CHANGE_ADDED:
+ case E_CAL_CHANGE_ADDED:
add_records++;
break;
- case CAL_CLIENT_CHANGE_MODIFIED:
+ case E_CAL_CHANGE_MODIFIED:
mod_records++;
break;
- case CAL_CLIENT_CHANGE_DELETED:
+ case E_CAL_CHANGE_DELETED:
del_records++;
break;
}
- } else if (ccc->type == CAL_CLIENT_CHANGE_DELETED) {
+ } else if (ccc->type == E_CAL_CHANGE_DELETED) {
e_pilot_map_remove_by_uid (ctxt->map, uid);
}
}
@@ -1490,7 +1490,7 @@ post_sync (GnomePilotConduit *conduit,
LOG (g_message ( "post_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
g_free (ctxt->cfg->last_uri);
- ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
+ ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client));
calconduit_save_configuration (ctxt->cfg);
filename = map_name (ctxt);
@@ -1501,8 +1501,8 @@ post_sync (GnomePilotConduit *conduit,
* a race condition if anyone changes a record elsewhere during sycnc
*/
change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id);
- if (cal_client_get_changes (ctxt->client, change_id, &changed, NULL))
- cal_client_change_list_free (changed);
+ if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
+ e_cal_change_list_free (changed);
g_free (change_id);
LOG (g_message ( "---------------------------------------------------------\n" ));
@@ -1520,7 +1520,7 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "set_pilot_id: setting to %d\n", ID ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, ID, uid, FALSE);
return 0;
@@ -1535,7 +1535,7 @@ set_status_cleared (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "set_status_cleared: clearing status\n" ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
g_hash_table_remove (ctxt->changed_hash, uid);
return 0;
@@ -1612,7 +1612,7 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
iterator = next_changed_item (ctxt, iterator);
if (iterator != NULL) {
- CalClientChange *ccc = iterator->data;
+ ECalChange *ccc = iterator->data;
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
@@ -1626,7 +1626,7 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
count++;
iterator = g_list_next (iterator);
if (iterator && (iterator = next_changed_item (ctxt, iterator))) {
- CalClientChange *ccc = iterator->data;
+ ECalChange *ccc = iterator->data;
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
@@ -1677,7 +1677,7 @@ add_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
- CalComponent *comp;
+ ECalComponent *comp;
char *uid;
int retval = 0;
@@ -1688,10 +1688,10 @@ add_record (GnomePilotConduitSyncAbs *conduit,
comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->client, ctxt->timezone);
/* Give it a new UID otherwise it will be the uid of the default comp */
- uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, uid);
+ uid = e_cal_component_gen_uid ();
+ e_cal_component_set_uid (comp, uid);
- if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL))
+ if (!e_cal_create_object (ctxt->client, e_cal_component_get_icalcomponent (comp), NULL, NULL))
return -1;
e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE);
@@ -1709,7 +1709,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
- CalComponent *new_comp;
+ ECalComponent *new_comp;
int retval = 0;
g_return_val_if_fail (remote != NULL, -1);
@@ -1721,7 +1721,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
g_object_unref (local->comp);
local->comp = new_comp;
- if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp),
+ if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp),
CALOBJ_MOD_ALL, NULL))
return -1;
@@ -1738,13 +1738,13 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
g_assert (local->comp != NULL);
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
/* FIXME Error handling */
- cal_client_remove_object (ctxt->client, uid, NULL);
+ e_cal_remove_object (ctxt->client, uid, NULL);
return 0;
}
@@ -1762,7 +1762,7 @@ archive_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive);
return retval;
diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am
index bb03a5acfc..4b4fccc732 100644
--- a/calendar/conduits/todo/Makefile.am
+++ b/calendar/conduits/todo/Makefile.am
@@ -1,8 +1,4 @@
INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/calendar \
- -I$(top_builddir)/calendar/cal-client \
- -I$(top_srcdir)/libical/src \
-I$(top_srcdir)/e-util \
-I$(top_builddir)/e-util \
$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
@@ -17,10 +13,6 @@ libetodo_conduit_la_SOURCES = \
libetodo_conduit_la_LDFLAGS = -module -avoid-version
libetodo_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/calendar/cal-client/libcal-client.la \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/libical/src/libical/libical-evolution.la \
$(top_builddir)/e-util/libeconduit.la \
$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index df69cdd088..4b20e2cf39 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -25,14 +25,14 @@
#define G_LOG_DOMAIN "etodoconduit"
-#include <cal-client/cal-client-types.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-types.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-time-util.h>
#include <pi-source.h>
#include <pi-socket.h>
#include <pi-dlp.h>
#include <pi-todo.h>
-#include <libical/src/libical/icaltypes.h>
+#include <libical/icaltypes.h>
#include <gpilotd/gnome-pilot-conduit.h>
#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
#include <libgpilotdCM/gnome-pilot-conduit-management.h>
@@ -73,7 +73,7 @@ struct _EToDoLocalRecord {
GnomePilotDesktopRecord local;
/* The corresponding Comp object */
- CalComponent *comp;
+ ECalComponent *comp;
/* pilot-link todo structure */
struct ToDo *todo;
@@ -251,10 +251,10 @@ struct _EToDoConduitContext {
struct ToDoAppInfo ai;
- CalClient *client;
+ ECal *client;
icaltimezone *timezone;
- CalComponent *default_comp;
+ ECalComponent *default_comp;
GList *comps;
GList *changed;
GHashTable *changed_hash;
@@ -329,7 +329,7 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
}
if (ctxt->changed != NULL)
- cal_client_change_list_free (ctxt->changed);
+ e_cal_change_list_free (ctxt->changed);
if (ctxt->map != NULL)
e_pilot_map_destroy (ctxt->map);
@@ -395,13 +395,13 @@ static char *print_remote (GnomePilotRecord *remote)
/* Calendar Server routines */
static void
-start_calendar_server_cb (CalClient *cal_client,
- CalClientOpenStatus status,
+start_calendar_server_cb (ECal *e_cal,
+ ECalOpenStatus status,
gpointer data)
{
gboolean *success = data;
- if (status == CAL_CLIENT_OPEN_SUCCESS) {
+ if (status == E_CAL_OPEN_SUCCESS) {
*success = TRUE;
} else {
*success = FALSE;
@@ -422,7 +422,7 @@ start_calendar_server (EToDoConduitContext *ctxt)
/* FIXME Need a mechanism for the user to select uri's */
/* FIXME Can we use the cal model? */
uri = g_strdup_printf ("file://%s/local/Tasks/", g_get_home_dir ());
- ctxt->client = cal_client_new (uri, CALOBJ_TYPE_TODO);
+ ctxt->client = e_cal_new (uri, CALOBJ_TYPE_TODO);
g_free (uri);
if (!ctxt->client)
@@ -431,7 +431,7 @@ start_calendar_server (EToDoConduitContext *ctxt)
g_signal_connect (ctxt->client, "cal_opened",
G_CALLBACK (start_calendar_server_cb), &success);
- if (!cal_client_open (ctxt->client, FALSE, NULL))
+ if (!e_cal_open (ctxt->client, FALSE, NULL))
return -1;
/* run a sub event loop to turn cal-client's async load
@@ -446,13 +446,13 @@ start_calendar_server (EToDoConduitContext *ctxt)
/* Utility routines */
static icaltimezone *
-get_timezone (CalClient *client, const char *tzid)
+get_timezone (ECal *client, const char *tzid)
{
icaltimezone *timezone = NULL;
timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (timezone == NULL)
- cal_client_get_timezone (client, tzid, &timezone, NULL);
+ e_cal_get_timezone (client, tzid, &timezone, NULL);
return timezone;
}
@@ -504,7 +504,7 @@ is_empty_time (struct tm time)
static GList *
next_changed_item (EToDoConduitContext *ctxt, GList *changes)
{
- CalClientChange *ccc;
+ ECalChange *ccc;
GList *l;
for (l = changes; l != NULL; l = l->next) {
@@ -512,7 +512,7 @@ next_changed_item (EToDoConduitContext *ctxt, GList *changes)
ccc = l->data;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
if (g_hash_table_lookup (ctxt->changed_hash, uid))
return l;
}
@@ -523,7 +523,7 @@ next_changed_item (EToDoConduitContext *ctxt, GList *changes)
static void
compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char *uid)
{
- CalClientChange *ccc;
+ ECalChange *ccc;
local->local.archived = FALSE;
local->local.secret = FALSE;
@@ -536,13 +536,13 @@ compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char *
}
switch (ccc->type) {
- case CAL_CLIENT_CHANGE_ADDED:
+ case E_CAL_CHANGE_ADDED:
local->local.attr = GnomePilotRecordNew;
break;
- case CAL_CLIENT_CHANGE_MODIFIED:
+ case E_CAL_CHANGE_MODIFIED:
local->local.attr = GnomePilotRecordModified;
break;
- case CAL_CLIENT_CHANGE_DELETED:
+ case E_CAL_CHANGE_DELETED:
local->local.attr = GnomePilotRecordDeleted;
break;
}
@@ -574,19 +574,19 @@ local_record_to_pilot_record (EToDoLocalRecord *local,
}
/*
- * converts a CalComponent object to a EToDoLocalRecord
+ * converts a ECalComponent object to a EToDoLocalRecord
*/
static void
-local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoConduitContext *ctxt)
+local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoConduitContext *ctxt)
{
const char *uid;
int *priority;
icalproperty_status status;
- CalComponentText summary;
+ ECalComponentText summary;
GSList *d_list = NULL;
- CalComponentText *description;
- CalComponentDateTime due;
- CalComponentClassification classif;
+ ECalComponentText *description;
+ ECalComponentDateTime due;
+ ECalComponentClassification classif;
icaltimezone *default_tz = get_default_timezone ();
LOG (g_message ( "local_record_from_comp\n" ));
@@ -597,7 +597,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
local->comp = comp;
g_object_ref (comp);
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE);
compute_status (ctxt, local, uid);
@@ -619,13 +619,13 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
/* STOP: don't replace these with g_strdup, since free_ToDo
uses free to deallocate */
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
if (summary.value)
local->todo->description = e_pilot_utf8_to_pchar (summary.value);
- cal_component_get_description_list (comp, &d_list);
+ e_cal_component_get_description_list (comp, &d_list);
if (d_list) {
- description = (CalComponentText *) d_list->data;
+ description = (ECalComponentText *) d_list->data;
if (description && description->value)
local->todo->note = e_pilot_utf8_to_pchar (description->value);
else
@@ -634,7 +634,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
local->todo->note = NULL;
}
- cal_component_get_due (comp, &due);
+ e_cal_component_get_due (comp, &due);
if (due.value) {
icaltimezone_convert_time (due.value,
get_timezone (ctxt->client, due.tzid),
@@ -644,15 +644,15 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
} else {
local->todo->indefinite = 1;
}
- cal_component_free_datetime (&due);
+ e_cal_component_free_datetime (&due);
- cal_component_get_status (comp, &status);
+ e_cal_component_get_status (comp, &status);
if (status == ICAL_STATUS_COMPLETED)
local->todo->complete = 1;
else
local->todo->complete = 0;
- cal_component_get_priority (comp, &priority);
+ e_cal_component_get_priority (comp, &priority);
if (priority && *priority != 0) {
if (*priority <= 3)
local->todo->priority = 1;
@@ -665,14 +665,14 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
else
local->todo->priority = 5;
- cal_component_free_priority (priority);
+ e_cal_component_free_priority (priority);
} else {
local->todo->priority = ctxt->cfg->priority;
}
- cal_component_get_classification (comp, &classif);
+ e_cal_component_get_classification (comp, &classif);
- if (classif == CAL_COMPONENT_CLASS_PRIVATE)
+ if (classif == E_CAL_COMPONENT_CLASS_PRIVATE)
local->local.secret = 1;
else
local->local.secret = 0;
@@ -685,15 +685,15 @@ local_record_from_uid (EToDoLocalRecord *local,
const char *uid,
EToDoConduitContext *ctxt)
{
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
GError *error = NULL;
g_assert(local!=NULL);
- if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ if (e_cal_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return;
@@ -702,9 +702,9 @@ local_record_from_uid (EToDoLocalRecord *local,
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
} else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
- cal_component_set_uid (comp, uid);
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
+ e_cal_component_set_uid (comp, uid);
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
} else {
@@ -715,16 +715,16 @@ local_record_from_uid (EToDoLocalRecord *local,
}
-static CalComponent *
+static ECalComponent *
comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
- CalComponent *in_comp,
+ ECalComponent *in_comp,
icaltimezone *timezone)
{
- CalComponent *comp;
+ ECalComponent *comp;
struct ToDo todo;
- CalComponentText summary = {NULL, NULL};
- CalComponentDateTime dt = {NULL, icaltimezone_get_tzid (timezone)};
+ ECalComponentText summary = {NULL, NULL};
+ ECalComponentDateTime dt = {NULL, icaltimezone_get_tzid (timezone)};
struct icaltimetype due, now;
icaltimezone *utc_zone;
int priority;
@@ -740,64 +740,64 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
utc_zone);
if (in_comp == NULL) {
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
- cal_component_set_created (comp, &now);
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
+ e_cal_component_set_created (comp, &now);
} else {
- comp = cal_component_clone (in_comp);
+ comp = e_cal_component_clone (in_comp);
}
- cal_component_set_last_modified (comp, &now);
+ e_cal_component_set_last_modified (comp, &now);
summary.value = txt = e_pilot_utf8_from_pchar (todo.description);
- cal_component_set_summary (comp, &summary);
+ e_cal_component_set_summary (comp, &summary);
free (txt);
/* The iCal description field */
if (!todo.note) {
- cal_component_set_comment_list (comp, NULL);
+ e_cal_component_set_comment_list (comp, NULL);
} else {
GSList l;
- CalComponentText text;
+ ECalComponentText text;
text.value = txt = e_pilot_utf8_from_pchar (todo.note);
text.altrep = NULL;
l.data = &text;
l.next = NULL;
- cal_component_set_description_list (comp, &l);
+ e_cal_component_set_description_list (comp, &l);
free (txt);
}
if (todo.complete) {
int percent = 100;
- cal_component_set_completed (comp, &now);
- cal_component_set_percent (comp, &percent);
- cal_component_set_status (comp, ICAL_STATUS_COMPLETED);
+ e_cal_component_set_completed (comp, &now);
+ e_cal_component_set_percent (comp, &percent);
+ e_cal_component_set_status (comp, ICAL_STATUS_COMPLETED);
} else {
int *percent = NULL;
icalproperty_status status;
- cal_component_set_completed (comp, NULL);
+ e_cal_component_set_completed (comp, NULL);
- cal_component_get_percent (comp, &percent);
+ e_cal_component_get_percent (comp, &percent);
if (percent == NULL || *percent == 100) {
int p = 0;
- cal_component_set_percent (comp, &p);
+ e_cal_component_set_percent (comp, &p);
}
if (percent != NULL)
- cal_component_free_percent (percent);
+ e_cal_component_free_percent (percent);
- cal_component_get_status (comp, &status);
+ e_cal_component_get_status (comp, &status);
if (status == ICAL_STATUS_COMPLETED)
- cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION);
+ e_cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION);
}
if (!is_empty_time (todo.due)) {
due = tm_to_icaltimetype (&todo.due, TRUE);
dt.value = &due;
- cal_component_set_due (comp, &dt);
+ e_cal_component_set_due (comp, &dt);
}
switch (todo.priority) {
@@ -817,15 +817,15 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
priority = 9;
}
- cal_component_set_priority (comp, &priority);
- cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE);
+ e_cal_component_set_priority (comp, &priority);
+ e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE);
if (remote->secret)
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE);
+ e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE);
else
- cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC);
+ e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC);
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
free_ToDo(&todo);
@@ -845,7 +845,7 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt)
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
/* Or if the URI's don't match */
- uri = cal_client_get_uri (ctxt->client);
+ uri = e_cal_get_uri (ctxt->client);
LOG (g_message ( " Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>" ));
if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
@@ -897,23 +897,23 @@ pre_sync (GnomePilotConduit *conduit,
/* Set the default timezone on the backend. */
if (ctxt->timezone) {
- if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
+ if (!e_cal_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
return -1;
}
/* Get the default component */
- if (!cal_client_get_default_object (ctxt->client, &icalcomp, NULL))
+ if (!e_cal_get_default_object (ctxt->client, &icalcomp, NULL))
return -1;
- ctxt->default_comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
+ ctxt->default_comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
g_object_unref (ctxt->default_comp);
icalcomponent_free (icalcomp);
return -1;
}
- ctxt->default_comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
+ ctxt->default_comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) {
g_object_unref (ctxt->default_comp);
icalcomponent_free (icalcomp);
return -1;
@@ -925,37 +925,37 @@ pre_sync (GnomePilotConduit *conduit,
g_free (filename);
/* Get the local database */
- if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
+ if (!e_cal_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
return -1;
/* Count and hash the changes */
change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id);
- if (!cal_client_get_changes (ctxt->client, change_id, &ctxt->changed, NULL))
+ if (!e_cal_get_changes (ctxt->client, change_id, &ctxt->changed, NULL))
return -1;
ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal);
g_free (change_id);
for (l = ctxt->changed; l != NULL; l = l->next) {
- CalClientChange *ccc = l->data;
+ ECalChange *ccc = l->data;
const char *uid;
- cal_component_get_uid (ccc->comp, &uid);
+ e_cal_component_get_uid (ccc->comp, &uid);
if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) {
g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc);
switch (ccc->type) {
- case CAL_CLIENT_CHANGE_ADDED:
+ case E_CAL_CHANGE_ADDED:
add_records++;
break;
- case CAL_CLIENT_CHANGE_MODIFIED:
+ case E_CAL_CHANGE_MODIFIED:
mod_records++;
break;
- case CAL_CLIENT_CHANGE_DELETED:
+ case E_CAL_CHANGE_DELETED:
del_records++;
break;
}
- } else if (ccc->type == CAL_CLIENT_CHANGE_DELETED) {
+ } else if (ccc->type == E_CAL_CHANGE_DELETED) {
e_pilot_map_remove_by_uid (ctxt->map, uid);
}
}
@@ -1000,7 +1000,7 @@ post_sync (GnomePilotConduit *conduit,
LOG (g_message ( "post_sync: ToDo Conduit v.%s", CONDUIT_VERSION ));
g_free (ctxt->cfg->last_uri);
- ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
+ ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client));
todoconduit_save_configuration (ctxt->cfg);
filename = map_name (ctxt);
@@ -1011,8 +1011,8 @@ post_sync (GnomePilotConduit *conduit,
* a race condition if anyone changes a record elsewhere during sycnc
*/
change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id);
- if (cal_client_get_changes (ctxt->client, change_id, &changed, NULL))
- cal_client_change_list_free (changed);
+ if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
+ e_cal_change_list_free (changed);
g_free (change_id);
LOG (g_message ( "---------------------------------------------------------\n" ));
@@ -1030,7 +1030,7 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "set_pilot_id: setting to %d\n", ID ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, ID, uid, FALSE);
return 0;
@@ -1045,7 +1045,7 @@ set_status_cleared (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "set_status_cleared: clearing status\n" ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
g_hash_table_remove (ctxt->changed_hash, uid);
return 0;
@@ -1122,7 +1122,7 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
iterator = next_changed_item (ctxt, iterator);
if (iterator != NULL) {
- CalClientChange *ccc = iterator->data;
+ ECalChange *ccc = iterator->data;
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
@@ -1136,7 +1136,7 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
count++;
iterator = g_list_next (iterator);
if (iterator && (iterator = next_changed_item (ctxt, iterator))) {
- CalClientChange *ccc = iterator->data;
+ ECalChange *ccc = iterator->data;
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
@@ -1187,7 +1187,7 @@ add_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
- CalComponent *comp;
+ ECalComponent *comp;
char *uid;
int retval = 0;
@@ -1198,10 +1198,10 @@ add_record (GnomePilotConduitSyncAbs *conduit,
comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->timezone);
/* Give it a new UID otherwise it will be the uid of the default comp */
- uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, uid);
+ uid = e_cal_component_gen_uid ();
+ e_cal_component_set_uid (comp, uid);
- if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL))
+ if (!e_cal_create_object (ctxt->client, e_cal_component_get_icalcomponent (comp), NULL, NULL))
return -1;
e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE);
@@ -1217,7 +1217,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
- CalComponent *new_comp;
+ ECalComponent *new_comp;
int retval = 0;
g_return_val_if_fail (remote != NULL, -1);
@@ -1229,7 +1229,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
g_object_unref (local->comp);
local->comp = new_comp;
- if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp),
+ if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp),
CALOBJ_MOD_ALL, NULL))
return -1;
@@ -1246,13 +1246,13 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
g_return_val_if_fail (local->comp != NULL, -1);
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
/* FIXME Error handling */
- cal_client_remove_object (ctxt->client, uid, NULL);
+ e_cal_remove_object (ctxt->client, uid, NULL);
return 0;
}
@@ -1270,7 +1270,7 @@ archive_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" ));
- cal_component_get_uid (local->comp, &uid);
+ e_cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive);
return retval;
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index ae623b84db..d05ae4dbc7 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -5,6 +5,19 @@ IDLS = \
$(top_srcdir)/calendar/idl/evolution-calendar.idl \
$(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
+CALENDAR_IDL_GENERATED_H = \
+ evolution-calendar.h
+CALENDAR_IDL_GENERATED_C = \
+ evolution-calendar-common.c \
+ evolution-calendar-skels.c \
+ evolution-calendar-stubs.c
+CALENDAR_IDL_GENERATED = $(CALENDAR_IDL_GENERATED_C) $(CALENDAR_IDL_GENERATED_H)
+
+$(CALENDAR_IDL_GENERATED_H): $(IDLS)
+ $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
+ $(top_srcdir)/calendar/idl/evolution-calendar.idl
+$(CALENDAR_IDL_GENERATED_C): $(CALENDAR_IDL_GENERATED_H)
+
# Message composer IDL files
COMPOSER_IDL_GENERATED_H = \
@@ -20,7 +33,6 @@ $(COMPOSER_IDL_GENERATED_H): $(IDLS)
$(srcdir)/../../composer/Evolution-Composer.idl
$(COMPOSER_IDL_GENERATED_C): $(COMPOSER_IDL_GENERATED_H)
-
# SelectNames IDL files
SELECT_NAMES_IDL_GENERATED_H = \
@@ -37,8 +49,11 @@ $(SELECT_NAMES_IDL_GENERATED_H): $(IDLS)
$(SELECT_NAMES_IDL_GENERATED_C): $(SELECT_NAMES_IDL_GENERATED_H)
-IDL_GENERATED = $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
+IDL_GENERATED = $(CALENDAR_IDL_GENERATED) $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
+# The marshallers
+MARSHAL_GENERATED = e-calendar-marshal.c e-calendar-marshal.h
+@EVO_MARSHAL_RULE@
SUBDIRS = alarm-notify dialogs
@@ -53,8 +68,6 @@ INCLUDES = \
-I$(top_srcdir)/calendar/cal-client \
-I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/libical/src \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/a11y/calendar \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
@@ -77,6 +90,7 @@ etspec_DATA = \
libevolution_calendar_la_SOURCES = \
$(IDL_GENERATED) \
+ $(MARSHAL_GENERATED) \
cal-search-bar.c \
cal-search-bar.h \
calendar-config.c \
@@ -203,8 +217,6 @@ libevolution_calendar_la_LIBADD = \
$(DB3_LDADD) \
$(top_builddir)/widgets/menus/libmenus.la \
$(top_builddir)/shell/libeshell.la \
- $(top_builddir)/calendar/cal-client/libcal-client.la \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
@@ -226,6 +238,7 @@ schemadir = $(GCONF_SCHEMA_FILE_DIR)
schema_DATA = apps_evolution_calendar.schemas
EXTRA_DIST = \
+ e-calendar-marshal.list \
$(glade_DATA) \
$(schema_DATA) \
$(etspec_DATA) \
diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am
index 82ecd516cf..6e1675aaa9 100644
--- a/calendar/gui/alarm-notify/Makefile.am
+++ b/calendar/gui/alarm-notify/Makefile.am
@@ -20,9 +20,6 @@ privlibexec_PROGRAMS = evolution-alarm-notify
INCLUDES = \
-DG_LOG_DOMAIN=\"evolution-alarm-notify\" \
-I$(top_srcdir) \
- -I$(top_srcdir)/calendar \
- -I$(top_builddir)/calendar \
- -I$(top_srcdir)/libical/src \
-I$(top_srcdir)/widgets \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
@@ -51,8 +48,7 @@ evolution_alarm_notify_SOURCES = \
util.h
evolution_alarm_notify_LDADD = \
- $(top_builddir)/calendar/cal-client/libcal-client.la \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
+ $(top_builddir)/e-util/libeutil.la \
$(EVOLUTION_CALENDAR_LIBS)
server_in_files = GNOME_Evolution_Calendar_AlarmNotify.server.in.in
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c
index 3697fc1290..d1db74ae80 100644
--- a/calendar/gui/alarm-notify/alarm-notify-dialog.c
+++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c
@@ -37,7 +37,7 @@
#include <gal/widgets/e-unicode.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "alarm-notify-dialog.h"
#include "config-data.h"
#include "util.h"
@@ -219,7 +219,7 @@ write_times (GtkHTMLStream *stream, char *start, char *end)
/* Creates a heading for the alarm notification dialog */
static void
write_html_heading (GtkHTMLStream *stream, const char *message,
- CalComponentVType vtype, time_t occur_start, time_t occur_end)
+ ECalComponentVType vtype, time_t occur_start, time_t occur_end)
{
char *buf;
char *start, *end;
@@ -258,11 +258,11 @@ write_html_heading (GtkHTMLStream *stream, const char *message,
/* Write the times */
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
write_times (stream, start, end);
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
write_times (stream, start, end);
break;
@@ -293,7 +293,7 @@ write_html_heading (GtkHTMLStream *stream, const char *message,
**/
gpointer
alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
- CalComponentVType vtype, const char *message,
+ ECalComponentVType vtype, const char *message,
AlarmNotifyFunc func, gpointer func_data)
{
AlarmNotify *an;
@@ -304,7 +304,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
g_return_val_if_fail (trigger != -1, NULL);
/* Only VEVENTs or VTODOs can have alarms */
- g_return_val_if_fail (vtype == CAL_COMPONENT_EVENT || vtype == CAL_COMPONENT_TODO, NULL);
+ g_return_val_if_fail (vtype == E_CAL_COMPONENT_EVENT || vtype == E_CAL_COMPONENT_TODO, NULL);
g_return_val_if_fail (message != NULL, NULL);
g_return_val_if_fail (func != NULL, NULL);
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h
index 39cadbca0b..9bebce0a08 100644
--- a/calendar/gui/alarm-notify/alarm-notify-dialog.h
+++ b/calendar/gui/alarm-notify/alarm-notify-dialog.h
@@ -23,7 +23,7 @@
#include <time.h>
#include <glib.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
@@ -36,7 +36,7 @@ typedef enum {
typedef void (* AlarmNotifyFunc) (AlarmNotifyResult result, int snooze_mins, gpointer data);
gpointer alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
- CalComponentVType vtype, const char *message,
+ ECalComponentVType vtype, const char *message,
AlarmNotifyFunc func, gpointer func_data);
void alarm_notify_dialog_disable_buttons (gpointer dialog);
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index ce73223afb..267a1001ca 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -23,7 +23,7 @@
#endif
#include <string.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "alarm-notify.h"
#include "alarm-queue.h"
#include "save.h"
@@ -92,7 +92,7 @@ static void
free_client_hash (gpointer key, gpointer value, gpointer user_data)
{
char *uri = key;
- CalClient *client = value;
+ ECal *client = value;
g_free (uri);
g_object_unref (client);
@@ -248,7 +248,7 @@ AlarmNotify_removeCalendar (PortableServer_Servant servant,
{
AlarmNotify *an;
AlarmNotifyPrivate *priv;
- CalClient *client;
+ ECal *client;
an = ALARM_NOTIFY (bonobo_object_from_servant (servant));
priv = an->priv;
@@ -299,7 +299,7 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
CORBA_Environment *ev)
{
AlarmNotifyPrivate *priv;
- CalClient *client;
+ ECal *client;
g_return_if_fail (an != NULL);
g_return_if_fail (IS_ALARM_NOTIFY (an));
@@ -312,10 +312,10 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
if (g_hash_table_lookup (priv->uri_client_hash, str_uri))
return;
- client = cal_client_new (str_uri, CALOBJ_TYPE_EVENT);
+ client = e_cal_new (str_uri, CALOBJ_TYPE_EVENT);
if (client) {
- if (cal_client_open (client, FALSE, NULL)) {
+ if (e_cal_open (client, FALSE, NULL)) {
add_uri_to_load (str_uri);
g_hash_table_insert (priv->uri_client_hash,
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 774604c804..be9574d9d8 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -41,7 +41,8 @@
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-uidefs.h>
#include <e-util/eggtrayicon.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
+#include "evolution-calendar.h"
#include "alarm.h"
#include "alarm-notify-dialog.h"
#include "alarm-queue.h"
@@ -66,7 +67,7 @@ static GHashTable *client_alarms_hash = NULL;
/* Structure that stores a client we are monitoring */
typedef struct {
/* Monitored client */
- CalClient *client;
+ ECal *client;
/* Number of times this client has been registered */
int refcount;
@@ -80,7 +81,7 @@ typedef struct {
GHashTable *uid_alarms_hash;
} ClientAlarms;
-/* Pair of a CalComponentAlarms and the mapping from queued alarm IDs to the
+/* Pair of a ECalComponentAlarms and the mapping from queued alarm IDs to the
* actual alarm instance structures.
*/
typedef struct {
@@ -91,7 +92,7 @@ typedef struct {
char *uid;
/* The actual component and its alarm instances */
- CalComponentAlarms *alarms;
+ ECalComponentAlarms *alarms;
/* List of QueuedAlarm structures */
GSList *queued_alarms;
@@ -106,7 +107,7 @@ typedef struct {
gpointer alarm_id;
/* Instance from our parent CompQueuedAlarms->alarms->alarms list */
- CalAlarmInstance *instance;
+ ECalComponentAlarmInstance *instance;
/* Whether this is a snoozed queued alarm or a normal one */
guint snooze : 1;
@@ -176,7 +177,7 @@ midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data)
/* Looks up a client in the client alarms hash table */
static ClientAlarms *
-lookup_client (CalClient *client)
+lookup_client (ECal *client)
{
return g_hash_table_lookup (client_alarms_hash, client);
}
@@ -226,7 +227,7 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id,
if (remove_alarm) {
cqa->expecting_update = TRUE;
- cal_client_discard_alarm (cqa->parent_client->client, cqa->alarms->comp,
+ e_cal_discard_alarm (cqa->parent_client->client, cqa->alarms->comp,
qa->instance->auid, NULL);
cqa->expecting_update = FALSE;
}
@@ -245,10 +246,10 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id,
g_free (cqa->uid);
cqa->uid = NULL;
cqa->parent_client = NULL;
- cal_component_alarms_free (cqa->alarms);
+ e_cal_component_alarms_free (cqa->alarms);
g_free (cqa);
} else {
- cal_component_alarms_free (cqa->alarms);
+ e_cal_component_alarms_free (cqa->alarms);
cqa->alarms = NULL;
}
}
@@ -258,10 +259,10 @@ static void
alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
{
CompQueuedAlarms *cqa;
- CalComponent *comp;
+ ECalComponent *comp;
QueuedAlarm *qa;
- CalComponentAlarm *alarm;
- CalAlarmAction action;
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmAction action;
cqa = data;
comp = cqa->alarms->comp;
@@ -279,26 +280,26 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
* occurrence.
*/
- alarm = cal_component_get_alarm (comp, qa->instance->auid);
+ alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);
- cal_component_alarm_get_action (alarm, &action);
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_free (alarm);
switch (action) {
- case CAL_ALARM_AUDIO:
+ case E_CAL_COMPONENT_ALARM_AUDIO:
audio_notification (trigger, cqa, alarm_id);
break;
- case CAL_ALARM_DISPLAY:
+ case E_CAL_COMPONENT_ALARM_DISPLAY:
display_notification (trigger, cqa, alarm_id, TRUE);
break;
- case CAL_ALARM_EMAIL:
+ case E_CAL_COMPONENT_ALARM_EMAIL:
mail_notification (trigger, cqa, alarm_id);
break;
- case CAL_ALARM_PROCEDURE:
+ case E_CAL_COMPONENT_ALARM_PROCEDURE:
procedure_notification (trigger, cqa, alarm_id);
break;
@@ -308,11 +309,11 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
}
}
-/* Adds the alarms in a CalComponentAlarms structure to the alarms queued for a
+/* Adds the alarms in a ECalComponentAlarms structure to the alarms queued for a
* particular client. Also puts the triggers in the alarm timer queue.
*/
static void
-add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms)
+add_component_alarms (ClientAlarms *ca, ECalComponentAlarms *alarms)
{
const char *uid;
CompQueuedAlarms *cqa;
@@ -320,7 +321,7 @@ add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms)
/* No alarms? */
if (alarms->alarms == NULL) {
- cal_component_alarms_free (alarms);
+ e_cal_component_alarms_free (alarms);
return;
}
@@ -332,7 +333,7 @@ add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms)
cqa->queued_alarms = NULL;
for (l = alarms->alarms; l; l = l->next) {
- CalAlarmInstance *instance;
+ ECalComponentAlarmInstance *instance;
gpointer alarm_id;
QueuedAlarm *qa;
@@ -353,14 +354,14 @@ add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms)
cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa);
}
- cal_component_get_uid (alarms->comp, &uid);
+ e_cal_component_get_uid (alarms->comp, &uid);
/* If we failed to add all the alarms, then we should get rid of the cqa */
if (cqa->queued_alarms == NULL) {
g_message ("add_component_alarms(): Could not add any of the alarms "
"for the component `%s'; discarding it...", uid);
- cal_component_alarms_free (cqa->alarms);
+ e_cal_component_alarms_free (cqa->alarms);
cqa->alarms = NULL;
g_free (cqa);
@@ -379,10 +380,10 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end)
GSList *comp_alarms;
GSList *l;
- comp_alarms = cal_client_get_alarms_in_range (ca->client, start, end);
+ comp_alarms = e_cal_get_alarms_in_range (ca->client, start, end);
for (l = comp_alarms; l; l = l->next) {
- CalComponentAlarms *alarms;
+ ECalComponentAlarms *alarms;
alarms = l->data;
add_component_alarms (ca, alarms);
@@ -427,13 +428,13 @@ load_missed_alarms (ClientAlarms *ca)
/* Called when a calendar client finished loading; we load its alarms */
static void
-cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+cal_opened_cb (ECal *client, ECalOpenStatus status, gpointer data)
{
ClientAlarms *ca;
ca = data;
- if (status != CAL_CLIENT_OPEN_SUCCESS)
+ if (status != E_CAL_OPEN_SUCCESS)
return;
load_alarms_for_today (ca);
@@ -496,11 +497,11 @@ remove_comp (ClientAlarms *ca, const char *uid)
* alarms.
*/
static void
-obj_updated_cb (CalClient *client, const char *uid, gpointer data)
+obj_updated_cb (ECal *client, const char *uid, gpointer data)
{
ClientAlarms *ca;
time_t now, day_end;
- CalComponentAlarms *alarms;
+ ECalComponentAlarms *alarms;
gboolean found;
icaltimezone *zone;
CompQueuedAlarms *cqa;
@@ -513,7 +514,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
day_end = time_day_end_with_zone (now, zone);
- found = cal_client_get_alarms_for_object (ca->client, uid, now, day_end, &alarms);
+ found = e_cal_get_alarms_for_object (ca->client, uid, now, day_end, &alarms);
if (!found) {
remove_comp (ca, uid);
@@ -533,7 +534,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
/* add the new alarms */
for (l = cqa->alarms->alarms; l; l = l->next) {
- CalAlarmInstance *instance;
+ ECalComponentAlarmInstance *instance;
gpointer alarm_id;
QueuedAlarm *qa;
@@ -566,7 +567,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
* alarms.
*/
static void
-obj_removed_cb (CalClient *client, const char *uid, gpointer data)
+obj_removed_cb (ECal *client, const char *uid, gpointer data)
{
ClientAlarms *ca;
@@ -610,16 +611,16 @@ create_snooze (CompQueuedAlarms *cqa, gpointer alarm_id, int snooze_mins)
/* Launches a component editor for a component */
static void
-edit_component (CalClient *client, CalComponent *comp)
+edit_component (ECal *client, ECalComponent *comp)
{
const char *uid;
const char *uri;
CORBA_Environment ev;
GNOME_Evolution_Calendar_CompEditorFactory factory;
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
- uri = cal_client_get_uri (client);
+ uri = e_cal_get_uri (client);
/* Get the factory */
@@ -695,15 +696,15 @@ typedef struct {
time_t trigger;
CompQueuedAlarms *cqa;
gpointer alarm_id;
- CalComponent *comp;
- CalClient *client;
+ ECalComponent *comp;
+ ECal *client;
GtkWidget *tray_icon;
GtkWidget *image;
GtkWidget *alarm_dialog;
} TrayIconData;
static void
-on_dialog_obj_updated_cb (CalClient *client, const char *uid, gpointer data)
+on_dialog_obj_updated_cb (ECal *client, const char *uid, gpointer data)
{
/* commented out so gcc won't complain about the unused variable
struct notify_dialog_closure *c = data;
@@ -711,12 +712,12 @@ on_dialog_obj_updated_cb (CalClient *client, const char *uid, gpointer data)
}
static void
-on_dialog_obj_removed_cb (CalClient *client, const char *uid, gpointer data)
+on_dialog_obj_removed_cb (ECal *client, const char *uid, gpointer data)
{
const char *our_uid;
TrayIconData *tray_data = data;
- cal_component_get_uid (tray_data->comp, &our_uid);
+ e_cal_component_get_uid (tray_data->comp, &our_uid);
g_return_if_fail (our_uid && *our_uid);
if (!strcmp (uid, our_uid)) {
@@ -798,7 +799,7 @@ tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_da
tray_data->trigger,
qa->instance->occur_start,
qa->instance->occur_end,
- cal_component_get_vtype (tray_data->comp),
+ e_cal_component_get_vtype (tray_data->comp),
tray_data->message,
notify_dialog_cb, tray_data);
if (tray_data->alarm_dialog) {
@@ -838,15 +839,15 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
gpointer alarm_id, gboolean use_description)
{
QueuedAlarm *qa;
- CalComponent *comp;
- CalClient *client;
- CalComponentVType vtype;
+ ECalComponent *comp;
+ ECal *client;
+ ECalComponentVType vtype;
const char *message;
- CalComponentAlarm *alarm;
+ ECalComponentAlarm *alarm;
GtkWidget *tray_icon, *image, *ebox;
GtkTooltips *tooltips;
TrayIconData *tray_data;
- CalComponentText text;
+ ECalComponentText text;
char *str, *start_str, *end_str, *alarm_str;
icaltimezone *current_zone;
@@ -855,19 +856,19 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
if (!qa)
return;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
/* get a sensible description for the event */
- alarm = cal_component_get_alarm (comp, qa->instance->auid);
+ alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);
- cal_component_alarm_get_description (alarm, &text);
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_get_description (alarm, &text);
+ e_cal_component_alarm_free (alarm);
if (text.value)
message = text.value;
else {
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
if (text.value)
message = text.value;
else
@@ -909,7 +910,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
tray_data->trigger = trigger;
tray_data->cqa = cqa;
tray_data->alarm_id = alarm_id;
- tray_data->comp = cal_component_clone (comp);
+ tray_data->comp = e_cal_component_clone (comp);
tray_data->client = cqa->parent_client->client;
tray_data->image = image;
tray_data->blink_state = FALSE;
@@ -932,8 +933,8 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
gpointer alarm_id)
{
QueuedAlarm *qa;
- CalComponent *comp;
- CalComponentAlarm *alarm;
+ ECalComponent *comp;
+ ECalComponentAlarm *alarm;
icalattach *attach;
comp = cqa->alarms->comp;
@@ -941,11 +942,11 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
if (!qa)
return;
- alarm = cal_component_get_alarm (comp, qa->instance->auid);
+ alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);
- cal_component_alarm_get_attach (alarm, &attach);
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_get_attach (alarm, &attach);
+ e_cal_component_alarm_free (alarm);
if (attach && icalattach_get_is_url (attach)) {
const char *url;
@@ -1038,9 +1039,9 @@ static void
procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id)
{
QueuedAlarm *qa;
- CalComponent *comp;
- CalComponentAlarm *alarm;
- CalComponentText description;
+ ECalComponent *comp;
+ ECalComponentAlarm *alarm;
+ ECalComponentText description;
icalattach *attach;
const char *url;
char *cmd;
@@ -1051,12 +1052,12 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
if (!qa)
return;
- alarm = cal_component_get_alarm (comp, qa->instance->auid);
+ alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);
- cal_component_alarm_get_attach (alarm, &attach);
- cal_component_alarm_get_description (alarm, &description);
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_get_attach (alarm, &attach);
+ e_cal_component_alarm_get_description (alarm, &description);
+ e_cal_component_alarm_free (alarm);
/* If the alarm has no attachment, simply display a notification dialog. */
if (!attach)
@@ -1125,7 +1126,7 @@ alarm_queue_init (void)
static void
free_client_alarms_cb (gpointer key, gpointer value, gpointer user_data)
{
- CalClient *client = key;
+ ECal *client = key;
ClientAlarms *ca = value;
if (ca) {
@@ -1175,13 +1176,13 @@ alarm_queue_done (void)
* queueing system when it is no longer wanted.
**/
void
-alarm_queue_add_client (CalClient *client)
+alarm_queue_add_client (ECal *client)
{
ClientAlarms *ca;
g_return_if_fail (alarm_queue_inited);
g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
ca = lookup_client (client);
if (ca) {
@@ -1199,7 +1200,7 @@ alarm_queue_add_client (CalClient *client)
ca->uid_alarms_hash = g_hash_table_new (g_str_hash, g_str_equal);
- if (cal_client_get_load_state (client) != CAL_CLIENT_LOAD_LOADED)
+ if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED)
g_signal_connect (client, "cal_opened",
G_CALLBACK (cal_opened_cb),
ca);
@@ -1211,7 +1212,7 @@ alarm_queue_add_client (CalClient *client)
G_CALLBACK (obj_removed_cb),
ca);
- if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED) {
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) {
load_alarms_for_today (ca);
load_missed_alarms (ca);
}
@@ -1264,13 +1265,13 @@ remove_client_alarms (ClientAlarms *ca)
* Removes a calendar client from the alarm queueing system.
**/
void
-alarm_queue_remove_client (CalClient *client)
+alarm_queue_remove_client (ECal *client)
{
ClientAlarms *ca;
g_return_if_fail (alarm_queue_inited);
g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
ca = lookup_client (client);
g_return_if_fail (ca != NULL);
diff --git a/calendar/gui/alarm-notify/alarm-queue.h b/calendar/gui/alarm-notify/alarm-queue.h
index a37119145f..12802750ec 100644
--- a/calendar/gui/alarm-notify/alarm-queue.h
+++ b/calendar/gui/alarm-notify/alarm-queue.h
@@ -21,14 +21,14 @@
#ifndef ALARM_QUEUE_H
#define ALARM_QUEUE_H
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
void alarm_queue_init (void);
void alarm_queue_done (void);
-void alarm_queue_add_client (CalClient *client);
-void alarm_queue_remove_client (CalClient *client);
+void alarm_queue_add_client (ECal *client);
+void alarm_queue_remove_client (ECal *client);
#endif
diff --git a/calendar/gui/alarm-notify/util.c b/calendar/gui/alarm-notify/util.c
index f40943d9b0..4bc91810a5 100644
--- a/calendar/gui/alarm-notify/util.c
+++ b/calendar/gui/alarm-notify/util.c
@@ -21,7 +21,7 @@
#include <libgnome/gnome-i18n.h>
#include <e-util/e-time-utils.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "config-data.h"
#include "util.h"
diff --git a/calendar/gui/alarm-notify/util.h b/calendar/gui/alarm-notify/util.h
index ab4cc4f995..7dae3dd7fe 100644
--- a/calendar/gui/alarm-notify/util.h
+++ b/calendar/gui/alarm-notify/util.h
@@ -22,7 +22,7 @@
#ifndef UTIL_H
#define UTIL_H
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
char *timet_to_str_with_zone (time_t t, icaltimezone *zone);
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index d04cbcb492..3bc9143215 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -225,7 +225,7 @@ get_current_category (CalSearchBar *cal_search)
/* Sets the query string to be (contains? "field" "text") */
static void
-notify_query_contains (CalSearchBar *cal_search, const char *field)
+notify_e_cal_view_contains (CalSearchBar *cal_search, const char *field)
{
char *text;
char *sexp;
@@ -294,19 +294,19 @@ regen_query (CalSearchBar *cal_search)
switch (id) {
case SEARCH_ANY_FIELD_CONTAINS:
- notify_query_contains (cal_search, "any");
+ notify_e_cal_view_contains (cal_search, "any");
break;
case SEARCH_SUMMARY_CONTAINS:
- notify_query_contains (cal_search, "summary");
+ notify_e_cal_view_contains (cal_search, "summary");
break;
case SEARCH_DESCRIPTION_CONTAINS:
- notify_query_contains (cal_search, "description");
+ notify_e_cal_view_contains (cal_search, "description");
break;
case SEARCH_COMMENT_CONTAINS:
- notify_query_contains (cal_search, "comment");
+ notify_e_cal_view_contains (cal_search, "comment");
break;
case SEARCH_CATEGORY_IS:
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 5dbce1ec54..c63075f5ea 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -49,7 +49,7 @@
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-exception.h>
#include <gal/util/e-util.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "shell/Evolution.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -86,13 +86,13 @@ file_new_appointment_cb (BonoboUIComponent *uic, gpointer data, const char *path
{
GnomeCalendar *gcal;
time_t dtstart, dtend;
- ECalView *cal_view;
+ ECalendarView *cal_view;
gcal = GNOME_CALENDAR (data);
- cal_view = (ECalView *) gnome_calendar_get_current_view_widget (gcal);
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
+ cal_view = (ECalendarView *) gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
}
static void
@@ -100,13 +100,13 @@ file_new_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
{
GnomeCalendar *gcal;
time_t dtstart, dtend;
- ECalView *cal_view;
+ ECalendarView *cal_view;
gcal = GNOME_CALENDAR (data);
- cal_view = (ECalView *) gnome_calendar_get_current_view_widget (gcal);
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
+ cal_view = (ECalendarView *) gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
}
static void
@@ -114,13 +114,13 @@ file_new_meeting_cb (BonoboUIComponent *uic, gpointer data, const char *path)
{
GnomeCalendar *gcal;
time_t dtstart, dtend;
- ECalView *cal_view;
+ ECalendarView *cal_view;
gcal = GNOME_CALENDAR (data);
- cal_view = (ECalView *) gnome_calendar_get_current_view_widget (gcal);
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
+ cal_view = (ECalendarView *) gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
}
static void
@@ -386,12 +386,12 @@ publish_freebusy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
/* FIXME Should we aggregate the data? */
client_list = e_cal_model_get_client_list (gnome_calendar_get_calendar_model (gcal));
for (cl = client_list; cl != NULL; cl = cl->next) {
- if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
+ if (e_cal_get_free_busy ((ECal *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, (CalClient *) cl->data, NULL);
+ ECalComponent *comp = E_CAL_COMPONENT (l->data);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, (ECal *) cl->data, NULL);
g_object_unref (comp);
}
@@ -649,28 +649,28 @@ void
calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalendar *gcal, gboolean enable)
{
BonoboUIComponent *uic;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
GList *list;
int n_selected;
GtkWidget *view;
- CalClient *cal_client;
+ ECal *e_cal;
gboolean read_only = FALSE, has_recurrences;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
view = gnome_calendar_get_current_view_widget (gcal);
- list = e_cal_view_get_selected_events (E_CAL_VIEW (view));
+ list = e_calendar_view_get_selected_events (E_CALENDAR_VIEW (view));
n_selected = enable ? g_list_length (list) : 0;
- event = (ECalViewEvent *) list ? list->data : NULL;
+ event = (ECalendarViewEvent *) list ? list->data : NULL;
if (event) {
- cal_client_is_read_only (event->comp_data->client, &read_only, NULL);
+ e_cal_is_read_only (event->comp_data->client, &read_only, NULL);
} else {
- cal_client = e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal));
- if (cal_client)
- cal_client_is_read_only (cal_client, &read_only, NULL);
+ e_cal = e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal));
+ if (e_cal)
+ e_cal_is_read_only (e_cal, &read_only, NULL);
else
read_only = TRUE;
}
@@ -698,8 +698,8 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen
has_recurrences = FALSE;
if (n_selected > 0 && !read_only) {
if (list) {
- event = (ECalViewEvent *) list->data;
- if (cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ event = (ECalendarViewEvent *) list->data;
+ if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
has_recurrences = TRUE;
}
}
@@ -725,16 +725,16 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea
{
BonoboUIComponent *uic;
int n_selected;
- CalClient *cal_client;
+ ECal *e_cal;
gboolean read_only = TRUE;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
n_selected = enable ? gnome_calendar_get_num_tasks_selected (gcal) : 0;
- cal_client = gnome_calendar_get_task_pad_cal_client (gcal);
- if (cal_client)
- cal_client_is_read_only (cal_client, &read_only, NULL);
+ e_cal = gnome_calendar_get_task_pad_e_cal (gcal);
+ if (e_cal)
+ e_cal_is_read_only (e_cal, &read_only, NULL);
else
read_only = TRUE;
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 4282ea7d5c..250328fa10 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -38,7 +38,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <gal/util/e-util.h>
#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "calendar-component.h"
#include "calendar-commands.h"
diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c
index ff30299746..bd8949bd00 100644
--- a/calendar/gui/calendar-offline-handler.c
+++ b/calendar/gui/calendar-offline-handler.c
@@ -32,14 +32,14 @@
#include <bonobo/bonobo-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-url.h"
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "calendar-offline-handler.h"
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
struct _CalendarOfflineHandlerPrivate {
- CalClient *client;
+ ECal *client;
GNOME_Evolution_OfflineProgressListener listener_interface;
@@ -76,7 +76,7 @@ create_connection_list (CalendarOfflineHandler *offline_handler)
priv = offline_handler->priv;
- uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE);
+ uris = e_cal_uri_list (priv->client, CAL_MODE_REMOTE);
list = GNOME_Evolution_ConnectionList__alloc ();
list->_length = 0;
@@ -139,7 +139,7 @@ update_offline (CalendarOfflineHandler *offline_handler)
}
static void
-backend_cal_set_mode (CalClient *client, CalClientSetModeStatus status, CalMode mode, gpointer data)
+backend_cal_set_mode (ECal *client, ECalSetModeStatus status, CalMode mode, gpointer data)
{
CalendarOfflineHandler *offline_handler = data;
@@ -148,29 +148,29 @@ backend_cal_set_mode (CalClient *client, CalClientSetModeStatus status, CalMode
}
static void
-backend_cal_opened_offline (CalClient *client, CalClientOpenStatus status, gpointer data)
+backend_cal_opened_offline (ECal *client, ECalOpenStatus status, gpointer data)
{
CalendarOfflineHandler *offline_handler = data;
- if (status != CAL_CLIENT_OPEN_SUCCESS) {
+ if (status != E_CAL_OPEN_SUCCESS) {
update_offline (offline_handler);
g_object_unref (client);
return;
}
g_signal_connect (client, "cal_set_mode", G_CALLBACK (backend_cal_set_mode), offline_handler);
- cal_client_set_mode (client, CAL_MODE_LOCAL);
+ e_cal_set_mode (client, CAL_MODE_LOCAL);
}
static void
-backend_cal_opened_online (CalClient *client, CalClientOpenStatus status, gpointer data)
+backend_cal_opened_online (ECal *client, ECalOpenStatus status, gpointer data)
{
- if (status != CAL_CLIENT_OPEN_SUCCESS) {
+ if (status != E_CAL_OPEN_SUCCESS) {
g_object_unref (G_OBJECT (client));
return;
}
- cal_client_set_mode (client, CAL_MODE_REMOTE);
+ e_cal_set_mode (client, CAL_MODE_REMOTE);
g_object_unref (client);
}
@@ -179,13 +179,13 @@ backend_go_offline (gpointer data, gpointer user_data)
{
CalendarOfflineHandler *offline_handler = user_data;
char *uri = data;
- CalClient *client;
+ ECal *client;
gboolean success;
GError *error = NULL;
- client = cal_client_new (uri, CALOBJ_TYPE_ANY);
+ client = e_cal_new (uri, CALOBJ_TYPE_ANY);
g_signal_connect (client, "cal_opened", G_CALLBACK (backend_cal_opened_offline), offline_handler);
- success = cal_client_open (client, TRUE, &error);
+ success = e_cal_open (client, TRUE, &error);
if (!success) {
g_warning (_("backend_go_offline(): %s"), error->message);
update_offline (offline_handler);
@@ -200,14 +200,14 @@ backend_go_online (gpointer data, gpointer user_data)
{
CalendarOfflineHandler *offline_handler = user_data;
char *uri = data;
- CalClient *client;
+ ECal *client;
gboolean success;
GError *error = NULL;
- client = cal_client_new (uri, CALOBJ_TYPE_ANY);
+ client = e_cal_new (uri, CALOBJ_TYPE_ANY);
g_signal_connect (G_OBJECT (client), "cal_opened",
G_CALLBACK (backend_cal_opened_online), offline_handler);
- success = cal_client_open (client, TRUE, &error);
+ success = e_cal_open (client, TRUE, &error);
if (!success) {
g_warning (_("backend_go_online(): %s"), error->message);
g_object_unref (G_OBJECT (client));
@@ -231,7 +231,7 @@ impl_goOffline (PortableServer_Servant servant,
/* To update the status */
priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev);
- uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE);
+ uris = e_cal_uri_list (priv->client, CAL_MODE_REMOTE);
g_list_foreach (uris, backend_go_offline, offline_handler);
}
@@ -247,7 +247,7 @@ impl_goOnline (PortableServer_Servant servant,
offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
priv = offline_handler->priv;
- uris = cal_client_uri_list (priv->client, CAL_MODE_LOCAL);
+ uris = e_cal_uri_list (priv->client, CAL_MODE_LOCAL);
g_list_foreach (uris, backend_go_online, offline_handler);
}
@@ -327,7 +327,7 @@ calendar_offline_handler_init (CalendarOfflineHandler *offline_handler)
offline_handler->priv = priv;
/* FIXME: what URI to use? */
- priv->client = cal_client_new ("", CALOBJ_TYPE_ANY);
+ priv->client = e_cal_new ("", CALOBJ_TYPE_ANY);
priv->listener_interface = CORBA_OBJECT_NIL;
priv->is_offline = FALSE;
}
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 7b7dcb4c87..ffb26a831c 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -27,7 +27,7 @@
#include <bonobo/bonobo-i18n.h>
#include <evolution-calendar.h>
#include <e-util/e-url.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "calendar-config.h"
#include "e-comp-editor-registry.h"
#include "comp-editor-factory.h"
@@ -69,7 +69,7 @@ typedef struct {
char *uri;
/* Client of the calendar */
- CalClient *client;
+ ECal *client;
/* Count editors using this client */
int editor_count;
@@ -239,23 +239,23 @@ editor_destroy_cb (GtkObject *object, gpointer data)
static void
edit_existing (OpenClient *oc, const char *uid)
{
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
CompEditor *editor;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
g_assert (oc->open);
/* Get the object */
- if (!cal_client_get_object (oc->client, uid, NULL, &icalcomp, NULL)) {
+ if (!e_cal_get_object (oc->client, uid, NULL, &icalcomp, NULL)) {
/* FIXME Better error handling */
g_warning (G_STRLOC ": Syntax error while getting component `%s'", uid);
return;
}
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return;
@@ -263,14 +263,14 @@ edit_existing (OpenClient *oc, const char *uid)
/* Create the appropriate type of editor */
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
editor = COMP_EDITOR (event_editor_new (oc->client));
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
editor = COMP_EDITOR (task_editor_new (oc->client));
break;
@@ -293,12 +293,12 @@ edit_existing (OpenClient *oc, const char *uid)
/* Creates a component with the appropriate defaults for the specified component
* type.
*/
-static CalComponent *
-get_default_event (CalClient *client, gboolean all_day)
+static ECalComponent *
+get_default_event (ECal *client, gboolean all_day)
{
- CalComponent *comp;
+ ECalComponent *comp;
struct icaltimetype itt;
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
char *location;
icaltimezone *zone;
@@ -313,8 +313,8 @@ get_default_event (CalClient *client, gboolean all_day)
dt.value = &itt;
dt.tzid = icaltimezone_get_tzid (zone);
- cal_component_set_dtstart (comp, &dt);
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
} else {
itt = icaltime_current_time_with_zone (zone);
icaltime_adjust (&itt, 0, 1, -itt.minute, -itt.second);
@@ -322,20 +322,20 @@ get_default_event (CalClient *client, gboolean all_day)
dt.value = &itt;
dt.tzid = icaltimezone_get_tzid (zone);
- cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
icaltime_adjust (&itt, 0, 1, 0, 0);
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
}
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
return comp;
}
-static CalComponent *
-get_default_task (CalClient *client)
+static ECalComponent *
+get_default_task (ECal *client)
{
- CalComponent *comp;
+ ECalComponent *comp;
comp = cal_comp_task_new_with_defaults (client);
@@ -346,7 +346,7 @@ get_default_task (CalClient *client)
static void
edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type)
{
- CalComponent *comp;
+ ECalComponent *comp;
CompEditor *editor;
switch (type) {
@@ -400,7 +400,7 @@ resolve_pending_requests (OpenClient *oc)
zone = icaltimezone_get_builtin_timezone (location);
if (zone)
/* FIXME Error handling? */
- cal_client_set_default_timezone (oc->client, zone, NULL);
+ e_cal_set_default_timezone (oc->client, zone, NULL);
for (l = oc->pending; l; l = l->next) {
Request *request;
@@ -428,7 +428,7 @@ resolve_pending_requests (OpenClient *oc)
* requests.
*/
static void
-cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+cal_opened_cb (ECal *client, ECalOpenStatus status, gpointer data)
{
OpenClient *oc;
CompEditorFactory *factory;
@@ -440,29 +440,29 @@ cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
priv = factory->priv;
switch (status) {
- case CAL_CLIENT_OPEN_SUCCESS:
+ case E_CAL_OPEN_SUCCESS:
oc->open = TRUE;
resolve_pending_requests (oc);
return;
- case CAL_CLIENT_OPEN_ERROR:
+ case E_CAL_OPEN_ERROR:
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Error while opening the calendar"));
break;
- case CAL_CLIENT_OPEN_NOT_FOUND:
+ case E_CAL_OPEN_NOT_FOUND:
/* bullshit; we specified only_if_exists = FALSE */
g_assert_not_reached ();
return;
- case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED:
+ case E_CAL_OPEN_METHOD_NOT_SUPPORTED:
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Method not supported when opening the calendar"));
break;
- case CAL_CLIENT_OPEN_PERMISSION_DENIED :
+ case E_CAL_OPEN_PERMISSION_DENIED :
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Permission denied to open the calendar"));
@@ -488,13 +488,13 @@ static OpenClient *
open_client (CompEditorFactory *factory, const char *uristr)
{
CompEditorFactoryPrivate *priv;
- CalClient *client;
+ ECal *client;
OpenClient *oc;
GError *error = NULL;
priv = factory->priv;
- client = cal_client_new (uristr, CALOBJ_TYPE_ANY);
+ client = e_cal_new (uristr, CALOBJ_TYPE_ANY);
if (!client)
return NULL;
@@ -512,7 +512,7 @@ open_client (CompEditorFactory *factory, const char *uristr)
g_hash_table_insert (priv->uri_client_hash, oc->uri, oc);
- if (!cal_client_open (oc->client, FALSE, &error)) {
+ if (!e_cal_open (oc->client, FALSE, &error)) {
g_warning (_("open_client(): %s"), error->message);
g_free (oc->uri);
g_object_unref (oc->client);
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 45d9dc1f27..170adb0cf5 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -1,4 +1,4 @@
-/* Evolution calendar - Utilities for manipulating CalComponent objects
+/* Evolution calendar - Utilities for manipulating ECalComponent objects
*
* Copyright (C) 2000 Ximian, Inc.
* Copyright (C) 2000 Ximian, Inc.
@@ -39,31 +39,31 @@
* component object.
**/
void
-cal_comp_util_add_exdate (CalComponent *comp, time_t t, icaltimezone *zone)
+cal_comp_util_add_exdate (ECalComponent *comp, time_t t, icaltimezone *zone)
{
GSList *list;
- CalComponentDateTime *cdt;
+ ECalComponentDateTime *cdt;
g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- cal_component_get_exdate_list (comp, &list);
+ e_cal_component_get_exdate_list (comp, &list);
- cdt = g_new (CalComponentDateTime, 1);
+ cdt = g_new (ECalComponentDateTime, 1);
cdt->value = g_new (struct icaltimetype, 1);
*cdt->value = icaltime_from_timet_with_zone (t, FALSE, zone);
cdt->tzid = g_strdup (icaltimezone_get_tzid (zone));
list = g_slist_append (list, cdt);
- cal_component_set_exdate_list (comp, list);
- cal_component_free_exdate_list (list);
+ e_cal_component_set_exdate_list (comp, list);
+ e_cal_component_free_exdate_list (list);
}
/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */
static gboolean
-cal_component_compare_tzid (const char *tzid1, const char *tzid2)
+e_cal_component_compare_tzid (const char *tzid1, const char *tzid2)
{
gboolean retval = TRUE;
@@ -81,7 +81,7 @@ cal_component_compare_tzid (const char *tzid1, const char *tzid2)
/**
* cal_comp_util_compare_event_timezones:
* @comp: A calendar component object.
- * @client: A #CalClient.
+ * @client: A #ECal.
*
* Checks if the component uses the given timezone for both the start and
* the end time, or if the UTC offsets of the start and end times are the same
@@ -91,11 +91,11 @@ cal_component_compare_tzid (const char *tzid1, const char *tzid2)
* offset in the given timezone.
**/
gboolean
-cal_comp_util_compare_event_timezones (CalComponent *comp,
- CalClient *client,
+cal_comp_util_compare_event_timezones (ECalComponent *comp,
+ ECal *client,
icaltimezone *zone)
{
- CalComponentDateTime start_datetime, end_datetime;
+ ECalComponentDateTime start_datetime, end_datetime;
const char *tzid;
gboolean retval = FALSE;
icaltimezone *start_zone, *end_zone;
@@ -103,8 +103,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
tzid = icaltimezone_get_tzid (zone);
- cal_component_get_dtstart (comp, &start_datetime);
- cal_component_get_dtend (comp, &end_datetime);
+ e_cal_component_get_dtstart (comp, &start_datetime);
+ e_cal_component_get_dtend (comp, &end_datetime);
/* If either the DTSTART or the DTEND is a DATE value, we return TRUE.
Maybe if one was a DATE-TIME we should check that, but that should
@@ -133,8 +133,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
}
/* FIXME: DURATION may be used instead. */
- if (cal_component_compare_tzid (tzid, start_datetime.tzid)
- && cal_component_compare_tzid (tzid, end_datetime.tzid)) {
+ if (e_cal_component_compare_tzid (tzid, start_datetime.tzid)
+ && e_cal_component_compare_tzid (tzid, end_datetime.tzid)) {
/* If both TZIDs are the same as the given zone's TZID, then
we know the timezones are the same so we return TRUE. */
retval = TRUE;
@@ -142,7 +142,7 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
/* If the TZIDs differ, we have to compare the UTC offsets
of the start and end times, using their own timezones and
the given timezone. */
- if (!cal_client_get_timezone (client, start_datetime.tzid,
+ if (!e_cal_get_timezone (client, start_datetime.tzid,
&start_zone, NULL))
goto out;
@@ -157,7 +157,7 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
goto out;
}
- if (!cal_client_get_timezone (client, end_datetime.tzid,
+ if (!e_cal_get_timezone (client, end_datetime.tzid,
&end_zone, NULL))
goto out;
@@ -177,8 +177,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
out:
- cal_component_free_datetime (&start_datetime);
- cal_component_free_datetime (&end_datetime);
+ e_cal_component_free_datetime (&start_datetime);
+ e_cal_component_free_datetime (&end_datetime);
return retval;
}
@@ -202,16 +202,16 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
* user cancelled the deletion.
**/
gboolean
-cal_comp_is_on_server (CalComponent *comp, CalClient *client)
+cal_comp_is_on_server (ECalComponent *comp, ECal *client)
{
const char *uid;
icalcomponent *icalcomp;
GError *error = NULL;
g_return_val_if_fail (comp != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_val_if_fail (E_IS_CAL (client), FALSE);
/* See if the component is on the server. If it is not, then it likely
* means that the appointment is new, only in the day view, and we
@@ -219,9 +219,9 @@ cal_comp_is_on_server (CalComponent *comp, CalClient *client)
* confirm and we can just delete the event. Otherwise, we ask
* the user.
*/
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
- if (cal_client_get_object (client, uid, NULL, &icalcomp, &error)) {
+ if (e_cal_get_object (client, uid, NULL, &icalcomp, &error)) {
icalcomponent_free (icalcomp);
return TRUE;
@@ -243,22 +243,22 @@ cal_comp_is_on_server (CalComponent *comp, CalClient *client)
*
* Return value: A newly-created calendar component.
**/
-CalComponent *
-cal_comp_event_new_with_defaults (CalClient *client)
+ECalComponent *
+cal_comp_event_new_with_defaults (ECal *client)
{
icalcomponent *icalcomp;
- CalComponent *comp;
+ ECalComponent *comp;
int interval;
CalUnits units;
- CalComponentAlarm *alarm;
+ ECalComponentAlarm *alarm;
icalproperty *icalprop;
- CalAlarmTrigger trigger;
+ ECalComponentAlarmTrigger trigger;
- if (!cal_client_get_default_object (client, &icalcomp, NULL))
+ if (!e_cal_get_default_object (client, &icalcomp, NULL))
return NULL;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return NULL;
@@ -270,20 +270,20 @@ cal_comp_event_new_with_defaults (CalClient *client)
interval = calendar_config_get_default_reminder_interval ();
units = calendar_config_get_default_reminder_units ();
- alarm = cal_component_alarm_new ();
+ alarm = e_cal_component_alarm_new ();
/* We don't set the description of the alarm; we'll copy it from the
* summary when it gets committed to the server. For that, we add a
* X-EVOLUTION-NEEDS-DESCRIPTION property to the alarm's component.
*/
- icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
icalprop = icalproperty_new_x ("1");
icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
icalcomponent_add_property (icalcomp, icalprop);
- cal_component_alarm_set_action (alarm, CAL_ALARM_DISPLAY);
+ e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
- trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START;
+ trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
@@ -306,33 +306,33 @@ cal_comp_event_new_with_defaults (CalClient *client)
g_assert_not_reached ();
}
- cal_component_alarm_set_trigger (alarm, trigger);
+ e_cal_component_alarm_set_trigger (alarm, trigger);
- cal_component_add_alarm (comp, alarm);
- cal_component_alarm_free (alarm);
+ e_cal_component_add_alarm (comp, alarm);
+ e_cal_component_alarm_free (alarm);
return comp;
}
-CalComponent *
-cal_comp_task_new_with_defaults (CalClient *client)
+ECalComponent *
+cal_comp_task_new_with_defaults (ECal *client)
{
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
- if (!cal_client_get_default_object (client, &icalcomp, NULL))
+ if (!e_cal_get_default_object (client, &icalcomp, NULL))
return NULL;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return NULL;
}
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return NULL;
diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h
index c3326fbaa3..0f4542aba1 100644
--- a/calendar/gui/comp-util.h
+++ b/calendar/gui/comp-util.h
@@ -1,4 +1,4 @@
-/* Evolution calendar - Utilities for manipulating CalComponent objects
+/* Evolution calendar - Utilities for manipulating ECalComponent objects
*
* Copyright (C) 2000 Ximian, Inc.
* Copyright (C) 2000 Ximian, Inc.
@@ -23,23 +23,23 @@
#define COMP_UTIL_H
#include <gtk/gtkwidget.h>
-#include <cal-util/cal-component.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal.h>
-void cal_comp_util_add_exdate (CalComponent *comp, time_t t, icaltimezone *zone);
+void cal_comp_util_add_exdate (ECalComponent *comp, time_t t, icaltimezone *zone);
/* Returns TRUE if the component uses the given timezone for both DTSTART
and DTEND, or if the UTC offsets of the start and end times are the same
as in the given zone. */
-gboolean cal_comp_util_compare_event_timezones (CalComponent *comp,
- CalClient *client,
+gboolean cal_comp_util_compare_event_timezones (ECalComponent *comp,
+ ECal *client,
icaltimezone *zone);
-gboolean cal_comp_is_on_server (CalComponent *comp,
- CalClient *client);
+gboolean cal_comp_is_on_server (ECalComponent *comp,
+ ECal *client);
-CalComponent *cal_comp_event_new_with_defaults (CalClient *client);
-CalComponent *cal_comp_task_new_with_defaults (CalClient *client);
+ECalComponent *cal_comp_event_new_with_defaults (ECal *client);
+ECalComponent *cal_comp_task_new_with_defaults (ECal *client);
#endif
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index 9586d6f62d..58436ec841 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -32,7 +32,7 @@
#include <glade/glade.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include <gui/gnome-cal.h>
#include <gui/calendar-commands.h>
#include <gui/calendar-config.h>
@@ -78,7 +78,7 @@ get_prop (BonoboPropertyBag *bag,
switch (arg_id) {
case PROPERTY_CALENDAR_URI_IDX:
- uri = cal_client_get_uri (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)));
+ uri = e_cal_get_uri (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)));
BONOBO_ARG_SET_STRING (arg, uri);
break;
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 84424f8cc0..9181d5d3dd 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -20,8 +20,6 @@ INCLUDES = \
-I$(top_srcdir)/libical/src \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c
index b94a75478d..f664d8d31f 100644
--- a/calendar/gui/dialogs/alarm-options.c
+++ b/calendar/gui/dialogs/alarm-options.c
@@ -51,7 +51,7 @@ typedef struct {
GladeXML *xml;
/* The alarm action selected */
- CalAlarmAction action;
+ ECalComponentAlarmAction action;
/* Toplevel */
GtkWidget *toplevel;
@@ -218,7 +218,7 @@ repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data)
gtk_widget_set_sensitive (dialog->repeat_group, active);
/* activate the 'OK' button */
- if (dialog->action == CAL_ALARM_PROCEDURE)
+ if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE)
palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
}
@@ -227,7 +227,7 @@ repeat_spin_button_changed_cb (GtkWidget *spin, gpointer user_data)
{
Dialog *dialog = user_data;
- if (dialog->action == CAL_ALARM_PROCEDURE)
+ if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE)
palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
}
@@ -237,7 +237,7 @@ repeat_unit_changed_cb (GtkWidget *option_menu, gpointer user_data)
{
Dialog *dialog = user_data;
- if (dialog->action == CAL_ALARM_PROCEDURE)
+ if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE)
palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
}
@@ -261,12 +261,12 @@ init_widgets (Dialog *dialog)
/* Fills the audio alarm widgets with the values from the alarm component */
static void
-alarm_to_aalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_aalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
icalattach *attach;
const char *url;
- cal_component_alarm_get_attach (alarm, &attach);
+ e_cal_component_alarm_get_attach (alarm, &attach);
if (!attach) {
e_dialog_editable_set (dialog->aalarm_attach, NULL);
@@ -289,12 +289,12 @@ alarm_to_aalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the display alarm widgets with the values from the alarm component */
static void
-alarm_to_dalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_dalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalComponentText description;
+ ECalComponentText description;
GtkTextBuffer *text_buffer;
- cal_component_alarm_get_description (alarm, &description);
+ e_cal_component_alarm_get_description (alarm, &description);
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description));
gtk_text_buffer_set_text (text_buffer, description.value ? description.value : "", -1);
@@ -302,16 +302,16 @@ alarm_to_dalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the mail alarm widgets with the values from the alarm component */
static void
-alarm_to_malarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_malarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalComponentText description;
+ ECalComponentText description;
GtkTextBuffer *text_buffer;
GSList *attendee_list, *l;
EABDestination **destv;
int len, i;
/* Recipients */
- cal_component_alarm_get_attendee_list (alarm, &attendee_list);
+ e_cal_component_alarm_get_attendee_list (alarm, &attendee_list);
len = g_slist_length (attendee_list);
if (len <= 0) {
@@ -323,7 +323,7 @@ alarm_to_malarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
} else {
destv = g_new0 (EABDestination *, len + 1);
for (l = attendee_list, i = 0; l != NULL; l = l->next, i++) {
- CalComponentAttendee *a = l->data;
+ ECalComponentAttendee *a = l->data;
EABDestination *dest;
dest = eab_destination_new ();
@@ -344,10 +344,10 @@ alarm_to_malarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
g_object_unref (GTK_OBJECT (destv[i]));
g_free (destv);
- cal_component_free_attendee_list (attendee_list);
+ e_cal_component_free_attendee_list (attendee_list);
/* Description */
- cal_component_alarm_get_description (alarm, &description);
+ e_cal_component_alarm_get_description (alarm, &description);
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description));
gtk_text_buffer_set_text (text_buffer, description.value ? description.value : "", -1);
@@ -355,13 +355,13 @@ alarm_to_malarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the procedure alarm widgets with the values from the alarm component */
static void
-alarm_to_palarm_widgets (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
icalattach *attach;
- CalComponentText description;
+ ECalComponentText description;
- cal_component_alarm_get_attach (alarm, &attach);
- cal_component_alarm_get_description (alarm, &description);
+ e_cal_component_alarm_get_attach (alarm, &attach);
+ e_cal_component_alarm_get_description (alarm, &description);
if (attach) {
const char *url;
@@ -416,13 +416,13 @@ normalize_duration (struct icaldurationtype dur, int *value, enum duration_units
/* Fills the repeat widgets with the values from the alarm component */
static void
-alarm_to_repeat_widgets (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_repeat_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalAlarmRepeat repeat;
+ ECalComponentAlarmRepeat repeat;
int value;
enum duration_units units;
- cal_component_alarm_get_repeat (alarm, &repeat);
+ e_cal_component_alarm_get_repeat (alarm, &repeat);
/* Sensitivity */
@@ -449,20 +449,20 @@ alarm_to_repeat_widgets (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the widgets with the values from the alarm component */
static void
-alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
+alarm_to_dialog (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalAlarmAction action;
+ ECalComponentAlarmAction action;
alarm_to_repeat_widgets (dialog, alarm);
- cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_get_action (alarm, &action);
switch (action) {
- case CAL_ALARM_NONE:
+ case E_CAL_COMPONENT_ALARM_NONE:
g_assert_not_reached ();
return;
- case CAL_ALARM_AUDIO:
+ case E_CAL_COMPONENT_ALARM_AUDIO:
gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Audio Alarm Options"));
gtk_widget_show (dialog->aalarm_group);
gtk_widget_hide (dialog->dalarm_group);
@@ -471,7 +471,7 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
alarm_to_aalarm_widgets (dialog, alarm);
break;
- case CAL_ALARM_DISPLAY:
+ case E_CAL_COMPONENT_ALARM_DISPLAY:
gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Message Alarm Options"));
gtk_widget_hide (dialog->aalarm_group);
gtk_widget_show (dialog->dalarm_group);
@@ -480,7 +480,7 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
alarm_to_dalarm_widgets (dialog, alarm);
break;
- case CAL_ALARM_EMAIL:
+ case E_CAL_COMPONENT_ALARM_EMAIL:
gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Email Alarm Options"));
gtk_widget_hide (dialog->aalarm_group);
gtk_widget_hide (dialog->dalarm_group);
@@ -489,7 +489,7 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
alarm_to_malarm_widgets (dialog, alarm);
break;
- case CAL_ALARM_PROCEDURE:
+ case E_CAL_COMPONENT_ALARM_PROCEDURE:
gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Program Alarm Options"));
gtk_widget_hide (dialog->aalarm_group);
gtk_widget_hide (dialog->dalarm_group);
@@ -505,7 +505,7 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
G_CALLBACK (palarm_options_changed_cb), dialog);
break;
- case CAL_ALARM_UNKNOWN:
+ case E_CAL_COMPONENT_ALARM_UNKNOWN:
gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Unknown Alarm Options"));
break;
@@ -521,14 +521,14 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the alarm data with the values from the repeat/duration widgets */
static void
-repeat_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalAlarmRepeat repeat;
+ ECalComponentAlarmRepeat repeat;
if (!e_dialog_toggle_get (dialog->repeat_toggle)) {
repeat.repetitions = 0;
- cal_component_alarm_set_repeat (alarm, repeat);
+ e_cal_component_alarm_set_repeat (alarm, repeat);
return;
}
@@ -552,13 +552,13 @@ repeat_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
g_assert_not_reached ();
}
- cal_component_alarm_set_repeat (alarm, repeat);
+ e_cal_component_alarm_set_repeat (alarm, repeat);
}
/* Fills the audio alarm data with the values from the widgets */
static void
-aalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+aalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
char *url;
icalattach *attach;
@@ -567,16 +567,16 @@ aalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
attach = icalattach_new_from_url (url ? url : "");
g_free (url);
- cal_component_alarm_set_attach (alarm, attach);
+ e_cal_component_alarm_set_attach (alarm, attach);
icalattach_unref (attach);
}
/* Fills the display alarm data with the values from the widgets */
static void
-dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+dalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
char *str;
- CalComponentText description;
+ ECalComponentText description;
GtkTextBuffer *text_buffer;
GtkTextIter text_iter_start, text_iter_end;
icalcomponent *icalcomp;
@@ -590,12 +590,12 @@ dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
description.value = str;
description.altrep = NULL;
- cal_component_alarm_set_description (alarm, &description);
+ e_cal_component_alarm_set_description (alarm, &description);
g_free (str);
/* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that
* we don't re-set the alarm's description */
- icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
@@ -612,10 +612,10 @@ dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the mail alarm data with the values from the widgets */
static void
-malarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
char *str;
- CalComponentText description;
+ ECalComponentText description;
GSList *attendee_list = NULL;
EABDestination **destv;
GtkTextBuffer *text_buffer;
@@ -632,20 +632,20 @@ malarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
for (i = 0; destv[i] != NULL; i++) {
EABDestination *dest;
- CalComponentAttendee *a;
+ ECalComponentAttendee *a;
dest = destv[i];
- a = g_new0 (CalComponentAttendee, 1);
+ a = g_new0 (ECalComponentAttendee, 1);
a->value = eab_destination_get_email (dest);
a->cn = eab_destination_get_name (dest);
attendee_list = g_slist_append (attendee_list, a);
}
- cal_component_alarm_set_attendee_list (alarm, attendee_list);
+ e_cal_component_alarm_set_attendee_list (alarm, attendee_list);
- cal_component_free_attendee_list (attendee_list);
+ e_cal_component_free_attendee_list (attendee_list);
eab_destination_freev (destv);
/* Description */
@@ -657,12 +657,12 @@ malarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
description.value = str;
description.altrep = NULL;
- cal_component_alarm_set_description (alarm, &description);
+ e_cal_component_alarm_set_description (alarm, &description);
g_free (str);
/* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that
* we don't re-set the alarm's description */
- icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
icalprop = icalcomponent_get_first_property(icalcomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
@@ -679,12 +679,12 @@ malarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the procedure alarm data with the values from the widgets */
static void
-palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+palarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
char *program;
icalattach *attach;
char *str;
- CalComponentText description;
+ ECalComponentText description;
icalcomponent *icalcomp;
icalproperty *icalprop;
@@ -692,19 +692,19 @@ palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
attach = icalattach_new_from_url (program ? program : "");
g_free (program);
- cal_component_alarm_set_attach (alarm, attach);
+ e_cal_component_alarm_set_attach (alarm, attach);
icalattach_unref (attach);
str = e_dialog_editable_get (dialog->palarm_args);
description.value = str;
description.altrep = NULL;
- cal_component_alarm_set_description (alarm, &description);
+ e_cal_component_alarm_set_description (alarm, &description);
g_free (str);
/* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that
* we don't re-set the alarm's description */
- icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
@@ -721,36 +721,36 @@ palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
/* Fills the alarm data with the values from the widgets */
static void
-dialog_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
+dialog_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
- CalAlarmAction action;
+ ECalComponentAlarmAction action;
repeat_widgets_to_alarm (dialog, alarm);
- cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_get_action (alarm, &action);
switch (action) {
- case CAL_ALARM_NONE:
+ case E_CAL_COMPONENT_ALARM_NONE:
g_assert_not_reached ();
break;
- case CAL_ALARM_AUDIO:
+ case E_CAL_COMPONENT_ALARM_AUDIO:
aalarm_widgets_to_alarm (dialog, alarm);
break;
- case CAL_ALARM_DISPLAY:
+ case E_CAL_COMPONENT_ALARM_DISPLAY:
dalarm_widgets_to_alarm (dialog, alarm);
break;
- case CAL_ALARM_EMAIL:
+ case E_CAL_COMPONENT_ALARM_EMAIL:
malarm_widgets_to_alarm (dialog, alarm);
break;
- case CAL_ALARM_PROCEDURE:
+ case E_CAL_COMPONENT_ALARM_PROCEDURE:
palarm_widgets_to_alarm (dialog, alarm);
break;
- case CAL_ALARM_UNKNOWN:
+ case E_CAL_COMPONENT_ALARM_UNKNOWN:
break;
default:
@@ -769,7 +769,7 @@ dialog_to_alarm (Dialog *dialog, CalComponentAlarm *alarm)
* Return value: TRUE if the dialog could be created, FALSE otherwise.
**/
gboolean
-alarm_options_dialog_run (CalComponentAlarm *alarm, const char *email, gboolean repeat)
+alarm_options_dialog_run (ECalComponentAlarm *alarm, const char *email, gboolean repeat)
{
Dialog dialog;
int response_id;
diff --git a/calendar/gui/dialogs/alarm-options.h b/calendar/gui/dialogs/alarm-options.h
index 1b4abb56d9..5a07935810 100644
--- a/calendar/gui/dialogs/alarm-options.h
+++ b/calendar/gui/dialogs/alarm-options.h
@@ -21,8 +21,8 @@
#ifndef ALARM_OPTIONS_H
#define ALARM_OPTIONS_H
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
-gboolean alarm_options_dialog_run (CalComponentAlarm *alarm, const char *email, gboolean repeat);
+gboolean alarm_options_dialog_run (ECalComponentAlarm *alarm, const char *email, gboolean repeat);
#endif
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 919ed9a2c8..f07df3c28f 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -39,8 +39,8 @@
#include <gal/widgets/e-unicode.h>
#include "e-util/e-dialog-widgets.h"
#include "e-util/e-time-utils.h"
-#include "cal-util/cal-util.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-time-util.h>
#include "../calendar-config.h"
#include "comp-editor-util.h"
#include "alarm-options.h"
@@ -74,7 +74,7 @@ struct _AlarmPagePrivate {
GtkWidget *button_options;
/* Alarm options dialog and the alarm we maintain */
- CalComponentAlarm *alarm;
+ ECalComponentAlarm *alarm;
/* Alarm store for the GtkTreeView list widget */
EAlarmList *list_store;
@@ -100,10 +100,10 @@ enum {
/* Option menu maps */
static const int action_map[] = {
- CAL_ALARM_DISPLAY,
- CAL_ALARM_AUDIO,
- CAL_ALARM_PROCEDURE,
- CAL_ALARM_EMAIL,
+ E_CAL_COMPONENT_ALARM_DISPLAY,
+ E_CAL_COMPONENT_ALARM_AUDIO,
+ E_CAL_COMPONENT_ALARM_PROCEDURE,
+ E_CAL_COMPONENT_ALARM_EMAIL,
-1
};
@@ -128,8 +128,8 @@ static const int relative_map[] = {
};
static const int time_map[] = {
- CAL_ALARM_TRIGGER_RELATIVE_START,
- CAL_ALARM_TRIGGER_RELATIVE_END,
+ E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START,
+ E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END,
-1
};
@@ -141,8 +141,8 @@ static void alarm_page_finalize (GObject *object);
static GtkWidget *alarm_page_get_widget (CompEditorPage *page);
static void alarm_page_focus_main_widget (CompEditorPage *page);
-static void alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean alarm_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean alarm_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void alarm_page_set_summary (CompEditorPage *page, const char *summary);
static void alarm_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -213,9 +213,9 @@ alarm_page_init (AlarmPage *apage)
/* create the default alarm, which will contain the
* X-EVOLUTION-NEEDS-DESCRIPTION property, so that we
* set a correct description if none is set */
- priv->alarm = cal_component_alarm_new ();
+ priv->alarm = e_cal_component_alarm_new ();
- icalcomp = cal_component_alarm_get_icalcomponent (priv->alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (priv->alarm);
icalprop = icalproperty_new_x ("1");
icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
icalcomponent_add_property (icalcomp, icalprop);
@@ -246,7 +246,7 @@ alarm_page_finalize (GObject *object)
}
if (priv->alarm) {
- cal_component_alarm_free (priv->alarm);
+ e_cal_component_alarm_free (priv->alarm);
priv->alarm = NULL;
}
@@ -310,11 +310,11 @@ clear_widgets (AlarmPage *apage)
gtk_label_set_text (GTK_LABEL (priv->date_time), "");
/* Sane defaults */
- e_dialog_option_menu_set (priv->action, CAL_ALARM_DISPLAY, action_map);
+ e_dialog_option_menu_set (priv->action, E_CAL_COMPONENT_ALARM_DISPLAY, action_map);
e_dialog_spin_set (priv->interval_value, 15);
e_dialog_option_menu_set (priv->value_units, MINUTES, value_map);
e_dialog_option_menu_set (priv->relative, BEFORE, relative_map);
- e_dialog_option_menu_set (priv->time, CAL_ALARM_TRIGGER_RELATIVE_START, time_map);
+ e_dialog_option_menu_set (priv->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map);
/* List data */
e_alarm_list_clear (priv->list_store);
@@ -324,7 +324,7 @@ static void
sensitize_buttons (AlarmPage *apage)
{
AlarmPagePrivate *priv;
- CalClient *client;
+ ECal *client;
GtkTreeSelection *selection;
GtkTreeIter iter;
gboolean have_selected;
@@ -336,13 +336,13 @@ sensitize_buttons (AlarmPage *apage)
have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter);
gtk_widget_set_sensitive (priv->add,
- cal_client_get_one_alarm_only (client) && have_selected ? FALSE : TRUE);
+ e_cal_get_one_alarm_only (client) && have_selected ? FALSE : TRUE);
gtk_widget_set_sensitive (priv->delete, have_selected);
}
/* Appends an alarm to the list */
static void
-append_reminder (AlarmPage *apage, CalComponentAlarm *alarm)
+append_reminder (AlarmPage *apage, ECalComponentAlarm *alarm)
{
AlarmPagePrivate *priv;
GtkTreeView *view;
@@ -359,12 +359,12 @@ append_reminder (AlarmPage *apage, CalComponentAlarm *alarm)
/* fill_widgets handler for the alarm page */
static void
-alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
AlarmPage *apage;
AlarmPagePrivate *priv;
GtkWidget *menu;
- CalComponentText text;
+ ECalComponentText text;
GList *alarms, *l;
CompEditorPageDates dates;
int i;
@@ -379,7 +379,7 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (apage);
/* Summary */
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
alarm_page_set_summary (page, text.value);
/* Dates */
@@ -388,21 +388,21 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
comp_editor_free_dates (&dates);
/* List */
- if (!cal_component_has_alarms (comp))
+ if (!e_cal_component_has_alarms (comp))
goto out;
- alarms = cal_component_get_alarm_uids (comp);
+ alarms = e_cal_component_get_alarm_uids (comp);
for (l = alarms; l != NULL; l = l->next) {
- CalComponentAlarm *ca, *ca_copy;
+ ECalComponentAlarm *ca, *ca_copy;
const char *auid;
auid = l->data;
- ca = cal_component_get_alarm (comp, auid);
+ ca = e_cal_component_get_alarm (comp, auid);
g_assert (ca != NULL);
- ca_copy = cal_component_alarm_clone (ca);
- cal_component_alarm_free (ca);
+ ca_copy = e_cal_component_alarm_clone (ca);
+ e_cal_component_alarm_free (ca);
append_reminder (apage, ca_copy);
}
@@ -413,7 +413,7 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Alarm types */
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->action));
for (i = 0, l = GTK_MENU_SHELL (menu)->children; action_map[i] != -1; i++, l = l->next) {
- if (cal_client_get_static_capability (page->client, action_map_cap[i]))
+ if (e_cal_get_static_capability (page->client, action_map_cap[i]))
gtk_widget_set_sensitive (l->data, FALSE);
else
gtk_widget_set_sensitive (l->data, TRUE);
@@ -426,7 +426,7 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the alarm page */
static gboolean
-alarm_page_fill_component (CompEditorPage *page, CalComponent *comp)
+alarm_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
AlarmPage *apage;
AlarmPagePrivate *priv;
@@ -441,12 +441,12 @@ alarm_page_fill_component (CompEditorPage *page, CalComponent *comp)
/* Remove all the alarms from the component */
- list = cal_component_get_alarm_uids (comp);
+ list = e_cal_component_get_alarm_uids (comp);
for (l = list; l; l = l->next) {
const char *auid;
auid = l->data;
- cal_component_remove_alarm (comp, auid);
+ e_cal_component_remove_alarm (comp, auid);
}
cal_obj_uid_list_free (list);
@@ -457,26 +457,26 @@ alarm_page_fill_component (CompEditorPage *page, CalComponent *comp)
for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter;
valid_iter = gtk_tree_model_iter_next (model, &iter)) {
- CalComponentAlarm *alarm, *alarm_copy;
+ ECalComponentAlarm *alarm, *alarm_copy;
icalcomponent *icalcomp;
icalproperty *icalprop;
- alarm = (CalComponentAlarm *) e_alarm_list_get_alarm (priv->list_store, &iter);
+ alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->list_store, &iter);
g_assert (alarm != NULL);
/* We set the description of the alarm if it's got
* the X-EVOLUTION-NEEDS-DESCRIPTION property.
*/
- icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
- CalComponentText summary;
+ ECalComponentText summary;
x_name = icalproperty_get_x_name (icalprop);
if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
- cal_component_get_summary (comp, &summary);
- cal_component_alarm_set_description (alarm, &summary);
+ e_cal_component_get_summary (comp, &summary);
+ e_cal_component_alarm_set_description (alarm, &summary);
icalcomponent_remove_property (icalcomp, icalprop);
break;
@@ -489,9 +489,9 @@ alarm_page_fill_component (CompEditorPage *page, CalComponent *comp)
* structures in the list did *not* come from the component.
*/
- alarm_copy = cal_component_alarm_clone (alarm);
- cal_component_add_alarm (comp, alarm_copy);
- cal_component_alarm_free (alarm_copy);
+ alarm_copy = e_cal_component_alarm_clone (alarm);
+ e_cal_component_add_alarm (comp, alarm_copy);
+ e_cal_component_alarm_free (alarm_copy);
}
return TRUE;
@@ -521,17 +521,17 @@ alarm_page_set_summary (CompEditorPage *page, const char *summary)
for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter;
valid_iter = gtk_tree_model_iter_next (model, &iter)) {
- CalComponentAlarm *alarm;
- CalComponentText desc;
+ ECalComponentAlarm *alarm;
+ ECalComponentText desc;
- alarm = (CalComponentAlarm *) e_alarm_list_get_alarm (priv->list_store, &iter);
+ alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->list_store, &iter);
g_assert (alarm != NULL);
- cal_component_alarm_get_description (alarm, &desc);
+ e_cal_component_alarm_get_description (alarm, &desc);
if (desc.value && *desc.value) {
if (!strcmp (desc.value, priv->old_summary)) {
desc.value = summary;
- cal_component_alarm_set_description (alarm, &desc);
+ e_cal_component_alarm_set_description (alarm, &desc);
}
}
}
@@ -637,16 +637,16 @@ add_clicked_cb (GtkButton *button, gpointer data)
{
AlarmPage *apage;
AlarmPagePrivate *priv;
- CalComponentAlarm *alarm;
- CalAlarmTrigger trigger;
- CalAlarmAction action;
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmTrigger trigger;
+ ECalComponentAlarmAction action;
apage = ALARM_PAGE (data);
priv = apage->priv;
- alarm = cal_component_alarm_clone (priv->alarm);
+ alarm = e_cal_component_alarm_clone (priv->alarm);
- memset (&trigger, 0, sizeof (CalAlarmTrigger));
+ memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger));
trigger.type = e_dialog_option_menu_get (priv->time, time_map);
if (e_dialog_option_menu_get (priv->relative, relative_map) == BEFORE)
trigger.u.rel_duration.is_neg = 1;
@@ -672,22 +672,22 @@ add_clicked_cb (GtkButton *button, gpointer data)
default:
g_assert_not_reached ();
}
- cal_component_alarm_set_trigger (alarm, trigger);
+ e_cal_component_alarm_set_trigger (alarm, trigger);
action = e_dialog_option_menu_get (priv->action, action_map);
- cal_component_alarm_set_action (alarm, action);
- if (action == CAL_ALARM_EMAIL && !cal_component_alarm_has_attendees (alarm)) {
+ e_cal_component_alarm_set_action (alarm, action);
+ if (action == E_CAL_COMPONENT_ALARM_EMAIL && !e_cal_component_alarm_has_attendees (alarm)) {
char *email;
- if (!cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
- CalComponentAttendee *a;
+ if (!e_cal_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
+ ECalComponentAttendee *a;
GSList attendee_list;
- a = g_new0 (CalComponentAttendee, 1);
+ a = g_new0 (ECalComponentAttendee, 1);
a->value = email;
attendee_list.data = a;
attendee_list.next = NULL;
- cal_component_alarm_set_attendee_list (alarm, &attendee_list);
+ e_cal_component_alarm_set_attendee_list (alarm, &attendee_list);
g_free (email);
g_free (a);
}
@@ -746,13 +746,13 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data)
apage = ALARM_PAGE (data);
priv = apage->priv;
- cal_component_alarm_set_action (priv->alarm,
+ e_cal_component_alarm_set_action (priv->alarm,
e_dialog_option_menu_get (priv->action, action_map));
- repeat = !cal_client_get_static_capability (COMP_EDITOR_PAGE (apage)->client,
+ repeat = !e_cal_get_static_capability (COMP_EDITOR_PAGE (apage)->client,
CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT);
- if (cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
+ if (e_cal_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
if (!alarm_options_dialog_run (priv->alarm, email, repeat))
g_message ("button_options_clicked_cb(): Could not create the alarm options dialog");
}
diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c
index e9efe92d99..3e9d76dead 100644
--- a/calendar/gui/dialogs/cancel-comp.c
+++ b/calendar/gui/dialogs/cancel-comp.c
@@ -40,20 +40,20 @@
* Return value: TRUE if the user clicked Yes, FALSE otherwise.
**/
gboolean
-cancel_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *comp, gboolean deleting)
+cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting)
{
GtkWidget *dialog;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
char *str;
gint response;
- if (deleting && cal_client_get_save_schedules (client))
+ if (deleting && e_cal_get_save_schedules (client))
return TRUE;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
if (deleting)
str = g_strdup_printf (_("The event being deleted is a meeting, "
"would you like to send a cancellation notice?"));
@@ -62,7 +62,7 @@ cancel_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *com
"and delete this meeting?"));
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
if (deleting)
str = g_strdup_printf (_("The task being deleted is assigned, "
"would you like to send a cancellation notice?"));
@@ -71,7 +71,7 @@ cancel_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *com
"and delete this task?"));
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
if (deleting)
str = g_strdup_printf (_("The journal entry being deleted is published, "
"would you like to send a cancellation notice?"));
diff --git a/calendar/gui/dialogs/cancel-comp.h b/calendar/gui/dialogs/cancel-comp.h
index 7dfb0fae31..a43f24f2fe 100644
--- a/calendar/gui/dialogs/cancel-comp.h
+++ b/calendar/gui/dialogs/cancel-comp.h
@@ -22,9 +22,9 @@
#define CANCEL_COMP_H
#include <glib.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-component.h>
-gboolean cancel_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *comp, gboolean deleting);
+gboolean cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting);
#endif
diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c
index 6d7ab0fc49..799a22579b 100644
--- a/calendar/gui/dialogs/changed-comp.c
+++ b/calendar/gui/dialogs/changed-comp.c
@@ -44,26 +44,26 @@
* Return value: TRUE if the user clicked Yes, FALSE otherwise.
**/
gboolean
-changed_component_dialog (GtkWindow *parent, CalComponent *comp, gboolean deleted, gboolean changed)
+changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean deleted, gboolean changed)
{
GtkWidget *dialog;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
char *str;
gint response;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
if (deleted) {
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = _("This event has been deleted.");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = _("This task has been deleted.");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = _("This journal entry has been deleted.");
break;
@@ -79,15 +79,15 @@ changed_component_dialog (GtkWindow *parent, CalComponent *comp, gboolean delete
} else {
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = _("This event has been changed.");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = _("This task has been changed.");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = _("This journal entry has been changed.");
break;
diff --git a/calendar/gui/dialogs/changed-comp.h b/calendar/gui/dialogs/changed-comp.h
index a29e1a5fc4..f029f3388e 100644
--- a/calendar/gui/dialogs/changed-comp.h
+++ b/calendar/gui/dialogs/changed-comp.h
@@ -23,8 +23,8 @@
#include <glib.h>
#include <gtk/gtkwindow.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
-gboolean changed_component_dialog (GtkWindow *window, CalComponent *comp, gboolean deleted, gboolean changed);
+gboolean changed_component_dialog (GtkWindow *window, ECalComponent *comp, gboolean deleted, gboolean changed);
#endif
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index a0fdcca3a8..1a6611b017 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -225,7 +225,7 @@ comp_editor_page_focus_main_widget (CompEditorPage *page)
* Fills the widgets of an editor page with the data from a calendar component.
**/
void
-comp_editor_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
@@ -247,7 +247,7 @@ comp_editor_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
* Returns: TRUE if the component could be filled, FALSE otherwise
**/
gboolean
-comp_editor_page_fill_component (CompEditorPage *page, CalComponent *comp)
+comp_editor_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
g_return_val_if_fail (page != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
@@ -260,14 +260,14 @@ comp_editor_page_fill_component (CompEditorPage *page, CalComponent *comp)
}
/**
- * comp_editor_page_set_cal_client:
+ * comp_editor_page_set_e_cal:
* @page: An editor page
- * @client: A #CalClient object
+ * @client: A #ECal object
*
- * Sets the #CalClient for the dialog page to use.
+ * Sets the #ECal for the dialog page to use.
**/
void
-comp_editor_page_set_cal_client (CompEditorPage *page, CalClient *client)
+comp_editor_page_set_e_cal (CompEditorPage *page, ECal *client)
{
g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index e3d4535391..6046a7c039 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -23,8 +23,8 @@
#include <time.h>
#include <gtk/gtkwidget.h>
-#include <cal-util/cal-component.h>
-#include "cal-client.h"
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal.h>
G_BEGIN_DECLS
@@ -37,17 +37,17 @@ G_BEGIN_DECLS
#define IS_COMP_EDITOR_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE))
typedef struct {
- CalComponentDateTime *start;
- CalComponentDateTime *end;
- CalComponentDateTime *due;
+ ECalComponentDateTime *start;
+ ECalComponentDateTime *end;
+ ECalComponentDateTime *due;
struct icaltimetype *complete;
} CompEditorPageDates;
typedef struct {
GtkObject object;
- /* Some of the pages need the CalClient to access timezone data. */
- CalClient *client;
+ /* Some of the pages need the ECal to access timezone data. */
+ ECal *client;
/* The GtkAccelGroup for the page. We install this when the page is
mapped, and uninstall when it is unmapped. libglade would do this
@@ -72,8 +72,8 @@ typedef struct {
GtkWidget *(* get_widget) (CompEditorPage *page);
void (* focus_main_widget) (CompEditorPage *page);
- void (* fill_widgets) (CompEditorPage *page, CalComponent *comp);
- gboolean (* fill_component) (CompEditorPage *page, CalComponent *comp);
+ void (* fill_widgets) (CompEditorPage *page, ECalComponent *comp);
+ gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp);
void (* set_summary) (CompEditorPage *page, const char *summary);
void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates);
@@ -84,11 +84,11 @@ GtkType comp_editor_page_get_type (void);
GtkWidget *comp_editor_page_get_widget (CompEditorPage *page);
void comp_editor_page_focus_main_widget (CompEditorPage *page);
void comp_editor_page_fill_widgets (CompEditorPage *page,
- CalComponent *comp);
+ ECalComponent *comp);
gboolean comp_editor_page_fill_component (CompEditorPage *page,
- CalComponent *comp);
-void comp_editor_page_set_cal_client (CompEditorPage *page,
- CalClient *client);
+ ECalComponent *comp);
+void comp_editor_page_set_e_cal (CompEditorPage *page,
+ ECal *client);
void comp_editor_page_set_summary (CompEditorPage *page,
const char *summary);
void comp_editor_page_set_dates (CompEditorPage *page,
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 4c3b683ec4..bdb66c6c92 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -32,7 +32,7 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
#include <e-util/e-time-utils.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "../calendar-config.h"
#include "../e-date-edit-config.h"
#include "comp-editor-util.h"
@@ -49,37 +49,37 @@
* results.
**/
void
-comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
+comp_editor_dates (CompEditorPageDates *dates, ECalComponent *comp)
{
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
dates->start = NULL;
dates->end = NULL;
dates->due = NULL;
dates->complete = NULL;
- /* Note that the CalComponentDateTime's returned contain allocated
+ /* Note that the ECalComponentDateTime's returned contain allocated
icaltimetype and tzid values, so we just take over ownership of
those. */
- cal_component_get_dtstart (comp, &dt);
+ e_cal_component_get_dtstart (comp, &dt);
if (dt.value) {
- dates->start = g_new (CalComponentDateTime, 1);
+ dates->start = g_new (ECalComponentDateTime, 1);
*dates->start = dt;
}
- cal_component_get_dtend (comp, &dt);
+ e_cal_component_get_dtend (comp, &dt);
if (dt.value) {
- dates->end = g_new (CalComponentDateTime, 1);
+ dates->end = g_new (ECalComponentDateTime, 1);
*dates->end = dt;
}
- cal_component_get_due (comp, &dt);
+ e_cal_component_get_due (comp, &dt);
if (dt.value) {
- dates->due = g_new (CalComponentDateTime, 1);
+ dates->due = g_new (ECalComponentDateTime, 1);
*dates->due = dt;
}
- cal_component_get_completed (comp, &dates->complete);
+ e_cal_component_get_completed (comp, &dates->complete);
}
@@ -89,25 +89,25 @@ comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
void
comp_editor_free_dates (CompEditorPageDates *dates)
{
- /* Note that cal_component_free_datetime() only frees the fields in
+ /* Note that e_cal_component_free_datetime() only frees the fields in
the struct. It doesn't free the struct itself, so we do that. */
if (dates->start) {
- cal_component_free_datetime (dates->start);
+ e_cal_component_free_datetime (dates->start);
g_free (dates->start);
}
if (dates->end) {
- cal_component_free_datetime (dates->end);
+ e_cal_component_free_datetime (dates->end);
g_free (dates->end);
}
if (dates->due) {
- cal_component_free_datetime (dates->due);
+ e_cal_component_free_datetime (dates->due);
g_free (dates->due);
}
if (dates->complete)
- cal_component_free_icaltimetype (dates->complete);
+ e_cal_component_free_icaltimetype (dates->complete);
}
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index 04bbe23cf4..078cd6508c 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -24,7 +24,7 @@
#include <gtk/gtkwidget.h>
#include "comp-editor-page.h"
-void comp_editor_dates (CompEditorPageDates *date, CalComponent *comp);
+void comp_editor_dates (CompEditorPageDates *date, ECalComponent *comp);
void comp_editor_free_dates (CompEditorPageDates *dates);
void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 14dad44b2a..5e88774ae5 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -55,10 +55,10 @@
/* Private part of the CompEditor structure */
struct _CompEditorPrivate {
/* Client to use */
- CalClient *client;
+ ECal *client;
/* Calendar object/uid we are editing; this is an internal copy */
- CalComponent *comp;
+ ECalComponent *comp;
/* The pages we have */
GList *pages;
@@ -91,9 +91,9 @@ static void comp_editor_init (CompEditor *editor);
static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e);
static void comp_editor_finalize (GObject *object);
-static void real_set_cal_client (CompEditor *editor, CalClient *client);
-static void real_edit_comp (CompEditor *editor, CalComponent *comp);
-static gboolean real_send_comp (CompEditor *editor, CalComponentItipMethod method);
+static void real_set_e_cal (CompEditor *editor, ECal *client);
+static void real_edit_comp (CompEditor *editor, ECalComponent *comp);
+static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method);
static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send);
static void delete_comp (CompEditor *editor);
static void close_dialog (CompEditor *editor);
@@ -102,8 +102,8 @@ static void page_changed_cb (GtkObject *obj, gpointer data);
static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data);
static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data);
-static void obj_updated_cb (CalClient *client, const char *uid, gpointer data);
-static void obj_removed_cb (CalClient *client, const char *uid, gpointer data);
+static void obj_updated_cb (ECal *client, const char *uid, gpointer data);
+static void obj_removed_cb (ECal *client, const char *uid, gpointer data);
static void save_cmd (GtkWidget *widget, gpointer data);
static void save_close_cmd (GtkWidget *widget, gpointer data);
@@ -166,7 +166,7 @@ comp_editor_class_init (CompEditorClass *klass)
parent_class = g_type_class_ref(BONOBO_TYPE_WINDOW);
- klass->set_cal_client = real_set_cal_client;
+ klass->set_e_cal = real_set_e_cal;
klass->edit_comp = real_edit_comp;
klass->send_comp = real_send_comp;
@@ -293,7 +293,7 @@ static gboolean
save_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
- CalComponent *clone;
+ ECalComponent *clone;
GList *l;
gboolean result;
GError *error = NULL;
@@ -303,7 +303,7 @@ save_comp (CompEditor *editor)
if (!priv->changed)
return TRUE;
- clone = cal_component_clone (priv->comp);
+ clone = e_cal_component_clone (priv->comp);
for (l = priv->pages; l != NULL; l = l->next) {
if (!comp_editor_page_fill_component (l->data, clone)) {
g_object_unref((clone));
@@ -313,10 +313,10 @@ save_comp (CompEditor *editor)
}
/* If we are not the organizer, we don't update the sequence number */
- if (!cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client))
- cal_component_commit_sequence (clone);
+ if (!e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client))
+ e_cal_component_commit_sequence (clone);
else
- cal_component_abort_sequence (clone);
+ e_cal_component_abort_sequence (clone);
g_object_unref((priv->comp));
priv->comp = clone;
@@ -324,9 +324,9 @@ save_comp (CompEditor *editor)
priv->updating = TRUE;
if (!cal_comp_is_on_server (priv->comp, priv->client)) {
- result = cal_client_create_object (priv->client, cal_component_get_icalcomponent (priv->comp), NULL, &error);
+ result = e_cal_create_object (priv->client, e_cal_component_get_icalcomponent (priv->comp), NULL, &error);
} else {
- result = cal_client_modify_object (priv->client, cal_component_get_icalcomponent (priv->comp), priv->mod, &error);
+ result = e_cal_modify_object (priv->client, e_cal_component_get_icalcomponent (priv->comp), priv->mod, &error);
}
if (!result) {
@@ -367,9 +367,9 @@ save_comp_with_send (CompEditor *editor)
if (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org)) {
if (itip_organizer_is_user (priv->comp, priv->client))
- return comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST);
+ return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST);
else
- return comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REPLY);
+ return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY);
}
return TRUE;
@@ -383,9 +383,9 @@ delete_comp (CompEditor *editor)
priv = editor->priv;
- cal_component_get_uid (priv->comp, &uid);
+ e_cal_component_get_uid (priv->comp, &uid);
priv->updating = TRUE;
- cal_client_remove_object (priv->client, uid, NULL);
+ e_cal_remove_object (priv->client, uid, NULL);
priv->updating = FALSE;
close_dialog (editor);
}
@@ -402,7 +402,7 @@ prompt_to_save_changes (CompEditor *editor, gboolean send)
switch (save_component_dialog (GTK_WINDOW (editor))) {
case GTK_RESPONSE_YES: /* Save */
- if (cal_component_is_instance (priv->comp))
+ if (e_cal_component_is_instance (priv->comp))
if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
return FALSE;
@@ -631,7 +631,7 @@ comp_editor_append_page (CompEditor *editor,
/* If we are editing something, fill the widgets with current info */
if (priv->comp != NULL) {
- CalComponent *comp;
+ ECalComponent *comp;
comp = comp_editor_get_current_comp (editor);
comp_editor_page_fill_widgets (page, comp);
@@ -733,14 +733,14 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page)
}
/**
- * comp_editor_set_cal_client:
+ * comp_editor_set_e_cal:
* @editor: A component editor
* @client: The calendar client to use
*
* Sets the calendar client used by the editor to update components
**/
void
-comp_editor_set_cal_client (CompEditor *editor, CalClient *client)
+comp_editor_set_e_cal (CompEditor *editor, ECal *client)
{
CompEditorClass *klass;
@@ -749,20 +749,20 @@ comp_editor_set_cal_client (CompEditor *editor, CalClient *client)
klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor));
- if (klass->set_cal_client)
- klass->set_cal_client (editor, client);
+ if (klass->set_e_cal)
+ klass->set_e_cal (editor, client);
}
/**
- * comp_editor_get_cal_client:
+ * comp_editor_get_e_cal:
* @editor: A component editor
*
* Returns the calendar client of the editor
*
* Return value: The calendar client of the editor
**/
-CalClient *
-comp_editor_get_cal_client (CompEditor *editor)
+ECal *
+comp_editor_get_e_cal (CompEditor *editor)
{
CompEditorPrivate *priv;
@@ -776,25 +776,25 @@ comp_editor_get_cal_client (CompEditor *editor)
/* Creates an appropriate title for the event editor dialog */
static char *
-make_title_from_comp (CalComponent *comp)
+make_title_from_comp (ECalComponent *comp)
{
char *title;
const char *type_string;
- CalComponentVType type;
- CalComponentText text;
+ ECalComponentVType type;
+ ECalComponentText text;
if (!comp)
return g_strdup (_("Edit Appointment"));
- type = cal_component_get_vtype (comp);
+ type = e_cal_component_get_vtype (comp);
switch (type) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
type_string = _("Appointment - %s");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
type_string = _("Task - %s");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
type_string = _("Journal entry - %s");
break;
default:
@@ -802,7 +802,7 @@ make_title_from_comp (CalComponent *comp)
return NULL;
}
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
if (text.value) {
title = g_strdup_printf (type_string, text.value);
} else {
@@ -814,24 +814,24 @@ make_title_from_comp (CalComponent *comp)
/* Creates an appropriate title for the event editor dialog */
static char *
-make_title_from_string (CalComponent *comp, const char *str)
+make_title_from_string (ECalComponent *comp, const char *str)
{
char *title;
const char *type_string;
- CalComponentVType type;
+ ECalComponentVType type;
if (!comp)
return g_strdup (_("Edit Appointment"));
- type = cal_component_get_vtype (comp);
+ type = e_cal_component_get_vtype (comp);
switch (type) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
type_string = _("Appointment - %s");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
type_string = _("Task - %s");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
type_string = _("Journal entry - %s");
break;
default:
@@ -849,19 +849,19 @@ make_title_from_string (CalComponent *comp, const char *str)
}
static const char *
-make_icon_from_comp (CalComponent *comp)
+make_icon_from_comp (ECalComponent *comp)
{
- CalComponentVType type;
+ ECalComponentVType type;
if (!comp)
return EVOLUTION_IMAGESDIR "/evolution-calendar-mini.png";
- type = cal_component_get_vtype (comp);
+ type = e_cal_component_get_vtype (comp);
switch (type) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
return EVOLUTION_IMAGESDIR "/buttons/new_appointment.png";
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
return EVOLUTION_IMAGESDIR "/buttons/new_task.png";
break;
default:
@@ -918,7 +918,7 @@ fill_widgets (CompEditor *editor)
}
static void
-real_set_cal_client (CompEditor *editor, CalClient *client)
+real_set_e_cal (CompEditor *editor, ECal *client)
{
CompEditorPrivate *priv;
GList *elem;
@@ -932,9 +932,9 @@ real_set_cal_client (CompEditor *editor, CalClient *client)
return;
if (client) {
- g_return_if_fail (IS_CAL_CLIENT (client));
- g_return_if_fail (cal_client_get_load_state (client) ==
- CAL_CLIENT_LOAD_LOADED);
+ g_return_if_fail (E_IS_CAL (client));
+ g_return_if_fail (e_cal_get_load_state (client) ==
+ E_CAL_LOAD_LOADED);
g_object_ref((client));
}
@@ -948,7 +948,7 @@ real_set_cal_client (CompEditor *editor, CalClient *client)
/* Pass the client to any pages that need it. */
for (elem = priv->pages; elem; elem = elem->next)
- comp_editor_page_set_cal_client (elem->data, client);
+ comp_editor_page_set_e_cal (elem->data, client);
g_signal_connect((priv->client), "obj_updated",
G_CALLBACK (obj_updated_cb), editor);
@@ -958,7 +958,7 @@ real_set_cal_client (CompEditor *editor, CalClient *client)
}
static void
-real_edit_comp (CompEditor *editor, CalComponent *comp)
+real_edit_comp (CompEditor *editor, ECalComponent *comp)
{
CompEditorPrivate *priv;
@@ -973,9 +973,9 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
}
if (comp)
- priv->comp = cal_component_clone (comp);
+ priv->comp = e_cal_component_clone (comp);
- priv->existing_org = cal_component_has_organizer (comp);
+ priv->existing_org = e_cal_component_has_organizer (comp);
priv->user_org = itip_organizer_is_user (comp, priv->client);
priv->warned = FALSE;
@@ -986,10 +986,10 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
static gboolean
-real_send_comp (CompEditor *editor, CalComponentItipMethod method)
+real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
CompEditorPrivate *priv;
- CalComponent *tmp_comp;
+ ECalComponent *tmp_comp;
g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
@@ -1022,14 +1022,14 @@ real_send_comp (CompEditor *editor, CalComponentItipMethod method)
* Starts the editor editing the given component
**/
void
-comp_editor_edit_comp (CompEditor *editor, CalComponent *comp)
+comp_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
CompEditorClass *klass;
g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor));
@@ -1037,7 +1037,7 @@ comp_editor_edit_comp (CompEditor *editor, CalComponent *comp)
klass->edit_comp (editor, comp);
}
-CalComponent *
+ECalComponent *
comp_editor_get_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
@@ -1050,11 +1050,11 @@ comp_editor_get_comp (CompEditor *editor)
return priv->comp;
}
-CalComponent *
+ECalComponent *
comp_editor_get_current_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
- CalComponent *comp;
+ ECalComponent *comp;
GList *l;
g_return_val_if_fail (editor != NULL, NULL);
@@ -1062,7 +1062,7 @@ comp_editor_get_current_comp (CompEditor *editor)
priv = editor->priv;
- comp = cal_component_clone (priv->comp);
+ comp = e_cal_component_clone (priv->comp);
if (priv->changed) {
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, comp);
@@ -1103,7 +1103,7 @@ comp_editor_delete_comp (CompEditor *editor)
*
**/
gboolean
-comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
+comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
CompEditorClass *klass;
@@ -1234,7 +1234,7 @@ save_cmd (GtkWidget *widget, gpointer data)
commit_all_fields (editor);
- if (cal_component_is_instance (priv->comp))
+ if (e_cal_component_is_instance (priv->comp))
if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
return;
@@ -1251,7 +1251,7 @@ save_close_cmd (GtkWidget *widget, gpointer data)
commit_all_fields (editor);
- if (cal_component_is_instance (priv->comp))
+ if (e_cal_component_is_instance (priv->comp))
if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
return;
@@ -1276,8 +1276,8 @@ save_as_cmd (GtkWidget *widget, gpointer data)
if (filename == NULL)
return;
- ical_string = cal_client_get_component_as_string (priv->client,
- cal_component_get_icalcomponent (priv->comp));
+ ical_string = e_cal_get_component_as_string (priv->client,
+ e_cal_component_get_icalcomponent (priv->comp));
if (ical_string == NULL) {
g_warning ("Couldn't convert item to a string");
return;
@@ -1299,17 +1299,17 @@ delete_cmd (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
priv = editor->priv;
- vtype = cal_component_get_vtype (priv->comp);
+ vtype = e_cal_component_get_vtype (priv->comp);
if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor))) {
if (itip_organizer_is_user (priv->comp, priv->client)
&& cancel_component_dialog ((GtkWindow *) editor,
priv->client, priv->comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, priv->comp, priv->client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, priv->comp, priv->client, NULL);
delete_comp (editor);
}
@@ -1319,7 +1319,7 @@ static void
print_cmd (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
- CalComponent *comp;
+ ECalComponent *comp;
commit_all_fields (editor);
@@ -1332,7 +1332,7 @@ static void
print_preview_cmd (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
- CalComponent *comp;
+ ECalComponent *comp;
commit_all_fields (editor);
@@ -1431,24 +1431,24 @@ page_dates_changed_cb (GtkObject *obj,
}
static void
-obj_updated_cb (CalClient *client, const char *uid, gpointer data)
+obj_updated_cb (ECal *client, const char *uid, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
const char *edit_uid;
priv = editor->priv;
- cal_component_get_uid (priv->comp, &edit_uid);
+ e_cal_component_get_uid (priv->comp, &edit_uid);
if (!strcmp (uid, edit_uid) && !priv->updating) {
if (changed_component_dialog ((GtkWindow *) editor, priv->comp, FALSE, priv->changed)) {
icalcomponent *icalcomp;
- if (!cal_client_get_object (priv->client, uid, NULL, &icalcomp, NULL)) {
- comp = cal_component_new ();
- if (cal_component_set_icalcomponent (comp, icalcomp))
+ if (!e_cal_get_object (priv->client, uid, NULL, &icalcomp, NULL)) {
+ comp = e_cal_component_new ();
+ if (e_cal_component_set_icalcomponent (comp, icalcomp))
comp_editor_edit_comp (editor, comp);
else {
GtkWidget *dlg;
@@ -1470,7 +1470,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
}
static void
-obj_removed_cb (CalClient *client, const char *uid, gpointer data)
+obj_removed_cb (ECal *client, const char *uid, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
@@ -1478,7 +1478,7 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data)
priv = editor->priv;
- cal_component_get_uid (priv->comp, &edit_uid);
+ e_cal_component_get_uid (priv->comp, &edit_uid);
if (!strcmp (uid, edit_uid) && !priv->updating) {
if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed))
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 8ef14c8edb..67684c0806 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -25,7 +25,7 @@
#include <bonobo/bonobo-window.h>
#include <bonobo/bonobo-ui-engine.h>
#include <bonobo/bonobo-ui-component.h>
-#include "cal-client.h"
+#include <libecal/e-cal.h>
#include "../itip-utils.h"
#include "comp-editor-page.h"
#include "evolution-shell-component-utils.h"
@@ -53,9 +53,9 @@ typedef struct {
BonoboWindowClass parent_class;
/* Virtual functions */
- void (* set_cal_client) (CompEditor *page, CalClient *client);
- void (* edit_comp) (CompEditor *page, CalComponent *comp);
- gboolean (* send_comp) (CompEditor *page, CalComponentItipMethod method);
+ void (* set_e_cal) (CompEditor *page, ECal *client);
+ void (* edit_comp) (CompEditor *page, ECalComponent *comp);
+ gboolean (* send_comp) (CompEditor *page, ECalComponentItipMethod method);
} CompEditorClass;
GtkType comp_editor_get_type (void);
@@ -78,18 +78,18 @@ void comp_editor_remove_page (CompEditor *editor,
CompEditorPage *page);
void comp_editor_show_page (CompEditor *editor,
CompEditorPage *page);
-void comp_editor_set_cal_client (CompEditor *editor,
- CalClient *client);
-CalClient *comp_editor_get_cal_client (CompEditor *editor);
+void comp_editor_set_e_cal (CompEditor *editor,
+ ECal *client);
+ECal *comp_editor_get_e_cal (CompEditor *editor);
void comp_editor_edit_comp (CompEditor *ee,
- CalComponent *comp);
-CalComponent *comp_editor_get_comp (CompEditor *editor);
-CalComponent *comp_editor_get_current_comp (CompEditor *editor);
+ ECalComponent *comp);
+ECalComponent *comp_editor_get_comp (CompEditor *editor);
+ECalComponent *comp_editor_get_current_comp (CompEditor *editor);
gboolean comp_editor_save_comp (CompEditor *editor,
gboolean send);
void comp_editor_delete_comp (CompEditor *editor);
gboolean comp_editor_send_comp (CompEditor *editor,
- CalComponentItipMethod method);
+ ECalComponentItipMethod method);
gboolean comp_editor_close (CompEditor *editor);
void comp_editor_merge_ui (CompEditor *editor,
const char *filename,
diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c
index b29c6305ce..adaa8895fa 100644
--- a/calendar/gui/dialogs/delete-comp.c
+++ b/calendar/gui/dialogs/delete-comp.c
@@ -55,9 +55,9 @@
* unconditionally return TRUE.
**/
gboolean
-delete_component_dialog (CalComponent *comp,
+delete_component_dialog (ECalComponent *comp,
gboolean consider_as_untitled,
- int n_comps, CalComponentVType vtype,
+ int n_comps, ECalComponentVType vtype,
GtkWidget *widget)
{
char *str;
@@ -65,11 +65,11 @@ delete_component_dialog (CalComponent *comp,
int ret;
if (comp) {
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
g_return_val_if_fail (n_comps == 1, FALSE);
} else {
g_return_val_if_fail (n_comps > 1, FALSE);
- g_return_val_if_fail (vtype != CAL_COMPONENT_NO_TYPE, FALSE);
+ g_return_val_if_fail (vtype != E_CAL_COMPONENT_NO_TYPE, FALSE);
}
g_return_val_if_fail (widget != NULL, FALSE);
@@ -79,19 +79,19 @@ delete_component_dialog (CalComponent *comp,
return TRUE;
if (comp) {
- CalComponentText summary;
+ ECalComponentText summary;
char *tmp;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
if (!consider_as_untitled) {
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
tmp = g_strdup (summary.value);
} else
tmp = NULL;
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
if (tmp)
str = g_strdup_printf (_("Are you sure you want to delete "
"the appointment `%s'?"), tmp);
@@ -100,7 +100,7 @@ delete_component_dialog (CalComponent *comp,
"untitled appointment?"));
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
if (tmp)
str = g_strdup_printf (_("Are you sure you want to delete "
"the task `%s'?"), tmp);
@@ -109,7 +109,7 @@ delete_component_dialog (CalComponent *comp,
"untitled task?"));
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
if (tmp)
str = g_strdup_printf (_("Are you sure you want to delete "
"the journal entry `%s'?"), tmp);
@@ -128,17 +128,17 @@ delete_component_dialog (CalComponent *comp,
g_free (tmp);
} else {
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = g_strdup_printf (_("Are you sure you want to delete "
"%d appointments?"), n_comps);
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = g_strdup_printf (_("Are you sure you want to delete "
"%d tasks?"), n_comps);
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = g_strdup_printf (_("Are you sure you want to delete "
"%d journal entries?"), n_comps);
break;
diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h
index 64945b5bee..f8773c25d0 100644
--- a/calendar/gui/dialogs/delete-comp.h
+++ b/calendar/gui/dialogs/delete-comp.h
@@ -22,11 +22,11 @@
#define DELETE_COMP_H
#include <gtk/gtkwidget.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
-gboolean delete_component_dialog (CalComponent *comp,
+gboolean delete_component_dialog (ECalComponent *comp,
gboolean consider_as_untitled,
- int n_comps, CalComponentVType vtype,
+ int n_comps, ECalComponentVType vtype,
GtkWidget *widget);
#endif
diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c
index edbcaf9880..bc9c958862 100644
--- a/calendar/gui/dialogs/delete-error.c
+++ b/calendar/gui/dialogs/delete-error.c
@@ -38,7 +38,7 @@
*
**/
void
-delete_error_dialog (GError *error, CalComponentVType vtype)
+delete_error_dialog (GError *error, ECalComponentVType vtype)
{
GtkWidget *dialog;
const char *str;
@@ -49,13 +49,13 @@ delete_error_dialog (GError *error, CalComponentVType vtype)
switch (error->code) {
case E_CALENDAR_STATUS_CORBA_EXCEPTION:
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = _("The event could not be deleted due to a corba error");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = _("The task could not be deleted due to a corba error");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = _("The journal entry could not be deleted due to a corba error");
break;
default:
@@ -65,13 +65,13 @@ delete_error_dialog (GError *error, CalComponentVType vtype)
break;
case E_CALENDAR_STATUS_PERMISSION_DENIED:
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = _("The event could not be deleted because permission was denied");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = _("The task could not be deleted because permission was denied");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = _("The journal entry could not be deleted because permission was denied");
break;
default:
@@ -81,13 +81,13 @@ delete_error_dialog (GError *error, CalComponentVType vtype)
break;
case E_CALENDAR_STATUS_OTHER_ERROR:
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = _("The event could not be deleted due to an error");
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = _("The task could not be deleted due to an error");
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = _("The journal entry could not be deleted due to an error");
break;
default:
diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h
index 4ac8cf4515..68c132e479 100644
--- a/calendar/gui/dialogs/delete-error.h
+++ b/calendar/gui/dialogs/delete-error.h
@@ -22,9 +22,9 @@
#define DELETE_ERROR_H
#include <glib.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-component.h>
-void delete_error_dialog (GError *error, CalComponentVType vtype);
+void delete_error_dialog (GError *error, ECalComponentVType vtype);
#endif
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 861a52c203..c3ba39aada 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -56,9 +56,9 @@ struct _EventEditorPrivate {
static void event_editor_class_init (EventEditorClass *class);
static void event_editor_init (EventEditor *ee);
-static void event_editor_set_cal_client (CompEditor *editor, CalClient *client);
-static void event_editor_edit_comp (CompEditor *editor, CalComponent *comp);
-static gboolean event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method);
+static void event_editor_set_e_cal (CompEditor *editor, ECal *client);
+static void event_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
+static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
static void event_editor_finalize (GObject *object);
static void schedule_meeting_cmd (GtkWidget *widget, gpointer data);
@@ -111,7 +111,7 @@ event_editor_class_init (EventEditorClass *klass)
parent_class = g_type_class_ref(TYPE_COMP_EDITOR);
- editor_class->set_cal_client = event_editor_set_cal_client;
+ editor_class->set_e_cal = event_editor_set_e_cal;
editor_class->edit_comp = event_editor_edit_comp;
editor_class->send_comp = event_editor_send_comp;
@@ -129,7 +129,7 @@ set_menu_sens (EventEditor *ee)
existing = comp_editor_get_existing_org (COMP_EDITOR (ee));
user = comp_editor_get_user_org (COMP_EDITOR (ee));
- cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)), &read_only, NULL);
+ e_cal_is_read_only (comp_editor_get_e_cal (COMP_EDITOR (ee)), &read_only, NULL);
sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
@@ -187,7 +187,7 @@ event_editor_init (EventEditor *ee)
}
EventEditor *
-event_editor_construct (EventEditor *ee, CalClient *client)
+event_editor_construct (EventEditor *ee, ECal *client)
{
EventEditorPrivate *priv;
@@ -228,7 +228,7 @@ event_editor_construct (EventEditor *ee, CalClient *client)
COMP_EDITOR_PAGE (priv->meet_page),
_("Meeting"));
- comp_editor_set_cal_client (COMP_EDITOR (ee), client);
+ comp_editor_set_e_cal (COMP_EDITOR (ee), client);
comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps);
@@ -240,7 +240,7 @@ event_editor_construct (EventEditor *ee, CalClient *client)
}
static void
-event_editor_set_cal_client (CompEditor *editor, CalClient *client)
+event_editor_set_e_cal (CompEditor *editor, ECal *client)
{
EventEditor *ee;
EventEditorPrivate *priv;
@@ -248,19 +248,19 @@ event_editor_set_cal_client (CompEditor *editor, CalClient *client)
ee = EVENT_EDITOR (editor);
priv = ee->priv;
- e_meeting_store_set_cal_client (priv->model, client);
+ e_meeting_store_set_e_cal (priv->model, client);
- if (parent_class->set_cal_client)
- parent_class->set_cal_client (editor, client);
+ if (parent_class->set_e_cal)
+ parent_class->set_e_cal (editor, client);
}
static void
-event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
+event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
EventEditor *ee;
EventEditorPrivate *priv;
- CalComponentOrganizer organizer;
- CalClient *client;
+ ECalComponentOrganizer organizer;
+ ECal *client;
GSList *attendees = NULL;
ee = EVENT_EDITOR (editor);
@@ -271,11 +271,11 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
if (parent_class->edit_comp)
parent_class->edit_comp (editor, comp);
- client = comp_editor_get_cal_client (COMP_EDITOR (editor));
+ client = comp_editor_get_e_cal (COMP_EDITOR (editor));
/* Get meeting related stuff */
- cal_component_get_organizer (comp, &organizer);
- cal_component_get_attendee_list (comp, &attendees);
+ e_cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_attendee_list (comp, &attendees);
/* Clear things up */
e_meeting_store_remove_all_attendees (priv->model);
@@ -299,10 +299,10 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
for (l = attendees; l != NULL; l = l->next) {
- CalComponentAttendee *ca = l->data;
+ ECalComponentAttendee *ca = l->data;
EMeetingAttendee *ia;
- ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
+ ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee (ca));
/* If we aren't the organizer or the attendee is just delegating, don't allow editing */
if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia))
@@ -329,7 +329,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS);
}
g_object_unref(it);
- } else if (cal_client_get_organizer_must_attend (client)) {
+ } else if (e_cal_get_organizer_must_attend (client)) {
EMeetingAttendee *ia;
ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row);
@@ -339,7 +339,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
priv->meeting_shown = TRUE;
}
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
set_menu_sens (ee);
comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown && itip_organizer_is_user (comp, client));
@@ -348,26 +348,26 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
static gboolean
-event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
+event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
EventEditor *ee = EVENT_EDITOR (editor);
EventEditorPrivate *priv;
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
priv = ee->priv;
/* Don't cancel more than once or when just publishing */
- if (method == CAL_COMPONENT_METHOD_PUBLISH ||
- method == CAL_COMPONENT_METHOD_CANCEL)
+ if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
+ method == E_CAL_COMPONENT_METHOD_CANCEL)
goto parent;
comp = meeting_page_get_cancel_comp (priv->meet_page);
if (comp != NULL) {
- CalClient *client;
+ ECal *client;
gboolean result;
- client = e_meeting_store_get_cal_client (priv->model);
- result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
+ client = e_meeting_store_get_e_cal (priv->model);
+ result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
g_object_unref((comp));
if (!result)
@@ -410,7 +410,7 @@ event_editor_finalize (GObject *object)
/**
* event_editor_new:
- * @client: a CalClient
+ * @client: a ECal
*
* Creates a new event editor dialog.
*
@@ -418,7 +418,7 @@ event_editor_finalize (GObject *object)
* editor could not be created.
**/
EventEditor *
-event_editor_new (CalClient *client)
+event_editor_new (ECal *client)
{
EventEditor *ee;
@@ -474,19 +474,19 @@ refresh_meeting_cmd (GtkWidget *widget, gpointer data)
{
EventEditor *ee = EVENT_EDITOR (data);
- comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_REFRESH);
+ comp_editor_send_comp (COMP_EDITOR (ee), E_CAL_COMPONENT_METHOD_REFRESH);
}
static void
cancel_meeting_cmd (GtkWidget *widget, gpointer data)
{
EventEditor *ee = EVENT_EDITOR (data);
- CalComponent *comp;
+ ECalComponent *comp;
comp = comp_editor_get_current_comp (COMP_EDITOR (ee));
if (cancel_component_dialog ((GtkWindow *) ee,
- comp_editor_get_cal_client (COMP_EDITOR (ee)), comp, FALSE)) {
- comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_CANCEL);
+ comp_editor_get_e_cal (COMP_EDITOR (ee)), comp, FALSE)) {
+ comp_editor_send_comp (COMP_EDITOR (ee), E_CAL_COMPONENT_METHOD_CANCEL);
comp_editor_delete_comp (COMP_EDITOR (ee));
}
}
@@ -497,7 +497,7 @@ forward_cmd (GtkWidget *widget, gpointer data)
EventEditor *ee = EVENT_EDITOR (data);
if (comp_editor_save_comp (COMP_EDITOR (ee), TRUE))
- comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_PUBLISH);
+ comp_editor_send_comp (COMP_EDITOR (ee), E_CAL_COMPONENT_METHOD_PUBLISH);
}
static void
diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h
index e0ce5043d8..9234b8310e 100644
--- a/calendar/gui/dialogs/event-editor.h
+++ b/calendar/gui/dialogs/event-editor.h
@@ -52,8 +52,8 @@ struct _EventEditorClass {
GtkType event_editor_get_type (void);
EventEditor *event_editor_construct (EventEditor *ee,
- CalClient *client);
-EventEditor *event_editor_new (CalClient *client);
+ ECal *client);
+EventEditor *event_editor_new (ECal *client);
void event_editor_show_meeting (EventEditor *ee);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 8813081f4d..c883174c1f 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -36,7 +36,7 @@
#include "e-util/e-categories-config.h"
#include "e-util/e-dialog-widgets.h"
#include "widgets/misc/e-dateedit.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "../calendar-config.h"
#include "../e-timezone-entry.h"
#include "comp-editor-util.h"
@@ -91,8 +91,8 @@ static void event_page_finalize (GObject *object);
static GtkWidget *event_page_get_widget (CompEditorPage *page);
static void event_page_focus_main_widget (CompEditorPage *page);
-static void event_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean event_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void event_page_set_summary (CompEditorPage *page, const char *summary);
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -198,15 +198,15 @@ event_page_finalize (GObject *object)
static const int classification_map[] = {
- CAL_COMPONENT_CLASS_PUBLIC,
- CAL_COMPONENT_CLASS_PRIVATE,
- CAL_COMPONENT_CLASS_CONFIDENTIAL,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PRIVATE,
+ E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
-1
};
static const int transparency_map[] = {
- CAL_COMPONENT_TRANSP_TRANSPARENT,
- CAL_COMPONENT_TRANSP_OPAQUE,
+ E_CAL_COMPONENT_TRANSP_TRANSPARENT,
+ E_CAL_COMPONENT_TRANSP_OPAQUE,
-1
};
@@ -265,7 +265,7 @@ set_all_day (EventPage *epage, gboolean all_day)
}
static void
-update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDateTime *end_date)
+update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date)
{
EventPagePrivate *priv;
struct icaltimetype *start_tt, *end_tt, implied_tt;
@@ -280,7 +280,7 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
/* FIXME: Handle error better. */
- if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ if (!e_cal_get_timezone (COMP_EDITOR_PAGE (epage)->client,
start_date->tzid, &start_zone, NULL)) {
g_warning ("Couldn't get timezone from server: %s",
start_date->tzid ? start_date->tzid : "");
@@ -289,7 +289,7 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ if (!e_cal_get_timezone (COMP_EDITOR_PAGE (epage)->client,
end_date->tzid, &end_zone, NULL)) {
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
@@ -395,11 +395,11 @@ clear_widgets (EventPage *epage)
/* Classification */
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PRIVATE, classification_map);
+ E_CAL_COMPONENT_CLASS_PRIVATE, classification_map);
/* Show Time As (Transparency) */
e_dialog_radio_set (priv->show_time_as_free,
- CAL_COMPONENT_TRANSP_OPAQUE, transparency_map);
+ E_CAL_COMPONENT_TRANSP_OPAQUE, transparency_map);
/* Categories */
e_dialog_editable_set (priv->categories, NULL);
@@ -408,14 +408,14 @@ clear_widgets (EventPage *epage)
/* fill_widgets handler for the event page */
static void
-event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
EventPage *epage;
EventPagePrivate *priv;
- CalComponentText text;
- CalComponentClassification cl;
- CalComponentTransparency transparency;
- CalComponentDateTime start_date, end_date;
+ ECalComponentText text;
+ ECalComponentClassification cl;
+ ECalComponentTransparency transparency;
+ ECalComponentDateTime start_date, end_date;
const char *location;
const char *categories;
GSList *l;
@@ -433,84 +433,84 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Summary, location, description(s) */
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
e_dialog_editable_set (priv->summary, text.value);
- cal_component_get_location (comp, &location);
+ e_cal_component_get_location (comp, &location);
e_dialog_editable_set (priv->location, location);
- cal_component_get_description_list (comp, &l);
+ e_cal_component_get_description_list (comp, &l);
if (l) {
- text = *(CalComponentText *)l->data;
+ text = *(ECalComponentText *)l->data;
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)),
text.value, -1);
}
- cal_component_free_text_list (l);
+ e_cal_component_free_text_list (l);
/* Start and end times */
- cal_component_get_dtstart (comp, &start_date);
- cal_component_get_dtend (comp, &end_date);
+ e_cal_component_get_dtstart (comp, &start_date);
+ e_cal_component_get_dtend (comp, &end_date);
update_time (epage, &start_date, &end_date);
- cal_component_free_datetime (&start_date);
- cal_component_free_datetime (&end_date);
+ e_cal_component_free_datetime (&start_date);
+ e_cal_component_free_datetime (&end_date);
/* Classification */
- cal_component_get_classification (comp, &cl);
+ e_cal_component_get_classification (comp, &cl);
switch (cl) {
- case CAL_COMPONENT_CLASS_PUBLIC:
+ case E_CAL_COMPONENT_CLASS_PUBLIC:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
classification_map);
break;
- case CAL_COMPONENT_CLASS_PRIVATE:
+ case E_CAL_COMPONENT_CLASS_PRIVATE:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PRIVATE,
+ E_CAL_COMPONENT_CLASS_PRIVATE,
classification_map);
break;
- case CAL_COMPONENT_CLASS_CONFIDENTIAL:
+ case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_CONFIDENTIAL,
+ E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
classification_map);
break;
default:
/* default to PUBLIC */
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
classification_map);
break;
}
/* Show Time As (Transparency) */
- cal_component_get_transparency (comp, &transparency);
+ e_cal_component_get_transparency (comp, &transparency);
switch (transparency) {
- case CAL_COMPONENT_TRANSP_TRANSPARENT:
+ case E_CAL_COMPONENT_TRANSP_TRANSPARENT:
e_dialog_radio_set (priv->show_time_as_free,
- CAL_COMPONENT_TRANSP_TRANSPARENT,
+ E_CAL_COMPONENT_TRANSP_TRANSPARENT,
transparency_map);
break;
default:
e_dialog_radio_set (priv->show_time_as_free,
- CAL_COMPONENT_TRANSP_OPAQUE,
+ E_CAL_COMPONENT_TRANSP_OPAQUE,
transparency_map);
break;
}
- if (cal_client_get_static_capability (page->client, CAL_STATIC_CAPABILITY_NO_TRANSPARENCY))
+ if (e_cal_get_static_capability (page->client, CAL_STATIC_CAPABILITY_NO_TRANSPARENCY))
gtk_widget_hide (priv->show_time_frame);
else
gtk_widget_show (priv->show_time_frame);
/* Categories */
- cal_component_get_categories (comp, &categories);
+ e_cal_component_get_categories (comp, &categories);
e_dialog_editable_set (priv->categories, categories);
priv->updating = FALSE;
@@ -518,16 +518,16 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the event page */
static gboolean
-event_page_fill_component (CompEditorPage *page, CalComponent *comp)
+event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
EventPage *epage;
EventPagePrivate *priv;
- CalComponentDateTime start_date, end_date;
+ ECalComponentDateTime start_date, end_date;
struct icaltimetype start_tt, end_tt;
gboolean all_day_event, start_date_set, end_date_set;
char *cat, *str;
- CalComponentClassification classif;
- CalComponentTransparency transparency;
+ ECalComponentClassification classif;
+ ECalComponentTransparency transparency;
GtkTextBuffer *text_buffer;
GtkTextIter text_iter_start, text_iter_end;
@@ -539,14 +539,14 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
str = e_dialog_editable_get (priv->summary);
if (!str || strlen (str) == 0)
- cal_component_set_summary (comp, NULL);
+ e_cal_component_set_summary (comp, NULL);
else {
- CalComponentText text;
+ ECalComponentText text;
text.value = str;
text.altrep = NULL;
- cal_component_set_summary (comp, &text);
+ e_cal_component_set_summary (comp, &text);
}
if (str)
@@ -556,9 +556,9 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
str = e_dialog_editable_get (priv->location);
if (!str || strlen (str) == 0)
- cal_component_set_location (comp, NULL);
+ e_cal_component_set_location (comp, NULL);
else
- cal_component_set_location (comp, str);
+ e_cal_component_set_location (comp, str);
if (str)
g_free (str);
@@ -570,17 +570,17 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);
if (!str || strlen (str) == 0)
- cal_component_set_description_list (comp, NULL);
+ e_cal_component_set_description_list (comp, NULL);
else {
GSList l;
- CalComponentText text;
+ ECalComponentText text;
text.value = str;
text.altrep = NULL;
l.data = &text;
l.next = NULL;
- cal_component_set_description_list (comp, &l);
+ e_cal_component_set_description_list (comp, &l);
}
if (str)
@@ -649,8 +649,8 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
end_date.tzid = icaltimezone_get_tzid (end_zone);
}
- cal_component_set_dtstart (comp, &start_date);
- cal_component_set_dtend (comp, &end_date);
+ e_cal_component_set_dtstart (comp, &start_date);
+ e_cal_component_set_dtend (comp, &end_date);
/* Categories */
@@ -660,7 +660,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
if (cat)
g_free (cat);
- cal_component_set_categories (comp, str);
+ e_cal_component_set_categories (comp, str);
if (str)
g_free (str);
@@ -669,13 +669,13 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
classif = e_dialog_radio_get (priv->classification_public,
classification_map);
- cal_component_set_classification (comp, classif);
+ e_cal_component_set_classification (comp, classif);
/* Show Time As (Transparency) */
transparency = e_dialog_radio_get (priv->show_time_as_free,
transparency_map);
- cal_component_set_transparency (comp, transparency);
+ e_cal_component_set_transparency (comp, transparency);
return TRUE;
}
@@ -800,7 +800,7 @@ notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt,
{
EventPagePrivate *priv;
CompEditorPageDates dates;
- CalComponentDateTime start_dt, end_dt;
+ ECalComponentDateTime start_dt, end_dt;
gboolean all_day_event;
icaltimezone *start_zone = NULL, *end_zone = NULL;
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 546baa8dc3..311ff6c879 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -59,7 +59,7 @@ struct _MeetingPagePrivate {
GPtrArray *deleted_attendees;
/* To use in case of cancellation */
- CalComponent *comp;
+ ECalComponent *comp;
/* List of identities */
EAccountList *accounts;
@@ -97,8 +97,8 @@ static void meeting_page_finalize (GObject *object);
static GtkWidget *meeting_page_get_widget (CompEditorPage *page);
static void meeting_page_focus_main_widget (CompEditorPage *page);
-static void meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean meeting_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean meeting_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static CompEditorPageClass *parent_class = NULL;
@@ -197,22 +197,22 @@ get_current_account (MeetingPage *mpage)
}
static void
-set_attendees (CalComponent *comp, const GPtrArray *attendees)
+set_attendees (ECalComponent *comp, const GPtrArray *attendees)
{
GSList *comp_attendees = NULL, *l;
int i;
for (i = 0; i < attendees->len; i++) {
EMeetingAttendee *ia = g_ptr_array_index (attendees, i);
- CalComponentAttendee *ca;
+ ECalComponentAttendee *ca;
- ca = e_meeting_attendee_as_cal_component_attendee (ia);
+ ca = e_meeting_attendee_as_e_cal_component_attendee (ia);
comp_attendees = g_slist_prepend (comp_attendees, ca);
}
comp_attendees = g_slist_reverse (comp_attendees);
- cal_component_set_attendee_list (comp, comp_attendees);
+ e_cal_component_set_attendee_list (comp, comp_attendees);
for (l = comp_attendees; l != NULL; l = l->next)
g_free (l->data);
@@ -319,11 +319,11 @@ clear_widgets (MeetingPage *mpage)
/* fill_widgets handler for the meeting page */
static void
-meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
MeetingPage *mpage;
MeetingPagePrivate *priv;
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
mpage = MEETING_PAGE (page);
priv = mpage->priv;
@@ -342,11 +342,11 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (mpage);
/* Component for cancellation */
- priv->comp = cal_component_clone (comp);
+ priv->comp = e_cal_component_clone (comp);
/* If there is an existing organizer show it properly */
- if (cal_component_has_organizer (comp)) {
- cal_component_get_organizer (comp, &organizer);
+ if (e_cal_component_has_organizer (comp)) {
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value != NULL) {
const gchar *strip = itip_strip_mailto (organizer.value);
gchar *string;
@@ -355,12 +355,12 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
gtk_widget_show (priv->existing_organizer_table);
if (itip_organizer_is_user (comp, page->client)) {
gtk_widget_show (priv->invite);
- if (cal_client_get_static_capability (
+ if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
gtk_widget_hide (priv->existing_organizer_btn);
} else {
- if (cal_client_get_static_capability (
+ if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
gtk_widget_hide (priv->existing_organizer_btn);
@@ -395,11 +395,11 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the meeting page */
static gboolean
-meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
+meeting_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
MeetingPage *mpage;
MeetingPagePrivate *priv;
- CalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
+ ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
mpage = MEETING_PAGE (page);
priv = mpage->priv;
@@ -428,7 +428,7 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
organizer.value = addr;
organizer.cn = a->id->name;
- cal_component_set_organizer (comp, &organizer);
+ e_cal_component_set_organizer (comp, &organizer);
g_free (addr);
}
@@ -691,7 +691,7 @@ add_btn_clicked_cb (GtkButton *btn, MeetingPage *mpage)
**/
MeetingPage *
meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
- CalClient *client)
+ ECal *client)
{
MeetingPagePrivate *priv;
ETable *real_table;
@@ -719,7 +719,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
}
/* Address information */
- if (!cal_client_get_cal_address (client, &backend_address, NULL))
+ if (!e_cal_get_cal_address (client, &backend_address, NULL))
return NULL;
priv->accounts = itip_addresses_get ();
@@ -797,7 +797,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
* not be created.
**/
MeetingPage *
-meeting_page_new (EMeetingStore *ems, CalClient *client)
+meeting_page_new (EMeetingStore *ems, ECal *client)
{
MeetingPage *mpage;
@@ -818,7 +818,7 @@ meeting_page_new (EMeetingStore *ems, CalClient *client)
*
* Return value:
**/
-CalComponent *
+ECalComponent *
meeting_page_get_cancel_comp (MeetingPage *mpage)
{
MeetingPagePrivate *priv;
@@ -833,5 +833,5 @@ meeting_page_get_cancel_comp (MeetingPage *mpage)
set_attendees (priv->comp, priv->deleted_attendees);
- return cal_component_clone (priv->comp);
+ return e_cal_component_clone (priv->comp);
}
diff --git a/calendar/gui/dialogs/meeting-page.h b/calendar/gui/dialogs/meeting-page.h
index 5891189810..95533cd771 100644
--- a/calendar/gui/dialogs/meeting-page.h
+++ b/calendar/gui/dialogs/meeting-page.h
@@ -55,10 +55,10 @@ typedef struct {
GtkType meeting_page_get_type (void);
MeetingPage *meeting_page_construct (MeetingPage *mpage,
EMeetingStore *ems,
- CalClient *client);
+ ECal *client);
MeetingPage *meeting_page_new (EMeetingStore *ems,
- CalClient *client);
-CalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage);
+ ECal *client);
+ECalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage);
diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c
index eafee32102..82648fe84d 100644
--- a/calendar/gui/dialogs/recur-comp.c
+++ b/calendar/gui/dialogs/recur-comp.c
@@ -32,30 +32,30 @@
gboolean
-recur_component_dialog (CalClient *client,
- CalComponent *comp,
+recur_component_dialog (ECal *client,
+ ECalComponent *comp,
CalObjModType *mod,
GtkWindow *parent)
{
char *str;
GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
gboolean ret;
- g_return_val_if_fail (IS_CAL_COMPONENT (comp), CALOBJ_MOD_THIS);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), CALOBJ_MOD_THIS);
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
str = g_strdup_printf (_("You are modifying a recurring event, what would you like to modify?"));
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
str = g_strdup_printf (_("You are modifying a recurring task, what would you like to modify?"));
break;
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
str = g_strdup_printf (_("You are modifying a recurring journal entry, what would you like to modify?"));
break;
@@ -73,13 +73,13 @@ recur_component_dialog (CalClient *client,
rb_this = gtk_radio_button_new_with_label (NULL, _("This Instance Only"));
gtk_container_add (GTK_CONTAINER (hbox), rb_this);
- if (!cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) {
+ if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) {
rb_prior = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Prior Instances"));
gtk_container_add (GTK_CONTAINER (hbox), rb_prior);
} else
rb_prior = NULL;
- if (!cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
+ if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
rb_future = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Future Instances"));
gtk_container_add (GTK_CONTAINER (hbox), rb_future);
} else
diff --git a/calendar/gui/dialogs/recur-comp.h b/calendar/gui/dialogs/recur-comp.h
index 76b1a63bef..94ccbdae87 100644
--- a/calendar/gui/dialogs/recur-comp.h
+++ b/calendar/gui/dialogs/recur-comp.h
@@ -22,12 +22,12 @@
#define RECUR_COMP_H
#include <gtk/gtkwindow.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/cal-util.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal-util.h>
-gboolean recur_component_dialog (CalClient *client,
- CalComponent *comp,
+gboolean recur_component_dialog (ECal *client,
+ ECalComponent *comp,
CalObjModType *mod,
GtkWindow *parent);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index ece6c115bb..c930e079a2 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -42,8 +42,8 @@
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-time-utils.h>
#include <widgets/misc/e-dateedit.h>
-#include <cal-util/cal-recur.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-recur.h>
+#include <libecal/e-cal-time-util.h>
#include "../calendar-config.h"
#include "../tag-calendar.h"
#include "../weekday-picker.h"
@@ -135,7 +135,7 @@ static const int ending_types_map[] = {
/* Private part of the RecurrencePage structure */
struct _RecurrencePagePrivate {
/* Component we use to expand the recurrence rules for the preview */
- CalComponent *comp;
+ ECalComponent *comp;
/* Glade XML data */
GladeXML *xml;
@@ -207,8 +207,8 @@ static void recurrence_page_finalize (GObject *object);
static GtkWidget *recurrence_page_get_widget (CompEditorPage *page);
static void recurrence_page_focus_main_widget (CompEditorPage *page);
-static void recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean recurrence_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void recurrence_page_set_summary (CompEditorPage *page, const char *summary);
static void recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -422,7 +422,7 @@ clear_widgets (RecurrencePage *rpage)
/* Appends an exception date to the list */
static void
-append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime)
+append_exception (RecurrencePage *rpage, ECalComponentDateTime *datetime)
{
RecurrencePagePrivate *priv;
GtkTreeView *view;
@@ -437,17 +437,17 @@ append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime)
/* Fills in the exception widgets with the data from the calendar component */
static void
-fill_exception_widgets (RecurrencePage *rpage, CalComponent *comp)
+fill_exception_widgets (RecurrencePage *rpage, ECalComponent *comp)
{
RecurrencePagePrivate *priv;
GSList *list, *l;
gboolean added = FALSE;
priv = rpage->priv;
- cal_component_get_exdate_list (comp, &list);
+ e_cal_component_get_exdate_list (comp, &list);
for (l = list; l; l = l->next) {
- CalComponentDateTime *cdt;
+ ECalComponentDateTime *cdt;
added = TRUE;
@@ -455,19 +455,19 @@ fill_exception_widgets (RecurrencePage *rpage, CalComponent *comp)
append_exception (rpage, cdt);
}
- cal_component_free_exdate_list (list);
+ e_cal_component_free_exdate_list (list);
}
/* Computes a weekday mask for the start day of a calendar component,
* for use in a WeekdayPicker widget.
*/
static guint8
-get_start_weekday_mask (CalComponent *comp)
+get_start_weekday_mask (ECalComponent *comp)
{
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
guint8 retval;
- cal_component_get_dtstart (comp, &dt);
+ e_cal_component_get_dtstart (comp, &dt);
if (dt.value) {
short weekday;
@@ -477,7 +477,7 @@ get_start_weekday_mask (CalComponent *comp)
} else
retval = 0;
- cal_component_free_datetime (&dt);
+ e_cal_component_free_datetime (&dt);
return retval;
}
@@ -514,7 +514,7 @@ sensitize_recur_widgets (RecurrencePage *rpage)
type = e_dialog_radio_get (priv->none, type_map);
/* We can't preview that well for instances right now */
- if (cal_component_is_instance (priv->comp))
+ if (e_cal_component_is_instance (priv->comp))
gtk_widget_set_sensitive (priv->preview_calendar, FALSE);
else
gtk_widget_set_sensitive (priv->preview_calendar, TRUE);
@@ -569,7 +569,7 @@ nth_weekday (int pos, icalrecurrencetype_weekday weekday)
* the calendar component.
*/
static void
-simple_recur_to_comp (RecurrencePage *rpage, CalComponent *comp)
+simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp)
{
RecurrencePagePrivate *priv;
struct icalrecurrencetype r;
@@ -754,14 +754,14 @@ simple_recur_to_comp (RecurrencePage *rpage, CalComponent *comp)
l.data = &r;
l.next = NULL;
- cal_component_set_rrule_list (comp, &l);
+ e_cal_component_set_rrule_list (comp, &l);
}
/* Fills a component with the data from the recurrence page; in the case of a
* custom recurrence, it leaves it intact.
*/
static gboolean
-fill_component (RecurrencePage *rpage, CalComponent *comp)
+fill_component (RecurrencePage *rpage, ECalComponent *comp)
{
RecurrencePagePrivate *priv;
enum recur_type recur_type;
@@ -777,14 +777,14 @@ fill_component (RecurrencePage *rpage, CalComponent *comp)
switch (recur_type) {
case RECUR_NONE:
- cal_component_set_rdate_list (comp, NULL);
- cal_component_set_rrule_list (comp, NULL);
- cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdate_list (comp, NULL);
+ e_cal_component_set_rrule_list (comp, NULL);
+ e_cal_component_set_exrule_list (comp, NULL);
break;
case RECUR_SIMPLE:
- cal_component_set_rdate_list (comp, NULL);
- cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdate_list (comp, NULL);
+ e_cal_component_set_exrule_list (comp, NULL);
simple_recur_to_comp (rpage, comp);
break;
@@ -802,10 +802,10 @@ fill_component (RecurrencePage *rpage, CalComponent *comp)
for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter;
valid_iter = gtk_tree_model_iter_next (model, &iter)) {
- const CalComponentDateTime *dt;
- CalComponentDateTime *cdt;
+ const ECalComponentDateTime *dt;
+ ECalComponentDateTime *cdt;
- cdt = g_new (CalComponentDateTime, 1);
+ cdt = g_new (ECalComponentDateTime, 1);
cdt->value = g_new (struct icaltimetype, 1);
dt = e_date_time_list_get_date_time (E_DATE_TIME_LIST (model), &iter);
@@ -824,8 +824,8 @@ fill_component (RecurrencePage *rpage, CalComponent *comp)
list = g_slist_prepend (list, cdt);
}
- cal_component_set_exdate_list (comp, list);
- cal_component_free_exdate_list (list);
+ e_cal_component_set_exdate_list (comp, list);
+ e_cal_component_free_exdate_list (list);
return TRUE;
}
@@ -837,8 +837,8 @@ static void
preview_recur (RecurrencePage *rpage)
{
RecurrencePagePrivate *priv;
- CalComponent *comp;
- CalComponentDateTime cdt;
+ ECalComponent *comp;
+ ECalComponentDateTime cdt;
GSList *l;
icaltimezone *zone = NULL;
@@ -847,44 +847,44 @@ preview_recur (RecurrencePage *rpage)
/* If our component has not been set yet through ::fill_widgets(), we
* cannot preview the recurrence.
*/
- if (!priv->comp || cal_component_is_instance (priv->comp))
+ if (!priv->comp || e_cal_component_is_instance (priv->comp))
return;
/* Create a scratch component with the start/end and
* recurrence/exception information from the one we are editing.
*/
- comp = cal_component_new ();
- cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
- cal_component_get_dtstart (priv->comp, &cdt);
+ e_cal_component_get_dtstart (priv->comp, &cdt);
if (cdt.tzid != NULL) {
- /* FIXME Will cal_client_get_timezone really not return builtin zones? */
- if (!cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL))
+ /* FIXME Will e_cal_get_timezone really not return builtin zones? */
+ if (!e_cal_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL))
zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid);
}
- cal_component_set_dtstart (comp, &cdt);
- cal_component_free_datetime (&cdt);
+ e_cal_component_set_dtstart (comp, &cdt);
+ e_cal_component_free_datetime (&cdt);
- cal_component_get_dtend (priv->comp, &cdt);
- cal_component_set_dtend (comp, &cdt);
- cal_component_free_datetime (&cdt);
+ e_cal_component_get_dtend (priv->comp, &cdt);
+ e_cal_component_set_dtend (comp, &cdt);
+ e_cal_component_free_datetime (&cdt);
- cal_component_get_exdate_list (priv->comp, &l);
- cal_component_set_exdate_list (comp, l);
- cal_component_free_exdate_list (l);
+ e_cal_component_get_exdate_list (priv->comp, &l);
+ e_cal_component_set_exdate_list (comp, l);
+ e_cal_component_free_exdate_list (l);
- cal_component_get_exrule_list (priv->comp, &l);
- cal_component_set_exrule_list (comp, l);
- cal_component_free_recur_list (l);
+ e_cal_component_get_exrule_list (priv->comp, &l);
+ e_cal_component_set_exrule_list (comp, l);
+ e_cal_component_free_recur_list (l);
- cal_component_get_rdate_list (priv->comp, &l);
- cal_component_set_rdate_list (comp, l);
- cal_component_free_period_list (l);
+ e_cal_component_get_rdate_list (priv->comp, &l);
+ e_cal_component_set_rdate_list (comp, l);
+ e_cal_component_free_period_list (l);
- cal_component_get_rrule_list (priv->comp, &l);
- cal_component_set_rrule_list (comp, l);
- cal_component_free_recur_list (l);
+ e_cal_component_get_rrule_list (priv->comp, &l);
+ e_cal_component_set_rrule_list (comp, l);
+ e_cal_component_free_recur_list (l);
fill_component (rpage, comp);
@@ -968,7 +968,7 @@ make_recur_month_num_submenu (const char *title, int start, int end)
submenu = gtk_menu_new ();
for (i = start; i < end; i++) {
- item = gtk_menu_item_new_with_label (_(cal_recur_nth[i]));
+ item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[i]));
gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
gtk_object_set_user_data (GTK_OBJECT (item), GINT_TO_POINTER (i + 1));
gtk_widget_show (item);
@@ -1006,7 +1006,7 @@ make_recur_month_num_menu (int month_index)
}
/* Current date */
- item = gtk_menu_item_new_with_label (_(cal_recur_nth[month_index - 1]));
+ item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[month_index - 1]));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_widget_show (item);
@@ -1096,7 +1096,7 @@ month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map);
label = GTK_BIN (priv->month_num_menu)->child;
- gtk_label_set_text (GTK_LABEL (label), _(cal_recur_nth[priv->month_index - 1]));
+ gtk_label_set_text (GTK_LABEL (label), _(e_cal_recur_nth[priv->month_index - 1]));
e_dialog_option_menu_set (priv->month_num_menu, 0, month_num_options_map);
e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map);
@@ -1445,11 +1445,11 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
/* Ending date */
if (!r->until.is_date) {
- CalClient *client = COMP_EDITOR_PAGE (rpage)->client;
- CalComponentDateTime dt;
+ ECal *client = COMP_EDITOR_PAGE (rpage)->client;
+ ECalComponentDateTime dt;
icaltimezone *from_zone, *to_zone;
- cal_component_get_dtstart (priv->comp, &dt);
+ e_cal_component_get_dtstart (priv->comp, &dt);
if (dt.value->is_date)
to_zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ());
@@ -1457,7 +1457,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
to_zone = icaltimezone_get_utc_timezone ();
else
/* FIXME Error checking? */
- cal_client_get_timezone (client, dt.tzid, &to_zone, NULL);
+ e_cal_get_timezone (client, dt.tzid, &to_zone, NULL);
from_zone = icaltimezone_get_utc_timezone ();
icaltimezone_convert_time (&r->until, from_zone, to_zone);
@@ -1494,11 +1494,11 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
* no rdates or exrules (exdates are handled just fine elsewhere).
*/
static void
-recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- CalComponentText text;
+ ECalComponentText text;
CompEditorPageDates dates;
GSList *rrule_list;
int len;
@@ -1519,7 +1519,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (priv->comp)
g_object_unref((priv->comp));
- priv->comp = cal_component_clone (comp);
+ priv->comp = e_cal_component_clone (comp);
/* Don't send off changes during this time */
priv->updating = TRUE;
@@ -1528,7 +1528,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (rpage);
/* Summary */
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
recurrence_page_set_summary (page, text.value);
/* Dates */
@@ -1544,9 +1544,9 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* No recurrences? */
- if (!cal_component_has_rdates (comp)
- && !cal_component_has_rrules (comp)
- && !cal_component_has_exrules (comp)) {
+ if (!e_cal_component_has_rdates (comp)
+ && !e_cal_component_has_rrules (comp)
+ && !e_cal_component_has_exrules (comp)) {
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->none),
rpage);
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->simple),
@@ -1572,11 +1572,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* See if it is a custom set we don't support */
- cal_component_get_rrule_list (comp, &rrule_list);
+ e_cal_component_get_rrule_list (comp, &rrule_list);
len = g_slist_length (rrule_list);
if (len > 1
- || cal_component_has_rdates (comp)
- || cal_component_has_exrules (comp))
+ || e_cal_component_has_rdates (comp)
+ || e_cal_component_has_exrules (comp))
goto custom;
/* Down to one rule, so test that one */
@@ -1718,9 +1718,9 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
goto custom;
if (nth == -1) {
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
- cal_component_get_dtstart (comp, &dt);
+ e_cal_component_get_dtstart (comp, &dt);
priv->month_index = dt.value->day;
priv->month_num = MONTH_NUM_LAST;
} else {
@@ -1858,7 +1858,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
out:
- cal_component_free_recur_list (rrule_list);
+ e_cal_component_free_recur_list (rrule_list);
preview_recur (rpage);
priv->updating = FALSE;
@@ -1866,7 +1866,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the recurrence page */
static gboolean
-recurrence_page_fill_component (CompEditorPage *page, CalComponent *comp)
+recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
RecurrencePage *rpage;
@@ -1893,7 +1893,7 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
struct icaltimetype icaltime;
guint8 mask;
@@ -1912,13 +1912,13 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
if (dates->start) {
icaltime = *dates->start->value;
dt.tzid = dates->start->tzid;
- cal_component_set_dtstart (priv->comp, &dt);
+ e_cal_component_set_dtstart (priv->comp, &dt);
}
if (dates->end) {
icaltime = *dates->end->value;
dt.tzid = dates->end->tzid;
- cal_component_set_dtend (priv->comp, &dt);
+ e_cal_component_set_dtend (priv->comp, &dt);
}
/* Update the weekday picker if necessary */
@@ -2094,7 +2094,7 @@ exception_add_cb (GtkWidget *widget, gpointer data)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
struct icaltimetype icaltime = icaltime_null_time ();
gboolean date_set;
@@ -2126,7 +2126,7 @@ exception_modify_cb (GtkWidget *widget, gpointer data)
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
GtkTreeSelection *selection;
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
struct icaltimetype icaltime = icaltime_null_time ();
struct icaltimetype *tt;
GtkTreeIter iter;
@@ -2205,7 +2205,7 @@ exception_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- const CalComponentDateTime *dt;
+ const ECalComponentDateTime *dt;
struct icaltimetype *t;
GtkTreeIter iter;
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 06c2d57131..7ed42cb707 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -81,8 +81,8 @@ static void schedule_page_finalize (GObject *object);
static GtkWidget *schedule_page_get_widget (CompEditorPage *page);
static void schedule_page_focus_main_widget (CompEditorPage *page);
-static void schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean schedule_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean schedule_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
static void times_changed_cb (GtkWidget *widget, gpointer data);
@@ -203,7 +203,7 @@ schedule_page_focus_main_widget (CompEditorPage *page)
/* Set date/time */
static void
-update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponentDateTime *end_date)
+update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date)
{
SchedulePagePrivate *priv;
struct icaltimetype start_tt, end_tt;
@@ -217,7 +217,7 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client,
start_date->tzid, &start_zone, NULL)) {
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
@@ -227,7 +227,7 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client,
end_date->tzid, &end_zone, NULL)) {
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
@@ -286,11 +286,11 @@ clear_widgets (SchedulePage *spage)
/* fill_widgets handler for the schedule page */
static void
-schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
SchedulePage *spage;
SchedulePagePrivate *priv;
- CalComponentDateTime start_date, end_date;
+ ECalComponentDateTime start_date, end_date;
spage = SCHEDULE_PAGE (page);
priv = spage->priv;
@@ -301,19 +301,19 @@ schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (spage);
/* Start and end times */
- cal_component_get_dtstart (comp, &start_date);
- cal_component_get_dtend (comp, &end_date);
+ e_cal_component_get_dtstart (comp, &start_date);
+ e_cal_component_get_dtend (comp, &end_date);
update_time (spage, &start_date, &end_date);
- cal_component_free_datetime (&start_date);
- cal_component_free_datetime (&end_date);
+ e_cal_component_free_datetime (&start_date);
+ e_cal_component_free_datetime (&end_date);
priv->updating = FALSE;
}
/* fill_component handler for the schedule page */
static gboolean
-schedule_page_fill_component (CompEditorPage *page, CalComponent *comp)
+schedule_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
SchedulePage *spage;
SchedulePagePrivate *priv;
@@ -473,7 +473,7 @@ times_changed_cb (GtkWidget *widget, gpointer data)
SchedulePage *spage = data;
SchedulePagePrivate *priv;
CompEditorPageDates dates;
- CalComponentDateTime start_dt, end_dt;
+ ECalComponentDateTime start_dt, end_dt;
struct icaltimetype start_tt = icaltime_null_time ();
struct icaltimetype end_tt = icaltime_null_time ();
diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c
index 0ca96ead7b..3075747a92 100644
--- a/calendar/gui/dialogs/send-comp.c
+++ b/calendar/gui/dialogs/send-comp.c
@@ -40,20 +40,20 @@
* Return value: TRUE if the user clicked Yes, FALSE otherwise.
**/
gboolean
-send_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *comp, gboolean new)
+send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new)
{
GtkWidget *dialog;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
char *str;
gint response;
- if (cal_client_get_save_schedules (client))
+ if (e_cal_get_save_schedules (client))
return FALSE;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
switch (vtype) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
if (new)
str = g_strdup_printf (_("The meeting information has "
"been created. Send it?"));
@@ -63,7 +63,7 @@ send_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *comp,
"version?"));
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
if (new)
str = g_strdup_printf (_("The task assignment "
"information has been "
diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h
index e02bd74d1e..86be94ccdb 100644
--- a/calendar/gui/dialogs/send-comp.h
+++ b/calendar/gui/dialogs/send-comp.h
@@ -23,9 +23,9 @@
#include <glib.h>
#include <gtk/gtkwindow.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-component.h>
-gboolean send_component_dialog (GtkWindow *parent, CalClient *client, CalComponent *comp, gboolean new);
+gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new);
#endif
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index cdaa8d08a1..938a9ec1fe 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -94,8 +94,8 @@ static void task_details_page_finalize (GObject *object);
static GtkWidget *task_details_page_get_widget (CompEditorPage *page);
static void task_details_page_focus_main_widget (CompEditorPage *page);
-static void task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean task_details_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static CompEditorPageClass *parent_class = NULL;
@@ -278,7 +278,7 @@ clear_widgets (TaskDetailsPage *tdpage)
/* fill_widgets handler for the task page */
static void
-task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
TaskDetailsPage *tdpage;
TaskDetailsPagePrivate *priv;
@@ -297,7 +297,7 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (tdpage);
/* Percent Complete. */
- cal_component_get_percent (comp, &percent);
+ e_cal_component_get_percent (comp, &percent);
if (percent) {
e_dialog_spin_set (priv->percent_complete, *percent);
} else {
@@ -306,7 +306,7 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
}
/* Status. */
- cal_component_get_status (comp, &status);
+ e_cal_component_get_status (comp, &status);
if (status == ICAL_STATUS_NONE || status == ICAL_STATUS_NEEDSACTION) {
/* Try to use the percent value. */
if (percent) {
@@ -322,10 +322,10 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_dialog_option_menu_set (priv->status, status, status_map);
if (percent)
- cal_component_free_percent (percent);
+ e_cal_component_free_percent (percent);
/* Completed Date. */
- cal_component_get_completed (comp, &completed);
+ e_cal_component_get_completed (comp, &completed);
if (completed) {
icaltimezone *utc_zone, *zone;
char *location;
@@ -345,21 +345,21 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
completed->hour,
completed->minute);
- cal_component_free_icaltimetype (completed);
+ e_cal_component_free_icaltimetype (completed);
}
/* Priority. */
- cal_component_get_priority (comp, &priority_value);
+ e_cal_component_get_priority (comp, &priority_value);
if (priority_value) {
priority = priority_value_to_index (*priority_value);
- cal_component_free_priority (priority_value);
+ e_cal_component_free_priority (priority_value);
} else {
priority = PRIORITY_UNDEFINED;
}
e_dialog_option_menu_set (priv->priority, priority, priority_map);
/* URL */
- cal_component_get_url (comp, &url);
+ e_cal_component_get_url (comp, &url);
e_dialog_editable_set (priv->url, url);
priv->updating = FALSE;
@@ -367,7 +367,7 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the task page */
static gboolean
-task_details_page_fill_component (CompEditorPage *page, CalComponent *comp)
+task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
TaskDetailsPage *tdpage;
TaskDetailsPagePrivate *priv;
@@ -383,16 +383,16 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp)
/* Percent Complete. */
percent = e_dialog_spin_get_int (priv->percent_complete);
- cal_component_set_percent (comp, &percent);
+ e_cal_component_set_percent (comp, &percent);
/* Status. */
status = e_dialog_option_menu_get (priv->status, status_map);
- cal_component_set_status (comp, status);
+ e_cal_component_set_status (comp, status);
/* Priority. */
priority = e_dialog_option_menu_get (priv->priority, priority_map);
priority_value = priority_index_to_value (priority);
- cal_component_set_priority (comp, &priority_value);
+ e_cal_component_set_priority (comp, &priority_value);
icaltime = icaltime_null_time ();
@@ -424,14 +424,14 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp)
icaltimezone *zone = icaltimezone_get_builtin_timezone (location);
icaltimezone_convert_time (&icaltime, zone,
icaltimezone_get_utc_timezone ());
- cal_component_set_completed (comp, &icaltime);
+ e_cal_component_set_completed (comp, &icaltime);
} else {
- cal_component_set_completed (comp, NULL);
+ e_cal_component_set_completed (comp, NULL);
}
/* URL. */
url = e_dialog_editable_get (priv->url);
- cal_component_set_url (comp, url);
+ e_cal_component_set_url (comp, url);
if (url)
g_free (url);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 339fdca80d..5c796df3a3 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -51,9 +51,9 @@ struct _TaskEditorPrivate {
static void task_editor_class_init (TaskEditorClass *class);
static void task_editor_init (TaskEditor *te);
-static void task_editor_set_cal_client (CompEditor *editor, CalClient *client);
-static void task_editor_edit_comp (CompEditor *editor, CalComponent *comp);
-static gboolean task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method);
+static void task_editor_set_e_cal (CompEditor *editor, ECal *client);
+static void task_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
+static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
static void task_editor_finalize (GObject *object);
static void assign_task_cmd (GtkWidget *widget, gpointer data);
@@ -101,7 +101,7 @@ task_editor_class_init (TaskEditorClass *klass)
parent_class = g_type_class_ref(TYPE_COMP_EDITOR);
- editor_class->set_cal_client = task_editor_set_cal_client;
+ editor_class->set_e_cal = task_editor_set_e_cal;
editor_class->edit_comp = task_editor_edit_comp;
editor_class->send_comp = task_editor_send_comp;
@@ -119,9 +119,9 @@ set_menu_sens (TaskEditor *te)
existing = comp_editor_get_existing_org (COMP_EDITOR (te));
user = comp_editor_get_user_org (COMP_EDITOR (te));
- cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)), &read_only, NULL);
+ e_cal_is_read_only (comp_editor_get_e_cal (COMP_EDITOR (te)), &read_only, NULL);
- sens = cal_client_get_static_capability (comp_editor_get_cal_client (COMP_EDITOR (te)),
+ sens = e_cal_get_static_capability (comp_editor_get_e_cal (COMP_EDITOR (te)),
CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)
|| priv->assignment_shown || read_only;
comp_editor_set_ui_prop (COMP_EDITOR (te),
@@ -180,7 +180,7 @@ task_editor_init (TaskEditor *te)
}
TaskEditor *
-task_editor_construct (TaskEditor *te, CalClient *client)
+task_editor_construct (TaskEditor *te, ECal *client)
{
TaskEditorPrivate *priv;
@@ -207,7 +207,7 @@ task_editor_construct (TaskEditor *te, CalClient *client)
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- comp_editor_set_cal_client (COMP_EDITOR (te), client);
+ comp_editor_set_e_cal (COMP_EDITOR (te), client);
comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL);
@@ -218,7 +218,7 @@ task_editor_construct (TaskEditor *te, CalClient *client)
}
static void
-task_editor_set_cal_client (CompEditor *editor, CalClient *client)
+task_editor_set_e_cal (CompEditor *editor, ECal *client)
{
TaskEditor *te;
TaskEditorPrivate *priv;
@@ -226,19 +226,19 @@ task_editor_set_cal_client (CompEditor *editor, CalClient *client)
te = TASK_EDITOR (editor);
priv = te->priv;
- e_meeting_store_set_cal_client (priv->model, client);
+ e_meeting_store_set_e_cal (priv->model, client);
- if (parent_class->set_cal_client)
- parent_class->set_cal_client (editor, client);
+ if (parent_class->set_e_cal)
+ parent_class->set_e_cal (editor, client);
}
static void
-task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
+task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
TaskEditor *te;
TaskEditorPrivate *priv;
- CalComponentOrganizer organizer;
- CalClient *client;
+ ECalComponentOrganizer organizer;
+ ECal *client;
GSList *attendees = NULL;
te = TASK_EDITOR (editor);
@@ -249,11 +249,11 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
if (parent_class->edit_comp)
parent_class->edit_comp (editor, comp);
- client = comp_editor_get_cal_client (COMP_EDITOR (editor));
+ client = comp_editor_get_e_cal (COMP_EDITOR (editor));
/* Get meeting related stuff */
- cal_component_get_organizer (comp, &organizer);
- cal_component_get_attendee_list (comp, &attendees);
+ e_cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_attendee_list (comp, &attendees);
/* Clear things up */
e_meeting_store_remove_all_attendees (priv->model);
@@ -271,10 +271,10 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
_("Assignment"));
for (l = attendees; l != NULL; l = l->next) {
- CalComponentAttendee *ca = l->data;
+ ECalComponentAttendee *ca = l->data;
EMeetingAttendee *ia;
- ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
+ ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee (ca));
/* If we aren't the organizer or the attendee is just delegating, don't allow editing */
if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia))
e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE);
@@ -300,7 +300,7 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS);
}
g_object_unref(it);
- } else if (cal_client_get_organizer_must_attend (client)) {
+ } else if (e_cal_get_organizer_must_attend (client)) {
EMeetingAttendee *ia;
ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row);
@@ -310,7 +310,7 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
priv->assignment_shown = TRUE;
}
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
set_menu_sens (te);
comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp, client));
@@ -319,26 +319,26 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
static gboolean
-task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
+task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
TaskEditor *te = TASK_EDITOR (editor);
TaskEditorPrivate *priv;
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
priv = te->priv;
/* Don't cancel more than once or when just publishing */
- if (method == CAL_COMPONENT_METHOD_PUBLISH ||
- method == CAL_COMPONENT_METHOD_CANCEL)
+ if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
+ method == E_CAL_COMPONENT_METHOD_CANCEL)
goto parent;
comp = meeting_page_get_cancel_comp (priv->meet_page);
if (comp != NULL) {
- CalClient *client;
+ ECal *client;
gboolean result;
- client = e_meeting_store_get_cal_client (priv->model);
- result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
+ client = e_meeting_store_get_e_cal (priv->model);
+ result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
g_object_unref((comp));
if (!result)
@@ -379,7 +379,7 @@ task_editor_finalize (GObject *object)
/**
* task_editor_new:
- * @client: a CalClient
+ * @client: a ECal
*
* Creates a new event editor dialog.
*
@@ -387,7 +387,7 @@ task_editor_finalize (GObject *object)
* editor could not be created.
**/
TaskEditor *
-task_editor_new (CalClient *client)
+task_editor_new (ECal *client)
{
TaskEditor *te;
@@ -439,19 +439,19 @@ refresh_task_cmd (GtkWidget *widget, gpointer data)
{
TaskEditor *te = TASK_EDITOR (data);
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_REFRESH);
+ comp_editor_send_comp (COMP_EDITOR (te), E_CAL_COMPONENT_METHOD_REFRESH);
}
static void
cancel_task_cmd (GtkWidget *widget, gpointer data)
{
TaskEditor *te = TASK_EDITOR (data);
- CalComponent *comp;
+ ECalComponent *comp;
comp = comp_editor_get_current_comp (COMP_EDITOR (te));
if (cancel_component_dialog ((GtkWindow *) te,
- comp_editor_get_cal_client (COMP_EDITOR (te)), comp, FALSE)) {
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_CANCEL);
+ comp_editor_get_e_cal (COMP_EDITOR (te)), comp, FALSE)) {
+ comp_editor_send_comp (COMP_EDITOR (te), E_CAL_COMPONENT_METHOD_CANCEL);
comp_editor_delete_comp (COMP_EDITOR (te));
}
}
@@ -462,7 +462,7 @@ forward_cmd (GtkWidget *widget, gpointer data)
TaskEditor *te = TASK_EDITOR (data);
if (comp_editor_save_comp (COMP_EDITOR (te), TRUE))
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH);
+ comp_editor_send_comp (COMP_EDITOR (te), E_CAL_COMPONENT_METHOD_PUBLISH);
}
static void
diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h
index aec98b073e..e0e6ac75be 100644
--- a/calendar/gui/dialogs/task-editor.h
+++ b/calendar/gui/dialogs/task-editor.h
@@ -53,8 +53,8 @@ struct _TaskEditorClass {
GtkType task_editor_get_type (void);
TaskEditor *task_editor_construct (TaskEditor *te,
- CalClient *client);
-TaskEditor *task_editor_new (CalClient *client);
+ ECal *client);
+TaskEditor *task_editor_new (ECal *client);
void task_editor_show_assignment(TaskEditor *te);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index fb7558ce5a..e691c8de92 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -73,9 +73,9 @@ struct _TaskPagePrivate {
};
static const int classification_map[] = {
- CAL_COMPONENT_CLASS_PUBLIC,
- CAL_COMPONENT_CLASS_PRIVATE,
- CAL_COMPONENT_CLASS_CONFIDENTIAL,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PRIVATE,
+ E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
-1
};
@@ -87,8 +87,8 @@ static void task_page_finalize (GObject *object);
static GtkWidget *task_page_get_widget (CompEditorPage *page);
static void task_page_focus_main_widget (CompEditorPage *page);
-static void task_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
-static gboolean task_page_fill_component (CompEditorPage *page, CalComponent *comp);
+static void task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void task_page_set_summary (CompEditorPage *page, const char *summary);
static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -231,14 +231,14 @@ clear_widgets (TaskPage *tpage)
/* Classification */
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PRIVATE, classification_map);
+ E_CAL_COMPONENT_CLASS_PRIVATE, classification_map);
/* Categories */
e_dialog_editable_set (priv->categories, NULL);
}
/* Decode the radio button group for classifications */
-static CalComponentClassification
+static ECalComponentClassification
classification_get (GtkWidget *widget)
{
return e_dialog_radio_get (widget, classification_map);
@@ -246,13 +246,13 @@ classification_get (GtkWidget *widget)
/* fill_widgets handler for the task page */
static void
-task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
+task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
TaskPage *tpage;
TaskPagePrivate *priv;
- CalComponentText text;
- CalComponentDateTime d;
- CalComponentClassification cl;
+ ECalComponentText text;
+ ECalComponentDateTime d;
+ ECalComponentClassification cl;
GSList *l;
const char *categories;
icaltimezone *zone, *default_zone;
@@ -267,25 +267,25 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
clear_widgets (tpage);
/* Summary, description(s) */
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
e_dialog_editable_set (priv->summary, text.value);
- cal_component_get_description_list (comp, &l);
+ e_cal_component_get_description_list (comp, &l);
if (l) {
- text = *(CalComponentText *)l->data;
+ text = *(ECalComponentText *)l->data;
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)),
text.value, -1);
} else {
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)),
"", 0);
}
- cal_component_free_text_list (l);
+ e_cal_component_free_text_list (l);
location = calendar_config_get_timezone ();
default_zone = icaltimezone_get_builtin_timezone (location);
/* Due Date. */
- cal_component_get_due (comp, &d);
+ e_cal_component_get_due (comp, &d);
zone = NULL;
if (d.value) {
struct icaltimetype *due_tt = d.value;
@@ -316,7 +316,7 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ if (!e_cal_get_timezone (page->client, d.tzid, &zone, NULL))
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
d.tzid ? d.tzid : "");
@@ -324,11 +324,11 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone),
zone);
- cal_component_free_datetime (&d);
+ e_cal_component_free_datetime (&d);
/* Start Date. */
- cal_component_get_dtstart (comp, &d);
+ e_cal_component_get_dtstart (comp, &d);
zone = NULL;
if (d.value) {
struct icaltimetype *start_tt = d.value;
@@ -356,7 +356,7 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ if (!e_cal_get_timezone (page->client, d.tzid, &zone, NULL))
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
d.tzid ? d.tzid : "");
@@ -364,40 +364,40 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone),
zone);
- cal_component_free_datetime (&d);
+ e_cal_component_free_datetime (&d);
/* Classification. */
- cal_component_get_classification (comp, &cl);
+ e_cal_component_get_classification (comp, &cl);
switch (cl) {
- case CAL_COMPONENT_CLASS_PUBLIC:
+ case E_CAL_COMPONENT_CLASS_PUBLIC:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
classification_map);
break;
- case CAL_COMPONENT_CLASS_PRIVATE:
+ case E_CAL_COMPONENT_CLASS_PRIVATE:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PRIVATE,
+ E_CAL_COMPONENT_CLASS_PRIVATE,
classification_map);
break;
- case CAL_COMPONENT_CLASS_CONFIDENTIAL:
+ case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_CONFIDENTIAL,
+ E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
classification_map);
break;
default:
/* default to PUBLIC */
e_dialog_radio_set (priv->classification_public,
- CAL_COMPONENT_CLASS_PUBLIC,
+ E_CAL_COMPONENT_CLASS_PUBLIC,
classification_map);
break;
}
/* Categories */
- cal_component_get_categories (comp, &categories);
+ e_cal_component_get_categories (comp, &categories);
e_dialog_editable_set (priv->categories, categories);
@@ -406,11 +406,11 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* fill_component handler for the task page */
static gboolean
-task_page_fill_component (CompEditorPage *page, CalComponent *comp)
+task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
TaskPage *tpage;
TaskPagePrivate *priv;
- CalComponentDateTime date;
+ ECalComponentDateTime date;
struct icaltimetype start_tt, due_tt;
char *cat, *str;
gboolean start_date_set, due_date_set, time_set;
@@ -428,14 +428,14 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
str = e_dialog_editable_get (priv->summary);
if (!str || strlen (str) == 0)
- cal_component_set_summary (comp, NULL);
+ e_cal_component_set_summary (comp, NULL);
else {
- CalComponentText text;
+ ECalComponentText text;
text.value = str;
text.altrep = NULL;
- cal_component_set_summary (comp, &text);
+ e_cal_component_set_summary (comp, &text);
}
if (str)
@@ -448,17 +448,17 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);
if (!str || strlen (str) == 0)
- cal_component_set_description_list (comp, NULL);
+ e_cal_component_set_description_list (comp, NULL);
else {
GSList l;
- CalComponentText text;
+ ECalComponentText text;
text.value = str;
text.altrep = NULL;
l.data = &text;
l.next = NULL;
- cal_component_set_description_list (comp, &l);
+ e_cal_component_set_description_list (comp, &l);
}
if (str)
@@ -493,9 +493,9 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
due_tt.is_date = TRUE;
date.tzid = NULL;
}
- cal_component_set_due (comp, &date);
+ e_cal_component_set_due (comp, &date);
} else {
- cal_component_set_due (comp, NULL);
+ e_cal_component_set_due (comp, NULL);
}
/* Start Date. */
@@ -522,9 +522,9 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
start_tt.is_date = TRUE;
date.tzid = NULL;
}
- cal_component_set_dtstart (comp, &date);
+ e_cal_component_set_dtstart (comp, &date);
} else {
- cal_component_set_dtstart (comp, NULL);
+ e_cal_component_set_dtstart (comp, NULL);
}
/* Check whether due datetime is before start datetime */
@@ -544,7 +544,7 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
/* Classification. */
- cal_component_set_classification (comp, classification_get (priv->classification_public));
+ e_cal_component_set_classification (comp, classification_get (priv->classification_public));
/* Categories */
cat = e_dialog_editable_get (priv->categories);
@@ -552,7 +552,7 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
if (cat)
g_free (cat);
- cal_component_set_categories (comp, str);
+ e_cal_component_set_categories (comp, str);
if (str)
g_free (str);
@@ -680,7 +680,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
TaskPagePrivate *priv;
CompEditorPageDates dates;
gboolean date_set, time_set;
- CalComponentDateTime start_dt, due_dt;
+ ECalComponentDateTime start_dt, due_dt;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype due_tt = icaltime_null_time();
diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c
index 534a8c9449..c1429f8705 100644
--- a/calendar/gui/e-alarm-list.c
+++ b/calendar/gui/e-alarm-list.c
@@ -27,7 +27,7 @@
#include <gtk/gtktreednd.h>
#include <libgnome/gnome-i18n.h>
#include <glib.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include <e-util/e-time-utils.h>
#include "calendar-config.h"
#include "e-alarm-list.h"
@@ -264,7 +264,7 @@ e_alarm_list_get_column_type (GtkTreeModel *tree_model,
return column_types [index];
}
-const CalComponentAlarm *
+const ECalComponentAlarm *
e_alarm_list_get_alarm (EAlarmList *alarm_list, GtkTreeIter *iter)
{
g_return_val_if_fail (IS_VALID_ITER (alarm_list, iter), NULL);
@@ -273,22 +273,22 @@ e_alarm_list_get_alarm (EAlarmList *alarm_list, GtkTreeIter *iter)
}
static void
-free_alarm (CalComponentAlarm *alarm)
+free_alarm (ECalComponentAlarm *alarm)
{
- cal_component_alarm_free (alarm);
+ e_cal_component_alarm_free (alarm);
}
-static CalComponentAlarm *
-copy_alarm (const CalComponentAlarm *alarm)
+static ECalComponentAlarm *
+copy_alarm (const ECalComponentAlarm *alarm)
{
- return cal_component_alarm_clone ((CalComponentAlarm *) alarm);
+ return e_cal_component_alarm_clone ((ECalComponentAlarm *) alarm);
}
void
e_alarm_list_set_alarm (EAlarmList *alarm_list, GtkTreeIter *iter,
- const CalComponentAlarm *alarm)
+ const ECalComponentAlarm *alarm)
{
- CalComponentAlarm *alarm_old;
+ ECalComponentAlarm *alarm_old;
g_return_if_fail (IS_VALID_ITER (alarm_list, iter));
@@ -300,7 +300,7 @@ e_alarm_list_set_alarm (EAlarmList *alarm_list, GtkTreeIter *iter,
void
e_alarm_list_append (EAlarmList *alarm_list, GtkTreeIter *iter,
- const CalComponentAlarm *alarm)
+ const ECalComponentAlarm *alarm)
{
g_return_if_fail (alarm != NULL);
@@ -321,7 +321,7 @@ e_alarm_list_remove (EAlarmList *alarm_list, GtkTreeIter *iter)
g_return_if_fail (IS_VALID_ITER (alarm_list, iter));
n = g_list_position (alarm_list->list, G_LIST (iter->user_data));
- free_alarm ((CalComponentAlarm *) G_LIST (iter->user_data)->data);
+ free_alarm ((ECalComponentAlarm *) G_LIST (iter->user_data)->data);
alarm_list->list = g_list_delete_link (alarm_list->list, G_LIST (iter->user_data));
row_deleted (alarm_list, n);
}
@@ -334,7 +334,7 @@ e_alarm_list_clear (EAlarmList *alarm_list)
all_rows_deleted (alarm_list);
for (l = alarm_list->list; l; l = g_list_next (l)) {
- free_alarm ((CalComponentAlarm *) l->data);
+ free_alarm ((ECalComponentAlarm *) l->data);
}
g_list_free (alarm_list->list);
@@ -444,37 +444,37 @@ get_alarm_duration_string (struct icaldurationtype *duration)
}
static char *
-get_alarm_string (CalComponentAlarm *alarm)
+get_alarm_string (ECalComponentAlarm *alarm)
{
- CalAlarmAction action;
- CalAlarmTrigger trigger;
+ ECalComponentAlarmAction action;
+ ECalComponentAlarmTrigger trigger;
char string[256];
char *base, *str = NULL, *dur;
string [0] = '\0';
- cal_component_alarm_get_action (alarm, &action);
- cal_component_alarm_get_trigger (alarm, &trigger);
+ e_cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_get_trigger (alarm, &trigger);
switch (action) {
- case CAL_ALARM_AUDIO:
+ case E_CAL_COMPONENT_ALARM_AUDIO:
base = _("Play a sound");
break;
- case CAL_ALARM_DISPLAY:
+ case E_CAL_COMPONENT_ALARM_DISPLAY:
base = _("Display a message");
break;
- case CAL_ALARM_EMAIL:
+ case E_CAL_COMPONENT_ALARM_EMAIL:
base = _("Send an email");
break;
- case CAL_ALARM_PROCEDURE:
+ case E_CAL_COMPONENT_ALARM_PROCEDURE:
base = _("Run a program");
break;
- case CAL_ALARM_NONE:
- case CAL_ALARM_UNKNOWN:
+ case E_CAL_COMPONENT_ALARM_NONE:
+ case E_CAL_COMPONENT_ALARM_UNKNOWN:
default:
base = _("Unknown action to be performed");
break;
@@ -483,7 +483,7 @@ get_alarm_string (CalComponentAlarm *alarm)
/* FIXME: This does not look like it will localize correctly. */
switch (trigger.type) {
- case CAL_ALARM_TRIGGER_RELATIVE_START:
+ case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START:
dur = get_alarm_duration_string (&trigger.u.rel_duration);
if (dur) {
@@ -500,7 +500,7 @@ get_alarm_string (CalComponentAlarm *alarm)
break;
- case CAL_ALARM_TRIGGER_RELATIVE_END:
+ case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END:
dur = get_alarm_duration_string (&trigger.u.rel_duration);
if (dur) {
@@ -517,7 +517,7 @@ get_alarm_string (CalComponentAlarm *alarm)
break;
- case CAL_ALARM_TRIGGER_ABSOLUTE: {
+ case E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE: {
struct icaltimetype itt;
icaltimezone *utc_zone, *current_zone;
char *location;
@@ -541,7 +541,7 @@ get_alarm_string (CalComponentAlarm *alarm)
break; }
- case CAL_ALARM_TRIGGER_NONE:
+ case E_CAL_COMPONENT_ALARM_TRIGGER_NONE:
default:
str = g_strdup_printf (_("%s for an unknown trigger type"), base);
break;
@@ -557,7 +557,7 @@ e_alarm_list_get_value (GtkTreeModel *tree_model,
GValue *value)
{
EAlarmList *alarm_list = E_ALARM_LIST (tree_model);
- CalComponentAlarm *alarm;
+ ECalComponentAlarm *alarm;
GList *l;
const gchar *str;
diff --git a/calendar/gui/e-alarm-list.h b/calendar/gui/e-alarm-list.h
index 2a03f9099b..93cc8ac58a 100644
--- a/calendar/gui/e-alarm-list.h
+++ b/calendar/gui/e-alarm-list.h
@@ -24,7 +24,7 @@
#define E_ALARM_LIST_H
#include <gtk/gtktreemodel.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
G_BEGIN_DECLS
@@ -66,11 +66,11 @@ struct _EAlarmListClass
GtkType e_alarm_list_get_type (void);
EAlarmList *e_alarm_list_new (void);
-const CalComponentAlarm *e_alarm_list_get_alarm (EAlarmList *alarm_list, GtkTreeIter *iter);
+const ECalComponentAlarm *e_alarm_list_get_alarm (EAlarmList *alarm_list, GtkTreeIter *iter);
void e_alarm_list_set_alarm (EAlarmList *alarm_list, GtkTreeIter *iter,
- const CalComponentAlarm *datetime);
+ const ECalComponentAlarm *datetime);
void e_alarm_list_append (EAlarmList *alarm_list, GtkTreeIter *iter,
- const CalComponentAlarm *datetime);
+ const ECalComponentAlarm *datetime);
void e_alarm_list_remove (EAlarmList *alarm_list, GtkTreeIter *iter);
void e_alarm_list_clear (EAlarmList *alarm_list);
diff --git a/calendar/gui/e-cal-list-view-config.c b/calendar/gui/e-cal-list-view-config.c
index 5e4bbc31d2..e7d82230df 100644
--- a/calendar/gui/e-cal-list-view-config.c
+++ b/calendar/gui/e-cal-list-view-config.c
@@ -167,7 +167,7 @@ set_timezone (ECalListView *list_view)
if (!zone)
zone = icaltimezone_get_utc_timezone ();
- e_cal_view_set_timezone (E_CAL_VIEW (list_view), zone);
+ e_calendar_view_set_timezone (E_CALENDAR_VIEW (list_view), zone);
g_free (location);
}
@@ -190,7 +190,7 @@ set_twentyfour_hour (ECalListView *list_view)
use_24_hour = calendar_config_get_24_hour_format ();
- e_cal_view_set_use_24_hour_format (E_CAL_VIEW (list_view), use_24_hour);
+ e_calendar_view_set_use_24_hour_format (E_CALENDAR_VIEW (list_view), use_24_hour);
}
static void
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 359ac4d557..c504695ada 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -56,7 +56,7 @@
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "e-cal-model-calendar.h"
#include "e-cell-date-edit-text.h"
#include "dialogs/delete-comp.h"
@@ -74,10 +74,10 @@
static void e_cal_list_view_class_init (ECalListViewClass *class);
static void e_cal_list_view_init (ECalListView *cal_list_view);
static void e_cal_list_view_destroy (GtkObject *object);
-static void e_cal_list_view_update_query (ECalView *cal_view);
+static void e_cal_list_view_update_query (ECalendarView *cal_view);
-static GList *e_cal_list_view_get_selected_events (ECalView *cal_view);
-static gboolean e_cal_list_view_get_visible_time_range (ECalView *cal_view, time_t *start_time,
+static GList *e_cal_list_view_get_selected_events (ECalendarView *cal_view);
+static gboolean e_cal_list_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time,
time_t *end_time);
static gboolean e_cal_list_view_popup_menu (GtkWidget *widget);
@@ -87,22 +87,22 @@ static void e_cal_list_view_show_popup_menu (ECalListView *cal_list_
static gboolean e_cal_list_view_on_table_right_click (GtkWidget *table, gint row, gint col,
GdkEvent *event, gpointer data);
-static GtkTableClass *parent_class; /* Should be ECalViewClass? */
+static GtkTableClass *parent_class; /* Should be ECalendarViewClass? */
E_MAKE_TYPE (e_cal_list_view, "ECalListView", ECalListView, e_cal_list_view_class_init,
- e_cal_list_view_init, e_cal_view_get_type ());
+ e_cal_list_view_init, e_calendar_view_get_type ());
static void
e_cal_list_view_class_init (ECalListViewClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- ECalViewClass *view_class;
+ ECalendarViewClass *view_class;
parent_class = g_type_class_peek_parent (class);
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- view_class = (ECalViewClass *) class;
+ view_class = (ECalendarViewClass *) class;
/* Method override */
object_class->destroy = e_cal_list_view_destroy;
@@ -161,7 +161,7 @@ get_current_time_cb (ECellDateEdit *ecde, gpointer data)
struct tm tmp_tm = { 0 };
struct icaltimetype tt;
- zone = e_cal_view_get_timezone (E_CAL_VIEW (cal_list_view));
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (cal_list_view));
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
/* Now copy it to the struct tm and return it. */
@@ -210,7 +210,7 @@ setup_e_table (ECalListView *cal_list_view)
GnomeCanvas *canvas;
GtkStyle *style;
- model = E_CAL_MODEL_CALENDAR (e_cal_view_get_model (E_CAL_VIEW (cal_list_view)));
+ model = E_CAL_MODEL_CALENDAR (e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view)));
if (cal_list_view->table_scrolled) {
save_table_state (cal_list_view);
@@ -392,15 +392,15 @@ setup_e_table_cb (gpointer data)
}
static void
-e_cal_list_view_update_query (ECalView *cal_list_view)
+e_cal_list_view_update_query (ECalendarView *cal_list_view)
{
- e_cal_view_set_status_message (E_CAL_VIEW (cal_list_view), _("Searching"));
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (cal_list_view), _("Searching"));
if (!E_CAL_LIST_VIEW (cal_list_view)->set_table_id)
E_CAL_LIST_VIEW (cal_list_view)->set_table_id =
g_idle_add (setup_e_table_cb, cal_list_view);
- e_cal_view_set_status_message (E_CAL_VIEW (cal_list_view), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (cal_list_view), NULL);
}
static void
@@ -408,7 +408,7 @@ e_cal_list_view_show_popup_menu (ECalListView *cal_list_view, gint row, GdkEvent
{
GtkMenu *popup;
- popup = e_cal_view_create_popup_menu (E_CAL_VIEW (cal_list_view));
+ popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (cal_list_view));
e_popup_menu (popup, gdk_event);
}
@@ -432,7 +432,7 @@ e_cal_list_view_on_table_right_click (GtkWidget *table, gint row, gint col, GdkE
}
static GList *
-e_cal_list_view_get_selected_events (ECalView *cal_view)
+e_cal_list_view_get_selected_events (ECalendarView *cal_view)
{
GList *event_list = NULL;
gint cursor_row;
@@ -445,11 +445,11 @@ e_cal_list_view_get_selected_events (ECalView *cal_view)
cursor_row = e_table_get_cursor_row (e_table_scrolled_get_table (E_CAL_LIST_VIEW (cal_view)->table_scrolled));
if (cursor_row >= 0) {
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- event = E_CAL_LIST_VIEW (cal_view)->cursor_event = g_new0 (ECalViewEvent, 1);
+ event = E_CAL_LIST_VIEW (cal_view)->cursor_event = g_new0 (ECalendarViewEvent, 1);
event->comp_data =
- e_cal_model_get_component_at (e_cal_view_get_model (cal_view),
+ e_cal_model_get_component_at (e_calendar_view_get_model (cal_view),
cursor_row);
event_list = g_list_prepend (event_list, event);
}
@@ -476,19 +476,19 @@ adjust_range (icaltimetype icaltime, time_t *earliest, time_t *latest, gboolean
* ideal, since it's used in a couple of places. We could probably be smarter about it,
* and use do it less frequently... */
static gboolean
-e_cal_list_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_cal_list_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
time_t earliest = G_MAXINT, latest = 0;
gboolean set = FALSE;
gint n_rows, i;
- n_rows = e_table_model_row_count (E_TABLE_MODEL (e_cal_view_get_model (cal_view)));
+ n_rows = e_table_model_row_count (E_TABLE_MODEL (e_calendar_view_get_model (cal_view)));
for (i = 0; i < n_rows; i++) {
ECalModelComponent *comp;
icalcomponent *icalcomp;
- comp = e_cal_model_get_component_at (e_cal_view_get_model (cal_view), i);
+ comp = e_cal_model_get_component_at (e_calendar_view_get_model (cal_view), i);
if (!comp)
continue;
@@ -515,11 +515,11 @@ e_cal_list_view_get_range_shown (ECalListView *cal_list_view, GDate *start_date,
time_t first, last;
GDate end_date;
- if (!e_cal_list_view_get_visible_time_range (E_CAL_VIEW (cal_list_view), &first, &last))
+ if (!e_cal_list_view_get_visible_time_range (E_CALENDAR_VIEW (cal_list_view), &first, &last))
return FALSE;
- time_to_gdate_with_zone (start_date, first, e_cal_view_get_timezone (E_CAL_VIEW (cal_list_view)));
- time_to_gdate_with_zone (&end_date, last, e_cal_view_get_timezone (E_CAL_VIEW (cal_list_view)));
+ time_to_gdate_with_zone (start_date, first, e_calendar_view_get_timezone (E_CALENDAR_VIEW (cal_list_view)));
+ time_to_gdate_with_zone (&end_date, last, e_calendar_view_get_timezone (E_CALENDAR_VIEW (cal_list_view)));
*days_shown = g_date_days_between (start_date, &end_date);
return TRUE;
diff --git a/calendar/gui/e-cal-list-view.h b/calendar/gui/e-cal-list-view.h
index edf2e843e2..37c0e9675b 100644
--- a/calendar/gui/e-cal-list-view.h
+++ b/calendar/gui/e-cal-list-view.h
@@ -50,7 +50,7 @@ typedef struct _ECalListViewClass ECalListViewClass;
struct _ECalListView
{
- ECalView cal_view;
+ ECalendarView cal_view;
/* The main display table */
ETableScrolled *table_scrolled;
@@ -59,7 +59,7 @@ struct _ECalListView
gchar *table_state_path;
/* S-expression for query and the query object */
- CalQuery *query;
+ ECalView *query;
/* The default category for new events */
gchar *default_category;
@@ -67,8 +67,8 @@ struct _ECalListView
/* Date editing cell */
ECellDateEdit *dates_cell;
- /* The last ECalViewEvent we returned from e_cal_list_view_get_selected_events(), to be freed */
- ECalViewEvent *cursor_event;
+ /* The last ECalendarViewEvent we returned from e_cal_list_view_get_selected_events(), to be freed */
+ ECalendarViewEvent *cursor_event;
/* Idle handler ID for setting a new ETableModel */
gint set_table_id;
@@ -76,7 +76,7 @@ struct _ECalListView
struct _ECalListViewClass
{
- ECalViewClass parent_class;
+ ECalendarViewClass parent_class;
};
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index fc44d29862..76462064a2 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -127,7 +127,7 @@ get_dtend (ECalModelComponent *comp_data)
comp_data->dtend->tt = tt_end;
/* FIXME: handle errors */
- cal_client_get_timezone (comp_data->client,
+ e_cal_get_timezone (comp_data->client,
icaltime_get_tzid (tt_end),
&zone, NULL);
comp_data->dtend->zone = zone;
@@ -309,7 +309,7 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value)
}
/* FIXME ask about mod type */
- if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ if (!e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
g_warning (G_STRLOC ": Could not modify the object!");
/* FIXME Show error dialog */
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 5442c92485..c6da14c7d1 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -221,7 +221,7 @@ get_completed (ECalModelComponent *comp_data)
comp_data->completed->tt = tt_completed;
/* FIXME: handle errors */
- cal_client_get_timezone (comp_data->client,
+ e_cal_get_timezone (comp_data->client,
icaltime_get_tzid (tt_completed),
&zone, NULL);
comp_data->completed->zone = zone;
@@ -251,7 +251,7 @@ get_due (ECalModelComponent *comp_data)
comp_data->due->tt = tt_due;
/* FIXME: handle errors */
- cal_client_get_timezone (comp_data->client,
+ e_cal_get_timezone (comp_data->client,
icaltime_get_tzid (tt_due),
&zone, NULL);
comp_data->due->zone = zone;
@@ -300,7 +300,7 @@ get_priority (ECalModelComponent *comp_data)
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PRIORITY_PROPERTY);
if (prop)
- return cal_util_priority_to_string (icalproperty_get_priority (prop));
+ return e_cal_util_priority_to_string (icalproperty_get_priority (prop));
return "";
}
@@ -374,7 +374,7 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data)
return E_CAL_MODEL_TASKS_DUE_NEVER;
else {
struct icaltimetype now_tt, due_tt;
- CalClientGetStatus status;
+ ECalGetStatus status;
icaltimezone *zone;
/* Second, is it already completed? */
@@ -397,10 +397,10 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data)
return E_CAL_MODEL_TASKS_DUE_FUTURE;
} else {
/* Get the current time in the same timezone as the DUE date.*/
- status = cal_client_get_timezone (comp_data->client,
+ status = e_cal_get_timezone (comp_data->client,
icaltime_get_tzid (due_tt),
&zone, NULL);
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (status != E_CAL_GET_SUCCESS)
return E_CAL_MODEL_TASKS_DUE_FUTURE;
now_tt = icaltime_current_time_with_zone (zone);
@@ -617,12 +617,12 @@ set_status (ECalModelComponent *comp_data, const char *value)
/* if (status == ICAL_STATUS_NEEDSACTION) { */
/* percent = 0; */
-/* cal_component_set_percent (comp, &percent); */
-/* cal_component_set_completed (comp, NULL); */
+/* e_cal_component_set_percent (comp, &percent); */
+/* e_cal_component_set_completed (comp, NULL); */
/* } else if (status == ICAL_STATUS_INPROCESS) { */
/* ensure_task_not_complete (comp); */
/* percent = 50; */
-/* cal_component_set_percent (comp, &percent); */
+/* e_cal_component_set_percent (comp, &percent); */
/* } else if (status == ICAL_STATUS_COMPLETED) { */
/* ensure_task_complete (comp, -1); */
/* } */
@@ -673,7 +673,7 @@ set_priority (ECalModelComponent *comp_data, const char *value)
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PRIORITY_PROPERTY);
- priority = cal_util_priority_from_string (value);
+ priority = e_cal_util_priority_from_string (value);
if (priority == -1) {
g_warning ("Invalid priority");
priority = 0;
@@ -757,7 +757,7 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value)
}
/* FIXME ask about mod type */
- if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ if (!e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
g_warning (G_STRLOC ": Could not modify the object!");
/* FIXME Show error dialog */
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index f23b272bdd..9e5dc34b2c 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -25,7 +25,7 @@
#include <gal/util/e-util.h>
#include <e-util/e-config-listener.h>
#include <e-util/e-time-utils.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "calendar-config.h"
#include "comp-util.h"
#include "e-cal-model.h"
@@ -33,8 +33,8 @@
#include "misc.h"
typedef struct {
- CalClient *client;
- CalQuery *query;
+ ECal *client;
+ ECalView *query;
} ECalModelClient;
struct _ECalModelPrivate {
@@ -42,7 +42,7 @@ struct _ECalModelPrivate {
GList *clients;
/* The default client in the list */
- CalClient *default_client;
+ ECal *default_client;
/* Array for storing the objects. Each element is of type ECalModelComponent */
GPtrArray *objects;
@@ -353,7 +353,7 @@ get_dtstart (ECalModel *model, ECalModelComponent *comp_data)
comp_data->dtstart->tt = tt_start;
/* FIXME: handle errors */
- cal_client_get_timezone (comp_data->client,
+ e_cal_get_timezone (comp_data->client,
icaltime_get_tzid (tt_start),
&zone, NULL);
comp_data->dtstart->zone = zone;
@@ -415,23 +415,23 @@ ecm_value_at (ETableModel *etm, int col, int row)
ICAL_VALARM_COMPONENT) != NULL));
case E_CAL_MODEL_FIELD_ICON :
{
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
gint retval = 0;
- comp = cal_component_new ();
+ comp = e_cal_component_new ();
icalcomp = icalcomponent_new_clone (comp_data->icalcomp);
- if (cal_component_set_icalcomponent (comp, icalcomp)) {
- if (cal_component_has_recurrences (comp))
+ if (e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ if (e_cal_component_has_recurrences (comp))
retval = 1;
else if (itip_organizer_is_user (comp, comp_data->client))
retval = 3;
else {
GSList *attendees = NULL, *sl;
- cal_component_get_attendee_list (comp, &attendees);
+ e_cal_component_get_attendee_list (comp, &attendees);
for (sl = attendees; sl != NULL; sl = sl->next) {
- CalComponentAttendee *ca = sl->data;
+ ECalComponentAttendee *ca = sl->data;
const char *text;
text = itip_strip_mailto (ca->value);
@@ -444,7 +444,7 @@ ecm_value_at (ETableModel *etm, int col, int row)
}
}
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
}
} else
icalcomponent_free (icalcomp);
@@ -613,7 +613,7 @@ ecm_set_value_at (ETableModel *etm, int col, int row, const void *value)
}
/* FIXME ask about mod type */
- if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ if (!e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
g_warning (G_STRLOC ": Could not modify the object!");
/* FIXME Show error dialog */
@@ -661,7 +661,7 @@ ecm_append_row (ETableModel *etm, ETableModel *source, int row)
comp_data.client = e_cal_model_get_default_client (model);
/* guard against saving before the calendar is open */
- if (!(comp_data.client && cal_client_get_load_state (comp_data.client) == CAL_CLIENT_LOAD_LOADED))
+ if (!(comp_data.client && e_cal_get_load_state (comp_data.client) == E_CAL_LOAD_LOADED))
return;
comp_data.icalcomp = e_cal_model_create_component_with_defaults (model);
@@ -680,7 +680,7 @@ ecm_append_row (ETableModel *etm, ETableModel *source, int row)
}
- if (!cal_client_create_object (comp_data.client, comp_data.icalcomp, NULL, NULL)) {
+ if (!e_cal_create_object (comp_data.client, comp_data.icalcomp, NULL, NULL)) {
g_warning (G_STRLOC ": Could not create the object!");
/* FIXME: show error dialog */
@@ -886,7 +886,7 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
for (l = assigned_colors[i].uris; l != NULL; l = l->next) {
if (!strcmp ((const char *) l->data,
- cal_client_get_uri (comp_data->client)))
+ e_cal_get_uri (comp_data->client)))
{
return assigned_colors[i].color;
}
@@ -895,7 +895,7 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
/* return the first unused color */
assigned_colors[first_empty].uris = g_list_append (assigned_colors[first_empty].uris,
- g_strdup (cal_client_get_uri (comp_data->client)));
+ g_strdup (e_cal_get_uri (comp_data->client)));
return assigned_colors[first_empty].color;
}
@@ -1003,7 +1003,7 @@ e_cal_model_set_use_24_hour_format (ECalModel *model, gboolean use24)
/**
* e_cal_model_get_default_client
*/
-CalClient *
+ECal *
e_cal_model_get_default_client (ECalModel *model)
{
ECalModelPrivate *priv;
@@ -1014,7 +1014,7 @@ e_cal_model_get_default_client (ECalModel *model)
priv = model->priv;
- /* we always return a valid CalClient, since we rely on it in many places */
+ /* we always return a valid ECal, since we rely on it in many places */
if (priv->default_client)
return priv->default_client;
@@ -1027,7 +1027,7 @@ e_cal_model_get_default_client (ECalModel *model)
}
void
-e_cal_model_set_default_client (ECalModel *model, CalClient *client)
+e_cal_model_set_default_client (ECalModel *model, ECal *client)
{
ECalModelPrivate *priv;
GList *l;
@@ -1036,7 +1036,7 @@ e_cal_model_set_default_client (ECalModel *model, CalClient *client)
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
priv = model->priv;
@@ -1080,7 +1080,7 @@ e_cal_model_get_client_list (ECalModel *model)
* @model: A calendar model.
* @uri: Uri for the client to get.
*/
-CalClient *
+ECal *
e_cal_model_get_client_for_uri (ECalModel *model, const char *uri)
{
GList *l;
@@ -1091,7 +1091,7 @@ e_cal_model_get_client_for_uri (ECalModel *model, const char *uri)
for (l = model->priv->clients; l != NULL; l = l->next) {
ECalModelClient *client_data = (ECalModelClient *) l->data;
- if (!strcmp (uri, cal_client_get_uri (client_data->client)))
+ if (!strcmp (uri, e_cal_get_uri (client_data->client)))
return client_data->client;
}
@@ -1099,7 +1099,7 @@ e_cal_model_get_client_for_uri (ECalModel *model, const char *uri)
}
static ECalModelComponent *
-search_by_uid_and_client (ECalModelPrivate *priv, CalClient *client, const char *uid)
+search_by_uid_and_client (ECalModelPrivate *priv, ECal *client, const char *uid)
{
gint i;
@@ -1134,7 +1134,7 @@ get_position_in_array (GPtrArray *objects, gpointer item)
}
static void
-query_objects_added_cb (CalQuery *query, GList *objects, gpointer user_data)
+e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data)
{
ECalModel *model = (ECalModel *) user_data;
ECalModelPrivate *priv;
@@ -1151,7 +1151,7 @@ query_objects_added_cb (CalQuery *query, GList *objects, gpointer user_data)
ECalModelComponent *comp_data;
comp_data = g_new0 (ECalModelComponent, 1);
- comp_data->client = cal_query_get_client (query);
+ comp_data->client = e_cal_view_get_client (query);
comp_data->icalcomp = icalcomponent_new_clone (l->data);
g_ptr_array_add (priv->objects, comp_data);
@@ -1161,7 +1161,7 @@ query_objects_added_cb (CalQuery *query, GList *objects, gpointer user_data)
}
static void
-query_objects_modified_cb (CalQuery *query, GList *objects, gpointer user_data)
+e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_data)
{
ECalModelPrivate *priv;
ECalModel *model = (ECalModel *) user_data;
@@ -1174,7 +1174,7 @@ query_objects_modified_cb (CalQuery *query, GList *objects, gpointer user_data)
e_table_model_pre_change (E_TABLE_MODEL (model));
- comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), icalcomponent_get_uid (l->data));
+ comp_data = search_by_uid_and_client (priv, e_cal_view_get_client (query), icalcomponent_get_uid (l->data));
g_assert (comp_data);
if (comp_data->icalcomp)
@@ -1203,7 +1203,7 @@ query_objects_modified_cb (CalQuery *query, GList *objects, gpointer user_data)
}
static void
-query_objects_removed_cb (CalQuery *query, GList *uids, gpointer user_data)
+e_cal_view_objects_removed_cb (ECalView *query, GList *uids, gpointer user_data)
{
ECalModelPrivate *priv;
ECalModel *model = (ECalModel *) user_data;
@@ -1217,7 +1217,7 @@ query_objects_removed_cb (CalQuery *query, GList *uids, gpointer user_data)
e_table_model_pre_change (E_TABLE_MODEL (model));
- comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), l->data);
+ comp_data = search_by_uid_and_client (priv, e_cal_view_get_client (query), l->data);
g_assert (comp_data);
pos = get_position_in_array (priv->objects, comp_data);
@@ -1230,7 +1230,7 @@ query_objects_removed_cb (CalQuery *query, GList *uids, gpointer user_data)
}
static void
-query_progress_cb (CalQuery *query, const char *message, int percent, gpointer user_data)
+e_cal_view_progress_cb (ECalView *query, const char *message, int percent, gpointer user_data)
{
ECalModel *model = (ECalModel *) user_data;
@@ -1240,7 +1240,7 @@ query_progress_cb (CalQuery *query, const char *message, int percent, gpointer u
}
static void
-query_done_cb (CalQuery *query, ECalendarStatus status, gpointer user_data)
+e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer user_data)
{
ECalModel *model = (ECalModel *) user_data;
@@ -1254,7 +1254,7 @@ query_done_cb (CalQuery *query, ECalendarStatus status, gpointer user_data)
* whether we want completed tasks.
*/
static char *
-adjust_query_sexp (ECalModel *model, const char *sexp)
+adjust_e_cal_view_sexp (ECalModel *model, const char *sexp)
{
ECalModelPrivate *priv;
char *type_sexp, *new_sexp;
@@ -1281,7 +1281,7 @@ adjust_query_sexp (ECalModel *model, const char *sexp)
}
static void
-update_query_for_client (ECalModel *model, ECalModelClient *client_data)
+update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data)
{
ECalModelPrivate *priv;
gchar *real_sexp;
@@ -1298,9 +1298,9 @@ update_query_for_client (ECalModel *model, ECalModelClient *client_data)
/* prepare the query */
g_assert (priv->sexp != NULL);
- real_sexp = adjust_query_sexp (model, priv->sexp);
+ real_sexp = adjust_e_cal_view_sexp (model, priv->sexp);
- if (!cal_client_get_query (client_data->client, real_sexp, &client_data->query, NULL)) {
+ if (!e_cal_get_query (client_data->client, real_sexp, &client_data->query, NULL)) {
g_warning (G_STRLOC ": Unable to get query");
g_free (real_sexp);
@@ -1308,17 +1308,17 @@ update_query_for_client (ECalModel *model, ECalModelClient *client_data)
}
g_free (real_sexp);
- g_signal_connect (client_data->query, "objects_added", G_CALLBACK (query_objects_added_cb), model);
- g_signal_connect (client_data->query, "objects_modified", G_CALLBACK (query_objects_modified_cb), model);
- g_signal_connect (client_data->query, "objects_removed", G_CALLBACK (query_objects_removed_cb), model);
- g_signal_connect (client_data->query, "query_progress", G_CALLBACK (query_progress_cb), model);
- g_signal_connect (client_data->query, "query_done", G_CALLBACK (query_done_cb), model);
+ g_signal_connect (client_data->query, "objects_added", G_CALLBACK (e_cal_view_objects_added_cb), model);
+ g_signal_connect (client_data->query, "objects_modified", G_CALLBACK (e_cal_view_objects_modified_cb), model);
+ g_signal_connect (client_data->query, "objects_removed", G_CALLBACK (e_cal_view_objects_removed_cb), model);
+ g_signal_connect (client_data->query, "view_progress", G_CALLBACK (e_cal_view_progress_cb), model);
+ g_signal_connect (client_data->query, "view_done", G_CALLBACK (e_cal_view_done_cb), model);
- cal_query_start (client_data->query);
+ e_cal_view_start (client_data->query);
}
static void
-backend_died_cb (CalClient *client, gpointer user_data)
+backend_died_cb (ECal *client, gpointer user_data)
{
ECalModel *model;
@@ -1328,7 +1328,7 @@ backend_died_cb (CalClient *client, gpointer user_data)
}
static void
-add_new_client (ECalModel *model, CalClient *client)
+add_new_client (ECalModel *model, ECal *client)
{
ECalModelPrivate *priv;
ECalModelClient *client_data;
@@ -1345,15 +1345,15 @@ add_new_client (ECalModel *model, CalClient *client)
g_signal_connect (G_OBJECT (client_data->client), "backend_died",
G_CALLBACK (backend_died_cb), model);
- update_query_for_client (model, client_data);
+ update_e_cal_view_for_client (model, client_data);
}
static void
-cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer user_data)
+cal_opened_cb (ECal *client, ECalOpenStatus status, gpointer user_data)
{
ECalModel *model = (ECalModel *) user_data;
- if (status != CAL_CLIENT_OPEN_SUCCESS)
+ if (status != E_CAL_OPEN_SUCCESS)
return;
add_new_client (model, client);
@@ -1363,16 +1363,16 @@ cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer user_data
* e_cal_model_add_client
*/
void
-e_cal_model_add_client (ECalModel *model, CalClient *client)
+e_cal_model_add_client (ECalModel *model, ECal *client)
{
ECalModelPrivate *priv;
g_return_if_fail (E_IS_CAL_MODEL (model));
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
priv = model->priv;
- if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED)
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
add_new_client (model, client);
else
g_signal_connect (client, "cal_opened", G_CALLBACK (cal_opened_cb), model);
@@ -1413,13 +1413,13 @@ remove_client (ECalModel *model, ECalModelClient *client_data)
* e_cal_model_remove_client
*/
void
-e_cal_model_remove_client (ECalModel *model, CalClient *client)
+e_cal_model_remove_client (ECalModel *model, ECal *client)
{
GList *l;
ECalModelPrivate *priv;
g_return_if_fail (E_IS_CAL_MODEL (model));
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
priv = model->priv;
for (l = priv->clients; l != NULL; l = l->next) {
@@ -1478,7 +1478,7 @@ e_cal_model_set_query (ECalModel *model, const char *sexp)
ECalModelClient *client_data;
client_data = (ECalModelClient *) l->data;
- update_query_for_client (model, client_data);
+ update_e_cal_view_for_client (model, client_data);
}
}
@@ -1489,9 +1489,9 @@ icalcomponent *
e_cal_model_create_component_with_defaults (ECalModel *model)
{
ECalModelPrivate *priv;
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
- CalClient *client;
+ ECal *client;
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
@@ -1517,14 +1517,14 @@ e_cal_model_create_component_with_defaults (ECalModel *model)
if (!comp)
return icalcomponent_new (priv->kind);
- icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (comp));
+ icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
g_object_unref (comp);
/* make sure the component has an UID */
if (!icalcomponent_get_uid (icalcomp)) {
char *uid;
- uid = cal_component_gen_uid ();
+ uid = e_cal_component_gen_uid ();
icalcomponent_set_uid (icalcomp, uid);
g_free (uid);
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index 6adbe0473f..9f193b4f07 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -23,7 +23,7 @@
#define E_CAL_MODEL_H
#include <gal/e-table/e-table-model.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "e-cell-date-edit-text.h"
G_BEGIN_DECLS
@@ -53,7 +53,7 @@ typedef enum {
} ECalModelField;
typedef struct {
- CalClient *client;
+ ECal *client;
icalcomponent *icalcomp;
/* private data */
@@ -88,12 +88,12 @@ void e_cal_model_set_default_category (ECalModel *model, const gc
gboolean e_cal_model_get_use_24_hour_format (ECalModel *model);
void e_cal_model_set_use_24_hour_format (ECalModel *model, gboolean use24);
-CalClient *e_cal_model_get_default_client (ECalModel *model);
-void e_cal_model_set_default_client (ECalModel *model, CalClient *client);
+ECal *e_cal_model_get_default_client (ECalModel *model);
+void e_cal_model_set_default_client (ECalModel *model, ECal *client);
GList *e_cal_model_get_client_list (ECalModel *model);
-CalClient *e_cal_model_get_client_for_uri (ECalModel *model, const char *uri);
-void e_cal_model_add_client (ECalModel *model, CalClient *client);
-void e_cal_model_remove_client (ECalModel *model, CalClient *client);
+ECal *e_cal_model_get_client_for_uri (ECalModel *model, const char *uri);
+void e_cal_model_add_client (ECalModel *model, ECal *client);
+void e_cal_model_remove_client (ECalModel *model, ECal *client);
void e_cal_model_remove_all_clients (ECalModel *model);
void e_cal_model_set_query (ECalModel *model, const gchar *sexp);
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index 2e392560cd..332019cf2c 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -29,8 +29,8 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-dialog-utils.h"
-#include "cal-util/cal-util-marshal.h"
-#include "cal-util/timeutil.h"
+#include "e-calendar-marshal.h"
+#include <libecal/e-cal-time-util.h>
#include "evolution-activity-client.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -53,7 +53,7 @@
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
-struct _ECalViewPrivate {
+struct _ECalendarViewPrivate {
/* The GnomeCalendar we are associated to */
GnomeCalendar *calendar;
@@ -74,11 +74,11 @@ struct _ECalViewPrivate {
char *default_category;
};
-static void e_cal_view_class_init (ECalViewClass *klass);
-static void e_cal_view_init (ECalView *cal_view, ECalViewClass *klass);
-static void e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static void e_cal_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static void e_cal_view_destroy (GtkObject *object);
+static void e_calendar_view_class_init (ECalendarViewClass *klass);
+static void e_calendar_view_init (ECalendarView *cal_view, ECalendarViewClass *klass);
+static void e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
+static void e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
+static void e_calendar_view_destroy (GtkObject *object);
static GObjectClass *parent_class = NULL;
static GdkAtom clipboard_atom = GDK_NONE;
@@ -101,20 +101,20 @@ enum {
LAST_SIGNAL
};
-static guint e_cal_view_signals[LAST_SIGNAL] = { 0 };
+static guint e_calendar_view_signals[LAST_SIGNAL] = { 0 };
static void
-e_cal_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
- ECalView *cal_view;
- ECalViewPrivate *priv;
+ ECalendarView *cal_view;
+ ECalendarViewPrivate *priv;
- cal_view = E_CAL_VIEW (object);
+ cal_view = E_CALENDAR_VIEW (object);
priv = cal_view->priv;
switch (property_id) {
case PROP_MODEL:
- e_cal_view_set_model (cal_view, E_CAL_MODEL (g_value_get_object (value)));
+ e_calendar_view_set_model (cal_view, E_CAL_MODEL (g_value_get_object (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -123,17 +123,17 @@ e_cal_view_set_property (GObject *object, guint property_id, const GValue *value
}
static void
-e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
- ECalView *cal_view;
- ECalViewPrivate *priv;
+ ECalendarView *cal_view;
+ ECalendarViewPrivate *priv;
- cal_view = E_CAL_VIEW (object);
+ cal_view = E_CALENDAR_VIEW (object);
priv = cal_view->priv;
switch (property_id) {
case PROP_MODEL:
- g_value_set_object (value, e_cal_view_get_model (cal_view));
+ g_value_set_object (value, e_calendar_view_get_model (cal_view));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -142,7 +142,7 @@ e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GPar
}
static void
-e_cal_view_class_init (ECalViewClass *klass)
+e_calendar_view_class_init (ECalendarViewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
@@ -150,9 +150,9 @@ e_cal_view_class_init (ECalViewClass *klass)
parent_class = g_type_class_peek_parent (klass);
/* Method override */
- gobject_class->set_property = e_cal_view_set_property;
- gobject_class->get_property = e_cal_view_get_property;
- object_class->destroy = e_cal_view_destroy;
+ gobject_class->set_property = e_calendar_view_set_property;
+ gobject_class->get_property = e_calendar_view_get_property;
+ object_class->destroy = e_calendar_view_destroy;
klass->selection_changed = NULL;
klass->selected_time_changed = NULL;
@@ -171,46 +171,46 @@ e_cal_view_class_init (ECalViewClass *klass)
| G_PARAM_CONSTRUCT));
/* Create class' signals */
- e_cal_view_signals[SELECTION_CHANGED] =
+ e_calendar_view_signals[SELECTION_CHANGED] =
g_signal_new ("selection_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, selection_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, selection_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_cal_view_signals[SELECTED_TIME_CHANGED] =
+ e_calendar_view_signals[SELECTED_TIME_CHANGED] =
g_signal_new ("selected_time_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, selected_time_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, selected_time_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_cal_view_signals[TIMEZONE_CHANGED] =
+ e_calendar_view_signals[TIMEZONE_CHANGED] =
g_signal_new ("timezone_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, timezone_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, timezone_changed),
NULL, NULL,
- cal_util_marshal_VOID__POINTER_POINTER,
+ e_calendar_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_cal_view_signals[EVENT_CHANGED] =
+ e_calendar_view_signals[EVENT_CHANGED] =
g_signal_new ("event_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, event_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- e_cal_view_signals[EVENT_ADDED] =
+ e_calendar_view_signals[EVENT_ADDED] =
g_signal_new ("event_added",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_added),
+ G_STRUCT_OFFSET (ECalendarViewClass, event_added),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
@@ -227,33 +227,33 @@ e_cal_view_class_init (ECalViewClass *klass)
static void
model_changed_cb (ETableModel *etm, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_row_changed_cb (ETableModel *etm, int row, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_cell_changed_cb (ETableModel *etm, int col, int row, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_rows_changed_cb (ETableModel *etm, int row, int count, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
@@ -261,7 +261,7 @@ selection_get (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint info,
guint time_stamp,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
if (cal_view->priv->clipboard_selection != NULL) {
gtk_selection_data_set (selection_data,
@@ -275,7 +275,7 @@ selection_get (GtkWidget *invisible,
static void
selection_clear_event (GtkWidget *invisible,
GdkEventSelection *event,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
if (cal_view->priv->clipboard_selection != NULL) {
g_free (cal_view->priv->clipboard_selection);
@@ -284,10 +284,10 @@ selection_clear_event (GtkWidget *invisible,
}
void
-e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
+e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas)
{
- CalComponent *comp;
+ ECalComponent *comp;
struct icaltimetype itime, old_dtstart, old_dtend;
time_t tt_start, tt_end, new_dtstart;
struct icaldurationtype ic_dur;
@@ -331,18 +331,18 @@ e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
icalcomponent_set_dtend (icalcomp, itime);
/* FIXME The new uid stuff can go away once we actually set it in the backend */
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
+ uid = e_cal_component_gen_uid ();
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (icalcomp));
- cal_component_set_uid (comp, uid);
+ e_cal_component_set_uid (comp, uid);
/* FIXME Error handling */
- if (cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL)) {
+ if (e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), NULL, NULL)) {
if (itip_organizer_is_user (comp, client) &&
send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
} else {
@@ -357,16 +357,16 @@ static void
selection_received (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint time,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
char *comp_str, *default_tzid;
icalcomponent *icalcomp;
icalcomponent_kind kind;
time_t selected_time_start, selected_time_end;
icaltimezone *default_zone;
- CalClient *client;
+ ECal *client;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (selection_data->length < 0 ||
selection_data->type != GDK_SELECTION_TYPE_STRING) {
@@ -382,7 +382,7 @@ selection_received (GtkWidget *invisible,
client = e_cal_model_get_default_client (cal_view->priv->model);
/* FIXME Error checking */
- cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
+ e_cal_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
/* FIXME An error dialog if we return? */
@@ -390,8 +390,8 @@ selection_received (GtkWidget *invisible,
if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
return;
- e_cal_view_set_status_message (cal_view, _("Updating objects"));
- e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
+ e_calendar_view_set_status_message (cal_view, _("Updating objects"));
+ e_calendar_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
/* FIXME Timezone handling */
if (kind == ICAL_VCALENDAR_COMPONENT) {
@@ -402,14 +402,14 @@ selection_received (GtkWidget *invisible,
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
if (child_kind == ICAL_VEVENT_COMPONENT)
- e_cal_view_add_event (cal_view, client, selected_time_start,
+ e_calendar_view_add_event (cal_view, client, selected_time_start,
default_zone, subcomp, FALSE);
else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- cal_client_add_timezone (client, zone, NULL);
+ e_cal_add_timezone (client, zone, NULL);
icaltimezone_free (zone, 1);
}
@@ -421,16 +421,16 @@ selection_received (GtkWidget *invisible,
icalcomponent_free (icalcomp);
} else {
- e_cal_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, FALSE);
+ e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, FALSE);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
}
static void
-e_cal_view_init (ECalView *cal_view, ECalViewClass *klass)
+e_calendar_view_init (ECalendarView *cal_view, ECalendarViewClass *klass)
{
- cal_view->priv = g_new0 (ECalViewPrivate, 1);
+ cal_view->priv = g_new0 (ECalendarViewPrivate, 1);
cal_view->priv->model = (ECalModel *) e_cal_model_calendar_new ();
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_changed",
@@ -461,11 +461,11 @@ e_cal_view_init (ECalView *cal_view, ECalViewClass *klass)
}
static void
-e_cal_view_destroy (GtkObject *object)
+e_calendar_view_destroy (GtkObject *object)
{
- ECalView *cal_view = (ECalView *) object;
+ ECalendarView *cal_view = (ECalendarView *) object;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (cal_view->priv) {
if (cal_view->priv->model) {
@@ -504,37 +504,37 @@ e_cal_view_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
-E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init,
- e_cal_view_init, GTK_TYPE_TABLE);
+E_MAKE_TYPE (e_calendar_view, "ECalendarView", ECalendarView, e_calendar_view_class_init,
+ e_calendar_view_init, GTK_TYPE_TABLE);
GnomeCalendar *
-e_cal_view_get_calendar (ECalView *cal_view)
+e_calendar_view_get_calendar (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return cal_view->priv->calendar;
}
void
-e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar)
+e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
cal_view->priv->calendar = calendar;
}
ECalModel *
-e_cal_view_get_model (ECalView *cal_view)
+e_calendar_view_get_model (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return cal_view->priv->model;
}
void
-e_cal_view_set_model (ECalView *cal_view, ECalModel *model)
+e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
g_return_if_fail (E_IS_CAL_MODEL (model));
if (cal_view->priv->model) {
@@ -551,41 +551,41 @@ e_cal_view_set_model (ECalView *cal_view, ECalModel *model)
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_rows_inserted", G_CALLBACK (model_rows_changed_cb), cal_view);
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_rows_deleted", G_CALLBACK (model_rows_changed_cb), cal_view);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
icaltimezone *
-e_cal_view_get_timezone (ECalView *cal_view)
+e_calendar_view_get_timezone (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return e_cal_model_get_timezone (cal_view->priv->model);
}
void
-e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone)
+e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone)
{
icaltimezone *old_zone;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
old_zone = e_cal_model_get_timezone (cal_view->priv->model);
if (old_zone == zone)
return;
e_cal_model_set_timezone (cal_view->priv->model, zone);
- g_signal_emit (G_OBJECT (cal_view), e_cal_view_signals[TIMEZONE_CHANGED], 0,
+ g_signal_emit (G_OBJECT (cal_view), e_calendar_view_signals[TIMEZONE_CHANGED], 0,
old_zone, zone);
}
const char *
-e_cal_view_get_default_category (ECalView *cal_view)
+e_calendar_view_get_default_category (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return (const char *) cal_view->priv->default_category;
}
/**
- * e_cal_view_set_default_category
+ * e_calendar_view_set_default_category
* @cal_view: A calendar view.
* @category: Default category name or NULL for no category.
*
@@ -593,9 +593,9 @@ e_cal_view_get_default_category (ECalView *cal_view)
* components from the given calendar view.
*/
void
-e_cal_view_set_default_category (ECalView *cal_view, const char *category)
+e_calendar_view_set_default_category (ECalendarView *cal_view, const char *category)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (cal_view->priv->default_category)
g_free (cal_view->priv->default_category);
@@ -604,7 +604,7 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
}
/**
- * e_cal_view_get_use_24_hour_format:
+ * e_calendar_view_get_use_24_hour_format:
* @cal_view: A calendar view.
*
* Gets whether the view is using 24 hour times or not.
@@ -612,32 +612,32 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
* Returns: the 24 hour setting.
*/
gboolean
-e_cal_view_get_use_24_hour_format (ECalView *cal_view)
+e_calendar_view_get_use_24_hour_format (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE);
return e_cal_model_get_use_24_hour_format (cal_view->priv->model);
}
/**
- * e_cal_view_set_use_24_hour_format
+ * e_calendar_view_set_use_24_hour_format
* @cal_view: A calendar view.
* @use_24_hour: Whether to use 24 hour times or not.
*
* Sets the 12/24 hour times setting for the given view.
*/
void
-e_cal_view_set_use_24_hour_format (ECalView *cal_view, gboolean use_24_hour)
+e_calendar_view_set_use_24_hour_format (ECalendarView *cal_view, gboolean use_24_hour)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour);
}
void
-e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
+e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (!message || !*message) {
if (cal_view->priv->activity) {
@@ -665,45 +665,45 @@ e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
}
GList *
-e_cal_view_get_selected_events (ECalView *cal_view)
+e_calendar_view_get_selected_events (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events)
- return E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events (cal_view);
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events)
+ return E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events (cal_view);
return NULL;
}
void
-e_cal_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_calendar_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range (
cal_view, start_time, end_time);
}
}
void
-e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time)
+e_calendar_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range (
cal_view, start_time, end_time);
}
}
gboolean
-e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_calendar_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE);
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range) {
- return E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range) {
+ return E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range (
cal_view, start_time, end_time);
}
@@ -711,91 +711,91 @@ e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_
}
void
-e_cal_view_update_query (ECalView *cal_view)
+e_calendar_view_update_query (ECalendarView *cal_view)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- e_cal_view_set_status_message (cal_view, _("Searching"));
+ e_calendar_view_set_status_message (cal_view, _("Searching"));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
}
void
-e_cal_view_cut_clipboard (ECalView *cal_view)
+e_calendar_view_cut_clipboard (ECalendarView *cal_view)
{
GList *selected, *l;
const char *uid;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- e_cal_view_set_status_message (cal_view, _("Deleting selected objects"));
+ e_calendar_view_set_status_message (cal_view, _("Deleting selected objects"));
- e_cal_view_copy_clipboard (cal_view);
+ e_calendar_view_copy_clipboard (cal_view);
for (l = selected; l != NULL; l = l->next) {
- CalComponent *comp;
- ECalViewEvent *event = (ECalViewEvent *) l->data;
+ ECalComponent *comp;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) l->data;
GError *error = NULL;
if (!event)
continue;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (itip_organizer_is_user (comp, event->comp_data->client)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client, comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
event->comp_data->client, NULL);
- cal_component_get_uid (comp, &uid);
- cal_client_remove_object (event->comp_data->client, uid, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ e_cal_component_get_uid (comp, &uid);
+ e_cal_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
g_object_unref (comp);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
g_list_free (selected);
}
void
-e_cal_view_copy_clipboard (ECalView *cal_view)
+e_calendar_view_copy_clipboard (ECalendarView *cal_view)
{
GList *selected, *l;
gchar *comp_str;
icalcomponent *vcal_comp;
icalcomponent *new_icalcomp;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
/* create top-level VCALENDAR component and add VTIMEZONE's */
- vcal_comp = cal_util_new_top_level ();
+ vcal_comp = e_cal_util_new_top_level ();
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
if (event)
- cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
}
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
new_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp);
icalcomponent_add_component (vcal_comp, new_icalcomp);
@@ -814,9 +814,9 @@ e_cal_view_copy_clipboard (ECalView *cal_view)
}
void
-e_cal_view_paste_clipboard (ECalView *cal_view)
+e_calendar_view_paste_clipboard (ECalendarView *cal_view)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
gtk_selection_convert (cal_view->priv->invisible,
clipboard_atom,
@@ -825,14 +825,14 @@ e_cal_view_paste_clipboard (ECalView *cal_view)
}
static void
-delete_event (ECalView *cal_view, ECalViewEvent *event)
+delete_event (ECalendarView *cal_view, ECalendarViewEvent *event)
{
- CalComponent *comp;
- CalComponentVType vtype;
+ ECalComponent *comp;
+ ECalComponentVType vtype;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- vtype = cal_component_get_vtype (comp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ vtype = e_cal_component_get_vtype (comp);
if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) {
const char *uid;
@@ -842,17 +842,17 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
event->comp_data->client, NULL);
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
if (!uid || !*uid) {
g_object_unref (comp);
return;
}
- cal_client_remove_object (event->comp_data->client, uid, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ e_cal_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
}
@@ -860,16 +860,16 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
}
void
-e_cal_view_delete_selected_event (ECalView *cal_view)
+e_calendar_view_delete_selected_event (ECalendarView *cal_view)
{
GList *selected;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
if (event)
delete_event (cal_view, event);
@@ -877,17 +877,17 @@ e_cal_view_delete_selected_event (ECalView *cal_view)
}
void
-e_cal_view_delete_selected_events (ECalView *cal_view)
+e_calendar_view_delete_selected_events (ECalendarView *cal_view)
{
GList *selected, *l;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
if (event)
delete_event (cal_view, event);
}
@@ -896,24 +896,24 @@ e_cal_view_delete_selected_events (ECalView *cal_view)
}
void
-e_cal_view_delete_selected_occurrence (ECalView *cal_view)
+e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
{
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
GList *selected;
const char *uid;
GError *error = NULL;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
uid = icalcomponent_get_uid (event->comp_data->icalcomp);
/* FIXME: use 'rid' argument */
- cal_client_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error);
+ e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
/* free memory */
@@ -923,42 +923,42 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view)
static void
on_new_appointment (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_new_appointment (cal_view);
+ e_calendar_view_new_appointment (cal_view);
}
static void
on_new_event (GtkWidget *widget, gpointer user_data)
{
time_t dtstart, dtend;
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
}
static void
on_new_meeting (GtkWidget *widget, gpointer user_data)
{
time_t dtstart, dtend;
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
}
static void
on_new_task (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
gnome_calendar_new_task (cal_view->priv->calendar);
}
static void
on_goto_date (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
goto_dialog (cal_view->priv->calendar);
}
@@ -966,7 +966,7 @@ on_goto_date (GtkWidget *widget, gpointer user_data)
static void
on_goto_today (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
calendar_goto_today (cal_view->priv->calendar);
}
@@ -975,14 +975,14 @@ static void
on_edit_appointment (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
if (event)
- e_cal_view_edit_appointment (cal_view, event->comp_data->client,
+ e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
event->comp_data->icalcomp, FALSE);
g_list_free (selected);
@@ -992,14 +992,14 @@ on_edit_appointment (GtkWidget *widget, gpointer user_data)
static void
on_print (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
time_t start;
GnomeCalendarViewType view_type;
PrintView print_view;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_get_visible_time_range (cal_view, &start, NULL);
+ e_calendar_view_get_visible_time_range (cal_view, &start, NULL);
view_type = gnome_calendar_get_view (cal_view->priv->calendar);
switch (view_type) {
@@ -1027,16 +1027,16 @@ on_print (GtkWidget *widget, gpointer user_data)
static void
on_save_as (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
GList *selected;
char *filename;
char *ical_string;
FILE *file;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1044,8 +1044,8 @@ on_save_as (GtkWidget *widget, gpointer user_data)
if (filename == NULL)
return;
- event = (ECalViewEvent *) selected->data;
- ical_string = cal_client_get_component_as_string (event->comp_data->client, event->comp_data->icalcomp);
+ event = (ECalendarViewEvent *) selected->data;
+ ical_string = e_cal_get_component_as_string (event->comp_data->client, event->comp_data->icalcomp);
if (ical_string == NULL) {
g_warning ("Couldn't convert item to a string");
return;
@@ -1067,20 +1067,20 @@ on_save_as (GtkWidget *widget, gpointer user_data)
static void
on_print_event (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
GList *selected;
- ECalViewEvent *event;
- CalComponent *comp;
+ ECalendarViewEvent *event;
+ ECalComponent *comp;
- cal_view = E_CAL_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
print_comp (comp, event->comp_data->client, FALSE);
g_object_unref (comp);
@@ -1090,12 +1090,12 @@ static void
on_meeting (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
- e_cal_view_edit_appointment (cal_view, event->comp_data->client, event->comp_data->icalcomp, TRUE);
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
+ e_calendar_view_edit_appointment (cal_view, event->comp_data->client, event->comp_data->icalcomp, TRUE);
g_list_free (selected);
}
@@ -1105,16 +1105,16 @@ static void
on_forward (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- CalComponent *comp;
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
+ ECalComponent *comp;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL);
g_list_free (selected);
g_object_unref (comp);
@@ -1124,12 +1124,12 @@ on_forward (GtkWidget *widget, gpointer user_data)
static void
on_publish (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
icaltimezone *utc;
time_t start = time (NULL), end;
GList *comp_list = NULL, *client_list, *cl;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
utc = icaltimezone_get_utc_timezone ();
start = time_day_begin_with_zone (start, utc);
@@ -1137,12 +1137,12 @@ on_publish (GtkWidget *widget, gpointer user_data)
client_list = e_cal_model_get_client_list (cal_view->priv->model);
for (cl = client_list; cl != NULL; cl = cl->next) {
- if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
+ if (e_cal_get_free_busy ((ECal *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, (CalClient *) cl->data, NULL);
+ ECalComponent *comp = E_CAL_COMPONENT (l->data);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, (ECal *) cl->data, NULL);
g_object_unref (comp);
}
@@ -1157,52 +1157,52 @@ on_publish (GtkWidget *widget, gpointer user_data)
static void
on_settings (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
control_util_show_settings (cal_view->priv->calendar);
}
static void
on_delete_appointment (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
- e_cal_view_delete_selected_event (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ e_calendar_view_delete_selected_event (cal_view);
}
static void
on_delete_occurrence (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
- e_cal_view_delete_selected_occurrence (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ e_calendar_view_delete_selected_occurrence (cal_view);
}
static void
on_cut (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_cut_clipboard (cal_view);
+ e_calendar_view_cut_clipboard (cal_view);
}
static void
on_copy (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_copy_clipboard (cal_view);
+ e_calendar_view_copy_clipboard (cal_view);
}
static void
on_paste (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_paste_clipboard (cal_view);
+ e_calendar_view_paste_clipboard (cal_view);
}
enum {
@@ -1307,7 +1307,7 @@ static EPopupMenu child_items [] = {
static void
free_view_popup (GtkWidget *widget, gpointer data)
{
- ECalView *cal_view = E_CAL_VIEW (data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (data);
if (cal_view->priv->view_menu == NULL)
return;
@@ -1362,19 +1362,19 @@ setup_popup_icons (EPopupMenu *context_menu)
}
GtkMenu *
-e_cal_view_create_popup_menu (ECalView *cal_view)
+e_calendar_view_create_popup_menu (ECalendarView *cal_view)
{
GList *selected;
EPopupMenu *context_menu;
guint32 disable_mask = 0, hide_mask = 0;
GtkMenu *popup;
- CalClient *client = NULL;
+ ECal *client = NULL;
gboolean read_only = TRUE;
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
/* get the selection */
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected == NULL) {
cal_view->priv->view_menu = gnome_calendar_setup_view_popup (cal_view->priv->calendar);
@@ -1383,26 +1383,26 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = e_cal_model_get_default_client (cal_view->priv->model);
} else {
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
context_menu = child_items;
- event = (ECalViewEvent *) selected->data;
- if (cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ event = (ECalendarViewEvent *) selected->data;
+ if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
hide_mask |= MASK_SINGLE;
else
hide_mask |= MASK_RECURRING;
- if (cal_util_component_is_instance (event->comp_data->icalcomp))
+ if (e_cal_util_component_is_instance (event->comp_data->icalcomp))
hide_mask |= MASK_INSTANCE;
- if (cal_util_component_has_organizer (event->comp_data->icalcomp)) {
- CalComponent *comp;
+ if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
+ ECalComponent *comp;
disable_mask |= MASK_MEETING;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (!itip_organizer_is_user (comp, event->comp_data->client))
disable_mask |= MASK_MEETING_ORGANIZER;
@@ -1412,7 +1412,7 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = event->comp_data->client;
}
- cal_client_is_read_only (client, &read_only, NULL);
+ e_cal_is_read_only (client, &read_only, NULL);
if (read_only)
disable_mask |= MASK_EDITABLE;
@@ -1424,7 +1424,7 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
}
/**
- * e_cal_view_new_appointment_for
+ * e_calendar_view_new_appointment_for
* @cal_view: A calendar view.
* @dtstart: A Unix time_t that marks the beginning of the appointment.
* @dtend: A Unix time_t that marks the end of the appointment.
@@ -1435,19 +1435,19 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
* Opens an event editor dialog for a new appointment.
*/
void
-e_cal_view_new_appointment_for (ECalView *cal_view,
+e_calendar_view_new_appointment_for (ECalendarView *cal_view,
time_t dtstart, time_t dtend,
gboolean all_day,
gboolean meeting)
{
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
struct icaltimetype itt;
- CalComponentDateTime dt;
- CalComponent *comp;
+ ECalComponentDateTime dt;
+ ECalComponent *comp;
icalcomponent *icalcomp;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
priv = cal_view->priv;
@@ -1458,8 +1458,8 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
dt.tzid = icaltimezone_get_tzid (e_cal_model_get_timezone (cal_view->priv->model));
icalcomp = e_cal_model_create_component_with_defaults (priv->model);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
/* DTSTART, DTEND */
itt = icaltime_from_timet_with_zone (dtstart, FALSE, e_cal_model_get_timezone (cal_view->priv->model));
@@ -1467,7 +1467,7 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
itt.hour = itt.minute = itt.second = 0;
itt.is_date = TRUE;
}
- cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
itt = icaltime_from_timet_with_zone (dtend, FALSE, e_cal_model_get_timezone (cal_view->priv->model));
if (all_day) {
@@ -1479,20 +1479,20 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
itt.hour = itt.minute = itt.second = 0;
itt.is_date = TRUE;
}
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
/* TRANSPARENCY */
- transparency = all_day ? CAL_COMPONENT_TRANSP_TRANSPARENT
- : CAL_COMPONENT_TRANSP_OPAQUE;
- cal_component_set_transparency (comp, transparency);
+ transparency = all_day ? E_CAL_COMPONENT_TRANSP_TRANSPARENT
+ : E_CAL_COMPONENT_TRANSP_OPAQUE;
+ e_cal_component_set_transparency (comp, transparency);
/* CATEGORY */
- cal_component_set_categories (comp, priv->default_category);
+ e_cal_component_set_categories (comp, priv->default_category);
/* edit the object */
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
- e_cal_view_edit_appointment (cal_view,
+ e_calendar_view_edit_appointment (cal_view,
e_cal_model_get_default_client (priv->model),
icalcomp, meeting);
@@ -1500,7 +1500,7 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
}
/**
- * e_cal_view_new_appointment
+ * e_calendar_view_new_appointment
* @cal_view: A calendar view.
*
* Opens an event editor dialog for a new appointment. The appointment's
@@ -1508,18 +1508,18 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
* the calendar view.
*/
void
-e_cal_view_new_appointment (ECalView *cal_view)
+e_calendar_view_new_appointment (ECalendarView *cal_view)
{
time_t dtstart, dtend;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
}
/**
- * e_cal_view_edit_appointment
+ * e_calendar_view_edit_appointment
* @cal_view: A calendar view.
* @client: Calendar client.
* @icalcomp: The object to be edited.
@@ -1529,18 +1529,18 @@ e_cal_view_new_appointment (ECalView *cal_view)
* object.
*/
void
-e_cal_view_edit_appointment (ECalView *cal_view,
- CalClient *client,
+e_calendar_view_edit_appointment (ECalendarView *cal_view,
+ ECal *client,
icalcomponent *icalcomp,
gboolean meeting)
{
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
CompEditor *ce;
const char *uid;
- CalComponent *comp;
+ ECalComponent *comp;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+ g_return_if_fail (E_IS_CAL (client));
g_return_if_fail (icalcomp != NULL);
priv = cal_view->priv;
@@ -1554,8 +1554,8 @@ e_cal_view_edit_appointment (ECalView *cal_view,
ee = event_editor_new (client);
ce = COMP_EDITOR (ee);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
comp_editor_edit_comp (ce, comp);
if (meeting)
event_editor_show_meeting (ee);
diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h
index 292871b709..a1b11023b3 100644
--- a/calendar/gui/e-cal-view.h
+++ b/calendar/gui/e-cal-view.h
@@ -20,10 +20,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-#ifndef _E_CAL_VIEW_H_
-#define _E_CAL_VIEW_H_
+#ifndef _E_CALENDAR_VIEW_H_
+#define _E_CALENDAR_VIEW_H_
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include <gtk/gtktable.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
@@ -34,21 +34,21 @@ G_BEGIN_DECLS
* EView - base widget class for the calendar views.
*/
-#define E_CAL_VIEW(obj) GTK_CHECK_CAST (obj, e_cal_view_get_type (), ECalView)
-#define E_CAL_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cal_view_get_type (), ECalViewClass)
-#define E_IS_CAL_VIEW(obj) GTK_CHECK_TYPE (obj, e_cal_view_get_type ())
+#define E_CALENDAR_VIEW(obj) GTK_CHECK_CAST (obj, e_calendar_view_get_type (), ECalendarView)
+#define E_CALENDAR_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_calendar_view_get_type (), ECalendarViewClass)
+#define E_IS_CALENDAR_VIEW(obj) GTK_CHECK_TYPE (obj, e_calendar_view_get_type ())
typedef enum {
- E_CAL_VIEW_POS_OUTSIDE,
- E_CAL_VIEW_POS_NONE,
- E_CAL_VIEW_POS_EVENT,
- E_CAL_VIEW_POS_LEFT_EDGE,
- E_CAL_VIEW_POS_RIGHT_EDGE,
- E_CAL_VIEW_POS_TOP_EDGE,
- E_CAL_VIEW_POS_BOTTOM_EDGE
-} ECalViewPosition;
-
-#define E_CAL_VIEW_EVENT_FIELDS \
+ E_CALENDAR_VIEW_POS_OUTSIDE,
+ E_CALENDAR_VIEW_POS_NONE,
+ E_CALENDAR_VIEW_POS_EVENT,
+ E_CALENDAR_VIEW_POS_LEFT_EDGE,
+ E_CALENDAR_VIEW_POS_RIGHT_EDGE,
+ E_CALENDAR_VIEW_POS_TOP_EDGE,
+ E_CALENDAR_VIEW_POS_BOTTOM_EDGE
+} ECalendarViewPosition;
+
+#define E_CALENDAR_VIEW_EVENT_FIELDS \
GnomeCanvasItem *canvas_item; \
ECalModelComponent *comp_data; \
gboolean allocated_comp_data; \
@@ -59,76 +59,76 @@ typedef enum {
guint different_timezone : 1;
typedef struct {
- E_CAL_VIEW_EVENT_FIELDS
-} ECalViewEvent;
+ E_CALENDAR_VIEW_EVENT_FIELDS
+} ECalendarViewEvent;
-typedef struct _ECalView ECalView;
-typedef struct _ECalViewClass ECalViewClass;
-typedef struct _ECalViewPrivate ECalViewPrivate;
+typedef struct _ECalendarView ECalendarView;
+typedef struct _ECalendarViewClass ECalendarViewClass;
+typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
-struct _ECalView {
+struct _ECalendarView {
GtkTable table;
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
};
-struct _ECalViewClass {
+struct _ECalendarViewClass {
GtkTableClass parent_class;
/* Notification signals */
- void (* selection_changed) (ECalView *cal_view);
- void (* selected_time_changed) (ECalView *cal_view);
- void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
- void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
- void (* event_added) (ECalView *day_view, ECalViewEvent *event);
+ void (* selection_changed) (ECalendarView *cal_view);
+ void (* selected_time_changed) (ECalendarView *cal_view);
+ void (* timezone_changed) (ECalendarView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
+ void (* event_changed) (ECalendarView *day_view, ECalendarViewEvent *event);
+ void (* event_added) (ECalendarView *day_view, ECalendarViewEvent *event);
/* Virtual methods */
- GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
- void (* get_selected_time_range) (ECalView *cal_view, time_t *start_time, time_t *end_time);
- void (* set_selected_time_range) (ECalView *cal_view, time_t start_time, time_t end_time);
- gboolean (* get_visible_time_range) (ECalView *cal_view, time_t *start_time, time_t *end_time);
- void (* update_query) (ECalView *cal_view);
+ GList * (* get_selected_events) (ECalendarView *cal_view); /* a GList of ECalendarViewEvent's */
+ void (* get_selected_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+ void (* set_selected_time_range) (ECalendarView *cal_view, time_t start_time, time_t end_time);
+ gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+ void (* update_query) (ECalendarView *cal_view);
};
-GType e_cal_view_get_type (void);
-
-GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view);
-void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar);
-ECalModel *e_cal_view_get_model (ECalView *cal_view);
-void e_cal_view_set_model (ECalView *cal_view, ECalModel *model);
-icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
-void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
-const char *e_cal_view_get_default_category (ECalView *cal_view);
-void e_cal_view_set_default_category (ECalView *cal_view, const char *category);
-gboolean e_cal_view_get_use_24_hour_format (ECalView *view);
-void e_cal_view_set_use_24_hour_format (ECalView *view, gboolean use_24_hour);
-
-void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
-
-GList *e_cal_view_get_selected_events (ECalView *cal_view);
-void e_cal_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-void e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time);
-gboolean e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-void e_cal_view_update_query (ECalView *cal_view);
-
-void e_cal_view_cut_clipboard (ECalView *cal_view);
-void e_cal_view_copy_clipboard (ECalView *cal_view);
-void e_cal_view_paste_clipboard (ECalView *cal_view);
-void e_cal_view_delete_selected_event (ECalView *cal_view);
-void e_cal_view_delete_selected_events (ECalView *cal_view);
-void e_cal_view_delete_selected_occurrence (ECalView *cal_view);
-
-GtkMenu *e_cal_view_create_popup_menu (ECalView *cal_view);
-
-void e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
+GType e_calendar_view_get_type (void);
+
+GnomeCalendar *e_calendar_view_get_calendar (ECalendarView *cal_view);
+void e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar);
+ECalModel *e_calendar_view_get_model (ECalendarView *cal_view);
+void e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model);
+icaltimezone *e_calendar_view_get_timezone (ECalendarView *cal_view);
+void e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone);
+const char *e_calendar_view_get_default_category (ECalendarView *cal_view);
+void e_calendar_view_set_default_category (ECalendarView *cal_view, const char *category);
+gboolean e_calendar_view_get_use_24_hour_format (ECalendarView *view);
+void e_calendar_view_set_use_24_hour_format (ECalendarView *view, gboolean use_24_hour);
+
+void e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message);
+
+GList *e_calendar_view_get_selected_events (ECalendarView *cal_view);
+void e_calendar_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+void e_calendar_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time);
+gboolean e_calendar_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+void e_calendar_view_update_query (ECalendarView *cal_view);
+
+void e_calendar_view_cut_clipboard (ECalendarView *cal_view);
+void e_calendar_view_copy_clipboard (ECalendarView *cal_view);
+void e_calendar_view_paste_clipboard (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_event (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_events (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view);
+
+GtkMenu *e_calendar_view_create_popup_menu (ECalendarView *cal_view);
+
+void e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas);
-void e_cal_view_new_appointment_for (ECalView *cal_view,
+void e_calendar_view_new_appointment_for (ECalendarView *cal_view,
time_t dtstart,
time_t dtend,
gboolean all_day,
gboolean meeting);
-void e_cal_view_new_appointment (ECalView *cal_view);
-void e_cal_view_edit_appointment (ECalView *cal_view,
- CalClient *client,
+void e_calendar_view_new_appointment (ECalendarView *cal_view);
+void e_calendar_view_edit_appointment (ECalendarView *cal_view,
+ ECal *client,
icalcomponent *icalcomp,
gboolean meeting);
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index fdea4d33bb..173887dab5 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -24,7 +24,7 @@
*/
/*
- * ECalendarTable - displays the CalComponent objects in a table (an ETable).
+ * ECalendarTable - displays the ECalComponent objects in a table (an ETable).
* Used for calendar events and tasks.
*/
@@ -188,30 +188,30 @@ compare_priorities (int *a, int *b)
* FIXME: Does this ever get called?? It doesn't seem to.
* I specified that the table should be sorted by this column, but it still
* never calls this function.
- * Also, this assumes it is passed pointers to CalComponents, but I think it
+ * Also, this assumes it is passed pointers to ECalComponents, but I think it
* may just be passed pointers to the 2 cell values.
*/
static gint
task_compare_cb (gconstpointer a, gconstpointer b)
{
- CalComponent *ca, *cb;
- CalComponentDateTime due_a, due_b;
+ ECalComponent *ca, *cb;
+ ECalComponentDateTime due_a, due_b;
int *prio_a, *prio_b;
int retval;
- ca = CAL_COMPONENT (a);
- cb = CAL_COMPONENT (b);
+ ca = E_CAL_COMPONENT (a);
+ cb = E_CAL_COMPONENT (b);
- cal_component_get_due (ca, &due_a);
- cal_component_get_due (cb, &due_b);
- cal_component_get_priority (ca, &prio_a);
- cal_component_get_priority (cb, &prio_b);
+ e_cal_component_get_due (ca, &due_a);
+ e_cal_component_get_due (cb, &due_b);
+ e_cal_component_get_priority (ca, &prio_a);
+ e_cal_component_get_priority (cb, &prio_b);
if (due_a.value && due_b.value) {
int v;
/* FIXME: TIMEZONES. But currently we have no way to get the
- CalClient, so we can't get the timezone. */
+ ECal, so we can't get the timezone. */
v = icaltime_compare (*due_a.value, *due_b.value);
if (v == 0)
@@ -225,14 +225,14 @@ task_compare_cb (gconstpointer a, gconstpointer b)
else
retval = compare_priorities (prio_a, prio_b);
- cal_component_free_datetime (&due_a);
- cal_component_free_datetime (&due_b);
+ e_cal_component_free_datetime (&due_a);
+ e_cal_component_free_datetime (&due_b);
if (prio_a)
- cal_component_free_priority (prio_a);
+ e_cal_component_free_priority (prio_a);
if (prio_b)
- cal_component_free_priority (prio_b);
+ e_cal_component_free_priority (prio_b);
return retval;
}
@@ -287,8 +287,8 @@ priority_compare_cb (gconstpointer a, gconstpointer b)
{
int priority1, priority2;
- priority1 = cal_util_priority_from_string ((const char*) a);
- priority2 = cal_util_priority_from_string ((const char*) b);
+ priority1 = e_cal_util_priority_from_string ((const char*) a);
+ priority2 = e_cal_util_priority_from_string ((const char*) b);
/* We change undefined priorities so they appear after 'Low'. */
if (priority1 <= 0)
@@ -727,9 +727,9 @@ delete_selected_components (ECalendarTable *cal_table)
ECalModelComponent *comp_data = (ECalModelComponent *) l->data;
GError *error = NULL;
- cal_client_remove_object (comp_data->client,
+ e_cal_remove_object (comp_data->client,
icalcomponent_get_uid (comp_data->icalcomp), &error);
- delete_error_dialog (error, CAL_COMPONENT_TODO);
+ delete_error_dialog (error, E_CAL_COMPONENT_TODO);
g_clear_error (&error);
}
@@ -750,7 +750,7 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table)
ETable *etable;
int n_selected;
ECalModelComponent *comp_data;
- CalComponent *comp;
+ ECalComponent *comp;
g_return_if_fail (cal_table != NULL);
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
@@ -768,11 +768,11 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table)
/* FIXME: this may be something other than a TODO component */
- comp = cal_component_new ();
+ comp = e_cal_component_new ();
if (comp_data)
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- if (delete_component_dialog (comp, FALSE, n_selected, CAL_COMPONENT_TODO,
+ if (delete_component_dialog (comp, FALSE, n_selected, E_CAL_COMPONENT_TODO,
GTK_WIDGET (cal_table)))
delete_selected_components (cal_table);
@@ -813,7 +813,7 @@ copy_row_cb (int model_row, gpointer data)
return;
/* add timezones to the VCALENDAR component */
- cal_util_add_timezones_from_component (cal_table->tmp_vcal, comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (cal_table->tmp_vcal, comp_data->icalcomp);
/* add the new component to the VCALENDAR component */
comp_str = icalcomponent_as_ical_string (comp_data->icalcomp);
@@ -845,7 +845,7 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
}
/* create temporary VCALENDAR object */
- cal_table->tmp_vcal = cal_util_new_top_level ();
+ cal_table->tmp_vcal = e_cal_util_new_top_level ();
etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
e_table_selected_row_foreach (etable, copy_row_cb, cal_table);
@@ -886,12 +886,12 @@ open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean as
tedit = e_comp_editor_registry_find (comp_editor_registry, uid);
if (tedit == NULL) {
- CalComponent *comp;
+ ECalComponent *comp;
tedit = COMP_EDITOR (task_editor_new (comp_data->client));
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
comp_editor_edit_comp (tedit, comp);
if (assign)
task_editor_show_assignment (TASK_EDITOR (tedit));
@@ -1074,11 +1074,11 @@ e_calendar_table_show_popup_menu (ETable *table,
} else
hide_mask = MASK_SINGLE;
- cal_client_is_read_only (comp_data->client, &read_only, NULL);
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
if (!read_only)
disable_mask |= MASK_EDITABLE;
- if (cal_client_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT))
+ if (e_cal_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT))
disable_mask |= MASK_ASSIGNABLE;
setup_popup_icons (tasks_popup_menu);
@@ -1143,7 +1143,7 @@ e_calendar_table_on_save_as (GtkWidget *widget, gpointer data)
if (filename == NULL)
return;
- ical_string = cal_client_get_component_as_string (comp_data->client, comp_data->icalcomp);
+ ical_string = e_cal_get_component_as_string (comp_data->client, comp_data->icalcomp);
if (ical_string == NULL) {
g_warning ("Couldn't convert item to a string");
return;
@@ -1165,7 +1165,7 @@ e_calendar_table_on_print_task (GtkWidget *widget, gpointer data)
{
ECalendarTable *cal_table;
ECalModelComponent *comp_data;
- CalComponent *comp;
+ ECalComponent *comp;
cal_table = E_CALENDAR_TABLE (data);
@@ -1173,8 +1173,8 @@ e_calendar_table_on_print_task (GtkWidget *widget, gpointer data)
if (comp_data == NULL)
return;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
print_comp (comp, comp_data->client, FALSE);
g_object_unref (comp);
@@ -1230,11 +1230,11 @@ e_calendar_table_on_forward (GtkWidget *widget, gpointer data)
comp_data = get_selected_comp (cal_table);
if (comp_data) {
- CalComponent *comp;
+ ECalComponent *comp;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL);
g_object_unref (comp);
}
@@ -1318,8 +1318,8 @@ selection_received (GtkWidget *invisible,
char *comp_str;
icalcomponent *icalcomp;
char *uid;
- CalComponent *comp;
- CalClient *client;
+ ECalComponent *comp;
+ ECal *client;
icalcomponent_kind kind;
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
@@ -1360,18 +1360,18 @@ selection_received (GtkWidget *invisible,
if (child_kind == ICAL_VEVENT_COMPONENT ||
child_kind == ICAL_VTODO_COMPONENT ||
child_kind == ICAL_VJOURNAL_COMPONENT) {
- CalComponent *tmp_comp;
+ ECalComponent *tmp_comp;
- uid = cal_component_gen_uid ();
- tmp_comp = cal_component_new ();
- cal_component_set_icalcomponent (
+ uid = e_cal_component_gen_uid ();
+ tmp_comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
tmp_comp, icalcomponent_new_clone (subcomp));
- cal_component_set_uid (tmp_comp, uid);
+ e_cal_component_set_uid (tmp_comp, uid);
free (uid);
/* FIXME should we convert start/due/complete times? */
/* FIXME Error handling */
- cal_client_create_object (client, cal_component_get_icalcomponent (tmp_comp), NULL, NULL);
+ e_cal_create_object (client, e_cal_component_get_icalcomponent (tmp_comp), NULL, NULL);
g_object_unref (tmp_comp);
}
@@ -1380,13 +1380,13 @@ selection_received (GtkWidget *invisible,
}
}
else {
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
- uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, (const char *) uid);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
+ uid = e_cal_component_gen_uid ();
+ e_cal_component_set_uid (comp, (const char *) uid);
free (uid);
- cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL);
+ e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), NULL, NULL);
g_object_unref (comp);
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 2e392560cd..332019cf2c 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -29,8 +29,8 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-dialog-utils.h"
-#include "cal-util/cal-util-marshal.h"
-#include "cal-util/timeutil.h"
+#include "e-calendar-marshal.h"
+#include <libecal/e-cal-time-util.h>
#include "evolution-activity-client.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -53,7 +53,7 @@
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
-struct _ECalViewPrivate {
+struct _ECalendarViewPrivate {
/* The GnomeCalendar we are associated to */
GnomeCalendar *calendar;
@@ -74,11 +74,11 @@ struct _ECalViewPrivate {
char *default_category;
};
-static void e_cal_view_class_init (ECalViewClass *klass);
-static void e_cal_view_init (ECalView *cal_view, ECalViewClass *klass);
-static void e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static void e_cal_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static void e_cal_view_destroy (GtkObject *object);
+static void e_calendar_view_class_init (ECalendarViewClass *klass);
+static void e_calendar_view_init (ECalendarView *cal_view, ECalendarViewClass *klass);
+static void e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
+static void e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
+static void e_calendar_view_destroy (GtkObject *object);
static GObjectClass *parent_class = NULL;
static GdkAtom clipboard_atom = GDK_NONE;
@@ -101,20 +101,20 @@ enum {
LAST_SIGNAL
};
-static guint e_cal_view_signals[LAST_SIGNAL] = { 0 };
+static guint e_calendar_view_signals[LAST_SIGNAL] = { 0 };
static void
-e_cal_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
- ECalView *cal_view;
- ECalViewPrivate *priv;
+ ECalendarView *cal_view;
+ ECalendarViewPrivate *priv;
- cal_view = E_CAL_VIEW (object);
+ cal_view = E_CALENDAR_VIEW (object);
priv = cal_view->priv;
switch (property_id) {
case PROP_MODEL:
- e_cal_view_set_model (cal_view, E_CAL_MODEL (g_value_get_object (value)));
+ e_calendar_view_set_model (cal_view, E_CAL_MODEL (g_value_get_object (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -123,17 +123,17 @@ e_cal_view_set_property (GObject *object, guint property_id, const GValue *value
}
static void
-e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
- ECalView *cal_view;
- ECalViewPrivate *priv;
+ ECalendarView *cal_view;
+ ECalendarViewPrivate *priv;
- cal_view = E_CAL_VIEW (object);
+ cal_view = E_CALENDAR_VIEW (object);
priv = cal_view->priv;
switch (property_id) {
case PROP_MODEL:
- g_value_set_object (value, e_cal_view_get_model (cal_view));
+ g_value_set_object (value, e_calendar_view_get_model (cal_view));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -142,7 +142,7 @@ e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GPar
}
static void
-e_cal_view_class_init (ECalViewClass *klass)
+e_calendar_view_class_init (ECalendarViewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
@@ -150,9 +150,9 @@ e_cal_view_class_init (ECalViewClass *klass)
parent_class = g_type_class_peek_parent (klass);
/* Method override */
- gobject_class->set_property = e_cal_view_set_property;
- gobject_class->get_property = e_cal_view_get_property;
- object_class->destroy = e_cal_view_destroy;
+ gobject_class->set_property = e_calendar_view_set_property;
+ gobject_class->get_property = e_calendar_view_get_property;
+ object_class->destroy = e_calendar_view_destroy;
klass->selection_changed = NULL;
klass->selected_time_changed = NULL;
@@ -171,46 +171,46 @@ e_cal_view_class_init (ECalViewClass *klass)
| G_PARAM_CONSTRUCT));
/* Create class' signals */
- e_cal_view_signals[SELECTION_CHANGED] =
+ e_calendar_view_signals[SELECTION_CHANGED] =
g_signal_new ("selection_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, selection_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, selection_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_cal_view_signals[SELECTED_TIME_CHANGED] =
+ e_calendar_view_signals[SELECTED_TIME_CHANGED] =
g_signal_new ("selected_time_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, selected_time_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, selected_time_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_cal_view_signals[TIMEZONE_CHANGED] =
+ e_calendar_view_signals[TIMEZONE_CHANGED] =
g_signal_new ("timezone_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalViewClass, timezone_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, timezone_changed),
NULL, NULL,
- cal_util_marshal_VOID__POINTER_POINTER,
+ e_calendar_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_cal_view_signals[EVENT_CHANGED] =
+ e_calendar_view_signals[EVENT_CHANGED] =
g_signal_new ("event_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_changed),
+ G_STRUCT_OFFSET (ECalendarViewClass, event_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- e_cal_view_signals[EVENT_ADDED] =
+ e_calendar_view_signals[EVENT_ADDED] =
g_signal_new ("event_added",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_added),
+ G_STRUCT_OFFSET (ECalendarViewClass, event_added),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
@@ -227,33 +227,33 @@ e_cal_view_class_init (ECalViewClass *klass)
static void
model_changed_cb (ETableModel *etm, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_row_changed_cb (ETableModel *etm, int row, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_cell_changed_cb (ETableModel *etm, int col, int row, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
model_rows_changed_cb (ETableModel *etm, int row, int count, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
static void
@@ -261,7 +261,7 @@ selection_get (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint info,
guint time_stamp,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
if (cal_view->priv->clipboard_selection != NULL) {
gtk_selection_data_set (selection_data,
@@ -275,7 +275,7 @@ selection_get (GtkWidget *invisible,
static void
selection_clear_event (GtkWidget *invisible,
GdkEventSelection *event,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
if (cal_view->priv->clipboard_selection != NULL) {
g_free (cal_view->priv->clipboard_selection);
@@ -284,10 +284,10 @@ selection_clear_event (GtkWidget *invisible,
}
void
-e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
+e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas)
{
- CalComponent *comp;
+ ECalComponent *comp;
struct icaltimetype itime, old_dtstart, old_dtend;
time_t tt_start, tt_end, new_dtstart;
struct icaldurationtype ic_dur;
@@ -331,18 +331,18 @@ e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
icalcomponent_set_dtend (icalcomp, itime);
/* FIXME The new uid stuff can go away once we actually set it in the backend */
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
+ uid = e_cal_component_gen_uid ();
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (icalcomp));
- cal_component_set_uid (comp, uid);
+ e_cal_component_set_uid (comp, uid);
/* FIXME Error handling */
- if (cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL)) {
+ if (e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), NULL, NULL)) {
if (itip_organizer_is_user (comp, client) &&
send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
} else {
@@ -357,16 +357,16 @@ static void
selection_received (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint time,
- ECalView *cal_view)
+ ECalendarView *cal_view)
{
char *comp_str, *default_tzid;
icalcomponent *icalcomp;
icalcomponent_kind kind;
time_t selected_time_start, selected_time_end;
icaltimezone *default_zone;
- CalClient *client;
+ ECal *client;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (selection_data->length < 0 ||
selection_data->type != GDK_SELECTION_TYPE_STRING) {
@@ -382,7 +382,7 @@ selection_received (GtkWidget *invisible,
client = e_cal_model_get_default_client (cal_view->priv->model);
/* FIXME Error checking */
- cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
+ e_cal_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
/* FIXME An error dialog if we return? */
@@ -390,8 +390,8 @@ selection_received (GtkWidget *invisible,
if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
return;
- e_cal_view_set_status_message (cal_view, _("Updating objects"));
- e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
+ e_calendar_view_set_status_message (cal_view, _("Updating objects"));
+ e_calendar_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
/* FIXME Timezone handling */
if (kind == ICAL_VCALENDAR_COMPONENT) {
@@ -402,14 +402,14 @@ selection_received (GtkWidget *invisible,
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
if (child_kind == ICAL_VEVENT_COMPONENT)
- e_cal_view_add_event (cal_view, client, selected_time_start,
+ e_calendar_view_add_event (cal_view, client, selected_time_start,
default_zone, subcomp, FALSE);
else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- cal_client_add_timezone (client, zone, NULL);
+ e_cal_add_timezone (client, zone, NULL);
icaltimezone_free (zone, 1);
}
@@ -421,16 +421,16 @@ selection_received (GtkWidget *invisible,
icalcomponent_free (icalcomp);
} else {
- e_cal_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, FALSE);
+ e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, FALSE);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
}
static void
-e_cal_view_init (ECalView *cal_view, ECalViewClass *klass)
+e_calendar_view_init (ECalendarView *cal_view, ECalendarViewClass *klass)
{
- cal_view->priv = g_new0 (ECalViewPrivate, 1);
+ cal_view->priv = g_new0 (ECalendarViewPrivate, 1);
cal_view->priv->model = (ECalModel *) e_cal_model_calendar_new ();
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_changed",
@@ -461,11 +461,11 @@ e_cal_view_init (ECalView *cal_view, ECalViewClass *klass)
}
static void
-e_cal_view_destroy (GtkObject *object)
+e_calendar_view_destroy (GtkObject *object)
{
- ECalView *cal_view = (ECalView *) object;
+ ECalendarView *cal_view = (ECalendarView *) object;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (cal_view->priv) {
if (cal_view->priv->model) {
@@ -504,37 +504,37 @@ e_cal_view_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
-E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init,
- e_cal_view_init, GTK_TYPE_TABLE);
+E_MAKE_TYPE (e_calendar_view, "ECalendarView", ECalendarView, e_calendar_view_class_init,
+ e_calendar_view_init, GTK_TYPE_TABLE);
GnomeCalendar *
-e_cal_view_get_calendar (ECalView *cal_view)
+e_calendar_view_get_calendar (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return cal_view->priv->calendar;
}
void
-e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar)
+e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
cal_view->priv->calendar = calendar;
}
ECalModel *
-e_cal_view_get_model (ECalView *cal_view)
+e_calendar_view_get_model (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return cal_view->priv->model;
}
void
-e_cal_view_set_model (ECalView *cal_view, ECalModel *model)
+e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
g_return_if_fail (E_IS_CAL_MODEL (model));
if (cal_view->priv->model) {
@@ -551,41 +551,41 @@ e_cal_view_set_model (ECalView *cal_view, ECalModel *model)
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_rows_inserted", G_CALLBACK (model_rows_changed_cb), cal_view);
g_signal_connect (G_OBJECT (cal_view->priv->model), "model_rows_deleted", G_CALLBACK (model_rows_changed_cb), cal_view);
- e_cal_view_update_query (cal_view);
+ e_calendar_view_update_query (cal_view);
}
icaltimezone *
-e_cal_view_get_timezone (ECalView *cal_view)
+e_calendar_view_get_timezone (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return e_cal_model_get_timezone (cal_view->priv->model);
}
void
-e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone)
+e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone)
{
icaltimezone *old_zone;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
old_zone = e_cal_model_get_timezone (cal_view->priv->model);
if (old_zone == zone)
return;
e_cal_model_set_timezone (cal_view->priv->model, zone);
- g_signal_emit (G_OBJECT (cal_view), e_cal_view_signals[TIMEZONE_CHANGED], 0,
+ g_signal_emit (G_OBJECT (cal_view), e_calendar_view_signals[TIMEZONE_CHANGED], 0,
old_zone, zone);
}
const char *
-e_cal_view_get_default_category (ECalView *cal_view)
+e_calendar_view_get_default_category (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
return (const char *) cal_view->priv->default_category;
}
/**
- * e_cal_view_set_default_category
+ * e_calendar_view_set_default_category
* @cal_view: A calendar view.
* @category: Default category name or NULL for no category.
*
@@ -593,9 +593,9 @@ e_cal_view_get_default_category (ECalView *cal_view)
* components from the given calendar view.
*/
void
-e_cal_view_set_default_category (ECalView *cal_view, const char *category)
+e_calendar_view_set_default_category (ECalendarView *cal_view, const char *category)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (cal_view->priv->default_category)
g_free (cal_view->priv->default_category);
@@ -604,7 +604,7 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
}
/**
- * e_cal_view_get_use_24_hour_format:
+ * e_calendar_view_get_use_24_hour_format:
* @cal_view: A calendar view.
*
* Gets whether the view is using 24 hour times or not.
@@ -612,32 +612,32 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
* Returns: the 24 hour setting.
*/
gboolean
-e_cal_view_get_use_24_hour_format (ECalView *cal_view)
+e_calendar_view_get_use_24_hour_format (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE);
return e_cal_model_get_use_24_hour_format (cal_view->priv->model);
}
/**
- * e_cal_view_set_use_24_hour_format
+ * e_calendar_view_set_use_24_hour_format
* @cal_view: A calendar view.
* @use_24_hour: Whether to use 24 hour times or not.
*
* Sets the 12/24 hour times setting for the given view.
*/
void
-e_cal_view_set_use_24_hour_format (ECalView *cal_view, gboolean use_24_hour)
+e_calendar_view_set_use_24_hour_format (ECalendarView *cal_view, gboolean use_24_hour)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour);
}
void
-e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
+e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
if (!message || !*message) {
if (cal_view->priv->activity) {
@@ -665,45 +665,45 @@ e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
}
GList *
-e_cal_view_get_selected_events (ECalView *cal_view)
+e_calendar_view_get_selected_events (ECalendarView *cal_view)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events)
- return E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events (cal_view);
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events)
+ return E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_events (cal_view);
return NULL;
}
void
-e_cal_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_calendar_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_selected_time_range (
cal_view, start_time, end_time);
}
}
void
-e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time)
+e_calendar_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->set_selected_time_range (
cal_view, start_time, end_time);
}
}
gboolean
-e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_calendar_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE);
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range) {
- return E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range (
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range) {
+ return E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range (
cal_view, start_time, end_time);
}
@@ -711,91 +711,91 @@ e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_
}
void
-e_cal_view_update_query (ECalView *cal_view)
+e_calendar_view_update_query (ECalendarView *cal_view)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- e_cal_view_set_status_message (cal_view, _("Searching"));
+ e_calendar_view_set_status_message (cal_view, _("Searching"));
- if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
- E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
+ if (E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
+ E_CALENDAR_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
}
void
-e_cal_view_cut_clipboard (ECalView *cal_view)
+e_calendar_view_cut_clipboard (ECalendarView *cal_view)
{
GList *selected, *l;
const char *uid;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- e_cal_view_set_status_message (cal_view, _("Deleting selected objects"));
+ e_calendar_view_set_status_message (cal_view, _("Deleting selected objects"));
- e_cal_view_copy_clipboard (cal_view);
+ e_calendar_view_copy_clipboard (cal_view);
for (l = selected; l != NULL; l = l->next) {
- CalComponent *comp;
- ECalViewEvent *event = (ECalViewEvent *) l->data;
+ ECalComponent *comp;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) l->data;
GError *error = NULL;
if (!event)
continue;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (itip_organizer_is_user (comp, event->comp_data->client)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client, comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
event->comp_data->client, NULL);
- cal_component_get_uid (comp, &uid);
- cal_client_remove_object (event->comp_data->client, uid, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ e_cal_component_get_uid (comp, &uid);
+ e_cal_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
g_object_unref (comp);
}
- e_cal_view_set_status_message (cal_view, NULL);
+ e_calendar_view_set_status_message (cal_view, NULL);
g_list_free (selected);
}
void
-e_cal_view_copy_clipboard (ECalView *cal_view)
+e_calendar_view_copy_clipboard (ECalendarView *cal_view)
{
GList *selected, *l;
gchar *comp_str;
icalcomponent *vcal_comp;
icalcomponent *new_icalcomp;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
/* create top-level VCALENDAR component and add VTIMEZONE's */
- vcal_comp = cal_util_new_top_level ();
+ vcal_comp = e_cal_util_new_top_level ();
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
if (event)
- cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
}
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
new_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp);
icalcomponent_add_component (vcal_comp, new_icalcomp);
@@ -814,9 +814,9 @@ e_cal_view_copy_clipboard (ECalView *cal_view)
}
void
-e_cal_view_paste_clipboard (ECalView *cal_view)
+e_calendar_view_paste_clipboard (ECalendarView *cal_view)
{
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
gtk_selection_convert (cal_view->priv->invisible,
clipboard_atom,
@@ -825,14 +825,14 @@ e_cal_view_paste_clipboard (ECalView *cal_view)
}
static void
-delete_event (ECalView *cal_view, ECalViewEvent *event)
+delete_event (ECalendarView *cal_view, ECalendarViewEvent *event)
{
- CalComponent *comp;
- CalComponentVType vtype;
+ ECalComponent *comp;
+ ECalComponentVType vtype;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- vtype = cal_component_get_vtype (comp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ vtype = e_cal_component_get_vtype (comp);
if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) {
const char *uid;
@@ -842,17 +842,17 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
event->comp_data->client, NULL);
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
if (!uid || !*uid) {
g_object_unref (comp);
return;
}
- cal_client_remove_object (event->comp_data->client, uid, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ e_cal_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
}
@@ -860,16 +860,16 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
}
void
-e_cal_view_delete_selected_event (ECalView *cal_view)
+e_calendar_view_delete_selected_event (ECalendarView *cal_view)
{
GList *selected;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
if (event)
delete_event (cal_view, event);
@@ -877,17 +877,17 @@ e_cal_view_delete_selected_event (ECalView *cal_view)
}
void
-e_cal_view_delete_selected_events (ECalView *cal_view)
+e_calendar_view_delete_selected_events (ECalendarView *cal_view)
{
GList *selected, *l;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
for (l = selected; l != NULL; l = l->next) {
- event = (ECalViewEvent *) l->data;
+ event = (ECalendarViewEvent *) l->data;
if (event)
delete_event (cal_view, event);
}
@@ -896,24 +896,24 @@ e_cal_view_delete_selected_events (ECalView *cal_view)
}
void
-e_cal_view_delete_selected_occurrence (ECalView *cal_view)
+e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
{
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
GList *selected;
const char *uid;
GError *error = NULL;
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
uid = icalcomponent_get_uid (event->comp_data->icalcomp);
/* FIXME: use 'rid' argument */
- cal_client_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error);
+ e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error);
- delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
g_clear_error (&error);
/* free memory */
@@ -923,42 +923,42 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view)
static void
on_new_appointment (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_new_appointment (cal_view);
+ e_calendar_view_new_appointment (cal_view);
}
static void
on_new_event (GtkWidget *widget, gpointer user_data)
{
time_t dtstart, dtend;
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, TRUE, FALSE);
}
static void
on_new_meeting (GtkWidget *widget, gpointer user_data)
{
time_t dtstart, dtend;
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, TRUE);
}
static void
on_new_task (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = (ECalView *) user_data;
+ ECalendarView *cal_view = (ECalendarView *) user_data;
gnome_calendar_new_task (cal_view->priv->calendar);
}
static void
on_goto_date (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
goto_dialog (cal_view->priv->calendar);
}
@@ -966,7 +966,7 @@ on_goto_date (GtkWidget *widget, gpointer user_data)
static void
on_goto_today (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
calendar_goto_today (cal_view->priv->calendar);
}
@@ -975,14 +975,14 @@ static void
on_edit_appointment (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
if (event)
- e_cal_view_edit_appointment (cal_view, event->comp_data->client,
+ e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
event->comp_data->icalcomp, FALSE);
g_list_free (selected);
@@ -992,14 +992,14 @@ on_edit_appointment (GtkWidget *widget, gpointer user_data)
static void
on_print (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
time_t start;
GnomeCalendarViewType view_type;
PrintView print_view;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_get_visible_time_range (cal_view, &start, NULL);
+ e_calendar_view_get_visible_time_range (cal_view, &start, NULL);
view_type = gnome_calendar_get_view (cal_view->priv->calendar);
switch (view_type) {
@@ -1027,16 +1027,16 @@ on_print (GtkWidget *widget, gpointer user_data)
static void
on_save_as (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
GList *selected;
char *filename;
char *ical_string;
FILE *file;
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1044,8 +1044,8 @@ on_save_as (GtkWidget *widget, gpointer user_data)
if (filename == NULL)
return;
- event = (ECalViewEvent *) selected->data;
- ical_string = cal_client_get_component_as_string (event->comp_data->client, event->comp_data->icalcomp);
+ event = (ECalendarViewEvent *) selected->data;
+ ical_string = e_cal_get_component_as_string (event->comp_data->client, event->comp_data->icalcomp);
if (ical_string == NULL) {
g_warning ("Couldn't convert item to a string");
return;
@@ -1067,20 +1067,20 @@ on_save_as (GtkWidget *widget, gpointer user_data)
static void
on_print_event (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
GList *selected;
- ECalViewEvent *event;
- CalComponent *comp;
+ ECalendarViewEvent *event;
+ ECalComponent *comp;
- cal_view = E_CAL_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
- event = (ECalViewEvent *) selected->data;
+ event = (ECalendarViewEvent *) selected->data;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
print_comp (comp, event->comp_data->client, FALSE);
g_object_unref (comp);
@@ -1090,12 +1090,12 @@ static void
on_meeting (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
- e_cal_view_edit_appointment (cal_view, event->comp_data->client, event->comp_data->icalcomp, TRUE);
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
+ e_calendar_view_edit_appointment (cal_view, event->comp_data->client, event->comp_data->icalcomp, TRUE);
g_list_free (selected);
}
@@ -1105,16 +1105,16 @@ static void
on_forward (GtkWidget *widget, gpointer user_data)
{
GList *selected;
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
- CalComponent *comp;
- ECalViewEvent *event = (ECalViewEvent *) selected->data;
+ ECalComponent *comp;
+ ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL);
g_list_free (selected);
g_object_unref (comp);
@@ -1124,12 +1124,12 @@ on_forward (GtkWidget *widget, gpointer user_data)
static void
on_publish (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
icaltimezone *utc;
time_t start = time (NULL), end;
GList *comp_list = NULL, *client_list, *cl;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
utc = icaltimezone_get_utc_timezone ();
start = time_day_begin_with_zone (start, utc);
@@ -1137,12 +1137,12 @@ on_publish (GtkWidget *widget, gpointer user_data)
client_list = e_cal_model_get_client_list (cal_view->priv->model);
for (cl = client_list; cl != NULL; cl = cl->next) {
- if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
+ if (e_cal_get_free_busy ((ECal *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, (CalClient *) cl->data, NULL);
+ ECalComponent *comp = E_CAL_COMPONENT (l->data);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, (ECal *) cl->data, NULL);
g_object_unref (comp);
}
@@ -1157,52 +1157,52 @@ on_publish (GtkWidget *widget, gpointer user_data)
static void
on_settings (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
+ cal_view = E_CALENDAR_VIEW (user_data);
control_util_show_settings (cal_view->priv->calendar);
}
static void
on_delete_appointment (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
- e_cal_view_delete_selected_event (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ e_calendar_view_delete_selected_event (cal_view);
}
static void
on_delete_occurrence (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view;
+ ECalendarView *cal_view;
- cal_view = E_CAL_VIEW (user_data);
- e_cal_view_delete_selected_occurrence (cal_view);
+ cal_view = E_CALENDAR_VIEW (user_data);
+ e_calendar_view_delete_selected_occurrence (cal_view);
}
static void
on_cut (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_cut_clipboard (cal_view);
+ e_calendar_view_cut_clipboard (cal_view);
}
static void
on_copy (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_copy_clipboard (cal_view);
+ e_calendar_view_copy_clipboard (cal_view);
}
static void
on_paste (GtkWidget *widget, gpointer user_data)
{
- ECalView *cal_view = E_CAL_VIEW (user_data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
- e_cal_view_paste_clipboard (cal_view);
+ e_calendar_view_paste_clipboard (cal_view);
}
enum {
@@ -1307,7 +1307,7 @@ static EPopupMenu child_items [] = {
static void
free_view_popup (GtkWidget *widget, gpointer data)
{
- ECalView *cal_view = E_CAL_VIEW (data);
+ ECalendarView *cal_view = E_CALENDAR_VIEW (data);
if (cal_view->priv->view_menu == NULL)
return;
@@ -1362,19 +1362,19 @@ setup_popup_icons (EPopupMenu *context_menu)
}
GtkMenu *
-e_cal_view_create_popup_menu (ECalView *cal_view)
+e_calendar_view_create_popup_menu (ECalendarView *cal_view)
{
GList *selected;
EPopupMenu *context_menu;
guint32 disable_mask = 0, hide_mask = 0;
GtkMenu *popup;
- CalClient *client = NULL;
+ ECal *client = NULL;
gboolean read_only = TRUE;
- g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
/* get the selection */
- selected = e_cal_view_get_selected_events (cal_view);
+ selected = e_calendar_view_get_selected_events (cal_view);
if (selected == NULL) {
cal_view->priv->view_menu = gnome_calendar_setup_view_popup (cal_view->priv->calendar);
@@ -1383,26 +1383,26 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = e_cal_model_get_default_client (cal_view->priv->model);
} else {
- ECalViewEvent *event;
+ ECalendarViewEvent *event;
context_menu = child_items;
- event = (ECalViewEvent *) selected->data;
- if (cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ event = (ECalendarViewEvent *) selected->data;
+ if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
hide_mask |= MASK_SINGLE;
else
hide_mask |= MASK_RECURRING;
- if (cal_util_component_is_instance (event->comp_data->icalcomp))
+ if (e_cal_util_component_is_instance (event->comp_data->icalcomp))
hide_mask |= MASK_INSTANCE;
- if (cal_util_component_has_organizer (event->comp_data->icalcomp)) {
- CalComponent *comp;
+ if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
+ ECalComponent *comp;
disable_mask |= MASK_MEETING;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (!itip_organizer_is_user (comp, event->comp_data->client))
disable_mask |= MASK_MEETING_ORGANIZER;
@@ -1412,7 +1412,7 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = event->comp_data->client;
}
- cal_client_is_read_only (client, &read_only, NULL);
+ e_cal_is_read_only (client, &read_only, NULL);
if (read_only)
disable_mask |= MASK_EDITABLE;
@@ -1424,7 +1424,7 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
}
/**
- * e_cal_view_new_appointment_for
+ * e_calendar_view_new_appointment_for
* @cal_view: A calendar view.
* @dtstart: A Unix time_t that marks the beginning of the appointment.
* @dtend: A Unix time_t that marks the end of the appointment.
@@ -1435,19 +1435,19 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
* Opens an event editor dialog for a new appointment.
*/
void
-e_cal_view_new_appointment_for (ECalView *cal_view,
+e_calendar_view_new_appointment_for (ECalendarView *cal_view,
time_t dtstart, time_t dtend,
gboolean all_day,
gboolean meeting)
{
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
struct icaltimetype itt;
- CalComponentDateTime dt;
- CalComponent *comp;
+ ECalComponentDateTime dt;
+ ECalComponent *comp;
icalcomponent *icalcomp;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
priv = cal_view->priv;
@@ -1458,8 +1458,8 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
dt.tzid = icaltimezone_get_tzid (e_cal_model_get_timezone (cal_view->priv->model));
icalcomp = e_cal_model_create_component_with_defaults (priv->model);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
/* DTSTART, DTEND */
itt = icaltime_from_timet_with_zone (dtstart, FALSE, e_cal_model_get_timezone (cal_view->priv->model));
@@ -1467,7 +1467,7 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
itt.hour = itt.minute = itt.second = 0;
itt.is_date = TRUE;
}
- cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtstart (comp, &dt);
itt = icaltime_from_timet_with_zone (dtend, FALSE, e_cal_model_get_timezone (cal_view->priv->model));
if (all_day) {
@@ -1479,20 +1479,20 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
itt.hour = itt.minute = itt.second = 0;
itt.is_date = TRUE;
}
- cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtend (comp, &dt);
/* TRANSPARENCY */
- transparency = all_day ? CAL_COMPONENT_TRANSP_TRANSPARENT
- : CAL_COMPONENT_TRANSP_OPAQUE;
- cal_component_set_transparency (comp, transparency);
+ transparency = all_day ? E_CAL_COMPONENT_TRANSP_TRANSPARENT
+ : E_CAL_COMPONENT_TRANSP_OPAQUE;
+ e_cal_component_set_transparency (comp, transparency);
/* CATEGORY */
- cal_component_set_categories (comp, priv->default_category);
+ e_cal_component_set_categories (comp, priv->default_category);
/* edit the object */
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
- e_cal_view_edit_appointment (cal_view,
+ e_calendar_view_edit_appointment (cal_view,
e_cal_model_get_default_client (priv->model),
icalcomp, meeting);
@@ -1500,7 +1500,7 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
}
/**
- * e_cal_view_new_appointment
+ * e_calendar_view_new_appointment
* @cal_view: A calendar view.
*
* Opens an event editor dialog for a new appointment. The appointment's
@@ -1508,18 +1508,18 @@ e_cal_view_new_appointment_for (ECalView *cal_view,
* the calendar view.
*/
void
-e_cal_view_new_appointment (ECalView *cal_view)
+e_calendar_view_new_appointment (ECalendarView *cal_view)
{
time_t dtstart, dtend;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- e_cal_view_get_selected_time_range (cal_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, FALSE, FALSE);
}
/**
- * e_cal_view_edit_appointment
+ * e_calendar_view_edit_appointment
* @cal_view: A calendar view.
* @client: Calendar client.
* @icalcomp: The object to be edited.
@@ -1529,18 +1529,18 @@ e_cal_view_new_appointment (ECalView *cal_view)
* object.
*/
void
-e_cal_view_edit_appointment (ECalView *cal_view,
- CalClient *client,
+e_calendar_view_edit_appointment (ECalendarView *cal_view,
+ ECal *client,
icalcomponent *icalcomp,
gboolean meeting)
{
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
CompEditor *ce;
const char *uid;
- CalComponent *comp;
+ ECalComponent *comp;
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+ g_return_if_fail (E_IS_CAL (client));
g_return_if_fail (icalcomp != NULL);
priv = cal_view->priv;
@@ -1554,8 +1554,8 @@ e_cal_view_edit_appointment (ECalView *cal_view,
ee = event_editor_new (client);
ce = COMP_EDITOR (ee);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
comp_editor_edit_comp (ce, comp);
if (meeting)
event_editor_show_meeting (ee);
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 292871b709..a1b11023b3 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -20,10 +20,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-#ifndef _E_CAL_VIEW_H_
-#define _E_CAL_VIEW_H_
+#ifndef _E_CALENDAR_VIEW_H_
+#define _E_CALENDAR_VIEW_H_
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include <gtk/gtktable.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
@@ -34,21 +34,21 @@ G_BEGIN_DECLS
* EView - base widget class for the calendar views.
*/
-#define E_CAL_VIEW(obj) GTK_CHECK_CAST (obj, e_cal_view_get_type (), ECalView)
-#define E_CAL_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cal_view_get_type (), ECalViewClass)
-#define E_IS_CAL_VIEW(obj) GTK_CHECK_TYPE (obj, e_cal_view_get_type ())
+#define E_CALENDAR_VIEW(obj) GTK_CHECK_CAST (obj, e_calendar_view_get_type (), ECalendarView)
+#define E_CALENDAR_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_calendar_view_get_type (), ECalendarViewClass)
+#define E_IS_CALENDAR_VIEW(obj) GTK_CHECK_TYPE (obj, e_calendar_view_get_type ())
typedef enum {
- E_CAL_VIEW_POS_OUTSIDE,
- E_CAL_VIEW_POS_NONE,
- E_CAL_VIEW_POS_EVENT,
- E_CAL_VIEW_POS_LEFT_EDGE,
- E_CAL_VIEW_POS_RIGHT_EDGE,
- E_CAL_VIEW_POS_TOP_EDGE,
- E_CAL_VIEW_POS_BOTTOM_EDGE
-} ECalViewPosition;
-
-#define E_CAL_VIEW_EVENT_FIELDS \
+ E_CALENDAR_VIEW_POS_OUTSIDE,
+ E_CALENDAR_VIEW_POS_NONE,
+ E_CALENDAR_VIEW_POS_EVENT,
+ E_CALENDAR_VIEW_POS_LEFT_EDGE,
+ E_CALENDAR_VIEW_POS_RIGHT_EDGE,
+ E_CALENDAR_VIEW_POS_TOP_EDGE,
+ E_CALENDAR_VIEW_POS_BOTTOM_EDGE
+} ECalendarViewPosition;
+
+#define E_CALENDAR_VIEW_EVENT_FIELDS \
GnomeCanvasItem *canvas_item; \
ECalModelComponent *comp_data; \
gboolean allocated_comp_data; \
@@ -59,76 +59,76 @@ typedef enum {
guint different_timezone : 1;
typedef struct {
- E_CAL_VIEW_EVENT_FIELDS
-} ECalViewEvent;
+ E_CALENDAR_VIEW_EVENT_FIELDS
+} ECalendarViewEvent;
-typedef struct _ECalView ECalView;
-typedef struct _ECalViewClass ECalViewClass;
-typedef struct _ECalViewPrivate ECalViewPrivate;
+typedef struct _ECalendarView ECalendarView;
+typedef struct _ECalendarViewClass ECalendarViewClass;
+typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
-struct _ECalView {
+struct _ECalendarView {
GtkTable table;
- ECalViewPrivate *priv;
+ ECalendarViewPrivate *priv;
};
-struct _ECalViewClass {
+struct _ECalendarViewClass {
GtkTableClass parent_class;
/* Notification signals */
- void (* selection_changed) (ECalView *cal_view);
- void (* selected_time_changed) (ECalView *cal_view);
- void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
- void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
- void (* event_added) (ECalView *day_view, ECalViewEvent *event);
+ void (* selection_changed) (ECalendarView *cal_view);
+ void (* selected_time_changed) (ECalendarView *cal_view);
+ void (* timezone_changed) (ECalendarView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
+ void (* event_changed) (ECalendarView *day_view, ECalendarViewEvent *event);
+ void (* event_added) (ECalendarView *day_view, ECalendarViewEvent *event);
/* Virtual methods */
- GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
- void (* get_selected_time_range) (ECalView *cal_view, time_t *start_time, time_t *end_time);
- void (* set_selected_time_range) (ECalView *cal_view, time_t start_time, time_t end_time);
- gboolean (* get_visible_time_range) (ECalView *cal_view, time_t *start_time, time_t *end_time);
- void (* update_query) (ECalView *cal_view);
+ GList * (* get_selected_events) (ECalendarView *cal_view); /* a GList of ECalendarViewEvent's */
+ void (* get_selected_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+ void (* set_selected_time_range) (ECalendarView *cal_view, time_t start_time, time_t end_time);
+ gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+ void (* update_query) (ECalendarView *cal_view);
};
-GType e_cal_view_get_type (void);
-
-GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view);
-void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar);
-ECalModel *e_cal_view_get_model (ECalView *cal_view);
-void e_cal_view_set_model (ECalView *cal_view, ECalModel *model);
-icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
-void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
-const char *e_cal_view_get_default_category (ECalView *cal_view);
-void e_cal_view_set_default_category (ECalView *cal_view, const char *category);
-gboolean e_cal_view_get_use_24_hour_format (ECalView *view);
-void e_cal_view_set_use_24_hour_format (ECalView *view, gboolean use_24_hour);
-
-void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
-
-GList *e_cal_view_get_selected_events (ECalView *cal_view);
-void e_cal_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-void e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time);
-gboolean e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-void e_cal_view_update_query (ECalView *cal_view);
-
-void e_cal_view_cut_clipboard (ECalView *cal_view);
-void e_cal_view_copy_clipboard (ECalView *cal_view);
-void e_cal_view_paste_clipboard (ECalView *cal_view);
-void e_cal_view_delete_selected_event (ECalView *cal_view);
-void e_cal_view_delete_selected_events (ECalView *cal_view);
-void e_cal_view_delete_selected_occurrence (ECalView *cal_view);
-
-GtkMenu *e_cal_view_create_popup_menu (ECalView *cal_view);
-
-void e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart,
+GType e_calendar_view_get_type (void);
+
+GnomeCalendar *e_calendar_view_get_calendar (ECalendarView *cal_view);
+void e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar);
+ECalModel *e_calendar_view_get_model (ECalendarView *cal_view);
+void e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model);
+icaltimezone *e_calendar_view_get_timezone (ECalendarView *cal_view);
+void e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone);
+const char *e_calendar_view_get_default_category (ECalendarView *cal_view);
+void e_calendar_view_set_default_category (ECalendarView *cal_view, const char *category);
+gboolean e_calendar_view_get_use_24_hour_format (ECalendarView *view);
+void e_calendar_view_set_use_24_hour_format (ECalendarView *view, gboolean use_24_hour);
+
+void e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message);
+
+GList *e_calendar_view_get_selected_events (ECalendarView *cal_view);
+void e_calendar_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+void e_calendar_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time);
+gboolean e_calendar_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+void e_calendar_view_update_query (ECalendarView *cal_view);
+
+void e_calendar_view_cut_clipboard (ECalendarView *cal_view);
+void e_calendar_view_copy_clipboard (ECalendarView *cal_view);
+void e_calendar_view_paste_clipboard (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_event (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_events (ECalendarView *cal_view);
+void e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view);
+
+GtkMenu *e_calendar_view_create_popup_menu (ECalendarView *cal_view);
+
+void e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas);
-void e_cal_view_new_appointment_for (ECalView *cal_view,
+void e_calendar_view_new_appointment_for (ECalendarView *cal_view,
time_t dtstart,
time_t dtend,
gboolean all_day,
gboolean meeting);
-void e_cal_view_new_appointment (ECalView *cal_view);
-void e_cal_view_edit_appointment (ECalView *cal_view,
- CalClient *client,
+void e_calendar_view_new_appointment (ECalendarView *cal_view);
+void e_calendar_view_edit_appointment (ECalendarView *cal_view,
+ ECal *client,
icalcomponent *icalcomp,
gboolean meeting);
diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c
index afd5fc1fb6..3d045fbdd6 100644
--- a/calendar/gui/e-cell-date-edit-text.c
+++ b/calendar/gui/e-cell-date-edit-text.c
@@ -23,7 +23,7 @@
/*
* ECellDateEditText - a subclass of ECellText used to show and edit the text
- * representation of the date, from a CalComponentDateTime* model value.
+ * representation of the date, from a ECalComponentDateTime* model value.
*/
#include <config.h>
@@ -38,7 +38,7 @@
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <e-util/e-time-utils.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "e-cell-date-edit-text.h"
@@ -214,7 +214,7 @@ e_cell_date_edit_text_init (GtkObject *object)
*
* Creates a new ECell renderer that can be used to render and edit dates that
* that come from the model. The value returned from the model is
- * interpreted as being a CalComponentDateTime*.
+ * interpreted as being a ECalComponentDateTime*.
*
* Returns: an ECell object that can be used to render dates.
*/
diff --git a/calendar/gui/e-cell-date-edit-text.h b/calendar/gui/e-cell-date-edit-text.h
index 53abb7dcff..ab00c0b39c 100644
--- a/calendar/gui/e-cell-date-edit-text.h
+++ b/calendar/gui/e-cell-date-edit-text.h
@@ -23,7 +23,7 @@
/*
* ECellDateEditText - a subclass of ECellText used to show and edit the text
- * representation of the date, from a CalComponentDateTime* model value.
+ * representation of the date, from a ECalComponentDateTime* model value.
*/
#ifndef _E_CELL_DATE_EDIT_TEXT_H_
diff --git a/calendar/gui/e-comp-editor-registry.c b/calendar/gui/e-comp-editor-registry.c
index 68b33d11ff..9e2a63bd48 100644
--- a/calendar/gui/e-comp-editor-registry.c
+++ b/calendar/gui/e-comp-editor-registry.c
@@ -107,7 +107,7 @@ e_comp_editor_registry_add (ECompEditorRegistry *reg, CompEditor *editor, gboole
{
ECompEditorRegistryPrivate *priv;
ECompEditorRegistryData *rdata;
- CalComponent *comp;
+ ECalComponent *comp;
const char *uid;
g_return_if_fail (reg != NULL);
@@ -118,7 +118,7 @@ e_comp_editor_registry_add (ECompEditorRegistry *reg, CompEditor *editor, gboole
priv = reg->priv;
comp = comp_editor_get_comp (editor);
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
rdata = g_new0 (ECompEditorRegistryData, 1);
@@ -193,14 +193,14 @@ editor_destroy_cb (GtkWidget *widget, gpointer data)
ECompEditorRegistry *reg;
ECompEditorRegistryPrivate *priv;
ECompEditorRegistryData *rdata;
- CalComponent *comp;
+ ECalComponent *comp;
const char *uid;
reg = E_COMP_EDITOR_REGISTRY (data);
priv = reg->priv;
comp = comp_editor_get_comp (COMP_EDITOR (widget));
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
rdata = g_hash_table_lookup (priv->editors, uid);
diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c
index 5aef6f9c51..348ccc86a9 100644
--- a/calendar/gui/e-date-time-list.c
+++ b/calendar/gui/e-date-time-list.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include <e-util/e-time-utils.h>
#include "e-date-time-list.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "calendar-config.h"
#define G_LIST(x) ((GList *) x)
@@ -262,7 +262,7 @@ e_date_time_list_get_column_type (GtkTreeModel *tree_model,
return column_types [index];
}
-const CalComponentDateTime *
+const ECalComponentDateTime *
e_date_time_list_get_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter)
{
g_return_val_if_fail (IS_VALID_ITER (date_time_list, iter), NULL);
@@ -271,7 +271,7 @@ e_date_time_list_get_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter
}
static void
-free_datetime (CalComponentDateTime *datetime)
+free_datetime (ECalComponentDateTime *datetime)
{
g_free (datetime->value);
if (datetime->tzid)
@@ -279,12 +279,12 @@ free_datetime (CalComponentDateTime *datetime)
g_free (datetime);
}
-static CalComponentDateTime *
-copy_datetime (const CalComponentDateTime *datetime)
+static ECalComponentDateTime *
+copy_datetime (const ECalComponentDateTime *datetime)
{
- CalComponentDateTime *datetime_copy;
+ ECalComponentDateTime *datetime_copy;
- datetime_copy = g_new0 (CalComponentDateTime, 1);
+ datetime_copy = g_new0 (ECalComponentDateTime, 1);
datetime_copy->value = g_new (struct icaltimetype, 1);
*datetime_copy->value = *datetime->value;
@@ -295,16 +295,16 @@ copy_datetime (const CalComponentDateTime *datetime)
}
static gint
-compare_datetime (const CalComponentDateTime *datetime1, const CalComponentDateTime *datetime2)
+compare_datetime (const ECalComponentDateTime *datetime1, const ECalComponentDateTime *datetime2)
{
return icaltime_compare (*datetime1->value, *datetime2->value);
}
void
e_date_time_list_set_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter,
- const CalComponentDateTime *datetime)
+ const ECalComponentDateTime *datetime)
{
- CalComponentDateTime *datetime_old;
+ ECalComponentDateTime *datetime_old;
g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
@@ -316,7 +316,7 @@ e_date_time_list_set_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter
void
e_date_time_list_append (EDateTimeList *date_time_list, GtkTreeIter *iter,
- const CalComponentDateTime *datetime)
+ const ECalComponentDateTime *datetime)
{
g_return_if_fail (datetime != NULL);
@@ -339,7 +339,7 @@ e_date_time_list_remove (EDateTimeList *date_time_list, GtkTreeIter *iter)
g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
n = g_list_position (date_time_list->list, G_LIST (iter->user_data));
- free_datetime ((CalComponentDateTime *) G_LIST (iter->user_data)->data);
+ free_datetime ((ECalComponentDateTime *) G_LIST (iter->user_data)->data);
date_time_list->list = g_list_delete_link (date_time_list->list, G_LIST (iter->user_data));
row_deleted (date_time_list, n);
}
@@ -352,7 +352,7 @@ e_date_time_list_clear (EDateTimeList *date_time_list)
all_rows_deleted (date_time_list);
for (l = date_time_list->list; l; l = g_list_next (l)) {
- free_datetime ((CalComponentDateTime *) l->data);
+ free_datetime ((ECalComponentDateTime *) l->data);
}
g_list_free (date_time_list->list);
@@ -403,7 +403,7 @@ e_date_time_list_get_path (GtkTreeModel *tree_model,
/* Builds a static string out of an exception date */
static char *
-get_exception_string (CalComponentDateTime *dt)
+get_exception_string (ECalComponentDateTime *dt)
{
static char buf [256];
struct tm tmp_tm;
@@ -433,7 +433,7 @@ e_date_time_list_get_value (GtkTreeModel *tree_model,
GValue *value)
{
EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
- CalComponentDateTime *datetime;
+ ECalComponentDateTime *datetime;
GList *l;
const gchar *str;
diff --git a/calendar/gui/e-date-time-list.h b/calendar/gui/e-date-time-list.h
index 07a7c77b02..83b145c7c6 100644
--- a/calendar/gui/e-date-time-list.h
+++ b/calendar/gui/e-date-time-list.h
@@ -24,7 +24,7 @@
#define E_DATE_TIME_LIST_H
#include <gtk/gtktreemodel.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
G_BEGIN_DECLS
@@ -66,14 +66,14 @@ struct _EDateTimeListClass
GtkType e_date_time_list_get_type (void);
EDateTimeList *e_date_time_list_new (void);
-const CalComponentDateTime *e_date_time_list_get_date_time (EDateTimeList *date_time_list,
+const ECalComponentDateTime *e_date_time_list_get_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter);
void e_date_time_list_set_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const CalComponentDateTime *datetime);
+ const ECalComponentDateTime *datetime);
void e_date_time_list_append (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const CalComponentDateTime *datetime);
+ const ECalComponentDateTime *datetime);
void e_date_time_list_remove (EDateTimeList *date_time_list,
GtkTreeIter *iter);
void e_date_time_list_clear (EDateTimeList *date_time_list);
diff --git a/calendar/gui/e-day-view-config.c b/calendar/gui/e-day-view-config.c
index bee97919f1..4c10451f40 100644
--- a/calendar/gui/e-day-view-config.c
+++ b/calendar/gui/e-day-view-config.c
@@ -167,7 +167,7 @@ set_timezone (EDayView *day_view)
if (!zone)
zone = icaltimezone_get_utc_timezone ();
- e_cal_view_set_timezone (E_CAL_VIEW (day_view), zone);
+ e_calendar_view_set_timezone (E_CALENDAR_VIEW (day_view), zone);
g_free (location);
}
@@ -214,7 +214,7 @@ set_twentyfour_hour (EDayView *day_view)
use_24_hour = calendar_config_get_24_hour_format ();
- e_cal_view_set_use_24_hour_format (E_CAL_VIEW (day_view), use_24_hour);
+ e_calendar_view_set_use_24_hour_format (E_CALENDAR_VIEW (day_view), use_24_hour);
}
static void
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 15d6141a5a..2b7787ded4 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -191,7 +191,7 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
for (day = 0; day < day_view->days_shown; day++) {
day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
weekday = icaltime_day_of_week (day_start_tt) - 1;
work_day = day_view->working_days & (1 << weekday);
@@ -318,7 +318,7 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem,
EDayViewEvent *event;
GdkGC *gc;
gint grid_x, event_num, bar_y, bar_h;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -330,17 +330,17 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem,
/* Draw the busy times corresponding to the events in the day. */
for (event_num = 0; event_num < day_view->events[day]->len;
event_num++) {
- CalComponent *comp;
+ ECalComponent *comp;
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
/* If the event is TRANSPARENT, skip it. */
- cal_component_get_transparency (comp, &transparency);
- if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ e_cal_component_get_transparency (comp, &transparency);
+ if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT)
continue;
/* We can skip the events in the first column since they will
@@ -375,7 +375,7 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem,
EDayViewEvent *event;
gint event_num, start_day, end_day, day, bar_y1, bar_y2, grid_x;
GdkGC *gc;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -384,17 +384,17 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem,
for (event_num = 0; event_num < day_view->long_events->len;
event_num++) {
- CalComponent *comp;
+ ECalComponent *comp;
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
/* If the event is TRANSPARENT, skip it. */
- cal_component_get_transparency (comp, &transparency);
- if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ e_cal_component_get_transparency (comp, &transparency);
+ if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT)
continue;
if (!e_day_view_find_long_event_days (event,
@@ -469,12 +469,12 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
GtkStyle *style;
GdkGC *gc;
GdkColor bg_color;
- CalComponent *comp;
+ ECalComponent *comp;
gint num_icons, icon_x, icon_y, icon_x_inc, icon_y_inc;
gint max_icon_w, max_icon_h;
gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon;
GSList *categories_list, *elem;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -505,7 +505,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
since that is used for multiple events. But then you can't see
where the event in the first column finishes. */
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_cal_view_get_model (E_CAL_VIEW (day_view)), event->comp_data),
+ if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
&bg_color)) {
GdkColormap *colormap;
@@ -541,21 +541,21 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
bar_y2 = event->end_minute * day_view->row_height / day_view->mins_per_row - y;
/* When an item is being resized, we fill the bar up to the new row. */
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == day
&& day_view->resize_event_num == event_num) {
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_TOP_EDGE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE)
bar_y1 = item_y + 1;
- else if (day_view->resize_drag_pos == E_CAL_VIEW_POS_BOTTOM_EDGE)
+ else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE)
bar_y2 = item_y + item_h - 1;
}
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
/* Only fill it in if the event isn't TRANSPARENT. */
- cal_component_get_transparency (comp, &transparency);
- if (transparency != CAL_COMPONENT_TRANSP_TRANSPARENT) {
+ e_cal_component_get_transparency (comp, &transparency);
+ if (transparency != E_CAL_COMPONENT_TRANSP_TRANSPARENT) {
gdk_draw_rectangle (drawable, gc, TRUE,
item_x + 1, bar_y1,
E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1);
@@ -593,12 +593,12 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
icon_y = item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT
+ E_DAY_VIEW_ICON_Y_PAD;
- if (cal_component_has_alarms (comp)) {
+ if (e_cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
num_icons++;
}
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
draw_recurrence_icon = TRUE;
num_icons++;
}
@@ -610,12 +610,12 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
num_icons++;
}
- if (cal_component_has_organizer (comp)) {
+ if (e_cal_component_has_organizer (comp)) {
draw_meeting_icon = TRUE;
num_icons++;
}
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -754,7 +754,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
}
/* free memory */
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
g_object_unref (comp);
}
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 6a1e1d4279..d70b0fd861 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -364,7 +364,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
long_line_x1, row_y,
long_line_x2, row_y);
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer), "%i:%02i",
display_hour, minute);
} else {
@@ -416,7 +416,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
/* In 12-hour format we display 'am' or 'pm'
instead of '00'. */
if (minute == 0
- && !e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ && !e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
strcpy (buffer, suffix);
} else {
g_snprintf (buffer, sizeof (buffer),
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 5a49408566..d2f60d7e7d 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -30,7 +30,7 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-categories-config.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "e-day-view-top-item.h"
static void e_day_view_top_item_class_init (EDayViewTopItemClass *class);
@@ -316,7 +316,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
gint start_day, end_day;
gint item_x, item_y, item_w, item_h;
gint text_x, icon_x, icon_y, icon_x_inc;
- CalComponent *comp;
+ ECalComponent *comp;
gchar buffer[16];
gint hour, display_hour, minute, offset, time_width, time_x;
gint min_end_time_x, suffix_width, max_icon_x;
@@ -348,8 +348,8 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
gc = day_view->main_gc;
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
bg_gc = style->bg_gc[GTK_STATE_NORMAL];
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
/* Draw the lines across the top & bottom of the entire event. */
gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]);
@@ -361,7 +361,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
item_x + item_w - 1 - x, item_y + item_h - 1 - y);
/* Fill it in. */
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_cal_view_get_model (E_CAL_VIEW (day_view)),
+ if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
event->comp_data),
&bg_color)) {
GdkColormap *colormap;
@@ -380,13 +380,13 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
/* When resizing we don't draw the triangles.*/
draw_start_triangle = TRUE;
draw_end_triangle = TRUE;
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == E_DAY_VIEW_LONG_EVENT
&& day_view->resize_event_num == event_num) {
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_LEFT_EDGE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE)
draw_start_triangle = FALSE;
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_RIGHT_EDGE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_RIGHT_EDGE)
draw_end_triangle = FALSE;
}
@@ -448,7 +448,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
e_day_view_convert_time_to_display (day_view, hour,
&display_hour,
&suffix, &suffix_width);
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer), "%i:%02i",
display_hour, minute);
} else {
@@ -497,7 +497,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
&display_hour,
&suffix,
&suffix_width);
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer),
"%i:%02i", display_hour, minute);
} else {
@@ -527,7 +527,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
icon_y = item_y + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT
+ E_DAY_VIEW_ICON_Y_PAD - y;
- if (icon_x <= max_icon_x && cal_component_has_recurrences (comp)) {
+ if (icon_x <= max_icon_x && e_cal_component_has_recurrences (comp)) {
gdk_gc_set_clip_origin (gc, icon_x, icon_y);
gdk_gc_set_clip_mask (gc, day_view->recurrence_mask);
gdk_draw_pixmap (drawable, gc,
@@ -538,7 +538,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
icon_x -= icon_x_inc;
}
- if (icon_x <= max_icon_x && cal_component_has_alarms (comp)) {
+ if (icon_x <= max_icon_x && e_cal_component_has_alarms (comp)) {
gdk_gc_set_clip_origin (gc, icon_x, icon_y);
gdk_gc_set_clip_mask (gc, day_view->reminder_mask);
gdk_draw_pixmap (drawable, gc,
@@ -550,7 +550,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
}
/* draw categories icons */
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -578,7 +578,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
gdk_bitmap_unref (mask);
}
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
g_object_unref (comp);
gdk_gc_set_clip_mask (gc, NULL);
@@ -672,7 +672,7 @@ e_day_view_top_item_get_day_label (EDayView *day_view, gint day,
day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day],
FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
day_start.tm_year = day_start_tt.year - 1900;
day_start.tm_mon = day_start_tt.month - 1;
day_start.tm_mday = day_start_tt.day;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index bfdb788327..74943593aa 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -53,7 +53,7 @@
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "dialogs/delete-comp.h"
#include "dialogs/delete-error.h"
#include "dialogs/send-comp.h"
@@ -159,11 +159,11 @@ static gboolean e_day_view_get_extreme_event (EDayView *day_view,
static gboolean e_day_view_do_key_press (GtkWidget *widget,
GdkEventKey *event);
static gboolean e_day_view_popup_menu (GtkWidget *widget);
-static GList *e_day_view_get_selected_events (ECalView *cal_view);
-static void e_day_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-static void e_day_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time);
-static gboolean e_day_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-static void e_day_view_update_query (ECalView *cal_view);
+static GList *e_day_view_get_selected_events (ECalendarView *cal_view);
+static void e_day_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+static void e_day_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time);
+static gboolean e_day_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+static void e_day_view_update_query (ECalendarView *cal_view);
static void e_day_view_goto_start_of_work_day (EDayView *day_view);
static void e_day_view_goto_end_of_work_day (EDayView *day_view);
static void e_day_view_change_duration_to_start_of_work_day (EDayView *day_view);
@@ -237,27 +237,27 @@ static void e_day_view_abort_resize (EDayView *day_view,
static gboolean e_day_view_on_long_event_button_press (EDayView *day_view,
gint event_num,
GdkEventButton *event,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y);
static gboolean e_day_view_on_event_button_press (EDayView *day_view,
gint day,
gint event_num,
GdkEventButton *event,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y);
static void e_day_view_on_long_event_click (EDayView *day_view,
gint event_num,
GdkEventButton *bevent,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y);
static void e_day_view_on_event_click (EDayView *day_view,
gint day,
gint event_num,
GdkEventButton *event,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y);
static void e_day_view_on_event_double_click (EDayView *day_view,
@@ -278,12 +278,12 @@ static void e_day_view_recalc_day_starts (EDayView *day_view,
static void e_day_view_recalc_num_rows (EDayView *day_view);
static void e_day_view_recalc_cell_sizes (EDayView *day_view);
-static ECalViewPosition e_day_view_convert_position_in_top_canvas (EDayView *day_view,
+static ECalendarViewPosition e_day_view_convert_position_in_top_canvas (EDayView *day_view,
gint x,
gint y,
gint *day_return,
gint *event_num_return);
-static ECalViewPosition e_day_view_convert_position_in_main_canvas (EDayView *day_view,
+static ECalendarViewPosition e_day_view_convert_position_in_main_canvas (EDayView *day_view,
gint x,
gint y,
gint *day_return,
@@ -310,7 +310,7 @@ static void e_day_view_foreach_event_with_uid (EDayView *day_view,
static void e_day_view_free_events (EDayView *day_view);
static void e_day_view_free_event_array (EDayView *day_view,
GArray *array);
-static int e_day_view_add_event (CalComponent *comp,
+static int e_day_view_add_event (ECalComponent *comp,
time_t start,
time_t end,
gpointer data);
@@ -444,19 +444,19 @@ static gboolean e_day_view_layout_timeout_cb (gpointer data);
static GtkTableClass *parent_class;
E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init,
- e_day_view_init, e_cal_view_get_type ());
+ e_day_view_init, e_calendar_view_get_type ());
static void
e_day_view_class_init (EDayViewClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- ECalViewClass *view_class;
+ ECalendarViewClass *view_class;
parent_class = g_type_class_peek_parent (class);
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- view_class = (ECalViewClass *) class;
+ view_class = (ECalendarViewClass *) class;
/* Method override */
object_class->destroy = e_day_view_destroy;
@@ -482,7 +482,7 @@ e_day_view_class_init (EDayViewClass *class)
}
static void
-timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
+timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone,
icaltimezone *new_zone, gpointer user_data)
{
struct icaltimetype tt;
@@ -503,7 +503,7 @@ timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
lower = icaltime_as_timet_with_zone (tt, new_zone);
e_day_view_recalc_day_starts (day_view, lower);
- e_day_view_update_query ((ECalView *) day_view);
+ e_day_view_update_query ((ECalendarView *) day_view);
}
static void
@@ -581,7 +581,7 @@ e_day_view_init (EDayView *day_view)
day_view->selection_drag_pos = E_DAY_VIEW_DRAG_END;
day_view->selection_in_top_canvas = FALSE;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE;
day_view->pressed_event_day = -1;
@@ -819,7 +819,7 @@ e_day_view_init (EDayView *day_view)
target_table, n_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
- /* connect to ECalView's signals */
+ /* connect to ECalendarView's signals */
g_signal_connect (G_OBJECT (day_view), "timezone_changed",
G_CALLBACK (timezone_changed_cb), NULL);
}
@@ -1644,7 +1644,7 @@ e_day_view_update_event_label (EDayView *day_view,
&end_suffix,
&end_suffix_width);
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
if (day_view->show_event_end_times) {
/* 24 hour format with end time. */
text = g_strdup_printf
@@ -1809,7 +1809,7 @@ e_day_view_find_event_from_uid (EDayView *day_view,
and are both visible in the view, then the selection is set to those times,
otherwise it is set to 1 hour from the start of the working day. */
static void
-e_day_view_set_selected_time_range (ECalView *cal_view,
+e_day_view_set_selected_time_range (ECalendarView *cal_view,
time_t start_time,
time_t end_time)
{
@@ -1825,7 +1825,7 @@ e_day_view_set_selected_time_range (ECalView *cal_view,
start of the day given by start_time, otherwise it is the previous
work-week start day. */
if (!day_view->work_week_view) {
- lower = time_day_begin_with_zone (start_time, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ lower = time_day_begin_with_zone (start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
} else {
lower = e_day_view_find_work_week_start (day_view, start_time);
}
@@ -1833,7 +1833,7 @@ e_day_view_set_selected_time_range (ECalView *cal_view,
/* See if we need to change the days shown. */
if (lower != day_view->lower) {
e_day_view_recalc_day_starts (day_view, lower);
- e_day_view_update_query ((ECalView *) day_view);
+ e_day_view_update_query ((ECalendarView *) day_view);
}
/* Set the selection. */
@@ -1992,7 +1992,7 @@ e_day_view_find_work_week_start (EDayView *day_view,
guint offset;
struct icaltimetype tt = icaltime_null_time ();
- time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ time_to_gdate_with_zone (&date, start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
/* The start of the work-week is the first working day after the
week start day. */
@@ -2023,12 +2023,12 @@ e_day_view_find_work_week_start (EDayView *day_view,
tt.month = g_date_month (&date);
tt.day = g_date_day (&date);
- return icaltime_as_timet_with_zone (tt, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ return icaltime_as_timet_with_zone (tt, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
}
/* Returns the selected time range. */
static void
-e_day_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+e_day_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time)
{
gint start_col, start_row, end_col, end_row;
time_t start, end;
@@ -2066,7 +2066,7 @@ e_day_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time
/* Gets the visible time range. Returns FALSE if no time range has been set. */
static gboolean
-e_day_view_get_visible_time_range (ECalView *cal_view,
+e_day_view_get_visible_time_range (ECalendarView *cal_view,
time_t *start_time,
time_t *end_time)
{
@@ -2090,7 +2090,7 @@ e_day_view_recalc_day_starts (EDayView *day_view,
day_view->day_starts[0] = start_time;
for (day = 1; day <= day_view->days_shown; day++) {
- day_view->day_starts[day] = time_add_day_with_zone (day_view->day_starts[day - 1], 1, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ day_view->day_starts[day] = time_add_day_with_zone (day_view->day_starts[day - 1], 1, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
}
#if 0
@@ -2161,7 +2161,7 @@ e_day_view_set_days_shown (EDayView *day_view,
e_day_view_recalc_day_starts (day_view, day_view->lower);
e_day_view_recalc_cell_sizes (day_view);
- e_day_view_update_query ((ECalView *) day_view);
+ e_day_view_update_query ((ECalendarView *) day_view);
}
@@ -2404,7 +2404,7 @@ e_day_view_recalc_work_week (EDayView *day_view)
day_view->selection_start_day = -1;
e_day_view_recalc_day_starts (day_view, lower);
- e_day_view_update_query ((ECalView *) day_view);
+ e_day_view_update_query ((ECalendarView *) day_view);
/* This updates the date navigator. */
e_day_view_update_calendar_selection_time (day_view);
@@ -2503,7 +2503,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
EDayView *day_view)
{
gint event_x, event_y, day, event_num;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
/* Convert the coords to the main canvas window, or return if the
window is not found. */
@@ -2516,10 +2516,10 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
event_x, event_y,
&day, &event_num);
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
return FALSE;
- if (pos != E_CAL_VIEW_POS_NONE)
+ if (pos != E_CALENDAR_VIEW_POS_NONE)
return e_day_view_on_long_event_button_press (day_view,
event_num,
event, pos,
@@ -2532,8 +2532,8 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
if (event->type == GDK_2BUTTON_PRESS) {
time_t dtstart, dtend;
- e_day_view_get_selected_time_range ((ECalView *) day_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (E_CAL_VIEW (day_view),
+ e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view),
dtstart, dtend,
TRUE, FALSE);
return TRUE;
@@ -2619,7 +2619,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
EDayView *day_view)
{
gint event_x, event_y, row, day, event_num;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
#if 0
g_print ("In e_day_view_on_main_canvas_button_press\n");
@@ -2638,10 +2638,10 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
&day, &row,
&event_num);
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
return FALSE;
- if (pos != E_CAL_VIEW_POS_NONE)
+ if (pos != E_CALENDAR_VIEW_POS_NONE)
return e_day_view_on_event_button_press (day_view, day,
event_num, event, pos,
event_x, event_y);
@@ -2653,8 +2653,8 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
if (event->type == GDK_2BUTTON_PRESS) {
time_t dtstart, dtend;
- e_day_view_get_selected_time_range ((ECalView *) day_view, &dtstart, &dtend);
- e_cal_view_new_appointment_for (E_CAL_VIEW (day_view),
+ e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend);
+ e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view),
dtstart, dtend,
FALSE, FALSE);
return TRUE;
@@ -2731,7 +2731,7 @@ static gboolean
e_day_view_on_long_event_button_press (EDayView *day_view,
gint event_num,
GdkEventButton *event,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
@@ -2773,7 +2773,7 @@ e_day_view_on_event_button_press (EDayView *day_view,
gint day,
gint event_num,
GdkEventButton *event,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
@@ -2813,7 +2813,7 @@ static void
e_day_view_on_long_event_click (EDayView *day_view,
gint event_num,
GdkEventButton *bevent,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
@@ -2825,14 +2825,14 @@ e_day_view_on_long_event_click (EDayView *day_view,
event_num);
/* Ignore clicks on the EText while editing. */
- if (pos == E_CAL_VIEW_POS_EVENT
+ if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing)
return;
- if ((cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))
- && (pos == E_CAL_VIEW_POS_LEFT_EDGE
- || pos == E_CAL_VIEW_POS_RIGHT_EDGE)) {
+ if ((e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ && (pos == E_CALENDAR_VIEW_POS_LEFT_EDGE
+ || pos == E_CALENDAR_VIEW_POS_RIGHT_EDGE)) {
if (!e_day_view_find_long_event_days (event,
day_view->days_shown,
day_view->day_starts,
@@ -2889,7 +2889,7 @@ e_day_view_on_event_click (EDayView *day_view,
gint day,
gint event_num,
GdkEventButton *bevent,
- ECalViewPosition pos,
+ ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
@@ -2900,14 +2900,14 @@ e_day_view_on_event_click (EDayView *day_view,
event_num);
/* Ignore clicks on the EText while editing. */
- if (pos == E_CAL_VIEW_POS_EVENT
+ if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing)
return;
- if ((cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))
- && (pos == E_CAL_VIEW_POS_TOP_EDGE
- || pos == E_CAL_VIEW_POS_BOTTOM_EDGE)) {
+ if ((e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ && (pos == E_CALENDAR_VIEW_POS_TOP_EDGE
+ || pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE)) {
/* Grab the keyboard focus, so the event being edited is saved
and we can use the Escape key to abort the resize. */
if (!GTK_WIDGET_HAS_FOCUS (day_view))
@@ -2973,7 +2973,7 @@ e_day_view_reshape_resize_long_event_rect_item (EDayView *day_view)
/* If we're not resizing an event, or the event is not shown,
hide the resize bars. */
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
|| !e_day_view_get_long_event_position (day_view, event_num,
&start_day, &end_day,
&item_x, &item_y,
@@ -3009,7 +3009,7 @@ e_day_view_reshape_resize_rect_item (EDayView *day_view)
/* If we're not resizing an event, or the event is not shown,
hide the resize bars. */
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
|| !e_day_view_get_event_position (day_view, day, event_num,
&item_x, &item_y,
&item_w, &item_h)) {
@@ -3056,7 +3056,7 @@ e_day_view_on_event_double_click (EDayView *day_view,
e_day_view_stop_editing_event (day_view);
- e_cal_view_edit_appointment (E_CAL_VIEW (day_view),
+ e_calendar_view_edit_appointment (E_CALENDAR_VIEW (day_view),
event->comp_data->client,
event->comp_data->icalcomp, FALSE);
}
@@ -3072,7 +3072,7 @@ e_day_view_show_popup_menu (EDayView *day_view,
day_view->popup_event_day = day;
day_view->popup_event_num = event_num;
- popup = e_cal_view_create_popup_menu (E_CAL_VIEW (day_view));
+ popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (day_view));
e_popup_menu (popup, gdk_event);
}
@@ -3088,7 +3088,7 @@ e_day_view_popup_menu (GtkWidget *widget)
/* Returns the currently-selected event, or NULL if none */
static GList *
-e_day_view_get_selected_events (ECalView *cal_view)
+e_day_view_get_selected_events (ECalendarView *cal_view)
{
EDayViewEvent *event = NULL;
GList *list = NULL;
@@ -3128,7 +3128,7 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
EDayViewEvent *event;
gint day, event_num;
const char *uid;
- CalComponent *comp;
+ ECalComponent *comp;
AddEventData add_event_data;
/* If our time hasn't been set yet, just return. */
@@ -3148,8 +3148,8 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
- if (!cal_util_component_has_recurrences (comp_data->icalcomp)
- && cal_util_event_dates_match (event->comp_data->icalcomp, comp_data->icalcomp)) {
+ if (!e_cal_util_component_has_recurrences (comp_data->icalcomp)
+ && e_cal_util_event_dates_match (event->comp_data->icalcomp, comp_data->icalcomp)) {
#if 0
g_print ("updated object's dates unchanged\n");
#endif
@@ -3170,16 +3170,16 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
}
/* Add the occurrences of the event */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
add_event_data.day_view = day_view;
add_event_data.comp_data = comp_data;
- cal_recur_generate_instances (comp, day_view->lower,
+ e_cal_recur_generate_instances (comp, day_view->lower,
day_view->upper,
e_day_view_add_event, &add_event_data,
- cal_client_resolve_tzid_cb, comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_cal_resolve_tzid_cb, comp_data->client,
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
g_object_unref (comp);
@@ -3188,7 +3188,7 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
/* Restarts a query for the day view */
static void
-e_day_view_update_query (ECalView *cal_view)
+e_day_view_update_query (ECalendarView *cal_view)
{
gint rows, r;
EDayView *day_view = E_DAY_VIEW (cal_view);
@@ -3200,11 +3200,11 @@ e_day_view_update_query (ECalView *cal_view)
e_day_view_free_events (day_view);
e_day_view_queue_layout (day_view);
- rows = e_table_model_row_count (E_TABLE_MODEL (e_cal_view_get_model (E_CAL_VIEW (day_view))));
+ rows = e_table_model_row_count (E_TABLE_MODEL (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view))));
for (r = 0; r < rows; r++) {
ECalModelComponent *comp_data;
- comp_data = e_cal_model_get_component_at (e_cal_view_get_model (E_CAL_VIEW (day_view)), r);
+ comp_data = e_cal_model_get_component_at (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), r);
g_assert (comp_data != NULL);
process_component (day_view, comp_data);
}
@@ -3245,7 +3245,7 @@ e_day_view_on_top_canvas_button_release (GtkWidget *widget,
if (day_view->selection_is_being_dragged) {
gdk_pointer_ungrab (event->time);
e_day_view_finish_selection (day_view);
- } else if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
+ } else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
gdk_pointer_ungrab (event->time);
e_day_view_finish_long_event_resize (day_view);
} else if (day_view->pressed_event_day != -1) {
@@ -3274,7 +3274,7 @@ e_day_view_on_main_canvas_button_release (GtkWidget *widget,
gdk_pointer_ungrab (event->time);
e_day_view_finish_selection (day_view);
e_day_view_stop_auto_scroll (day_view);
- } else if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
+ } else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
gdk_pointer_ungrab (event->time);
e_day_view_finish_resize (day_view);
e_day_view_stop_auto_scroll (day_view);
@@ -3297,14 +3297,14 @@ e_day_view_update_calendar_selection_time (EDayView *day_view)
time_t start, end;
GnomeCalendar *calendar;
- e_day_view_get_selected_time_range ((ECalView *) day_view, &start, &end);
+ e_day_view_get_selected_time_range ((ECalendarView *) day_view, &start, &end);
#if 0
g_print ("Start: %s", ctime (&start));
g_print ("End : %s", ctime (&end));
#endif
- calendar = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ calendar = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
if (calendar)
gnome_calendar_set_selected_time_range (calendar,
start, end);
@@ -3317,7 +3317,7 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
EDayView *day_view)
{
EDayViewEvent *event = NULL;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint event_x, event_y, canvas_x, canvas_y;
gint day, event_num;
GdkCursor *cursor;
@@ -3346,8 +3346,8 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
if (day_view->selection_is_being_dragged) {
e_day_view_update_selection (day_view, day, -1);
return TRUE;
- } else if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ } else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
e_day_view_update_long_event_resize (day_view, day);
return TRUE;
}
@@ -3357,8 +3357,8 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->pressed_event_num);
- if ((cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ if ((e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
&& (abs (canvas_x - day_view->drag_event_x)
> E_DAY_VIEW_DRAG_START_OFFSET
|| abs (canvas_y - day_view->drag_event_y)
@@ -3386,11 +3386,11 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
cursor = day_view->normal_cursor;
/* Recurring events can't be resized. */
- if (event && (cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))) {
+ if (event && (e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))) {
switch (pos) {
- case E_CAL_VIEW_POS_LEFT_EDGE:
- case E_CAL_VIEW_POS_RIGHT_EDGE:
+ case E_CALENDAR_VIEW_POS_LEFT_EDGE:
+ case E_CALENDAR_VIEW_POS_RIGHT_EDGE:
cursor = day_view->resize_width_cursor;
break;
default:
@@ -3416,7 +3416,7 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
EDayView *day_view)
{
EDayViewEvent *event = NULL;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint event_x, event_y, canvas_x, canvas_y;
gint row, day, event_num;
GdkCursor *cursor;
@@ -3444,14 +3444,14 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
event_num);
if (day_view->selection_is_being_dragged) {
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
e_day_view_update_selection (day_view, day, row);
e_day_view_check_auto_scroll (day_view,
event_x, event_y);
return TRUE;
}
- } else if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ } else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
e_day_view_update_resize (day_view, row);
e_day_view_check_auto_scroll (day_view,
event_x, event_y);
@@ -3463,8 +3463,8 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
event = &g_array_index (day_view->events[day_view->pressed_event_day], EDayViewEvent, day_view->pressed_event_num);
- if ((cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ if ((e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
&& (abs (canvas_x - day_view->drag_event_x)
> E_DAY_VIEW_DRAG_START_OFFSET
|| abs (canvas_y - day_view->drag_event_y)
@@ -3492,14 +3492,14 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
cursor = day_view->normal_cursor;
/* Recurring events can't be resized. */
- if (event && (cal_util_component_is_instance (event->comp_data->icalcomp) ||
- !cal_util_component_has_recurrences (event->comp_data->icalcomp))) {
+ if (event && (e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
+ !e_cal_util_component_has_recurrences (event->comp_data->icalcomp))) {
switch (pos) {
- case E_CAL_VIEW_POS_LEFT_EDGE:
+ case E_CALENDAR_VIEW_POS_LEFT_EDGE:
cursor = day_view->move_cursor;
break;
- case E_CAL_VIEW_POS_TOP_EDGE:
- case E_CAL_VIEW_POS_BOTTOM_EDGE:
+ case E_CALENDAR_VIEW_POS_TOP_EDGE:
+ case E_CALENDAR_VIEW_POS_BOTTOM_EDGE:
cursor = day_view->resize_height_cursor;
break;
default:
@@ -3640,7 +3640,7 @@ e_day_view_update_long_event_resize (EDayView *day_view,
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_LEFT_EDGE) {
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE) {
day = MIN (day, day_view->resize_end_row);
if (day != day_view->resize_start_row) {
need_reshape = TRUE;
@@ -3681,7 +3681,7 @@ e_day_view_update_resize (EDayView *day_view,
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_TOP_EDGE) {
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE) {
row = MIN (row, day_view->resize_end_row);
if (row != day_view->resize_start_row) {
need_reshape = TRUE;
@@ -3713,11 +3713,11 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
{
EDayViewEvent *event;
gint event_num;
- CalComponent *comp;
- CalComponentDateTime date;
+ ECalComponent *comp;
+ ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
- CalClient *client;
+ ECal *client;
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
@@ -3730,27 +3730,27 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
/* We use a temporary copy of the comp since we don't want to
change the original comp here. Otherwise we would not detect that
the event's time had changed in the "update_event" callback. */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
date.value = &itt;
/* FIXME: Should probably keep the timezone of the original start
and end times. */
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_LEFT_EDGE) {
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE) {
dt = day_view->day_starts[day_view->resize_start_row];
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtstart (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtstart (comp, &date);
} else {
dt = day_view->day_starts[day_view->resize_end_row + 1];
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtend (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtend (comp, &date);
}
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL)) {
gtk_widget_queue_draw (day_view->top_canvas);
goto out;
@@ -3759,10 +3759,10 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
- if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
if (itip_organizer_is_user (comp, client) &&
send_component_dialog (toplevel, client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
} else {
g_message (G_STRLOC ": Could not update the object!");
}
@@ -3771,7 +3771,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
out:
gnome_canvas_item_hide (day_view->resize_long_event_rect_item);
- day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE;
g_object_unref (comp);
}
@@ -3784,11 +3784,11 @@ e_day_view_finish_resize (EDayView *day_view)
{
EDayViewEvent *event;
gint day, event_num;
- CalComponent *comp;
- CalComponentDateTime date;
+ ECalComponent *comp;
+ ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
- CalClient *client;
+ ECal *client;
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
@@ -3802,24 +3802,24 @@ e_day_view_finish_resize (EDayView *day_view)
/* We use a temporary shallow copy of the ico since we don't want to
change the original ico here. Otherwise we would not detect that
the event's time had changed in the "update_event" callback. */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
date.value = &itt;
/* FIXME: Should probably keep the timezone of the original start
and end times. */
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_TOP_EDGE) {
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE) {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_start_row);
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtstart (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtstart (comp, &date);
} else {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_end_row + 1);
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtend (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtend (comp, &date);
}
gnome_canvas_item_hide (day_view->resize_rect_item);
@@ -3831,9 +3831,9 @@ e_day_view_finish_resize (EDayView *day_view)
gnome_canvas_item_hide (day_view->main_canvas_top_resize_bar_item);
gnome_canvas_item_hide (day_view->main_canvas_bottom_resize_bar_item);
- day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE;
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL)) {
gtk_widget_queue_draw (day_view->top_canvas);
goto out;
@@ -3842,11 +3842,11 @@ e_day_view_finish_resize (EDayView *day_view)
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
- cal_component_commit_sequence (comp);
- if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ e_cal_component_commit_sequence (comp);
+ if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
if (itip_organizer_is_user (comp, client) &&
send_component_dialog (toplevel, client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
} else {
g_message (G_STRLOC ": Could not update the object!");
}
@@ -3863,10 +3863,10 @@ e_day_view_abort_resize (EDayView *day_view,
{
gint day, event_num;
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_NONE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE)
return;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE;
gdk_pointer_ungrab (time);
day = day_view->resize_event_day;
@@ -3938,7 +3938,7 @@ e_day_view_free_event_array (EDayView *day_view,
/* This adds one event to the view, adding it to the appropriate array. */
static gboolean
-e_day_view_add_event (CalComponent *comp,
+e_day_view_add_event (ECalComponent *comp,
time_t start,
time_t end,
gpointer data)
@@ -3964,9 +3964,9 @@ e_day_view_add_event (CalComponent *comp,
g_return_val_if_fail (end > add_event_data->day_view->lower, TRUE);
start_tt = icaltime_from_timet_with_zone (start, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view)));
end_tt = icaltime_from_timet_with_zone (end, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view)));
if (add_event_data->comp_data) {
event.comp_data = add_event_data->comp_data;
@@ -3975,9 +3975,9 @@ e_day_view_add_event (CalComponent *comp,
event.comp_data = g_new0 (ECalModelComponent, 1);
event.allocated_comp_data = TRUE;
- event.comp_data->client = e_cal_model_get_default_client (e_cal_view_get_model (E_CAL_VIEW (add_event_data->day_view)));
- cal_component_commit_sequence (comp);
- event.comp_data->icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (comp));
+ event.comp_data->client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (add_event_data->day_view)));
+ e_cal_component_commit_sequence (comp);
+ event.comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
}
event.start = start;
@@ -3997,7 +3997,7 @@ e_day_view_add_event (CalComponent *comp,
event.different_timezone = FALSE;
if (!cal_comp_util_compare_event_timezones (comp,
event.comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->day_view))))
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view))))
event.different_timezone = TRUE;
/* Find out which array to add the event to. */
@@ -4126,7 +4126,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
EDayViewEvent *event;
gint start_day, end_day, item_x, item_y, item_w, item_h;
gint text_x, text_w, num_icons, icons_width, width, time_width;
- CalComponent *comp;
+ ECalComponent *comp;
gint min_text_x, max_text_w, text_width, line_len;
gchar *text, *end_of_line;
gboolean show_icons = TRUE, use_max_width = FALSE;
@@ -4157,15 +4157,15 @@ e_day_view_reshape_long_event (EDayView *day_view,
/* We don't show the icons while resizing, since we'd have to
draw them on top of the resize rect. Nor when editing. */
num_icons = 0;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
/* Set up Pango prerequisites */
font_desc = gtk_widget_get_style (GTK_WIDGET (day_view))->font_desc;
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (day_view));
layout = pango_layout_new (pango_context);
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == E_DAY_VIEW_LONG_EVENT
&& day_view->resize_event_num == event_num)
show_icons = FALSE;
@@ -4179,16 +4179,16 @@ e_day_view_reshape_long_event (EDayView *day_view,
if (show_icons) {
GSList *categories_list, *elem;
- if (cal_component_has_alarms (comp))
+ if (e_cal_component_has_alarms (comp))
num_icons++;
- if (cal_component_has_recurrences (comp))
+ if (e_cal_component_has_recurrences (comp))
num_icons++;
if (event->different_timezone)
num_icons++;
- if (cal_component_has_organizer (comp))
+ if (e_cal_component_has_organizer (comp))
num_icons++;
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -4198,7 +4198,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
if (e_categories_config_get_icon_for (category, &pixmap, &mask))
num_icons++;
}
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
}
if (!event->canvas_item) {
@@ -4330,25 +4330,25 @@ e_day_view_reshape_day_event (EDayView *day_view,
/* We don't show the icons while resizing, since we'd have to
draw them on top of the resize rect. */
num_icons = 0;
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
|| day_view->resize_event_day != day
|| day_view->resize_event_num != event_num) {
GSList *categories_list, *elem;
- CalComponent *comp;
+ ECalComponent *comp;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- if (cal_component_has_alarms (comp))
+ if (e_cal_component_has_alarms (comp))
num_icons++;
- if (cal_component_has_recurrences (comp))
+ if (e_cal_component_has_recurrences (comp))
num_icons++;
if (event->different_timezone)
num_icons++;
- if (cal_component_has_organizer (comp))
+ if (e_cal_component_has_organizer (comp))
num_icons++;
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -4358,7 +4358,7 @@ e_day_view_reshape_day_event (EDayView *day_view,
if (e_categories_config_get_icon_for (category, &pixmap, &mask))
num_icons++;
}
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
}
if (num_icons > 0) {
@@ -4513,13 +4513,13 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
{
EDayView *day_view;
icalcomponent *icalcomp;
- CalComponent *comp;
+ ECalComponent *comp;
gint day, event_num;
gchar *initial_text;
guint keyval;
gboolean stop_emission;
time_t dtstart, dtend;
- CalComponentDateTime start_dt, end_dt;
+ ECalComponentDateTime start_dt, end_dt;
struct icaltimetype start_tt, end_tt;
const char *uid;
AddEventData add_event_data;
@@ -4532,7 +4532,7 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
keyval = event->keyval;
/* The Escape key aborts a resize operation. */
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
if (keyval == GDK_Escape) {
e_day_view_abort_resize (day_view, event->time);
}
@@ -4646,38 +4646,38 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
/* Add a new event covering the selected range */
- icalcomp = e_cal_model_create_component_with_defaults (e_cal_view_get_model (E_CAL_VIEW (day_view)));
+ icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)));
if (!icalcomp)
return FALSE;
uid = icalcomponent_get_uid (icalcomp);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
- e_day_view_get_selected_time_range ((ECalView *) day_view, &dtstart, &dtend);
+ e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend);
start_tt = icaltime_from_timet_with_zone (dtstart, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
end_tt = icaltime_from_timet_with_zone (dtend, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
if (day_view->selection_in_top_canvas) {
start_dt.tzid = NULL;
start_tt.is_date = 1;
end_tt.is_date = 1;
} else {
- start_dt.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ start_dt.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
}
start_dt.value = &start_tt;
end_dt.value = &end_tt;
end_dt.tzid = start_dt.tzid;
- cal_component_set_dtstart (comp, &start_dt);
- cal_component_set_dtend (comp, &end_dt);
+ e_cal_component_set_dtstart (comp, &start_dt);
+ e_cal_component_set_dtend (comp, &end_dt);
- cal_component_set_categories (
- comp, e_cal_view_get_default_category (E_CAL_VIEW (day_view)));
+ e_cal_component_set_categories (
+ comp, e_calendar_view_get_default_category (E_CALENDAR_VIEW (day_view)));
/* We add the event locally and start editing it. We don't send it
to the server until the user finishes editing it. */
@@ -5270,7 +5270,7 @@ static void
e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event)
{
if (day_view->selection_start_day == 0) {
- gnome_calendar_previous (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
+ gnome_calendar_previous (e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)));
} else {
day_view->selection_start_day--;
day_view->selection_end_day--;
@@ -5289,7 +5289,7 @@ static void
e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
{
if (day_view->selection_end_day == day_view->days_shown - 1) {
- gnome_calendar_next (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
+ gnome_calendar_next (e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)));
} else {
day_view->selection_start_day++;
day_view->selection_end_day++;
@@ -5567,7 +5567,7 @@ e_day_view_change_event_end_time_up (EDayView *day_view)
resize_end_row = resize_start_row;
if (resize_end_row == resize_start_row)
return;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_BOTTOM_EDGE;
resize_end_row--;
day_view->resize_start_row = resize_start_row;
day_view->resize_end_row = resize_end_row;
@@ -5598,7 +5598,7 @@ e_day_view_change_event_end_time_down (EDayView *day_view)
resize_end_row = resize_start_row;
if (resize_end_row == day_view->rows -1)
return;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE;
+ day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_BOTTOM_EDGE;
resize_end_row++;
day_view->resize_start_row = resize_start_row;
day_view->resize_end_row = resize_end_row;
@@ -5655,9 +5655,9 @@ e_day_view_on_editing_stopped (EDayView *day_view,
gboolean editing_long_event = FALSE;
EDayViewEvent *event;
gchar *text = NULL;
- CalComponentText summary;
- CalComponent *comp;
- CalClient *client;
+ ECalComponentText summary;
+ ECalComponent *comp;
+ ECal *client;
gboolean on_server;
/* Note: the item we are passed here isn't reliable, so we just stop
@@ -5701,8 +5701,8 @@ e_day_view_on_editing_stopped (EDayView *day_view,
NULL);
g_assert (text != NULL);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
client = event->comp_data->client;
on_server = cal_comp_is_on_server (comp, client);
@@ -5710,7 +5710,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (string_is_empty (text) && !on_server) {
const char *uid;
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
e_day_view_foreach_event_with_uid (day_view, uid,
e_day_view_remove_event_cb, NULL);
@@ -5721,7 +5721,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
}
/* Only update the summary if necessary. */
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
if (summary.value && !strcmp (text, summary.value)) {
if (day == E_DAY_VIEW_LONG_EVENT)
e_day_view_reshape_long_event (day_view, event_num);
@@ -5729,19 +5729,19 @@ e_day_view_on_editing_stopped (EDayView *day_view,
e_day_view_update_event_label (day_view, day,
event_num);
} else if (summary.value || !string_is_empty (text)) {
- icalcomponent *icalcomp = cal_component_get_icalcomponent (comp);
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
summary.value = text;
summary.altrep = NULL;
- cal_component_set_summary (comp, &summary);
+ e_cal_component_set_summary (comp, &summary);
if (!on_server) {
- if (!cal_client_create_object (client, icalcomp, NULL, NULL))
+ if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
} else {
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL)) {
goto out;
}
@@ -5749,10 +5749,10 @@ e_day_view_on_editing_stopped (EDayView *day_view,
/* FIXME When sending here, what exactly should we send? */
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
- if (cal_client_modify_object (client, icalcomp, mod, NULL)) {
+ if (e_cal_modify_object (client, icalcomp, mod, NULL)) {
if (itip_organizer_is_user (comp, client)
&& send_component_dialog (toplevel, client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
}
@@ -5792,12 +5792,12 @@ e_day_view_convert_grid_position_to_time (EDayView *day_view,
/* Create an icaltimetype and convert to a time_t. */
tt = icaltime_from_timet_with_zone (day_view->day_starts[col],
- FALSE, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
tt.hour = minutes / 60;
tt.minute = minutes % 60;
tt.second = 0;
- val = icaltime_as_timet_with_zone (tt, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ val = icaltime_as_timet_with_zone (tt, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
return val;
}
@@ -5827,7 +5827,7 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
/* To find the row we need to convert the time to an icaltimetype,
calculate the offset in minutes from the top of the display and
divide it by the mins per row setting. */
- tt = icaltime_from_timet_with_zone (time, FALSE, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ tt = icaltime_from_timet_with_zone (time, FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
minutes = tt.hour * 60 + tt.minute;
minutes -= day_view->first_hour_shown * 60 + day_view->first_minute_shown;
@@ -5895,7 +5895,7 @@ static gboolean
e_day_view_auto_scroll_handler (gpointer data)
{
EDayView *day_view;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint scroll_x, scroll_y, new_scroll_y, canvas_x, canvas_y, row, day;
GtkAdjustment *adj;
@@ -5957,10 +5957,10 @@ e_day_view_auto_scroll_handler (gpointer data)
if (day_view->last_mouse_x == -1)
day = -1;
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
if (day_view->selection_is_being_dragged) {
e_day_view_update_selection (day_view, day, row);
- } else if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
+ } else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
e_day_view_update_resize (day_view, row);
} else if (day_view->drag_item->object.flags
& GNOME_CANVAS_ITEM_VISIBLE) {
@@ -6028,12 +6028,12 @@ e_day_view_get_event_position (EDayView *day_view,
return FALSE;
/* If the event is being resize, use the resize position. */
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == day
&& day_view->resize_event_num == event_num) {
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_TOP_EDGE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE)
start_row = day_view->resize_start_row;
- else if (day_view->resize_drag_pos == E_CAL_VIEW_POS_BOTTOM_EDGE)
+ else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE)
end_row = day_view->resize_end_row;
}
@@ -6081,12 +6081,12 @@ e_day_view_get_long_event_position (EDayView *day_view,
return FALSE;
/* If the event is being resize, use the resize position. */
- if (day_view->resize_drag_pos != E_CAL_VIEW_POS_NONE
+ if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == E_DAY_VIEW_LONG_EVENT
&& day_view->resize_event_num == event_num) {
- if (day_view->resize_drag_pos == E_CAL_VIEW_POS_LEFT_EDGE)
+ if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE)
*start_day = day_view->resize_start_row;
- else if (day_view->resize_drag_pos == E_CAL_VIEW_POS_RIGHT_EDGE)
+ else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_RIGHT_EDGE)
*end_day = day_view->resize_end_row;
}
@@ -6103,7 +6103,7 @@ e_day_view_get_long_event_position (EDayView *day_view,
/* Converts a position within the entire top canvas to a day & event and
a place within the event if appropriate. If event_num_return is NULL, it
simply returns the grid position without trying to find the event. */
-static ECalViewPosition
+static ECalendarViewPosition
e_day_view_convert_position_in_top_canvas (EDayView *day_view,
gint x,
gint y,
@@ -6119,7 +6119,7 @@ e_day_view_convert_position_in_top_canvas (EDayView *day_view,
*event_num_return = -1;
if (x < 0 || y < 0)
- return E_CAL_VIEW_POS_OUTSIDE;
+ return E_CALENDAR_VIEW_POS_OUTSIDE;
row = y / day_view->top_row_height - 1;
@@ -6131,13 +6131,13 @@ e_day_view_convert_position_in_top_canvas (EDayView *day_view,
}
}
if (day == -1)
- return E_CAL_VIEW_POS_OUTSIDE;
+ return E_CALENDAR_VIEW_POS_OUTSIDE;
*day_return = day;
/* If only the grid position is wanted, return. */
if (event_num_return == NULL)
- return E_CAL_VIEW_POS_NONE;
+ return E_CALENDAR_VIEW_POS_NONE;
for (event_num = 0; event_num < day_view->long_events->len;
event_num++) {
@@ -6163,23 +6163,23 @@ e_day_view_convert_position_in_top_canvas (EDayView *day_view,
if (x < item_x + E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH
+ E_DAY_VIEW_LONG_EVENT_X_PAD)
- return E_CAL_VIEW_POS_LEFT_EDGE;
+ return E_CALENDAR_VIEW_POS_LEFT_EDGE;
if (x >= item_x + item_w - E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH
- E_DAY_VIEW_LONG_EVENT_X_PAD)
- return E_CAL_VIEW_POS_RIGHT_EDGE;
+ return E_CALENDAR_VIEW_POS_RIGHT_EDGE;
- return E_CAL_VIEW_POS_EVENT;
+ return E_CALENDAR_VIEW_POS_EVENT;
}
- return E_CAL_VIEW_POS_NONE;
+ return E_CALENDAR_VIEW_POS_NONE;
}
/* Converts a position within the entire main canvas to a day, row, event and
a place within the event if appropriate. If event_num_return is NULL, it
simply returns the grid position without trying to find the event. */
-static ECalViewPosition
+static ECalendarViewPosition
e_day_view_convert_position_in_main_canvas (EDayView *day_view,
gint x,
gint y,
@@ -6202,11 +6202,11 @@ e_day_view_convert_position_in_main_canvas (EDayView *day_view,
/* Check the position is inside the canvas, and determine the day
and row. */
if (x < 0 || y < 0)
- return E_CAL_VIEW_POS_OUTSIDE;
+ return E_CALENDAR_VIEW_POS_OUTSIDE;
row = y / day_view->row_height;
if (row >= day_view->rows)
- return E_CAL_VIEW_POS_OUTSIDE;
+ return E_CALENDAR_VIEW_POS_OUTSIDE;
day = -1;
for (col = 1; col <= day_view->days_shown; col++) {
@@ -6216,14 +6216,14 @@ e_day_view_convert_position_in_main_canvas (EDayView *day_view,
}
}
if (day == -1)
- return E_CAL_VIEW_POS_OUTSIDE;
+ return E_CALENDAR_VIEW_POS_OUTSIDE;
*day_return = day;
*row_return = row;
/* If only the grid position is wanted, return. */
if (event_num_return == NULL)
- return E_CAL_VIEW_POS_NONE;
+ return E_CALENDAR_VIEW_POS_NONE;
/* Check the selected item first, since the horizontal resizing bars
may be above other events. */
@@ -6236,10 +6236,10 @@ e_day_view_convert_position_in_main_canvas (EDayView *day_view,
*event_num_return = day_view->resize_bars_event_num;
if (y >= item_y - E_DAY_VIEW_BAR_HEIGHT
&& y < item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT)
- return E_CAL_VIEW_POS_TOP_EDGE;
+ return E_CALENDAR_VIEW_POS_TOP_EDGE;
if (y >= item_y + item_h - E_DAY_VIEW_EVENT_BORDER_HEIGHT
&& y < item_y + item_h + E_DAY_VIEW_BAR_HEIGHT)
- return E_CAL_VIEW_POS_BOTTOM_EDGE;
+ return E_CALENDAR_VIEW_POS_BOTTOM_EDGE;
}
}
}
@@ -6260,20 +6260,20 @@ e_day_view_convert_position_in_main_canvas (EDayView *day_view,
*event_num_return = event_num;
if (x < item_x + E_DAY_VIEW_BAR_WIDTH)
- return E_CAL_VIEW_POS_LEFT_EDGE;
+ return E_CALENDAR_VIEW_POS_LEFT_EDGE;
if (y < item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT
+ E_DAY_VIEW_EVENT_Y_PAD)
- return E_CAL_VIEW_POS_TOP_EDGE;
+ return E_CALENDAR_VIEW_POS_TOP_EDGE;
if (y >= item_y + item_h - E_DAY_VIEW_EVENT_BORDER_HEIGHT
- E_DAY_VIEW_EVENT_Y_PAD)
- return E_CAL_VIEW_POS_BOTTOM_EDGE;
+ return E_CALENDAR_VIEW_POS_BOTTOM_EDGE;
- return E_CAL_VIEW_POS_EVENT;
+ return E_CALENDAR_VIEW_POS_EVENT;
}
- return E_CAL_VIEW_POS_NONE;
+ return E_CALENDAR_VIEW_POS_NONE;
}
@@ -6301,7 +6301,7 @@ e_day_view_on_top_canvas_drag_motion (GtkWidget *widget,
static void
e_day_view_reshape_top_canvas_drag_item (EDayView *day_view)
{
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint x, y, day;
/* Calculate the day & start row of the event being dragged, using
@@ -6311,7 +6311,7 @@ e_day_view_reshape_top_canvas_drag_item (EDayView *day_view)
pos = e_day_view_convert_position_in_top_canvas (day_view, x, y,
&day, NULL);
/* This shouldn't really happen in a drag. */
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
return;
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT)
@@ -6448,7 +6448,7 @@ e_day_view_on_main_canvas_drag_motion (GtkWidget *widget,
static void
e_day_view_reshape_main_canvas_drag_item (EDayView *day_view)
{
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint x, y, day, row;
/* Calculate the day & start row of the event being dragged, using
@@ -6458,7 +6458,7 @@ e_day_view_reshape_main_canvas_drag_item (EDayView *day_view)
pos = e_day_view_convert_position_in_main_canvas (day_view, x, y,
&day, &row, NULL);
/* This shouldn't really happen in a drag. */
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
return;
if (day_view->drag_event_day != -1
@@ -6710,8 +6710,8 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
char *comp_str;
icalcomponent *vcal;
- vcal = cal_util_new_top_level ();
- cal_util_add_timezones_from_component (vcal, event->comp_data->icalcomp);
+ vcal = e_cal_util_new_top_level ();
+ e_cal_util_add_timezones_from_component (vcal, event->comp_data->icalcomp);
icalcomponent_add_component (
vcal,
icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -6738,15 +6738,15 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
EDayView *day_view)
{
EDayViewEvent *event=NULL;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint day, start_day, end_day, num_days;
gint start_offset, end_offset;
- CalComponent *comp;
- CalComponentDateTime date;
+ ECalComponent *comp;
+ ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
gboolean all_day_event;
- CalClient *client;
+ ECal *client;
gboolean drag_from_same_window;
if (day_view->drag_event_day != -1)
@@ -6754,7 +6754,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
else
drag_from_same_window = FALSE;
- client = e_cal_model_get_default_client (e_cal_view_get_model (E_CAL_VIEW (day_view)));
+ client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)));
/* Note that we only support DnD within the EDayView at present. */
if ((data->length >= 0) && (data->format == 8)
@@ -6764,7 +6764,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
pos = e_day_view_convert_position_in_top_canvas (day_view,
x, y, &day,
NULL);
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
@@ -6802,8 +6802,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
Otherwise we would not detect that the event's time
had changed in the "update_event" callback. */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (start_offset == 0 && end_offset == 0)
all_day_event = TRUE;
@@ -6814,32 +6814,32 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
dt = day_view->day_starts[day] + start_offset * 60;
itt = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
if (all_day_event) {
itt.is_date = TRUE;
date.tzid = NULL;
} else {
/* FIXME: Should probably keep the timezone of
the original start and end times. */
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
}
- cal_component_set_dtstart (comp, &date);
+ e_cal_component_set_dtstart (comp, &date);
if (end_offset == 0)
dt = day_view->day_starts[day + num_days];
else
dt = day_view->day_starts[day + num_days - 1] + end_offset * 60;
itt = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
if (all_day_event) {
itt.is_date = TRUE;
date.tzid = NULL;
} else {
/* FIXME: Should probably keep the timezone of
the original start and end times. */
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
}
- cal_component_set_dtend (comp, &date);
+ e_cal_component_set_dtend (comp, &date);
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -6851,18 +6851,18 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL))
return;
}
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
- if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
if (itip_organizer_is_user (comp, client)
&& send_component_dialog (toplevel, client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
@@ -6885,7 +6885,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
pos = e_day_view_convert_position_in_top_canvas (day_view,
x, y, &day,
NULL);
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
comp_str = (char *) data->data;
@@ -6894,7 +6894,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
goto error;
default_tzid = calendar_config_get_timezone ();
- cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
+ e_cal_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
kind = icalcomponent_isa (icalcomp);
@@ -6911,14 +6911,14 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
if (child_kind == ICAL_VEVENT_COMPONENT)
- e_cal_view_add_event (E_CAL_VIEW (day_view), client, dtstart,
+ e_calendar_view_add_event (E_CALENDAR_VIEW (day_view), client, dtstart,
default_zone, subcomp, TRUE);
else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- cal_client_add_timezone (client, zone, NULL);
+ e_cal_add_timezone (client, zone, NULL);
icaltimezone_free (zone, 1);
}
@@ -6930,7 +6930,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
icalcomponent_free (icalcomp);
} else {
- e_cal_view_add_event (E_CAL_VIEW (day_view), client, dtstart, default_zone, icalcomp, TRUE);
+ e_calendar_view_add_event (E_CALENDAR_VIEW (day_view), client, dtstart, default_zone, icalcomp, TRUE);
}
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -6953,14 +6953,14 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
EDayView *day_view)
{
EDayViewEvent *event = NULL;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
gint day, row, start_row, end_row, num_rows, scroll_x, scroll_y;
gint start_offset, end_offset;
- CalComponent *comp;
- CalComponentDateTime date;
+ ECalComponent *comp;
+ ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
- CalClient *client;
+ ECal *client;
gboolean drag_from_same_window;
if (day_view->drag_event_day != -1)
@@ -6968,7 +6968,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
else
drag_from_same_window = FALSE;
- client = e_cal_model_get_default_client (e_cal_view_get_model (E_CAL_VIEW (day_view)));
+ client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)));
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget),
&scroll_x, &scroll_y);
@@ -6983,7 +6983,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
pos = e_day_view_convert_position_in_main_canvas (day_view,
x, y, &day,
&row, NULL);
- if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
@@ -7020,20 +7020,20 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
don't want to change the original comp here.
Otherwise we would not detect that the event's time
had changed in the "update_event" callback. */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
date.value = &itt;
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
dt = e_day_view_convert_grid_position_to_time (day_view, day, row) + start_offset * 60;
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtstart (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtstart (comp, &date);
dt = e_day_view_convert_grid_position_to_time (day_view, day, row + num_rows) - end_offset * 60;
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtend (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ e_cal_component_set_dtend (comp, &date);
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -7045,7 +7045,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL)) {
g_object_unref (comp);
return;
@@ -7053,12 +7053,12 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
}
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
- cal_component_commit_sequence (comp);
+ e_cal_component_commit_sequence (comp);
- if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
if (itip_organizer_is_user (comp, client)
&& send_component_dialog (toplevel, client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
@@ -7081,7 +7081,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
pos = e_day_view_convert_position_in_main_canvas (day_view,
x, y, &day,
&row, NULL);
- if (pos == E_CAL_VIEW_POS_OUTSIDE)
+ if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
comp_str = (char *) data->data;
@@ -7090,7 +7090,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
goto error;
default_tzid = calendar_config_get_timezone ();
- cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
+ e_cal_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
kind = icalcomponent_isa (icalcomp);
@@ -7107,14 +7107,14 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
if (child_kind == ICAL_VEVENT_COMPONENT)
- e_cal_view_add_event (E_CAL_VIEW (day_view), client, dtstart,
+ e_calendar_view_add_event (E_CALENDAR_VIEW (day_view), client, dtstart,
default_zone, subcomp, FALSE);
else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- cal_client_add_timezone (client, zone, NULL);
+ e_cal_add_timezone (client, zone, NULL);
icaltimezone_free (zone, 1);
}
@@ -7126,7 +7126,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
icalcomponent_free (icalcomp);
} else {
- e_cal_view_add_event (E_CAL_VIEW (day_view), client, dtstart, default_zone, icalcomp, FALSE);
+ e_calendar_view_add_event (E_CALENDAR_VIEW (day_view), client, dtstart, default_zone, icalcomp, FALSE);
}
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -7150,7 +7150,7 @@ e_day_view_convert_time_to_display (EDayView *day_view,
/* Calculate the actual hour number to display. For 12-hour
format we convert 0-23 to 12-11am/12-11pm. */
*display_hour = hour;
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
*suffix = "";
*suffix_width = 0;
} else {
@@ -7177,7 +7177,7 @@ e_day_view_get_time_string_width (EDayView *day_view)
time_width = day_view->digit_width * 4 + day_view->colon_width;
- if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view)))
+ if (!e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view)))
time_width += MAX (day_view->am_string_width,
day_view->pm_string_width);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index cb691f5762..e31f0946dd 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -169,7 +169,7 @@ typedef enum
typedef struct _EDayViewEvent EDayViewEvent;
struct _EDayViewEvent {
- E_CAL_VIEW_EVENT_FIELDS
+ E_CALENDAR_VIEW_EVENT_FIELDS
/* For events in the main canvas, this contains the start column.
For long events in the top canvas, this is its row. */
@@ -194,7 +194,7 @@ typedef struct _EDayViewClass EDayViewClass;
struct _EDayView
{
- ECalView cal_view;
+ ECalendarView cal_view;
/* The top canvas where the dates and long appointments are shown. */
GtkWidget *top_canvas;
@@ -211,7 +211,7 @@ struct _EDayView
GtkWidget *vscrollbar;
/* S-expression for query and the query object */
- CalQuery *query;
+ ECalView *query;
/* The start and end of the days shown. */
time_t lower;
@@ -408,7 +408,7 @@ struct _EDayView
/* These are used when resizing events. */
gint resize_event_day;
gint resize_event_num;
- ECalViewPosition resize_drag_pos;
+ ECalendarViewPosition resize_drag_pos;
gint resize_start_row;
gint resize_end_row;
@@ -456,7 +456,7 @@ struct _EDayView
struct _EDayViewClass
{
- ECalViewClass parent_class;
+ ECalendarViewClass parent_class;
};
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 257d10fd71..e05079dd88 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -43,9 +43,9 @@
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <libical/ical.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/timeutil.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal-time-util.h>
+#include <libecal/e-cal.h>
#include <e-util/e-time-utils.h>
#include <e-util/e-dialog-widgets.h>
#include <evolution-shell-client.h>
@@ -60,12 +60,12 @@ struct _EItipControlPrivate {
GtkWidget *html;
GPtrArray *event_clients;
- CalClient *event_client;
+ ECal *event_client;
GPtrArray *task_clients;
- CalClient *task_client;
+ ECal *task_client;
char *vcalendar;
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *main_comp;
icalcomponent *ical_comp;
icalcomponent *top_level;
@@ -130,15 +130,15 @@ class_init (EItipControlClass *klass)
object_class->finalize = finalize;
}
-static CalClient *
+static ECal *
start_calendar_server (EItipControl *itip, char *uri)
{
- CalClient *client;
+ ECal *client;
GError *error = NULL;
- client = cal_client_new (uri, CALOBJ_TYPE_EVENT);
+ client = e_cal_new (uri, CALOBJ_TYPE_EVENT);
- if (!cal_client_open (client, TRUE, &error)) {
+ if (!e_cal_open (client, TRUE, &error)) {
g_warning (_("start_calendar_server(): %s"), error->message);
g_error_free (error);
g_object_unref (client);
@@ -149,13 +149,13 @@ start_calendar_server (EItipControl *itip, char *uri)
}
static gboolean
-start_default_server (EItipControl *itip, CalClient *client, gboolean tasks)
+start_default_server (EItipControl *itip, ECal *client, gboolean tasks)
{
#if 0
if (tasks)
- return cal_client_open_default_tasks (client, FALSE);
+ return e_cal_open_default_tasks (client, FALSE);
else
- return cal_client_open_default_calendar (client, FALSE);
+ return e_cal_open_default_calendar (client, FALSE);
#endif
}
@@ -201,7 +201,7 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char
folder = folder_list->_buffer[j];
for (k = 0; possible_types[k] != NULL; k++) {
- CalClient *client;
+ ECal *client;
char *uri;
if (itip->priv->destroyed)
@@ -210,7 +210,7 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char
if (strcmp (possible_types[k], folder.type))
continue;
- uri = cal_util_expand_uri (folder.physicalUri, tasks);
+ uri = e_cal_util_expand_uri (folder.physicalUri, tasks);
client = start_calendar_server (itip, uri);
if (client != NULL)
g_ptr_array_add (servers, client);
@@ -229,19 +229,19 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char
}
#endif
-static CalClient *
-find_server (GPtrArray *servers, CalComponent *comp)
+static ECal *
+find_server (GPtrArray *servers, ECalComponent *comp)
{
const char *uid;
int i;
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
for (i = 0; i < servers->len; i++) {
- CalClient *client;
+ ECal *client;
icalcomponent *icalcomp;
client = g_ptr_array_index (servers, i);
- if (cal_client_get_object (client, uid, NULL, &icalcomp, NULL)) {
+ if (e_cal_get_object (client, uid, NULL, &icalcomp, NULL)) {
icalcomponent_free (icalcomp);
g_object_ref (client);
@@ -527,7 +527,7 @@ find_attendee (icalcomponent *ical_comp, const char *address)
}
static void
-write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
+write_label_piece (EItipControl *itip, ECalComponentDateTime *dt,
char *buffer, int size,
const char *stext, const char *etext,
gboolean just_date)
@@ -597,7 +597,7 @@ nth (int n)
else if (n < 1 || n > 31)
return "?";
else
- return cal_recur_nth[n];
+ return e_cal_recur_nth[n];
}
static const char *dayname[] = {
@@ -622,7 +622,7 @@ get_dayname (struct icalrecurrencetype *r, int i)
}
static void
-write_recurrence_piece (EItipControl *itip, CalComponent *comp,
+write_recurrence_piece (EItipControl *itip, ECalComponent *comp,
char *buffer, int size)
{
GSList *rrules;
@@ -634,12 +634,12 @@ write_recurrence_piece (EItipControl *itip, CalComponent *comp,
buffer += len;
size -= len;
- if (!cal_component_has_simple_recurrence (comp)) {
+ if (!e_cal_component_has_simple_recurrence (comp)) {
strcpy (buffer, _("Yes. (Complex Recurrence)"));
return;
}
- cal_component_get_rrule_list (comp, &rrules);
+ e_cal_component_get_rrule_list (comp, &rrules);
g_return_if_fail (rrules && !rrules->next);
r = rrules->data;
@@ -722,7 +722,7 @@ write_recurrence_piece (EItipControl *itip, CalComponent *comp,
if (r->count) {
sprintf (buffer, _(" a total of %d times"), r->count);
} else if (!icaltime_is_null_time (r->until)) {
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
/* FIXME This should get the tzid id, not the whole zone */
dt.value = &r->until;
@@ -737,20 +737,20 @@ write_recurrence_piece (EItipControl *itip, CalComponent *comp,
static void
set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
- CalComponent *comp)
+ ECalComponent *comp)
{
EItipControlPrivate *priv;
- CalComponentDateTime datetime;
+ ECalComponentDateTime datetime;
static char buffer[1024];
gboolean wrote = FALSE, task_completed = FALSE;
- CalComponentVType type;
+ ECalComponentVType type;
priv = itip->priv;
- type = cal_component_get_vtype (comp);
+ type = e_cal_component_get_vtype (comp);
buffer[0] = '\0';
- cal_component_get_dtstart (comp, &datetime);
+ e_cal_component_get_dtstart (comp, &datetime);
if (datetime.value) {
write_label_piece (itip, &datetime, buffer, 1024,
_("<b>Starts:</b> "),
@@ -758,19 +758,19 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
gtk_html_write (html, html_stream, buffer, strlen(buffer));
wrote = TRUE;
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
buffer[0] = '\0';
- cal_component_get_dtend (comp, &datetime);
+ e_cal_component_get_dtend (comp, &datetime);
if (datetime.value){
write_label_piece (itip, &datetime, buffer, 1024, _("<b>Ends:</b> "), "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
buffer[0] = '\0';
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
write_recurrence_piece (itip, comp, buffer, 1024);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
@@ -778,8 +778,8 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
buffer[0] = '\0';
datetime.tzid = NULL;
- cal_component_get_completed (comp, &datetime.value);
- if (type == CAL_COMPONENT_TODO && datetime.value) {
+ e_cal_component_get_completed (comp, &datetime.value);
+ if (type == E_CAL_COMPONENT_TODO && datetime.value) {
/* Pass TRUE as is_utc, so it gets converted to the current
timezone. */
datetime.value->is_utc = TRUE;
@@ -788,17 +788,17 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
wrote = TRUE;
task_completed = TRUE;
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
buffer[0] = '\0';
- cal_component_get_due (comp, &datetime);
- if (type == CAL_COMPONENT_TODO && !task_completed && datetime.value) {
+ e_cal_component_get_due (comp, &datetime);
+ if (type == E_CAL_COMPONENT_TODO && !task_completed && datetime.value) {
write_label_piece (itip, &datetime, buffer, 1024, _("<b>Due:</b> "), "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
if (wrote)
gtk_html_stream_printf (html_stream, "<br>");
@@ -866,9 +866,9 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
{
EItipControlPrivate *priv;
GtkHTMLStream *html_stream;
- CalComponentText text;
- CalComponentOrganizer organizer;
- CalComponentAttendee *attendee;
+ ECalComponentText text;
+ ECalComponentOrganizer organizer;
+ ECalComponentAttendee *attendee;
GSList *attendees, *l = NULL;
const char *string;
gchar *html;
@@ -906,7 +906,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
case ICAL_METHOD_REFRESH:
case ICAL_METHOD_REPLY:
/* An attendee sent this */
- cal_component_get_attendee_list (priv->comp, &attendees);
+ e_cal_component_get_attendee_list (priv->comp, &attendees);
if (attendees != NULL) {
attendee = attendees->data;
html = g_strdup_printf (itip_desc,
@@ -919,7 +919,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
break;
case ICAL_METHOD_REQUEST:
/* The organizer sent this */
- cal_component_get_organizer (priv->comp, &organizer);
+ e_cal_component_get_organizer (priv->comp, &organizer);
if (priv->delegator_address != NULL) {
if (organizer.value != NULL)
html = g_strdup_printf (itip_desc,
@@ -951,7 +951,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
case ICAL_METHOD_CANCEL:
default:
/* The organizer sent this */
- cal_component_get_organizer (priv->comp, &organizer);
+ e_cal_component_get_organizer (priv->comp, &organizer);
if (organizer.value != NULL)
html = g_strdup_printf (itip_desc,
organizer.cn ?
@@ -979,7 +979,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
set_date_label (itip, GTK_HTML (priv->html), html_stream, priv->comp);
/* Summary */
- cal_component_get_summary (priv->comp, &text);
+ e_cal_component_get_summary (priv->comp, &text);
html = text.value ? camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0) : _("<i>None</i>");
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>",
_("Summary:"), html);
@@ -987,7 +987,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
g_free (html);
/* Location */
- cal_component_get_location (priv->comp, &string);
+ e_cal_component_get_location (priv->comp, &string);
if (string != NULL) {
html = camel_text_to_html (string, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>",
@@ -999,10 +999,10 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
if (priv->method == ICAL_METHOD_REPLY) {
GSList *alist;
- cal_component_get_attendee_list (priv->comp, &alist);
+ e_cal_component_get_attendee_list (priv->comp, &alist);
if (alist != NULL) {
- CalComponentAttendee *a = alist->data;
+ ECalComponentAttendee *a = alist->data;
gtk_html_stream_printf (html_stream, "<b>%s</b><br>",
_("Status:"));
@@ -1026,13 +1026,13 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
}
}
- cal_component_free_attendee_list (alist);
+ e_cal_component_free_attendee_list (alist);
}
/* Description */
- cal_component_get_description_list (priv->comp, &l);
+ e_cal_component_get_description_list (priv->comp, &l);
if (l)
- text = *((CalComponentText *)l->data);
+ text = *((ECalComponentText *)l->data);
if (l && text.value) {
html = camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
@@ -1040,7 +1040,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
_("Description:"), html);
g_free (html);
}
- cal_component_free_text_list (l);
+ e_cal_component_free_text_list (l);
/* Separator */
gtk_html_write (GTK_HTML (priv->html), html_stream, HTML_SEP, strlen (HTML_SEP));
@@ -1176,29 +1176,29 @@ get_cancel_options ()
}
-static CalComponent *
+static ECalComponent *
get_real_item (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
- CalComponentVType type;
+ ECalComponentVType type;
gboolean found = FALSE;
const char *uid;
priv = itip->priv;
- type = cal_component_get_vtype (priv->comp);
- cal_component_get_uid (priv->comp, &uid);
+ type = e_cal_component_get_vtype (priv->comp);
+ e_cal_component_get_uid (priv->comp, &uid);
switch (type) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
if (priv->event_client != NULL)
- found = cal_client_get_object (priv->event_client, uid, NULL, &icalcomp, NULL);
+ found = e_cal_get_object (priv->event_client, uid, NULL, &icalcomp, NULL);
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
if (priv->task_client != NULL)
- found = cal_client_get_object (priv->task_client, uid, NULL, &icalcomp, NULL);
+ found = e_cal_get_object (priv->task_client, uid, NULL, &icalcomp, NULL);
break;
default:
found = FALSE;
@@ -1207,8 +1207,8 @@ get_real_item (EItipControl *itip)
if (!found)
return NULL;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
icalcomponent_free (icalcomp);
return NULL;
@@ -1218,29 +1218,29 @@ get_real_item (EItipControl *itip)
}
static void
-adjust_item (EItipControl *itip, CalComponent *comp)
+adjust_item (EItipControl *itip, ECalComponent *comp)
{
- CalComponent *real_comp;
+ ECalComponent *real_comp;
real_comp = get_real_item (itip);
if (real_comp != NULL) {
- CalComponentText text;
+ ECalComponentText text;
const char *string;
GSList *l;
- cal_component_get_summary (real_comp, &text);
- cal_component_set_summary (comp, &text);
- cal_component_get_location (real_comp, &string);
- cal_component_set_location (comp, string);
- cal_component_get_description_list (real_comp, &l);
- cal_component_set_description_list (comp, l);
- cal_component_free_text_list (l);
+ e_cal_component_get_summary (real_comp, &text);
+ e_cal_component_set_summary (comp, &text);
+ e_cal_component_get_location (real_comp, &string);
+ e_cal_component_set_location (comp, string);
+ e_cal_component_get_description_list (real_comp, &l);
+ e_cal_component_set_description_list (comp, l);
+ e_cal_component_free_text_list (l);
g_object_unref (real_comp);
} else {
- CalComponentText text = {_("Unknown"), NULL};
+ ECalComponentText text = {_("Unknown"), NULL};
- cal_component_set_summary (comp, &text);
+ e_cal_component_set_summary (comp, &text);
}
}
@@ -1435,7 +1435,7 @@ static void
show_current (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalComponentVType type;
+ ECalComponentVType type;
icalcomponent *alarm_comp;
icalcompiter alarm_iter;
icalproperty *prop;
@@ -1479,8 +1479,8 @@ show_current (EItipControl *itip)
icalcompiter_next (&alarm_iter);
}
- priv->comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (priv->comp, priv->ical_comp)) {
+ priv->comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (priv->comp, priv->ical_comp)) {
write_error_html (itip, _("The message does not appear to be properly formed"));
g_object_unref (priv->comp);
priv->comp = NULL;
@@ -1490,19 +1490,19 @@ show_current (EItipControl *itip)
/* Add default reminder if the config says so */
if (calendar_config_get_use_default_reminder ()) {
- CalComponentAlarm *acomp;
+ ECalComponentAlarm *acomp;
int interval;
CalUnits units;
- CalAlarmTrigger trigger;
+ ECalComponentAlarmTrigger trigger;
interval = calendar_config_get_default_reminder_interval ();
units = calendar_config_get_default_reminder_units ();
- acomp = cal_component_alarm_new ();
+ acomp = e_cal_component_alarm_new ();
- cal_component_alarm_set_action (acomp, CAL_ALARM_DISPLAY);
+ e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY);
- trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START;
+ trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
trigger.u.rel_duration.is_neg = TRUE;
@@ -1521,16 +1521,16 @@ show_current (EItipControl *itip)
g_assert_not_reached ();
}
- cal_component_alarm_set_trigger (acomp, trigger);
- cal_component_add_alarm (priv->comp, acomp);
+ e_cal_component_alarm_set_trigger (acomp, trigger);
+ e_cal_component_add_alarm (priv->comp, acomp);
- cal_component_alarm_free (acomp);
+ e_cal_component_alarm_free (acomp);
}
- type = cal_component_get_vtype (priv->comp);
+ type = e_cal_component_get_vtype (priv->comp);
switch (type) {
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
if (!priv->event_clients) {
priv->event_clients = g_ptr_array_new ();
/* EPFIXME */
@@ -1538,14 +1538,14 @@ show_current (EItipControl *itip)
}
show_current_event (itip);
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
if (!priv->task_clients) {
/* EPFIXME */
/* priv->task_clients = get_servers (itip, global_shell_client, tasks_types, TRUE); */
}
show_current_todo (itip);
break;
- case CAL_COMPONENT_FREEBUSY:
+ case E_CAL_COMPONENT_FREEBUSY:
show_current_freebusy (itip);
break;
default:
@@ -1576,7 +1576,7 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text)
}
priv->vcalendar = g_strdup (text);
- priv->top_level = cal_util_new_top_level ();
+ priv->top_level = e_cal_util_new_top_level ();
priv->main_comp = icalparser_parse_string (priv->vcalendar);
if (priv->main_comp == NULL) {
@@ -1818,8 +1818,8 @@ update_item (EItipControl *itip)
struct icaltimetype stamp;
icalproperty *prop;
icalcomponent *clone;
- CalClient *client;
- CalComponentVType type;
+ ECal *client;
+ ECalComponentVType type;
GtkWidget *dialog;
priv = itip->priv;
@@ -1838,8 +1838,8 @@ update_item (EItipControl *itip)
icalproperty_set_x_name (prop, "X-MICROSOFT-CDO-REPLYTIME");
icalcomponent_add_property (priv->ical_comp, prop);
- type = cal_component_get_vtype (priv->comp);
- if (type == CAL_COMPONENT_TODO)
+ type = e_cal_component_get_vtype (priv->comp);
+ if (type == E_CAL_COMPONENT_TODO)
client = priv->task_client;
else
client = priv->event_client;
@@ -1849,7 +1849,7 @@ update_item (EItipControl *itip)
icalcomponent_set_method (priv->top_level, priv->method);
/* FIXME Better error dialog */
- if (!cal_client_receive_objects (client, priv->top_level, NULL)) {
+ if (!e_cal_receive_objects (client, priv->top_level, NULL)) {
dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n"));
} else {
dialog = gnome_ok_dialog (_("Update complete\n"));
@@ -1864,19 +1864,19 @@ static void
update_attendee_status (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalClient *client;
- CalClientGetStatus status;
- CalComponent *comp = NULL;
+ ECal *client;
+ ECalGetStatus status;
+ ECalComponent *comp = NULL;
icalcomponent *icalcomp = NULL;
- CalComponentVType type;
+ ECalComponentVType type;
const char *uid;
GtkWidget *dialog;
- CalClientResult result;
+ ECalResult result;
priv = itip->priv;
- type = cal_component_get_vtype (priv->comp);
- if (type == CAL_COMPONENT_TODO)
+ type = e_cal_component_get_vtype (priv->comp);
+ if (type == E_CAL_COMPONENT_TODO)
client = priv->task_client;
else
client = priv->event_client;
@@ -1888,21 +1888,21 @@ update_attendee_status (EItipControl *itip)
}
/* Obtain our version */
- cal_component_get_uid (priv->comp, &uid);
- status = cal_client_get_object (client, uid, NULL, &icalcomp);
+ e_cal_component_get_uid (priv->comp, &uid);
+ status = e_cal_get_object (client, uid, NULL, &icalcomp);
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (status == E_CAL_GET_SUCCESS) {
GSList *attendees;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
} else {
- cal_component_get_attendee_list (priv->comp, &attendees);
+ e_cal_component_get_attendee_list (priv->comp, &attendees);
if (attendees != NULL) {
- CalComponentAttendee *a = attendees->data;
+ ECalComponentAttendee *a = attendees->data;
icalproperty *prop;
prop = find_attendee (icalcomp, itip_strip_mailto (a->value));
@@ -1915,7 +1915,7 @@ update_attendee_status (EItipControl *itip)
change_status (icalcomp,
itip_strip_mailto (a->value),
a->status);
- cal_component_rescan (comp);
+ e_cal_component_rescan (comp);
} else {
goto cleanup;
}
@@ -1928,26 +1928,26 @@ update_attendee_status (EItipControl *itip)
change_status (icalcomp,
itip_strip_mailto (a->value),
a->status);
- cal_component_rescan (comp);
+ e_cal_component_rescan (comp);
}
}
}
- result = cal_client_update_object (client, comp);
+ result = e_cal_update_object (client, comp);
switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
+ case E_CAL_RESULT_INVALID_OBJECT :
dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
break;
- case CAL_CLIENT_RESULT_CORBA_ERROR :
+ case E_CAL_RESULT_CORBA_ERROR :
dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
+ case E_CAL_RESULT_NOT_FOUND :
dialog = gnome_warning_dialog (_("Object could not be found\n"));
break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
+ case E_CAL_RESULT_PERMISSION_DENIED :
dialog = gnome_warning_dialog (_("You don't have the right permissions to update the calendar\n"));
break;
- case CAL_CLIENT_RESULT_SUCCESS :
+ case E_CAL_RESULT_SUCCESS :
dialog = gnome_ok_dialog (_("Attendee status updated\n"));
break;
default :
@@ -1969,16 +1969,16 @@ static void
remove_item (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalClient *client;
- CalComponentVType type;
+ ECal *client;
+ ECalComponentVType type;
const char *uid;
GtkWidget *dialog;
GError *error = NULL;
priv = itip->priv;
- type = cal_component_get_vtype (priv->comp);
- if (type == CAL_COMPONENT_TODO)
+ type = e_cal_component_get_vtype (priv->comp);
+ if (type == E_CAL_COMPONENT_TODO)
client = priv->task_client;
else
client = priv->event_client;
@@ -1986,8 +1986,8 @@ remove_item (EItipControl *itip)
if (client == NULL)
return;
- cal_component_get_uid (priv->comp, &uid);
- cal_client_remove_object (client, uid, &error);
+ e_cal_component_get_uid (priv->comp, &uid);
+ e_cal_remove_object (client, uid, &error);
if (!error || error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
dialog = gnome_ok_dialog (_("Removal Complete"));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
@@ -2002,25 +2002,25 @@ static void
send_item (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalComponent *comp;
- CalComponentVType vtype;
+ ECalComponent *comp;
+ ECalComponentVType vtype;
GtkWidget *dialog;
priv = itip->priv;
comp = get_real_item (itip);
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
if (comp != NULL) {
switch (vtype) {
- case CAL_COMPONENT_EVENT:
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, priv->event_client, NULL);
+ case E_CAL_COMPONENT_EVENT:
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->event_client, NULL);
break;
- case CAL_COMPONENT_TODO:
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, priv->task_client, NULL);
+ case E_CAL_COMPONENT_TODO:
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->task_client, NULL);
break;
default:
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, NULL, NULL);
}
g_object_unref (comp);
dialog = gnome_ok_dialog (_("Item sent!\n"));
@@ -2034,7 +2034,7 @@ static void
send_freebusy (EItipControl *itip)
{
EItipControlPrivate *priv;
- CalComponentDateTime datetime;
+ ECalComponentDateTime datetime;
time_t start, end;
GtkWidget *dialog;
GList *comp_list = NULL;
@@ -2042,7 +2042,7 @@ send_freebusy (EItipControl *itip)
priv = itip->priv;
- cal_component_get_dtstart (priv->comp, &datetime);
+ e_cal_component_get_dtstart (priv->comp, &datetime);
if (datetime.tzid) {
zone = icalcomponent_get_timezone (priv->top_level,
datetime.tzid);
@@ -2050,9 +2050,9 @@ send_freebusy (EItipControl *itip)
zone = NULL;
}
start = icaltime_as_timet_with_zone (*datetime.value, zone);
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
- cal_component_get_dtend (priv->comp, &datetime);
+ e_cal_component_get_dtend (priv->comp, &datetime);
if (datetime.tzid) {
zone = icalcomponent_get_timezone (priv->top_level,
datetime.tzid);
@@ -2060,14 +2060,14 @@ send_freebusy (EItipControl *itip)
zone = NULL;
}
end = icaltime_as_timet_with_zone (*datetime.value, zone);
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
- if (cal_client_get_free_busy (priv->event_client, NULL, start, end, &comp_list, NULL)) {
+ if (e_cal_get_free_busy (priv->event_client, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, priv->event_client, NULL);
+ ECalComponent *comp = E_CAL_COMPONENT (l->data);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->event_client, NULL);
g_object_unref (comp);
}
@@ -2085,16 +2085,16 @@ button_selected_cb (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folde
{
EItipControl *itip = E_ITIP_CONTROL (data);
EItipControlPrivate *priv;
- CalComponentVType type;
+ ECalComponentVType type;
char *uri;
priv = itip->priv;
- type = cal_component_get_vtype (priv->comp);
- if (type == CAL_COMPONENT_TODO)
- uri = cal_util_expand_uri (folder->physicalUri, TRUE);
+ type = e_cal_component_get_vtype (priv->comp);
+ if (type == E_CAL_COMPONENT_TODO)
+ uri = e_cal_util_expand_uri (folder->physicalUri, TRUE);
else
- uri = cal_util_expand_uri (folder->physicalUri, FALSE);
+ uri = e_cal_util_expand_uri (folder->physicalUri, FALSE);
g_object_unref (priv->event_client);
priv->event_client = start_calendar_server (itip, uri);
@@ -2137,21 +2137,21 @@ typedef struct
{
EItipControl *itip;
GtkHTMLEmbedded *eb;
- CalClient *client;
+ ECal *client;
}
ObjectRequestContext;
static void
-default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+default_server_started_cb (ECal *client, ECalOpenStatus status, gpointer data)
{
ObjectRequestContext *context = data;
EItipControlPrivate *priv;
GtkWidget *button;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
priv = context->itip->priv;
- if (status != CAL_CLIENT_OPEN_SUCCESS ||
+ if (status != E_CAL_OPEN_SUCCESS ||
context->itip->priv->destroyed ||
context->itip->priv->html == NULL) {
g_object_unref (context->client);
@@ -2161,17 +2161,17 @@ default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpoint
}
priv->event_client = client;
- vtype = cal_component_get_vtype (priv->comp);
+ vtype = e_cal_component_get_vtype (priv->comp);
switch (vtype) {
#if 0 /* EPFIXME */
- case CAL_COMPONENT_EVENT:
+ case E_CAL_COMPONENT_EVENT:
button = evolution_folder_selector_button_new (
global_shell_client, _("Select Calendar Folder"),
calendar_config_default_calendar_folder (),
calendar_types);
break;
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
button = evolution_folder_selector_button_new (
global_shell_client, _("Select Tasks Folder"),
calendar_config_default_tasks_folder (),
@@ -2198,23 +2198,23 @@ object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
EItipControl *itip = E_ITIP_CONTROL (data);
ObjectRequestContext *context;
EItipControlPrivate *priv;
- CalComponentVType vtype;
+ ECalComponentVType vtype;
gboolean success;
priv = itip->priv;
- vtype = cal_component_get_vtype (priv->comp);
+ vtype = e_cal_component_get_vtype (priv->comp);
context = g_new0 (ObjectRequestContext, 1);
context->itip = itip;
context->eb = eb;
switch (vtype) {
- case CAL_COMPONENT_EVENT:
- context->client = cal_client_new ("", CALOBJ_TYPE_EVENT);
+ case E_CAL_COMPONENT_EVENT:
+ context->client = e_cal_new ("", CALOBJ_TYPE_EVENT);
success = start_default_server (itip, context->client, FALSE);
break;
- case CAL_COMPONENT_TODO:
- context->client = cal_client_new ("", CALOBJ_TYPE_TODO);
+ case E_CAL_COMPONENT_TODO:
+ context->client = e_cal_new ("", CALOBJ_TYPE_TODO);
success = start_default_server (itip, context->client, TRUE);
break;
default:
@@ -2262,7 +2262,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
status = change_status (priv->ical_comp, priv->my_address,
ICAL_PARTSTAT_ACCEPTED);
if (status) {
- cal_component_rescan (priv->comp);
+ e_cal_component_rescan (priv->comp);
update_item (itip);
}
break;
@@ -2270,7 +2270,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
status = change_status (priv->ical_comp, priv->my_address,
ICAL_PARTSTAT_TENTATIVE);
if (status) {
- cal_component_rescan (priv->comp);
+ e_cal_component_rescan (priv->comp);
update_item (itip);
}
break;
@@ -2278,7 +2278,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
status = change_status (priv->ical_comp, priv->my_address,
ICAL_PARTSTAT_DECLINED);
if (status) {
- cal_component_rescan (priv->comp);
+ e_cal_component_rescan (priv->comp);
remove_item (itip);
}
break;
@@ -2308,24 +2308,24 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
g_strfreev (fields);
if (rsvp && status) {
- CalComponent *comp = NULL;
- CalComponentVType vtype;
+ ECalComponent *comp = NULL;
+ ECalComponentVType vtype;
icalcomponent *ical_comp;
icalproperty *prop;
icalvalue *value;
const char *attendee;
GSList *l, *list = NULL;
- comp = cal_component_clone (priv->comp);
+ comp = e_cal_component_clone (priv->comp);
if (comp == NULL)
return;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
if (priv->my_address == NULL)
find_my_address (itip, priv->ical_comp);
g_assert (priv->my_address != NULL);
- ical_comp = cal_component_get_icalcomponent (comp);
+ ical_comp = e_cal_component_get_icalcomponent (comp);
for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
@@ -2353,18 +2353,18 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
}
g_slist_free (list);
- cal_component_rescan (comp);
+ e_cal_component_rescan (comp);
switch (vtype) {
- case CAL_COMPONENT_EVENT:
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp,
+ case E_CAL_COMPONENT_EVENT:
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp,
priv->event_client, priv->top_level);
break;
- case CAL_COMPONENT_TODO:
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp,
+ case E_CAL_COMPONENT_TODO:
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp,
priv->task_client, priv->top_level);
break;
default:
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, NULL, NULL);
}
g_object_unref (comp);
}
diff --git a/calendar/gui/e-meeting-attendee.c b/calendar/gui/e-meeting-attendee.c
index 8b988f085f..474cf7b1a4 100644
--- a/calendar/gui/e-meeting-attendee.c
+++ b/calendar/gui/e-meeting-attendee.c
@@ -199,7 +199,7 @@ e_meeting_attendee_new (void)
}
GObject *
-e_meeting_attendee_new_from_cal_component_attendee (CalComponentAttendee *ca)
+e_meeting_attendee_new_from_e_cal_component_attendee (ECalComponentAttendee *ca)
{
EMeetingAttendee *ia;
@@ -220,15 +220,15 @@ e_meeting_attendee_new_from_cal_component_attendee (CalComponentAttendee *ca)
return G_OBJECT (ia);
}
-CalComponentAttendee *
-e_meeting_attendee_as_cal_component_attendee (EMeetingAttendee *ia)
+ECalComponentAttendee *
+e_meeting_attendee_as_e_cal_component_attendee (EMeetingAttendee *ia)
{
EMeetingAttendeePrivate *priv;
- CalComponentAttendee *ca;
+ ECalComponentAttendee *ca;
priv = ia->priv;
- ca = g_new0 (CalComponentAttendee, 1);
+ ca = g_new0 (ECalComponentAttendee, 1);
ca->value = priv->address;
ca->member = string_is_set (priv->member) ? priv->member : NULL;
diff --git a/calendar/gui/e-meeting-attendee.h b/calendar/gui/e-meeting-attendee.h
index 5ddc9968b2..42c5e13c2e 100644
--- a/calendar/gui/e-meeting-attendee.h
+++ b/calendar/gui/e-meeting-attendee.h
@@ -28,7 +28,7 @@
#endif
#include <gtk/gtk.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal-component.h>
#include "e-meeting-types.h"
#ifdef __cplusplus
@@ -80,9 +80,9 @@ struct _EMeetingAttendeeClass {
GType e_meeting_attendee_get_type (void);
GObject *e_meeting_attendee_new (void);
-GObject *e_meeting_attendee_new_from_cal_component_attendee (CalComponentAttendee *ca);
+GObject *e_meeting_attendee_new_from_e_cal_component_attendee (ECalComponentAttendee *ca);
-CalComponentAttendee *e_meeting_attendee_as_cal_component_attendee (EMeetingAttendee *ia);
+ECalComponentAttendee *e_meeting_attendee_as_e_cal_component_attendee (EMeetingAttendee *ia);
const gchar *e_meeting_attendee_get_address (EMeetingAttendee *ia);
void e_meeting_attendee_set_address (EMeetingAttendee *ia, gchar *address);
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 4de564ff22..903b16f126 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -34,11 +34,11 @@
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs.h>
-#include <ebook/e-book.h>
-#include <ebook/e-vcard.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/cal-util.h>
-#include <cal-util/timeutil.h>
+#include <libebook/e-book.h>
+#include <libebook/e-vcard.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-time-util.h>
#include "Evolution-Addressbook-SelectNames.h"
#include "calendar-config.h"
#include "e-meeting-list-view.h"
@@ -318,7 +318,7 @@ process_section (EMeetingListView *view, EABDestination **cards, icalparameter_r
name = eab_destination_get_name (cards[i]);
/* Get the field as attendee from the backend */
- if (cal_client_get_ldap_attribute (e_meeting_store_get_cal_client (priv->store),
+ if (e_cal_get_ldap_attribute (e_meeting_store_get_e_cal (priv->store),
&attr, NULL)) {
/* FIXME this should be more general */
if (!g_ascii_strcasecmp (attr, "icscalendar")) {
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index 964102d512..1a67594eca 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -39,9 +39,9 @@
#include <ebook/e-book.h>
#include <ebook/e-book-async.h>
#include <ebook/e-contact.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/cal-util.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-time-util.h>
#include "Evolution-Addressbook-SelectNames.h"
#include "calendar-config.h"
#include "itip-utils.h"
@@ -57,7 +57,7 @@ struct _EMeetingModelPrivate
GList *tables;
- CalClient *client;
+ ECal *client;
icaltimezone *zone;
EBook *ebook;
@@ -678,8 +678,8 @@ e_meeting_model_new (void)
}
-CalClient *
-e_meeting_model_get_cal_client (EMeetingModel *im)
+ECal *
+e_meeting_model_get_e_cal (EMeetingModel *im)
{
EMeetingModelPrivate *priv;
@@ -689,7 +689,7 @@ e_meeting_model_get_cal_client (EMeetingModel *im)
}
void
-e_meeting_model_set_cal_client (EMeetingModel *im, CalClient *client)
+e_meeting_model_set_e_cal (EMeetingModel *im, ECal *client)
{
EMeetingModelPrivate *priv;
@@ -1234,7 +1234,7 @@ process_free_busy (EMeetingModelQueueData *qdata, char *text)
icalcompiter iter;
icalcomponent *tz_top_level, *sub_comp;
- tz_top_level = cal_util_new_top_level ();
+ tz_top_level = e_cal_util_new_top_level ();
iter = icalcomponent_begin_component (main_comp, ICAL_VTIMEZONE_COMPONENT);
while ((sub_comp = icalcompiter_deref (&iter)) != NULL) {
@@ -1407,16 +1407,16 @@ refresh_busy_periods (gpointer data)
users = g_list_append (users, g_strdup (user));
/* FIXME Error checking */
- cal_client_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL);
+ e_cal_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL);
g_list_foreach (users, (GFunc)g_free, NULL);
g_list_free (users);
if (fb_data != NULL) {
- CalComponent *comp = fb_data->data;
+ ECalComponent *comp = fb_data->data;
char *comp_str;
- comp_str = cal_component_get_as_string (comp);
+ comp_str = e_cal_component_get_as_string (comp);
process_free_busy (qdata, comp_str);
g_free (comp_str);
return TRUE;
@@ -1660,7 +1660,7 @@ process_section (EMeetingModel *im, EABDestination **destv, icalparameter_role r
name = eab_destination_get_name (dest);
/* Get the field as attendee from the backend */
- if (cal_client_get_ldap_attribute (priv->client, &attr, NULL) && attr) {
+ if (e_cal_get_ldap_attribute (priv->client, &attr, NULL) && attr) {
/* FIXME this should be more general */
if (!strcmp (attr, "icscalendar")) {
EContact *contact = eab_destination_get_contact (dest);
diff --git a/calendar/gui/e-meeting-model.h b/calendar/gui/e-meeting-model.h
index 50fba6c7a6..e709cd3aa4 100644
--- a/calendar/gui/e-meeting-model.h
+++ b/calendar/gui/e-meeting-model.h
@@ -26,7 +26,7 @@
#include <gtk/gtk.h>
#include <gal/e-table/e-table-scrolled.h>
#include <gal/e-table/e-table-model.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "e-meeting-attendee.h"
G_BEGIN_DECLS
@@ -72,8 +72,8 @@ typedef void (* EMeetingModelRefreshCallback) (gpointer data);
GtkType e_meeting_model_get_type (void);
GtkObject *e_meeting_model_new (void);
-CalClient *e_meeting_model_get_cal_client (EMeetingModel *im);
-void e_meeting_model_set_cal_client (EMeetingModel *im, CalClient *client);
+ECal *e_meeting_model_get_e_cal (EMeetingModel *im);
+void e_meeting_model_set_e_cal (EMeetingModel *im, ECal *client);
icaltimezone *e_meeting_model_get_zone (EMeetingModel *im);
void e_meeting_model_set_zone (EMeetingModel *im, icaltimezone *zone);
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 6064971d9f..2bbaff4bec 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -29,10 +29,10 @@
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs.h>
-#include <ebook/e-book.h>
-#include <cal-util/cal-component.h>
-#include <cal-util/cal-util.h>
-#include <cal-util/timeutil.h>
+#include <libebook/e-book.h>
+#include <libecal/e-cal-component.h>
+#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-time-util.h>
#include "calendar-config.h"
#include "itip-utils.h"
#include "e-meeting-utils.h"
@@ -45,7 +45,7 @@ struct _EMeetingStorePrivate {
GPtrArray *attendees;
gint stamp;
- CalClient *client;
+ ECal *client;
icaltimezone *zone;
EBook *ebook;
@@ -667,14 +667,14 @@ e_meeting_store_new (void)
}
-CalClient *
-e_meeting_store_get_cal_client (EMeetingStore *store)
+ECal *
+e_meeting_store_get_e_cal (EMeetingStore *store)
{
return store->priv->client;
}
void
-e_meeting_store_set_cal_client (EMeetingStore *store, CalClient *client)
+e_meeting_store_set_e_cal (EMeetingStore *store, ECal *client)
{
if (store->priv->client != NULL)
g_object_unref (store->priv->client);
@@ -1057,7 +1057,7 @@ process_free_busy (EMeetingStoreQueueData *qdata, char *text)
icalcompiter iter;
icalcomponent *tz_top_level, *sub_comp;
- tz_top_level = cal_util_new_top_level ();
+ tz_top_level = e_cal_util_new_top_level ();
iter = icalcomponent_begin_component (main_comp, ICAL_VTIMEZONE_COMPONENT);
while ((sub_comp = icalcompiter_deref (&iter)) != NULL) {
@@ -1147,16 +1147,16 @@ refresh_busy_periods (gpointer data)
user = itip_strip_mailto (e_meeting_attendee_get_address (attendee));
users = g_list_append (users, g_strdup (user));
- cal_client_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL);
+ e_cal_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL);
g_list_foreach (users, (GFunc)g_free, NULL);
g_list_free (users);
if (fb_data != NULL) {
- CalComponent *comp = fb_data->data;
+ ECalComponent *comp = fb_data->data;
char *comp_str;
- comp_str = cal_component_get_as_string (comp);
+ comp_str = e_cal_component_get_as_string (comp);
process_free_busy (qdata, comp_str);
g_free (comp_str);
return TRUE;
diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h
index e5e518289d..8454c380b0 100644
--- a/calendar/gui/e-meeting-store.h
+++ b/calendar/gui/e-meeting-store.h
@@ -24,7 +24,7 @@
#define _E_MEETING_STORE_H_
#include <gtk/gtkliststore.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "e-meeting-attendee.h"
G_BEGIN_DECLS
@@ -72,8 +72,8 @@ GObject *e_meeting_store_new (void);
void e_meeting_store_set_value (EMeetingStore *im, int row, int col, const gchar *val);
-CalClient *e_meeting_store_get_cal_client (EMeetingStore *im);
-void e_meeting_store_set_cal_client (EMeetingStore *im, CalClient *client);
+ECal *e_meeting_store_get_e_cal (EMeetingStore *im);
+void e_meeting_store_set_e_cal (EMeetingStore *im, ECal *client);
icaltimezone *e_meeting_store_get_zone (EMeetingStore *im);
void e_meeting_store_set_zone (EMeetingStore *im, icaltimezone *zone);
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index 9b325d6ac0..fbda387d23 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -24,7 +24,7 @@
#include <gtk/gtkcellrenderertext.h>
#include <gal/util/e-util.h>
-#include "cal-util/cal-util-marshal.h"
+#include "e-calendar-marshal.h"
#include "e-select-names-editable.h"
#include "e-select-names-renderer.h"
@@ -161,7 +161,7 @@ esnr_class_init (ESelectNamesRendererClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ESelectNamesRendererClass, cell_edited),
NULL, NULL,
- cal_util_marshal_VOID__STRING_STRING_STRING,
+ e_calendar_marshal_VOID__STRING_STRING_STRING,
G_TYPE_NONE, 3,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
}
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index d094b3af56..a5b9eac4e8 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -36,7 +36,7 @@
#include "e-util/e-categories-config.h"
#include "e-util/e-time-utils.h"
#include "e-util/e-url.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "widgets/menus/gal-view-menus.h"
#include "dialogs/delete-error.h"
#include "dialogs/task-editor.h"
@@ -53,8 +53,8 @@
/* Private part of the GnomeCalendar structure */
struct _ETasksPrivate {
/* The calendar client object we monitor */
- CalClient *client;
- CalQuery *query;
+ ECal *client;
+ ECalView *query;
/* The ECalendarTable showing the tasks. */
GtkWidget *tasks_view;
@@ -80,8 +80,8 @@ static void e_tasks_init (ETasks *tasks);
static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
-static void cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data);
-static void backend_error_cb (CalClient *client, const char *message, gpointer data);
+static void cal_opened_cb (ECal *client, ECalOpenStatus status, gpointer data);
+static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
enum {
@@ -117,17 +117,17 @@ timet_to_str_with_zone (time_t t, icaltimezone *zone)
}
static void
-write_html (GtkHTMLStream *stream, CalComponent *comp)
+write_html (GtkHTMLStream *stream, ECalComponent *comp)
{
- CalComponentText text;
- CalComponentDateTime dt;
+ ECalComponentText text;
+ ECalComponentDateTime dt;
gchar *buf, *str;
icaltimezone *current_zone;
GSList *l;
icalproperty_status status;
int *priority_value;
- g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
str = calendar_config_get_timezone ();
if (str && str[0]) {
@@ -136,13 +136,13 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
current_zone = icaltimezone_get_utc_timezone ();
/* write document header */
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
gtk_html_stream_printf (stream,
"<HTML><BODY><H1>%s</H1>",
text.value);
/* write icons for the categories */
- cal_component_get_categories_list (comp, &l);
+ e_cal_component_get_categories_list (comp, &l);
if (l) {
GSList *node;
@@ -156,7 +156,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
}
}
- cal_component_free_categories_list (l);
+ e_cal_component_free_categories_list (l);
}
/* write summary */
@@ -166,7 +166,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
_("Summary:"), text.value);
/* write start date */
- cal_component_get_dtstart (comp, &dt);
+ e_cal_component_get_dtstart (comp, &dt);
if (dt.value != NULL) {
buf = timet_to_str_with_zone (icaltime_as_timet (*dt.value), current_zone);
str = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
@@ -178,11 +178,11 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD><TD>%s</TD></TR>",
_("Start Date:"), str);
- cal_component_free_datetime (&dt);
+ e_cal_component_free_datetime (&dt);
g_free (str);
/* write Due Date */
- cal_component_get_due (comp, &dt);
+ e_cal_component_get_due (comp, &dt);
if (dt.value != NULL) {
buf = timet_to_str_with_zone (icaltime_as_timet (*dt.value), current_zone);
str = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
@@ -194,12 +194,12 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD><TD>%s</TD></TR>",
_("Due Date:"), str);
- cal_component_free_datetime (&dt);
+ e_cal_component_free_datetime (&dt);
g_free (str);
/* write status */
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Status:"));
- cal_component_get_status (comp, &status);
+ e_cal_component_get_status (comp, &status);
switch (status) {
case ICAL_STATUS_INPROCESS :
str = g_strdup (_("In Progress"));
@@ -221,7 +221,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
/* write priority */
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Priority:"));
- cal_component_get_priority (comp, &priority_value);
+ e_cal_component_get_priority (comp, &priority_value);
if (priority_value) {
if (*priority_value == 0)
str = g_strdup ("");
@@ -235,7 +235,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gtk_html_stream_printf (stream, "<TD>%s</TD></TR>", str);
g_free (str);
- cal_component_free_priority (priority_value);
+ e_cal_component_free_priority (priority_value);
} else
gtk_html_stream_printf (stream, "<TD></TD></TR>");
@@ -243,7 +243,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gtk_html_stream_printf (stream, "<TR><TD COLSPAN=\"2\"><HR></TD></TR>");
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Description:"));
- cal_component_get_description_list (comp, &l);
+ e_cal_component_get_description_list (comp, &l);
if (l) {
GSList *node;
@@ -253,7 +253,7 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gint i;
GString *str = g_string_new ("");;
- text = * (CalComponentText *) node->data;
+ text = * (ECalComponentText *) node->data;
for (i = 0; i < strlen (text.value ? text.value : 0); i++) {
if (text.value[i] == '\n')
str = g_string_append (str, "<BR>");
@@ -271,13 +271,13 @@ write_html (GtkHTMLStream *stream, CalComponent *comp)
gtk_html_stream_printf (stream, "</TD></TR>");
- cal_component_free_text_list (l);
+ e_cal_component_free_text_list (l);
} else
gtk_html_stream_printf (stream, "<TD></TD></TR>");
/* URL */
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Web Page:"));
- cal_component_get_url (comp, (const char **) &str);
+ e_cal_component_get_url (comp, (const char **) &str);
if (str)
gtk_html_stream_printf (stream, "<TD><A HREF=\"%s\">%s</A></TD></TR>", str, str);
else
@@ -320,7 +320,7 @@ table_cursor_change_cb (ETable *etable, int row, gpointer data)
GtkHTMLStream *stream;
ECalModel *model;
ECalModelComponent *comp_data;
- CalComponent *comp;
+ ECalComponent *comp;
const char *uid;
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
@@ -328,13 +328,13 @@ table_cursor_change_cb (ETable *etable, int row, gpointer data)
stream = gtk_html_begin (GTK_HTML (priv->html));
comp_data = e_cal_model_get_component_at (model, e_table_get_cursor_row (etable));
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
write_html (stream, comp);
gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
if (priv->current_uid)
g_free (priv->current_uid);
priv->current_uid = g_strdup (uid);
@@ -435,9 +435,9 @@ set_timezone (ETasks *tasks)
if (!zone)
zone = icaltimezone_get_utc_timezone ();
- if (cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED)
+ if (e_cal_get_load_state (priv->client) == E_CAL_LOAD_LOADED)
/* FIXME Error checking */
- cal_client_set_default_timezone (priv->client, zone, NULL);
+ e_cal_set_default_timezone (priv->client, zone, NULL);
}
static void
@@ -581,7 +581,7 @@ e_tasks_init (ETasks *tasks)
/* Callback used when the set of categories changes in the calendar client */
static void
-client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer data)
+client_categories_changed_cb (ECal *client, GPtrArray *categories, gpointer data)
{
ETasks *tasks;
ETasksPrivate *priv;
@@ -593,7 +593,7 @@ client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer
}
static void
-client_obj_updated_cb (CalClient *client, const char *uid, gpointer data)
+client_obj_updated_cb (ECal *client, const char *uid, gpointer data)
{
ETasks *tasks;
ETasksPrivate *priv;
@@ -717,8 +717,8 @@ e_tasks_open (ETasks *tasks,
g_free (message);
g_free (urinopwd);
- /* create the CalClient */
- priv->client = cal_client_new (real_uri, CALOBJ_TYPE_TODO);
+ /* create the ECal */
+ priv->client = e_cal_new (real_uri, CALOBJ_TYPE_TODO);
if (!priv->client)
return FALSE;
@@ -736,7 +736,7 @@ e_tasks_open (ETasks *tasks,
e_cal_model_add_client (model, priv->client);
- if (cal_client_open (priv->client, FALSE, &error)) {
+ if (e_cal_open (priv->client, FALSE, &error)) {
g_message ("e_tasks_open(): %s", error->message);
g_free (real_uri);
e_uri_free (uri);
@@ -798,8 +798,8 @@ permission_error (ETasks *tasks, const char *uri)
/* Callback from the calendar client when a calendar is opened */
static void
-cal_opened_cb (CalClient *client,
- CalClientOpenStatus status,
+cal_opened_cb (ECal *client,
+ ECalOpenStatus status,
gpointer data)
{
ETasks *tasks;
@@ -811,26 +811,26 @@ cal_opened_cb (CalClient *client,
set_status_message (tasks, NULL);
switch (status) {
- case CAL_CLIENT_OPEN_SUCCESS:
+ case E_CAL_OPEN_SUCCESS:
/* Everything is OK */
set_timezone (tasks);
return;
- case CAL_CLIENT_OPEN_ERROR:
- load_error (tasks, cal_client_get_uri (client));
+ case E_CAL_OPEN_ERROR:
+ load_error (tasks, e_cal_get_uri (client));
break;
- case CAL_CLIENT_OPEN_NOT_FOUND:
+ case E_CAL_OPEN_NOT_FOUND:
/* bullshit; we did not specify only_if_exists */
g_assert_not_reached ();
return;
- case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED:
- method_error (tasks, cal_client_get_uri (client));
+ case E_CAL_OPEN_METHOD_NOT_SUPPORTED:
+ method_error (tasks, e_cal_get_uri (client));
break;
- case CAL_CLIENT_OPEN_PERMISSION_DENIED:
- permission_error (tasks, cal_client_get_uri (client));
+ case E_CAL_OPEN_PERMISSION_DENIED:
+ permission_error (tasks, e_cal_get_uri (client));
break;
default:
@@ -840,7 +840,7 @@ cal_opened_cb (CalClient *client,
/* Callback from the calendar client when an error occurs in the backend */
static void
-backend_error_cb (CalClient *client, const char *message, gpointer data)
+backend_error_cb (ECal *client, const char *message, gpointer data)
{
ETasks *tasks;
ETasksPrivate *priv;
@@ -850,7 +850,7 @@ backend_error_cb (CalClient *client, const char *message, gpointer data)
tasks = E_TASKS (data);
priv = tasks->priv;
- urinopwd = get_uri_without_password (cal_client_get_uri (client));
+ urinopwd = get_uri_without_password (e_cal_get_uri (client));
errmsg = g_strdup_printf (_("Error on %s:\n %s"), urinopwd, message);
gnome_error_dialog_parented (errmsg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
g_free (errmsg);
@@ -862,7 +862,7 @@ e_tasks_new_task (ETasks *tasks)
{
ETasksPrivate *priv;
TaskEditor *tedit;
- CalComponent *comp;
+ ECalComponent *comp;
const char *category;
g_return_if_fail (E_IS_TASKS (tasks));
@@ -874,7 +874,7 @@ e_tasks_new_task (ETasks *tasks)
comp = cal_comp_task_new_with_defaults (priv->client);
category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
- cal_component_set_categories (comp, category);
+ e_cal_component_set_categories (comp, category);
comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
g_object_unref (comp);
@@ -966,7 +966,7 @@ e_tasks_delete_completed (ETasks *tasks)
set_status_message (tasks, _("Expunging"));
- if (!cal_client_get_object_list (priv->client, sexp, &objects, NULL)) {
+ if (!e_cal_get_object_list (priv->client, sexp, &objects, NULL)) {
set_status_message (tasks, NULL);
g_warning (G_STRLOC ": Could not get the objects");
@@ -975,7 +975,7 @@ e_tasks_delete_completed (ETasks *tasks)
for (l = objects; l; l = l->next) {
/* FIXME Better error handling */
- cal_client_remove_object (priv->client, icalcomponent_get_uid (l->data), NULL);
+ e_cal_remove_object (priv->client, icalcomponent_get_uid (l->data), NULL);
}
set_status_message (tasks, NULL);
@@ -1053,7 +1053,7 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
gal_view_collection_load (collection);
}
- priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
+ priv->view_instance = gal_view_instance_new (collection, e_cal_get_uri (priv->client));
priv->view_menus = gal_view_menus_new (priv->view_instance);
gal_view_menus_apply (priv->view_menus, uic, NULL);
diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h
index efa2ea2d1e..a1cfc0612b 100644
--- a/calendar/gui/e-tasks.h
+++ b/calendar/gui/e-tasks.h
@@ -27,7 +27,7 @@
#include <bonobo/bonobo-ui-component.h>
#include <gtk/gtktable.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "e-calendar-table.h"
#define E_TYPE_TASKS (e_tasks_get_type ())
diff --git a/calendar/gui/e-timezone-entry.h b/calendar/gui/e-timezone-entry.h
index 4f94cd88a1..94a7df9efc 100644
--- a/calendar/gui/e-timezone-entry.h
+++ b/calendar/gui/e-timezone-entry.h
@@ -33,7 +33,7 @@
#define __E_TIMEZONE_ENTRY_H_
#include <gtk/gtkhbox.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
G_BEGIN_DECLS
diff --git a/calendar/gui/e-week-view-config.c b/calendar/gui/e-week-view-config.c
index 097d86dd92..1257813062 100644
--- a/calendar/gui/e-week-view-config.c
+++ b/calendar/gui/e-week-view-config.c
@@ -167,7 +167,7 @@ set_timezone (EWeekView *week_view)
if (!zone)
zone = icaltimezone_get_utc_timezone ();
- e_cal_view_set_timezone (E_CAL_VIEW (week_view), zone);
+ e_calendar_view_set_timezone (E_CALENDAR_VIEW (week_view), zone);
g_free (location);
}
@@ -214,7 +214,7 @@ set_twentyfour_hour (EWeekView *week_view)
use_24_hour = calendar_config_get_24_hour_format ();
- e_cal_view_set_use_24_hour_format (E_CAL_VIEW (week_view), use_24_hour);
+ e_calendar_view_set_use_24_hour_format (E_CALENDAR_VIEW (week_view), use_24_hour);
}
static void
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index a534943d75..85e1cf775a 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -84,7 +84,7 @@ static gboolean e_week_view_event_item_button_release (EWeekViewEventItem *wveit
GdkEvent *event);
static gboolean e_week_view_event_item_double_click (EWeekViewEventItem *wveitem,
GdkEvent *bevent);
-static ECalViewPosition e_week_view_event_item_get_position (EWeekViewEventItem *wveitem,
+static ECalendarViewPosition e_week_view_event_item_get_position (EWeekViewEventItem *wveitem,
gdouble x,
gdouble y);
@@ -287,7 +287,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item,
rect_x = x1 + E_WEEK_VIEW_EVENT_L_PAD;
rect_w = x2 - x1 - E_WEEK_VIEW_EVENT_L_PAD - E_WEEK_VIEW_EVENT_R_PAD + 1;
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_cal_view_get_model (E_CAL_VIEW (week_view)),
+ if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)),
event->comp_data),
&bg_color)) {
GdkColormap *colormap;
@@ -377,7 +377,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item,
rect_w -= 2;
}
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_cal_view_get_model (E_CAL_VIEW (week_view)),
+ if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)),
event->comp_data),
&bg_color)) {
GdkColormap *colormap;
@@ -550,7 +550,7 @@ e_week_view_draw_time (EWeekView *week_view,
time_x += week_view->small_digit_width * 2;
/* Draw the 'am'/'pm' suffix, if 12-hour format. */
- if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view))) {
+ if (!e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (week_view))) {
pango_layout_set_text (layout, suffix, -1);
gdk_draw_layout (drawable, gc,
time_x,
@@ -592,7 +592,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
EWeekView *week_view;
EWeekViewEvent *event;
EWeekViewEventSpan *span;
- CalComponent *comp;
+ ECalComponent *comp;
GdkGC *gc;
gint num_icons = 0, icon_x_inc;
gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE;
@@ -605,17 +605,17 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
wveitem->event_num);
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + wveitem->span_num);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
gc = week_view->main_gc;
- if (cal_component_has_alarms (comp)) {
+ if (e_cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
num_icons++;
}
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
draw_recurrence_icon = TRUE;
num_icons++;
}
@@ -625,7 +625,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
num_icons++;
}
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -700,7 +700,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
gdk_bitmap_unref (mask);
}
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
gdk_gc_set_clip_mask (gc, NULL);
}
@@ -790,7 +790,7 @@ e_week_view_event_item_button_press (EWeekViewEventItem *wveitem,
GdkEvent *bevent)
{
EWeekView *week_view;
- ECalViewPosition pos;
+ ECalendarViewPosition pos;
EWeekViewEvent *event;
EWeekViewEventSpan *span;
GnomeCanvasItem *item;
@@ -811,7 +811,7 @@ e_week_view_event_item_button_press (EWeekViewEventItem *wveitem,
pos = e_week_view_event_item_get_position (wveitem, bevent->button.x,
bevent->button.y);
- if (pos == E_CAL_VIEW_POS_NONE)
+ if (pos == E_CALENDAR_VIEW_POS_NONE)
return FALSE;
if (bevent->button.button == 1) {
@@ -901,13 +901,13 @@ e_week_view_event_item_double_click (EWeekViewEventItem *wveitem,
e_week_view_stop_editing_event (week_view);
- e_cal_view_edit_appointment (E_CAL_VIEW (week_view), event->comp_data->client, event->comp_data->icalcomp, FALSE);
+ e_calendar_view_edit_appointment (E_CALENDAR_VIEW (week_view), event->comp_data->client, event->comp_data->icalcomp, FALSE);
return TRUE;
}
-static ECalViewPosition
+static ECalendarViewPosition
e_week_view_event_item_get_position (EWeekViewEventItem *wveitem,
gdouble x,
gdouble y)
@@ -918,7 +918,7 @@ e_week_view_event_item_get_position (EWeekViewEventItem *wveitem,
item = GNOME_CANVAS_ITEM (wveitem);
week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), E_CAL_VIEW_POS_NONE);
+ g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), E_CALENDAR_VIEW_POS_NONE);
#if 0
g_print ("In e_week_view_event_item_get_position item: %g,%g %g,%g point: %g,%g\n", item->x1, item->y1, item->x2, item->y2, x, y);
@@ -926,20 +926,20 @@ e_week_view_event_item_get_position (EWeekViewEventItem *wveitem,
if (x < item->x1 + E_WEEK_VIEW_EVENT_L_PAD
|| x >= item->x2 - E_WEEK_VIEW_EVENT_R_PAD)
- return E_CAL_VIEW_POS_NONE;
+ return E_CALENDAR_VIEW_POS_NONE;
/* Support left/right edge for long events only. */
if (!e_week_view_is_one_day_event (week_view, wveitem->event_num)) {
if (x < item->x1 + E_WEEK_VIEW_EVENT_L_PAD
+ E_WEEK_VIEW_EVENT_BORDER_WIDTH
+ E_WEEK_VIEW_EVENT_EDGE_X_PAD)
- return E_CAL_VIEW_POS_LEFT_EDGE;
+ return E_CALENDAR_VIEW_POS_LEFT_EDGE;
if (x >= item->x2 + 1 - E_WEEK_VIEW_EVENT_R_PAD
- E_WEEK_VIEW_EVENT_BORDER_WIDTH
- E_WEEK_VIEW_EVENT_EDGE_X_PAD)
- return E_CAL_VIEW_POS_RIGHT_EDGE;
+ return E_CALENDAR_VIEW_POS_RIGHT_EDGE;
}
- return E_CAL_VIEW_POS_EVENT;
+ return E_CALENDAR_VIEW_POS_EVENT;
}
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index ca80da28c3..ed823c2dcd 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -346,7 +346,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem,
/* Check if we are drawing today */
tt = icaltime_from_timet_with_zone (time (NULL), FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
if (g_date_year (date) == tt.year
&& g_date_month (date) == tt.month
&& g_date_day (date) == tt.day)
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index e4d701a0a6..99d0ad27c7 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -57,7 +57,7 @@
#include "dialogs/recur-comp.h"
#include "comp-util.h"
#include "itip-utils.h"
-#include "cal-util/timeutil.h"
+#include <libecal/e-cal-time-util.h>
#include "calendar-commands.h"
#include "calendar-config.h"
#include "print.h"
@@ -119,11 +119,11 @@ static gboolean e_week_view_get_next_tab_event (EWeekView *week_view,
gint *next_span_num);
static gboolean e_week_view_focus (GtkWidget *widget,
GtkDirectionType direction);
-static GList *e_week_view_get_selected_events (ECalView *cal_view);
-static void e_week_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-static void e_week_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time);
-static gboolean e_week_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
-static void e_week_view_update_query (ECalView *cal_view);
+static GList *e_week_view_get_selected_events (ECalendarView *cal_view);
+static void e_week_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+static void e_week_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time);
+static gboolean e_week_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
+static void e_week_view_update_query (ECalendarView *cal_view);
static void e_week_view_draw_shadow (EWeekView *week_view);
static gboolean e_week_view_on_button_press (GtkWidget *widget,
@@ -145,7 +145,7 @@ static void e_week_view_update_selection (EWeekView *week_view,
gint day);
static void e_week_view_free_events (EWeekView *week_view);
-static gboolean e_week_view_add_event (CalComponent *comp,
+static gboolean e_week_view_add_event (ECalComponent *comp,
time_t start,
time_t end,
gpointer data);
@@ -201,22 +201,22 @@ static void e_week_view_queue_layout (EWeekView *week_view);
static void e_week_view_cancel_layout (EWeekView *week_view);
static gboolean e_week_view_layout_timeout_cb (gpointer data);
-static ECalViewClass *parent_class;
+static ECalendarViewClass *parent_class;
E_MAKE_TYPE (e_week_view, "EWeekView", EWeekView, e_week_view_class_init,
- e_week_view_init, e_cal_view_get_type ());
+ e_week_view_init, e_calendar_view_get_type ());
static void
e_week_view_class_init (EWeekViewClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- ECalViewClass *view_class;
+ ECalendarViewClass *view_class;
parent_class = g_type_class_peek_parent (class);
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- view_class = (ECalViewClass *) class;
+ view_class = (ECalendarViewClass *) class;
/* Method override */
object_class->destroy = e_week_view_destroy;
@@ -243,7 +243,7 @@ e_week_view_class_init (EWeekViewClass *class)
}
static void
-timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
+timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone,
icaltimezone *new_zone, gpointer user_data)
{
struct icaltimetype tt = icaltime_null_time ();
@@ -265,7 +265,7 @@ timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
lower = icaltime_as_timet_with_zone (tt, new_zone);
e_week_view_recalc_day_starts (week_view, lower);
- e_week_view_update_query ((ECalView *) week_view);
+ e_week_view_update_query ((ECalendarView *) week_view);
}
static void
@@ -406,7 +406,7 @@ e_week_view_init (EWeekView *week_view)
week_view->resize_width_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
week_view->last_cursor_set = NULL;
- /* connect to ECalView's signals */
+ /* connect to ECalendarView's signals */
g_signal_connect (G_OBJECT (week_view), "timezone_changed",
G_CALLBACK (timezone_changed_cb), NULL);
}
@@ -1067,7 +1067,7 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction)
/* Returns the currently-selected event, or NULL if none */
static GList *
-e_week_view_get_selected_events (ECalView *cal_view)
+e_week_view_get_selected_events (ECalendarView *cal_view)
{
EWeekViewEvent *event = NULL;
GList *list = NULL;
@@ -1094,7 +1094,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
{
EWeekViewEvent *event;
gint event_num, num_days;
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
AddEventData add_event_data;
const char *uid;
@@ -1102,30 +1102,30 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
if (!g_date_valid (&week_view->first_day_shown))
return;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) {
g_object_unref (comp);
- g_message ("process_component(): Could not set icalcomponent on CalComponent");
+ g_message ("process_component(): Could not set icalcomponent on ECalComponent");
return;
}
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
/* If the event already exists and the dates didn't change, we can
update the event fairly easily without changing the events arrays
or computing a new layout. */
if (e_week_view_find_event_from_uid (week_view, uid, &event_num)) {
- CalComponent *tmp_comp;
+ ECalComponent *tmp_comp;
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
- tmp_comp = cal_component_new ();
- cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (comp_data->icalcomp));
- if (!cal_component_has_recurrences (comp)
- && !cal_component_has_recurrences (tmp_comp)
- && cal_component_event_dates_match (comp, tmp_comp)) {
+ tmp_comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (comp_data->icalcomp));
+ if (!e_cal_component_has_recurrences (comp)
+ && !e_cal_component_has_recurrences (tmp_comp)
+ && e_cal_component_event_dates_match (comp, tmp_comp)) {
#if 0
g_print ("updated object's dates unchanged\n");
#endif
@@ -1153,12 +1153,12 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
add_event_data.week_view = week_view;
add_event_data.comp_data = comp_data;
- cal_recur_generate_instances (comp,
+ e_cal_recur_generate_instances (comp,
week_view->day_starts[0],
week_view->day_starts[num_days],
e_week_view_add_event, &add_event_data,
- cal_client_resolve_tzid_cb, comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_cal_resolve_tzid_cb, comp_data->client,
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
g_object_unref (comp);
@@ -1167,7 +1167,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
/* Restarts a query for the week view */
static void
-e_week_view_update_query (ECalView *cal_view)
+e_week_view_update_query (ECalendarView *cal_view)
{
gint rows, r;
EWeekView *week_view = E_WEEK_VIEW (cal_view);
@@ -1176,11 +1176,11 @@ e_week_view_update_query (ECalView *cal_view)
e_week_view_free_events (week_view);
e_week_view_queue_layout (week_view);
- rows = e_table_model_row_count (E_TABLE_MODEL (e_cal_view_get_model (E_CAL_VIEW (week_view))));
+ rows = e_table_model_row_count (E_TABLE_MODEL (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view))));
for (r = 0; r < rows; r++) {
ECalModelComponent *comp_data;
- comp_data = e_cal_model_get_component_at (e_cal_view_get_model (E_CAL_VIEW (week_view)), r);
+ comp_data = e_cal_model_get_component_at (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), r);
g_assert (comp_data != NULL);
process_component (week_view, comp_data);
}
@@ -1215,7 +1215,7 @@ e_week_view_draw_shadow (EWeekView *week_view)
month and the days between start_time and end_time will be selected.
To select a single day, use the same value for start_time & end_time. */
static void
-e_week_view_set_selected_time_range (ECalView *cal_view,
+e_week_view_set_selected_time_range (ECalendarView *cal_view,
time_t start_time,
time_t end_time)
{
@@ -1226,7 +1226,7 @@ e_week_view_set_selected_time_range (ECalView *cal_view,
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
- time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ time_to_gdate_with_zone (&date, start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
if (week_view->multi_week_view) {
/* Find the number of days since the start of the month. */
@@ -1275,11 +1275,11 @@ e_week_view_set_selected_time_range (ECalView *cal_view,
|| g_date_compare (&week_view->first_day_shown, &base_date)) {
week_view->first_day_shown = base_date;
start_time = time_add_day_with_zone (start_time, -day_offset,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
start_time = time_day_begin_with_zone (start_time,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, start_time);
- e_week_view_update_query ((ECalView *) week_view);
+ e_week_view_update_query ((ECalendarView *) week_view);
}
/* Set the selection to the given days. */
@@ -1287,10 +1287,10 @@ e_week_view_set_selected_time_range (ECalView *cal_view,
- g_date_julian (&base_date);
if (end_time == start_time
|| end_time <= time_add_day_with_zone (start_time, 1,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view))))
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))))
week_view->selection_end_day = week_view->selection_start_day;
else {
- time_to_gdate_with_zone (&end_date, end_time - 60, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ time_to_gdate_with_zone (&end_date, end_time - 60, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
week_view->selection_end_day = g_date_julian (&end_date)
- g_date_julian (&base_date);
}
@@ -1323,17 +1323,17 @@ e_week_view_set_selected_time_range_visible (EWeekView *week_view,
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
- time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ time_to_gdate_with_zone (&date, start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
/* Set the selection to the given days. */
week_view->selection_start_day = g_date_julian (&date)
- g_date_julian (&week_view->first_day_shown);
if (end_time == start_time
|| end_time <= time_add_day_with_zone (start_time, 1,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view))))
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))))
week_view->selection_end_day = week_view->selection_start_day;
else {
- time_to_gdate_with_zone (&end_date, end_time - 60, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ time_to_gdate_with_zone (&end_date, end_time - 60, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
week_view->selection_end_day = g_date_julian (&end_date)
- g_date_julian (&week_view->first_day_shown);
}
@@ -1353,7 +1353,7 @@ e_week_view_set_selected_time_range_visible (EWeekView *week_view,
/* Returns the selected time range. */
static void
-e_week_view_get_selected_time_range (ECalView *cal_view,
+e_week_view_get_selected_time_range (ECalendarView *cal_view,
time_t *start_time,
time_t *end_time)
{
@@ -1377,7 +1377,7 @@ e_week_view_get_selected_time_range (ECalView *cal_view,
/* Gets the visible time range. Returns FALSE if no time range has been set. */
static gboolean
-e_week_view_get_visible_time_range (ECalView *cal_view,
+e_week_view_get_visible_time_range (ECalendarView *cal_view,
time_t *start_time,
time_t *end_time)
{
@@ -1458,10 +1458,10 @@ e_week_view_set_first_day_shown (EWeekView *week_view,
start_tt.day = g_date_day (&base_date);
start_time = icaltime_as_timet_with_zone (start_tt,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, start_time);
- e_week_view_update_query ((ECalView *) week_view);
+ e_week_view_update_query ((ECalendarView *) week_view);
}
/* Try to keep the previous selection, but if it is no longer shown
@@ -1508,7 +1508,7 @@ e_week_view_recalc_day_starts (EWeekView *week_view,
week_view->day_starts[0] = tmp_time;
for (day = 1; day <= num_days; day++) {
tmp_time = time_add_day_with_zone (tmp_time, 1,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
week_view->day_starts[day] = tmp_time;
}
}
@@ -1598,7 +1598,7 @@ e_week_view_set_weeks_shown (EWeekView *week_view,
if (g_date_valid (&week_view->first_day_shown))
e_week_view_set_first_day_shown (week_view, &week_view->first_day_shown);
- e_week_view_update_query ((ECalView *) week_view);
+ e_week_view_update_query ((ECalendarView *) week_view);
}
}
@@ -1959,7 +1959,7 @@ e_week_view_on_button_press (GtkWidget *widget,
return FALSE;
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
- e_cal_view_new_appointment (E_CAL_VIEW (week_view));
+ e_calendar_view_new_appointment (E_CALENDAR_VIEW (week_view));
return TRUE;
}
@@ -2016,7 +2016,7 @@ e_week_view_on_button_release (GtkWidget *widget,
start = week_view->day_starts[week_view->selection_start_day];
end = week_view->day_starts[week_view->selection_end_day + 1];
- gnome_calendar_set_selected_time_range (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ gnome_calendar_set_selected_time_range (e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)),
start, end);
}
@@ -2225,7 +2225,7 @@ e_week_view_free_events (EWeekView *week_view)
/* This adds one event to the view, adding it to the appropriate array. */
static gboolean
-e_week_view_add_event (CalComponent *comp,
+e_week_view_add_event (ECalComponent *comp,
time_t start,
time_t end,
gpointer data)
@@ -2251,9 +2251,9 @@ e_week_view_add_event (CalComponent *comp,
g_return_val_if_fail (end > add_event_data->week_view->day_starts[0], TRUE);
start_tt = icaltime_from_timet_with_zone (start, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view)));
end_tt = icaltime_from_timet_with_zone (end, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->week_view)));
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view)));
if (add_event_data->comp_data) {
event.comp_data = add_event_data->comp_data;
@@ -2262,9 +2262,9 @@ e_week_view_add_event (CalComponent *comp,
event.comp_data = g_new0 (ECalModelComponent, 1);
event.allocated_comp_data = TRUE;
- event.comp_data->client = e_cal_model_get_default_client (e_cal_view_get_model (E_CAL_VIEW (add_event_data->week_view)));
- cal_component_commit_sequence (comp);
- event.comp_data->icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (comp));
+ event.comp_data->client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (add_event_data->week_view)));
+ e_cal_component_commit_sequence (comp);
+ event.comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
}
event.start = start;
event.end = end;
@@ -2280,7 +2280,7 @@ e_week_view_add_event (CalComponent *comp,
if (!cal_comp_util_compare_event_timezones (
comp,
event.comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (add_event_data->week_view))))
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view))))
event.different_timezone = TRUE;
g_array_append_val (add_event_data->week_view->events, event);
@@ -2419,7 +2419,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
gint min_text_x, max_text_w, width;
gboolean show_icons = TRUE, use_max_width = FALSE;
gboolean one_day_event;
- CalComponent *comp;
+ ECalComponent *comp;
gdouble text_x, text_y, text_w, text_h;
gchar *text, *end_of_line;
gint line_len, text_width;
@@ -2431,8 +2431,8 @@ e_week_view_reshape_event_span (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
one_day_event = e_week_view_is_one_day_event (week_view, event_num);
@@ -2471,14 +2471,14 @@ e_week_view_reshape_event_span (EWeekView *week_view,
if (show_icons) {
GSList *categories_list, *elem;
- if (cal_component_has_alarms (comp))
+ if (e_cal_component_has_alarms (comp))
num_icons++;
- if (cal_component_has_recurrences (comp))
+ if (e_cal_component_has_recurrences (comp))
num_icons++;
if (event->different_timezone)
num_icons++;
- cal_component_get_categories_list (comp, &categories_list);
+ e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
GdkPixmap *pixmap = NULL;
@@ -2489,7 +2489,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
num_icons++;
}
- cal_component_free_categories_list (categories_list);
+ e_cal_component_free_categories_list (categories_list);
}
/* Create the background canvas item if necessary. */
@@ -2507,9 +2507,9 @@ e_week_view_reshape_event_span (EWeekView *week_view,
/* Create the text item if necessary. */
if (!span->text_item) {
- CalComponentText text;
+ ECalComponentText text;
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
span->text_item =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root),
e_text_get_type (),
@@ -2707,16 +2707,16 @@ e_week_view_on_adjustment_changed (GtkAdjustment *adjustment,
start_tt.month = g_date_month (&date);
start_tt.day = g_date_day (&date);
- lower = icaltime_as_timet_with_zone (start_tt, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ lower = icaltime_as_timet_with_zone (start_tt, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, lower);
- e_week_view_update_query ((ECalView *) week_view);
+ e_week_view_update_query ((ECalendarView *) week_view);
/* Update the selection, if needed. */
if (week_view->selection_start_day != -1) {
start = week_view->day_starts[week_view->selection_start_day];
end = week_view->day_starts[week_view->selection_end_day + 1];
- gnome_calendar_set_selected_time_range (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ gnome_calendar_set_selected_time_range (e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)),
start, end);
}
}
@@ -2853,7 +2853,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
- e_cal_view_edit_appointment (E_CAL_VIEW (week_view),
+ e_calendar_view_edit_appointment (E_CALENDAR_VIEW (week_view),
event->comp_data->client,
event->comp_data->icalcomp, FALSE);
@@ -2986,9 +2986,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
EWeekViewEvent *event;
EWeekViewEventSpan *span;
gchar *text = NULL;
- CalComponent *comp;
- CalComponentText summary;
- CalClient *client;
+ ECalComponent *comp;
+ ECalComponentText summary;
+ ECal *client;
const char *uid;
gboolean on_server;
@@ -3018,8 +3018,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
g_object_get (G_OBJECT (span->text_item), "text", &text, NULL);
g_assert (text != NULL);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
client = event->comp_data->client;
on_server = cal_comp_is_on_server (comp, client);
@@ -3027,7 +3027,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (string_is_empty (text) && !on_server) {
const char *uid;
- cal_component_get_uid (comp, &uid);
+ e_cal_component_get_uid (comp, &uid);
e_week_view_foreach_event_with_uid (week_view, uid,
e_week_view_remove_event_cb, NULL);
@@ -3037,26 +3037,26 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
}
/* Only update the summary if necessary. */
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
if (summary.value && !strcmp (text, summary.value)) {
if (!e_week_view_is_one_day_event (week_view, event_num))
e_week_view_reshape_event_span (week_view, event_num,
span_num);
} else if (summary.value || !string_is_empty (text)) {
- icalcomponent *icalcomp = cal_component_get_icalcomponent (comp);
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
summary.value = text;
summary.altrep = NULL;
- cal_component_set_summary (comp, &summary);
+ e_cal_component_set_summary (comp, &summary);
if (!on_server) {
- if (!cal_client_create_object (client, icalcomp, NULL, NULL))
+ if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
} else {
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
- if (cal_component_has_recurrences (comp)) {
+ if (e_cal_component_has_recurrences (comp)) {
if (!recur_component_dialog (client, comp, &mod, NULL)) {
goto out;
}
@@ -3064,10 +3064,10 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
/* FIXME When sending here, what exactly should we send? */
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view)));
- if (cal_client_modify_object (client, icalcomp, mod, NULL)) {
+ if (e_cal_modify_object (client, icalcomp, mod, NULL)) {
if (itip_organizer_is_user (comp, client)
&& send_component_dialog (toplevel, client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
}
}
@@ -3178,11 +3178,11 @@ static gboolean
e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
{
EWeekView *week_view;
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
gint event_num;
gchar *initial_text;
- CalComponentDateTime date;
+ ECalComponentDateTime date;
struct icaltimetype itt;
time_t dtstart, dtend;
const char *uid;
@@ -3196,7 +3196,7 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
/* The Escape key aborts a resize operation. */
#if 0
- if (week_view->resize_drag_pos != E_CAL_VIEW_POS_NONE) {
+ if (week_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
if (event->keyval == GDK_Escape) {
e_week_view_abort_resize (week_view, event->time);
}
@@ -3238,13 +3238,13 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string);
/* Add a new event covering the selected range. */
- icalcomp = e_cal_model_create_component_with_defaults (e_cal_view_get_model (E_CAL_VIEW (week_view)));
+ icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)));
if (!icalcomp)
return FALSE;
uid = icalcomponent_get_uid (icalcomp);
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
dtstart = week_view->day_starts[week_view->selection_start_day];
dtend = week_view->day_starts[week_view->selection_end_day + 1];
@@ -3253,18 +3253,18 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
date.tzid = NULL;
/* We use DATE values now, so we don't need the timezone. */
- /*date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (week_view)));*/
+ /*date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));*/
*date.value = icaltime_from_timet_with_zone (dtstart, TRUE,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
- cal_component_set_dtstart (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
+ e_cal_component_set_dtstart (comp, &date);
*date.value = icaltime_from_timet_with_zone (dtend, TRUE,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
- cal_component_set_dtend (comp, &date);
+ e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
+ e_cal_component_set_dtend (comp, &date);
- cal_component_set_categories (
- comp, e_cal_view_get_default_category (E_CAL_VIEW (week_view)));
+ e_cal_component_set_categories (
+ comp, e_calendar_view_get_default_category (E_CALENDAR_VIEW (week_view)));
/* We add the event locally and start editing it. We don't send it
to the server until the user finishes editing it. */
@@ -3483,7 +3483,7 @@ e_week_view_show_popup_menu (EWeekView *week_view,
week_view->popup_event_num = event_num;
- popup = e_cal_view_create_popup_menu (E_CAL_VIEW (week_view));
+ popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (week_view));
e_popup_menu (popup, (GdkEvent *) bevent);
}
@@ -3504,7 +3504,7 @@ e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; ++day) {
if (item == week_view->jump_buttons[day]) {
- calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ calendar = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
if (calendar)
gnome_calendar_dayjump
(calendar,
@@ -3585,7 +3585,7 @@ e_week_view_convert_time_to_display (EWeekView *week_view,
/* Calculate the actual hour number to display. For 12-hour
format we convert 0-23 to 12-11am/12-11pm. */
*display_hour = hour;
- if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view))) {
+ if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (week_view))) {
*suffix = "";
*suffix_width = 0;
} else {
@@ -3617,7 +3617,7 @@ e_week_view_get_time_string_width (EWeekView *week_view)
time_width = week_view->digit_width * 4
+ week_view->colon_width;
- if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view)))
+ if (!e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (week_view)))
time_width += MAX (week_view->am_string_width,
week_view->pm_string_width);
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index f36760d76a..aca3f2bc2a 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -143,7 +143,7 @@ struct _EWeekViewEventSpan {
typedef struct _EWeekViewEvent EWeekViewEvent;
struct _EWeekViewEvent {
- E_CAL_VIEW_EVENT_FIELDS
+ E_CALENDAR_VIEW_EVENT_FIELDS
gint spans_index;
guint8 num_spans;
};
@@ -159,7 +159,7 @@ typedef struct _EWeekViewClass EWeekViewClass;
struct _EWeekView
{
- ECalView cal_view;
+ ECalendarView cal_view;
/* The top canvas where the dates are shown. */
GtkWidget *titles_canvas;
@@ -175,7 +175,7 @@ struct _EWeekView
GtkWidget *vscrollbar;
/* The query object */
- CalQuery *query;
+ ECalView *query;
/* The array of EWeekViewEvent elements. */
GArray *events;
@@ -332,7 +332,7 @@ struct _EWeekView
struct _EWeekViewClass
{
- ECalViewClass parent_class;
+ ECalendarViewClass parent_class;
};
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 359de9c209..a14678f3e3 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -37,7 +37,7 @@
#include <libgnomeui/gnome-dialog-util.h>
#include <bonobo/bonobo-exception.h>
#include "e-util/e-url.h"
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "widgets/menus/gal-view-menus.h"
#include "e-comp-editor-registry.h"
#include "dialogs/delete-error.h"
@@ -85,7 +85,7 @@ struct _GnomeCalendarPrivate {
*/
/* The calendar client object we monitor */
- CalClient *task_pad_client;
+ ECal *task_pad_client;
/* Set of categories from the tasks client */
GPtrArray *tasks_categories;
@@ -123,12 +123,12 @@ struct _GnomeCalendarPrivate {
/* Calendar query for the date navigator */
GList *dn_queries; /* list of CalQueries */
char *sexp;
- guint query_timeout;
+ guint e_cal_view_timeout;
/* This is the view currently shown. We use it to keep track of the
positions of the panes. range_selected is TRUE if a range of dates
was selected in the date navigator to show the view. */
- ECalView *views[GNOME_CAL_LAST_VIEW];
+ ECalendarView *views[GNOME_CAL_LAST_VIEW];
GObject *configs[GNOME_CAL_LAST_VIEW];
GnomeCalendarViewType current_view_type;
GList *notifications;
@@ -370,7 +370,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
/* Callback used when the calendar query reports of an updated object */
static void
-dn_query_objects_added_cb (CalQuery *query, GList *objects, gpointer data)
+dn_e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -380,23 +380,23 @@ dn_query_objects_added_cb (CalQuery *query, GList *objects, gpointer data)
priv = gcal->priv;
for (l = objects; l; l = l->next) {
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) {
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) {
g_object_unref (comp);
continue;
}
- tag_calendar_by_comp (priv->date_navigator, comp, cal_query_get_client (query), NULL,
+ tag_calendar_by_comp (priv->date_navigator, comp, e_cal_view_get_client (query), NULL,
FALSE, TRUE);
g_object_unref (comp);
}
}
static void
-dn_query_objects_modified_cb (CalQuery *query, GList *objects, gpointer data)
+dn_e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -413,7 +413,7 @@ dn_query_objects_modified_cb (CalQuery *query, GList *objects, gpointer data)
/* Callback used when the calendar query reports of a removed object */
static void
-dn_query_objects_removed_cb (CalQuery *query, GList *uids, gpointer data)
+dn_e_cal_view_objects_removed_cb (ECalView *query, GList *uids, gpointer data)
{
GnomeCalendar *gcal;
@@ -425,7 +425,7 @@ dn_query_objects_removed_cb (CalQuery *query, GList *uids, gpointer data)
/* Callback used when the calendar query is done */
static void
-dn_query_done_cb (CalQuery *query, ECalendarStatus status, gpointer data)
+dn_e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer data)
{
GnomeCalendar *gcal;
@@ -544,7 +544,7 @@ get_date_navigator_range (GnomeCalendar *gcal, time_t *start_time, time_t *end_t
/* Adjusts a given query sexp with the time range of the date navigator */
static char *
-adjust_query_sexp (GnomeCalendar *gcal, const char *sexp)
+adjust_e_cal_view_sexp (GnomeCalendar *gcal, const char *sexp)
{
time_t start_time, end_time;
char *start, *end;
@@ -576,7 +576,7 @@ static void
update_query (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- CalQuery *old_query;
+ ECalView *old_query;
char *real_sexp;
GList *l;
@@ -584,7 +584,7 @@ update_query (GnomeCalendar *gcal)
e_calendar_item_clear_marks (priv->date_navigator->calitem);
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), _("Searching"));
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), _("Searching"));
/* free the previous queries */
for (l = priv->dn_queries; l != NULL; l = l->next) {
@@ -602,46 +602,46 @@ update_query (GnomeCalendar *gcal)
g_assert (priv->sexp != NULL);
- real_sexp = adjust_query_sexp (gcal, priv->sexp);
+ real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp);
if (!real_sexp) {
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL);
return; /* No time range is set, so don't start a query */
}
/* create queries for each loaded client */
for (l = priv->clients_list; l != NULL; l = l->next) {
- if (!cal_client_get_query ((CalClient *) l->data, real_sexp, &old_query, NULL)) {
+ if (!e_cal_get_query ((ECal *) l->data, real_sexp, &old_query, NULL)) {
g_warning (G_STRLOC ": Could not create the query");
continue;
}
g_signal_connect (old_query, "objects_added",
- G_CALLBACK (dn_query_objects_added_cb), gcal);
+ G_CALLBACK (dn_e_cal_view_objects_added_cb), gcal);
g_signal_connect (old_query, "objects_modified",
- G_CALLBACK (dn_query_objects_modified_cb), gcal);
+ G_CALLBACK (dn_e_cal_view_objects_modified_cb), gcal);
g_signal_connect (old_query, "objects_removed",
- G_CALLBACK (dn_query_objects_removed_cb), gcal);
- g_signal_connect (old_query, "query_done",
- G_CALLBACK (dn_query_done_cb), gcal);
+ G_CALLBACK (dn_e_cal_view_objects_removed_cb), gcal);
+ g_signal_connect (old_query, "view_done",
+ G_CALLBACK (dn_e_cal_view_done_cb), gcal);
priv->dn_queries = g_list_append (priv->dn_queries, old_query);
- cal_query_start (old_query);
+ e_cal_view_start (old_query);
}
g_free (real_sexp);
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL);
}
static void
-adjust_query_for_view (ECalView *cal_view, const char *sexp)
+adjust_e_cal_view_for_view (ECalendarView *cal_view, const char *sexp)
{
char *real_sexp, *start, *end;
time_t ttstart, ttend;
- e_cal_view_get_visible_time_range (cal_view, &ttstart, &ttend);
+ e_calendar_view_get_visible_time_range (cal_view, &ttstart, &ttend);
start = isodate_from_time_t (ttstart);
end = isodate_from_time_t (ttend);
@@ -652,7 +652,7 @@ adjust_query_for_view (ECalView *cal_view, const char *sexp)
" %s)",
start, end, sexp);
- e_cal_model_set_query (e_cal_view_get_model (cal_view), real_sexp);
+ e_cal_model_set_query (e_calendar_view_get_model (cal_view), real_sexp);
g_free (start);
g_free (end);
@@ -690,7 +690,7 @@ gnome_calendar_set_query (GnomeCalendar *gcal, const char *sexp)
/* Set the query on the views */
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
- adjust_query_for_view (E_CAL_VIEW (priv->views[i]), sexp);
+ adjust_e_cal_view_for_view (E_CALENDAR_VIEW (priv->views[i]), sexp);
/* Set the query on the task pad */
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
@@ -740,7 +740,7 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
priv = gcal->priv;
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
- e_cal_view_set_default_category (E_CAL_VIEW (priv->views[i]),
+ e_calendar_view_set_default_category (E_CALENDAR_VIEW (priv->views[i]),
category);
}
@@ -851,17 +851,17 @@ set_timezone (GnomeCalendar *calendar)
priv->zone = icaltimezone_get_utc_timezone ();
for (l = priv->clients_list; l != NULL; l = l->next) {
- CalClient *client = l->data;
+ ECal *client = l->data;
- if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED)
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
/* FIXME Error checking */
- cal_client_set_default_timezone (client, priv->zone, NULL);
+ e_cal_set_default_timezone (client, priv->zone, NULL);
}
if (priv->task_pad_client
- && cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) {
+ && e_cal_get_load_state (priv->task_pad_client) == E_CAL_LOAD_LOADED) {
/* FIXME Error Checking */
- cal_client_set_default_timezone (priv->task_pad_client,
+ e_cal_set_default_timezone (priv->task_pad_client,
priv->zone, NULL);
}
}
@@ -991,13 +991,13 @@ setup_widgets (GnomeCalendar *gcal)
e_day_view_set_work_week_view (E_DAY_VIEW (priv->work_week_view),
TRUE);
e_day_view_set_days_shown (E_DAY_VIEW (priv->work_week_view), 5);
- e_cal_view_set_calendar (E_CAL_VIEW (priv->work_week_view), gcal);
+ e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->work_week_view), gcal);
connect_day_view_focus (gcal, E_DAY_VIEW (priv->work_week_view));
/* The Week View. */
priv->week_view = e_week_view_new ();
- e_cal_view_set_calendar (E_CAL_VIEW (priv->week_view), gcal);
+ e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->week_view), gcal);
g_signal_connect (priv->week_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
@@ -1005,7 +1005,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The Month View. */
priv->month_view = e_week_view_new ();
- e_cal_view_set_calendar (E_CAL_VIEW (priv->month_view), gcal);
+ e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->month_view), gcal);
e_week_view_set_multi_week_view (E_WEEK_VIEW (priv->month_view), TRUE);
g_signal_connect (priv->month_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
@@ -1017,19 +1017,19 @@ setup_widgets (GnomeCalendar *gcal)
priv->list_view = e_cal_list_view_new (filename);
g_free (filename);
- e_cal_view_set_calendar (E_CAL_VIEW (priv->list_view), gcal);
+ e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->list_view), gcal);
connect_list_view_focus (gcal, E_CAL_LIST_VIEW (priv->list_view));
- priv->views[GNOME_CAL_DAY_VIEW] = E_CAL_VIEW (priv->day_view);
+ priv->views[GNOME_CAL_DAY_VIEW] = E_CALENDAR_VIEW (priv->day_view);
priv->configs[GNOME_CAL_DAY_VIEW] = e_day_view_config_new (E_DAY_VIEW (priv->views[GNOME_CAL_DAY_VIEW]));
- priv->views[GNOME_CAL_WORK_WEEK_VIEW] = E_CAL_VIEW (priv->work_week_view);
+ priv->views[GNOME_CAL_WORK_WEEK_VIEW] = E_CALENDAR_VIEW (priv->work_week_view);
priv->configs[GNOME_CAL_WORK_WEEK_VIEW] = e_day_view_config_new (E_DAY_VIEW (priv->views[GNOME_CAL_WORK_WEEK_VIEW]));
- priv->views[GNOME_CAL_WEEK_VIEW] = E_CAL_VIEW (priv->week_view);
+ priv->views[GNOME_CAL_WEEK_VIEW] = E_CALENDAR_VIEW (priv->week_view);
priv->configs[GNOME_CAL_WEEK_VIEW] = e_week_view_config_new (E_WEEK_VIEW (priv->views[GNOME_CAL_WEEK_VIEW]));
- priv->views[GNOME_CAL_MONTH_VIEW] = E_CAL_VIEW (priv->month_view);
+ priv->views[GNOME_CAL_MONTH_VIEW] = E_CALENDAR_VIEW (priv->month_view);
priv->configs[GNOME_CAL_MONTH_VIEW] = e_week_view_config_new (E_WEEK_VIEW (priv->views[GNOME_CAL_MONTH_VIEW]));
- priv->views[GNOME_CAL_LIST_VIEW] = E_CAL_VIEW (priv->list_view);
+ priv->views[GNOME_CAL_LIST_VIEW] = E_CALENDAR_VIEW (priv->list_view);
priv->configs[GNOME_CAL_MONTH_VIEW] = e_cal_list_view_config_new (E_CAL_LIST_VIEW (priv->views[GNOME_CAL_LIST_VIEW]));
priv->configs[GNOME_CAL_LIST_VIEW] = NULL;
@@ -1142,9 +1142,9 @@ gnome_calendar_destroy (GtkObject *object)
if (priv->dn_queries) {
for (l = priv->dn_queries; l != NULL; l = l->next) {
- g_signal_handlers_disconnect_matched ((CalQuery *) l->data, G_SIGNAL_MATCH_DATA,
+ g_signal_handlers_disconnect_matched ((ECalView *) l->data, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
- g_object_unref ((CalQuery *) l->data);
+ g_object_unref ((ECalView *) l->data);
}
g_list_free (priv->dn_queries);
@@ -1156,9 +1156,9 @@ gnome_calendar_destroy (GtkObject *object)
priv->sexp = NULL;
}
- if (priv->query_timeout) {
- g_source_remove (priv->query_timeout);
- priv->query_timeout = 0;
+ if (priv->e_cal_view_timeout) {
+ g_source_remove (priv->e_cal_view_timeout);
+ priv->e_cal_view_timeout = 0;
}
if (priv->task_pad_client) {
@@ -1313,7 +1313,7 @@ gnome_calendar_update_view_times (GnomeCalendar *gcal)
priv = gcal->priv;
- e_cal_view_set_selected_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)),
+ e_calendar_view_set_selected_time_range (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)),
priv->selection_start_time,
priv->selection_end_time);
}
@@ -1638,7 +1638,7 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
}
priv->view_instance = gal_view_instance_new (collection,
- cal_client_get_uri (gnome_calendar_get_default_client (gcal)));
+ e_cal_get_uri (gnome_calendar_get_default_client (gcal)));
priv->view_menus = gal_view_menus_new (priv->view_instance);
gal_view_menus_set_show_define_views (priv->view_menus, FALSE);
@@ -1771,7 +1771,7 @@ permission_error (GnomeCalendar *gcal, const char *uri)
/* Callback from the calendar client when a calendar is loaded */
static gboolean
-update_query_timeout (gpointer data)
+update_e_cal_view_timeout (gpointer data)
{
GnomeCalendar *gcal = data;
GnomeCalendarPrivate *priv;
@@ -1780,13 +1780,13 @@ update_query_timeout (gpointer data)
priv = gcal->priv;
update_query (gcal);
- priv->query_timeout = 0;
+ priv->e_cal_view_timeout = 0;
return FALSE;
}
static void
-client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+client_cal_opened_cb (ECal *client, ECalOpenStatus status, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -1797,15 +1797,15 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da
priv = gcal->priv;
switch (status) {
- case CAL_CLIENT_OPEN_SUCCESS:
+ case E_CAL_OPEN_SUCCESS:
/* Set the client's default timezone, if we have one. */
if (priv->zone) {
/* FIXME Error checking */
- cal_client_set_default_timezone (client, priv->zone, NULL);
+ e_cal_set_default_timezone (client, priv->zone, NULL);
}
/* add the alarms for this client */
- uristr = get_uri_without_password (cal_client_get_uri (client));
+ uristr = get_uri_without_password (e_cal_get_uri (client));
msg = g_strdup_printf (_("Adding alarms for %s"), uristr);
g_free (uristr);
if (client == priv->task_pad_client) {
@@ -1814,31 +1814,31 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da
priv->task_pad_client);
}
else {
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg);
- e_cal_model_add_client (e_cal_view_get_model (E_CAL_VIEW (priv->week_view)), client);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg);
+ e_cal_model_add_client (e_calendar_view_get_model (E_CALENDAR_VIEW (priv->week_view)), client);
- priv->query_timeout = g_timeout_add (100, update_query_timeout, gcal);
+ priv->e_cal_view_timeout = g_timeout_add (100, update_e_cal_view_timeout, gcal);
}
g_free (msg);
- add_alarms (cal_client_get_uri (client));
+ add_alarms (e_cal_get_uri (client));
break;
- case CAL_CLIENT_OPEN_ERROR:
- open_error (gcal, cal_client_get_uri (client));
+ case E_CAL_OPEN_ERROR:
+ open_error (gcal, e_cal_get_uri (client));
break;
- case CAL_CLIENT_OPEN_NOT_FOUND:
+ case E_CAL_OPEN_NOT_FOUND:
/* bullshit; we did not specify only_if_exists */
g_assert_not_reached ();
return;
- case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED:
- method_error (gcal, cal_client_get_uri (client));
+ case E_CAL_OPEN_METHOD_NOT_SUPPORTED:
+ method_error (gcal, e_cal_get_uri (client));
break;
- case CAL_CLIENT_OPEN_PERMISSION_DENIED :
- permission_error (gcal, cal_client_get_uri (client));
+ case E_CAL_OPEN_PERMISSION_DENIED :
+ permission_error (gcal, e_cal_get_uri (client));
break;
default:
@@ -1849,7 +1849,7 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da
if (client == priv->task_pad_client)
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
else
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL);
}
/* Duplicates an array of categories */
@@ -1943,7 +1943,7 @@ merge_categories (GPtrArray *a, GPtrArray *b)
* have to merge the categories of the calendar and tasks clients.
*/
static void
-client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer data)
+client_categories_changed_cb (ECal *client, GPtrArray *categories, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -1967,7 +1967,7 @@ client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer
/* Callback when we get an error message from the backend */
static void
-backend_error_cb (CalClient *client, const char *message, gpointer data)
+backend_error_cb (ECal *client, const char *message, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -1977,7 +1977,7 @@ backend_error_cb (CalClient *client, const char *message, gpointer data)
gcal = GNOME_CALENDAR (data);
priv = gcal->priv;
- uristr = get_uri_without_password (cal_client_get_uri (client));
+ uristr = get_uri_without_password (e_cal_get_uri (client));
errmsg = g_strdup_printf (_("Error on %s:\n %s"), uristr, message);
gnome_error_dialog_parented (errmsg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
g_free (errmsg);
@@ -1986,7 +1986,7 @@ backend_error_cb (CalClient *client, const char *message, gpointer data)
/* Callback when the backend dies */
static void
-backend_died_cb (CalClient *client, gpointer data)
+backend_died_cb (ECal *client, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
@@ -1997,7 +1997,7 @@ backend_died_cb (CalClient *client, gpointer data)
priv = gcal->priv;
/* FIXME This doesn't remove the calendar from the list or anything */
- uristr = get_uri_without_password (cal_client_get_uri (client));
+ uristr = get_uri_without_password (e_cal_get_uri (client));
if (client == priv->task_pad_client) {
message = g_strdup_printf (_("The task backend for\n%s\n has crashed. "
"You will have to restart Evolution in order "
@@ -2013,7 +2013,7 @@ backend_died_cb (CalClient *client, gpointer data)
uristr);
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
- e_cal_view_set_status_message (priv->views[i], NULL);
+ e_calendar_view_set_status_message (priv->views[i], NULL);
}
gnome_error_dialog_parented (message, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
@@ -2035,7 +2035,7 @@ gnome_calendar_construct (GnomeCalendar *gcal)
/*
* TaskPad Folder Client.
*/
- priv->task_pad_client = cal_client_new ("", CALOBJ_TYPE_TODO); /* FIXME: use default tasks */
+ priv->task_pad_client = e_cal_new ("", CALOBJ_TYPE_TODO); /* FIXME: use default tasks */
if (!priv->task_pad_client)
return NULL;
@@ -2102,22 +2102,22 @@ gnome_calendar_get_calendar_model (GnomeCalendar *gcal)
priv = gcal->priv;
- return e_cal_view_get_model (priv->views[priv->current_view_type]);
+ return e_calendar_view_get_model (priv->views[priv->current_view_type]);
}
/**
* gnome_calendar_get_default_client
*/
-CalClient *
+ECal *
gnome_calendar_get_default_client (GnomeCalendar *gcal)
{
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
- return e_cal_model_get_default_client (e_cal_view_get_model (E_CAL_VIEW (gcal->priv->week_view)));
+ return e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (gcal->priv->week_view)));
}
/**
- * gnome_calendar_get_task_pad_cal_client:
+ * gnome_calendar_get_task_pad_e_cal:
* @gcal: A calendar view.
*
* Queries the calendar client interface object that a calendar view is using
@@ -2125,8 +2125,8 @@ gnome_calendar_get_default_client (GnomeCalendar *gcal)
*
* Return value: A calendar client interface object.
**/
-CalClient *
-gnome_calendar_get_task_pad_cal_client (GnomeCalendar *gcal)
+ECal *
+gnome_calendar_get_task_pad_e_cal (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
@@ -2197,7 +2197,7 @@ gboolean
gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
{
GnomeCalendarPrivate *priv;
- CalClient *client;
+ ECal *client;
int i;
g_return_val_if_fail (gcal != NULL, FALSE);
@@ -2210,7 +2210,7 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
if (client)
return TRUE;
- client = cal_client_new (str_uri, CALOBJ_TYPE_EVENT);
+ client = e_cal_new (str_uri, CALOBJ_TYPE_EVENT);
g_hash_table_insert (priv->clients, g_strdup (str_uri), client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
@@ -2218,7 +2218,7 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), gcal);
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal);
- if (!cal_client_open (client, FALSE, NULL)) {
+ if (!e_cal_open (client, FALSE, NULL)) {
g_hash_table_remove (priv->clients, str_uri);
priv->clients_list = g_list_prepend (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
@@ -2230,7 +2230,7 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
ECalModel *model;
- model = e_cal_view_get_model (priv->views[i]);
+ model = e_calendar_view_get_model (priv->views[i]);
e_cal_model_add_client (model, client);
}
@@ -2254,7 +2254,7 @@ gboolean
gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
{
GnomeCalendarPrivate *priv;
- CalClient *client;
+ ECal *client;
int i;
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
@@ -2274,7 +2274,7 @@ gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
ECalModel *model;
- model = e_cal_view_get_model (priv->views[i]);
+ model = e_calendar_view_get_model (priv->views[i]);
e_cal_model_remove_client (model, client);
}
@@ -2309,7 +2309,7 @@ gboolean
gnome_calendar_set_default_uri (GnomeCalendar *gcal, const char *uri)
{
GnomeCalendarPrivate *priv;
- CalClient *client;
+ ECal *client;
int i;
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
@@ -2322,7 +2322,7 @@ gnome_calendar_set_default_uri (GnomeCalendar *gcal, const char *uri)
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
e_cal_model_set_default_client (
- e_cal_view_get_model (E_CAL_VIEW (priv->views[i])),
+ e_calendar_view_get_model (E_CALENDAR_VIEW (priv->views[i])),
client);
}
@@ -2383,7 +2383,7 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
TaskEditor *tedit;
- CalComponent *comp;
+ ECalComponent *comp;
icalcomponent *icalcomp;
const char *category;
@@ -2394,12 +2394,12 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
tedit = task_editor_new (priv->task_pad_client);
- icalcomp = e_cal_model_create_component_with_defaults (e_cal_view_get_model (E_CAL_VIEW (priv->week_view)));
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
+ icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (priv->week_view)));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
- cal_component_set_categories (comp, category);
+ e_cal_component_set_categories (comp, category);
comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
g_object_unref (comp);
@@ -2420,7 +2420,7 @@ gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
priv = gcal->priv;
- e_cal_view_get_selected_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)),
+ e_calendar_view_get_selected_time_range (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)),
start_time, end_time);
}
@@ -2439,7 +2439,7 @@ gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
priv = gcal->priv;
- retval = e_cal_view_get_visible_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)),
+ retval = e_calendar_view_get_visible_time_range (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)),
start_time, end_time);
return retval;
@@ -2698,7 +2698,7 @@ gnome_calendar_cut_clipboard (GnomeCalendar *gcal)
location = get_focus_location (gcal);
if (location == FOCUS_CALENDAR) {
- e_cal_view_cut_clipboard (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)));
+ e_calendar_view_cut_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
} else if (location == FOCUS_TASKPAD)
e_calendar_table_cut_clipboard (E_CALENDAR_TABLE (priv->todo));
else
@@ -2716,7 +2716,7 @@ gnome_calendar_copy_clipboard (GnomeCalendar *gcal)
location = get_focus_location (gcal);
if (location == FOCUS_CALENDAR) {
- e_cal_view_copy_clipboard (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)));
+ e_calendar_view_copy_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
} else if (location == FOCUS_TASKPAD)
e_calendar_table_copy_clipboard (E_CALENDAR_TABLE (priv->todo));
else
@@ -2734,7 +2734,7 @@ gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
location = get_focus_location (gcal);
if (location == FOCUS_CALENDAR) {
- e_cal_view_paste_clipboard (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)));
+ e_calendar_view_paste_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
} else if (location == FOCUS_TASKPAD)
e_calendar_table_paste_clipboard (E_CALENDAR_TABLE (priv->todo));
else
@@ -2841,7 +2841,7 @@ gnome_calendar_delete_selection (GnomeCalendar *gcal)
if (location == FOCUS_CALENDAR) {
view = gnome_calendar_get_current_view_widget (gcal);
- e_cal_view_delete_selected_events (E_CAL_VIEW (view));
+ e_calendar_view_delete_selected_events (E_CALENDAR_VIEW (view));
} else if (location == FOCUS_TASKPAD)
e_calendar_table_delete_selected (E_CALENDAR_TABLE (priv->todo));
else
@@ -2864,12 +2864,12 @@ gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
if (location == FOCUS_CALENDAR) {
view = gnome_calendar_get_current_view_widget (gcal);
- e_cal_view_delete_selected_occurrence (E_CAL_VIEW (view));
+ e_calendar_view_delete_selected_occurrence (E_CALENDAR_VIEW (view));
}
}
static gboolean
-check_instance_cb (CalComponent *comp,
+check_instance_cb (ECalComponent *comp,
time_t instance_start,
time_t instance_end,
gpointer data)
@@ -2899,46 +2899,46 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
" (make-time \"%s\")))",
start, end);
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), _("Purging"));
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), _("Purging"));
/* FIXME Confirm expunge */
for (l = priv->clients_list; l != NULL; l = l->next) {
- CalClient *client = l->data;
+ ECal *client = l->data;
GList *objects, *l;
gboolean read_only = TRUE;
- cal_client_is_read_only (client, &read_only, NULL);
+ e_cal_is_read_only (client, &read_only, NULL);
if (!read_only)
continue;
- if (!cal_client_get_object_list (client, sexp, &objects, NULL)) {
+ if (!e_cal_get_object_list (client, sexp, &objects, NULL)) {
g_warning (G_STRLOC ": Could not get the objects");
continue;
}
for (l = objects; l; l = l->next) {
- CalComponent *comp;
+ ECalComponent *comp;
gboolean remove = TRUE;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data));
- cal_recur_generate_instances (comp, older_than, -1,
- (CalRecurInstanceFn) check_instance_cb,
+ e_cal_recur_generate_instances (comp, older_than, -1,
+ (ECalRecurInstanceFn) check_instance_cb,
&remove,
- (CalRecurResolveTimezoneFn) cal_client_resolve_tzid_cb,
+ (ECalRecurResolveTimezoneFn) e_cal_resolve_tzid_cb,
client, priv->zone);
/* FIXME Better error handling */
if (remove)
- cal_client_remove_object (client, icalcomponent_get_uid (l->data), NULL);
+ e_cal_remove_object (client, icalcomponent_get_uid (l->data), NULL);
g_object_unref (comp);
}
}
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL);
g_free (sexp);
g_free (start);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 748be4dc0c..0b1aba9b64 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -30,7 +30,7 @@
#include <bonobo/bonobo-ui-component.h>
#include <gal/widgets/e-popup-menu.h>
#include <widgets/misc/e-calendar.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
#include "e-calendar-table.h"
@@ -106,8 +106,8 @@ void gnome_calendar_set_ui_component (GnomeCalendar *cal,
ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
ECalModel *gnome_calendar_get_calendar_model (GnomeCalendar *gcal);
-CalClient *gnome_calendar_get_default_client (GnomeCalendar *gcal);
-CalClient *gnome_calendar_get_task_pad_cal_client(GnomeCalendar *gcal);
+ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal);
+ECal *gnome_calendar_get_task_pad_e_cal(GnomeCalendar *gcal);
gboolean gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri);
gboolean gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri);
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index 770e2e40ac..4bff9addca 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -70,7 +70,7 @@ static void
ecal_date_range_changed (ECalendarItem *calitem, gpointer user_data)
{
GoToDialog *dlg = user_data;
- CalClient *client;
+ ECal *client;
client = gnome_calendar_get_default_client (dlg->gcal);
if (client)
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index e2640f01f4..2ea27974fd 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -36,8 +36,8 @@
#include <Evolution-Composer.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-time-utils.h>
-#include <cal-util/timeutil.h>
-#include <cal-util/cal-util.h>
+#include <libecal/e-cal-time-util.h>
+#include <libecal/e-cal-util.h>
#include "calendar-config.h"
#include "itip-utils.h"
@@ -86,24 +86,24 @@ itip_addresses_get_default (void)
}
gboolean
-itip_organizer_is_user (CalComponent *comp, CalClient *client)
+itip_organizer_is_user (ECalComponent *comp, ECal *client)
{
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
const char *strip;
gboolean user_org = FALSE;
- if (!cal_component_has_organizer (comp))
+ if (!e_cal_component_has_organizer (comp))
return FALSE;
- cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value != NULL) {
strip = itip_strip_mailto (organizer.value);
- if (cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) {
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) {
char *email;
- if (cal_client_get_cal_address (client, &email, NULL) && !g_strcasecmp (email, strip)) {
+ if (e_cal_get_cal_address (client, &email, NULL) && !g_strcasecmp (email, strip)) {
g_free (email);
return TRUE;
@@ -119,16 +119,16 @@ itip_organizer_is_user (CalComponent *comp, CalClient *client)
}
gboolean
-itip_sentby_is_user (CalComponent *comp)
+itip_sentby_is_user (ECalComponent *comp)
{
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
const char *strip;
gboolean user_sentby = FALSE;
- if (!cal_component_has_organizer (comp))
+ if (!e_cal_component_has_organizer (comp))
return FALSE;
- cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.sentby != NULL) {
strip = itip_strip_mailto (organizer.sentby);
user_sentby = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
@@ -167,7 +167,7 @@ get_label (struct icaltimetype *tt)
typedef struct {
GHashTable *tzids;
icalcomponent *icomp;
- CalClient *client;
+ ECal *client;
icalcomponent *zones;
} ItipUtilTZData;
@@ -191,7 +191,7 @@ foreach_tzid_callback (icalparameter *param, gpointer data)
if (zone == NULL)
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (zone == NULL && tz_data->client != NULL)
- cal_client_get_timezone (tz_data->client, tzid, &zone, NULL);
+ e_cal_get_timezone (tz_data->client, tzid, &zone, NULL);
if (zone == NULL)
return;
@@ -205,21 +205,21 @@ foreach_tzid_callback (icalparameter *param, gpointer data)
}
static icalcomponent *
-comp_toplevel_with_zones (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones)
+comp_toplevel_with_zones (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones)
{
icalcomponent *top_level, *icomp;
icalproperty *prop;
icalvalue *value;
ItipUtilTZData tz_data;
- top_level = cal_util_new_top_level ();
+ top_level = e_cal_util_new_top_level ();
prop = icalproperty_new (ICAL_METHOD_PROPERTY);
value = icalvalue_new_method (itip_methods_enum[method]);
icalproperty_set_value (prop, value);
icalcomponent_add_property (top_level, prop);
- icomp = cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
icomp = icalcomponent_new_clone (icomp);
tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal);
@@ -248,21 +248,21 @@ users_has_attendee (GList *users, const char *address)
}
static CORBA_char *
-comp_from (CalComponentItipMethod method, CalComponent *comp)
+comp_from (ECalComponentItipMethod method, ECalComponent *comp)
{
- CalComponentOrganizer organizer;
- CalComponentAttendee *attendee;
+ ECalComponentOrganizer organizer;
+ ECalComponentAttendee *attendee;
GSList *attendees;
CORBA_char *str;
switch (method) {
- case CAL_COMPONENT_METHOD_PUBLISH:
+ case E_CAL_COMPONENT_METHOD_PUBLISH:
return CORBA_string_dup ("");
- case CAL_COMPONENT_METHOD_REQUEST:
- case CAL_COMPONENT_METHOD_CANCEL:
- case CAL_COMPONENT_METHOD_ADD:
- cal_component_get_organizer (comp, &organizer);
+ case E_CAL_COMPONENT_METHOD_REQUEST:
+ case E_CAL_COMPONENT_METHOD_CANCEL:
+ case E_CAL_COMPONENT_METHOD_ADD:
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
@@ -272,36 +272,36 @@ comp_from (CalComponentItipMethod method, CalComponent *comp)
return CORBA_string_dup (itip_strip_mailto (organizer.value));
default:
- if (!cal_component_has_attendees (comp))
+ if (!e_cal_component_has_attendees (comp))
return CORBA_string_dup ("");
- cal_component_get_attendee_list (comp, &attendees);
+ e_cal_component_get_attendee_list (comp, &attendees);
attendee = attendees->data;
str = CORBA_string_dup (attendee->value ? itip_strip_mailto (attendee->value) : "");
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
return str;
}
}
static GNOME_Evolution_Composer_RecipientList *
-comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
+comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users)
{
GNOME_Evolution_Composer_RecipientList *to_list;
GNOME_Evolution_Composer_Recipient *recipient;
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
GSList *attendees, *l;
gint len;
switch (method) {
- case CAL_COMPONENT_METHOD_REQUEST:
- case CAL_COMPONENT_METHOD_CANCEL:
- cal_component_get_attendee_list (comp, &attendees);
+ case E_CAL_COMPONENT_METHOD_REQUEST:
+ case E_CAL_COMPONENT_METHOD_CANCEL:
+ e_cal_component_get_attendee_list (comp, &attendees);
len = g_slist_length (attendees);
if (len <= 0) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("At least one attendee is necessary"));
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
return NULL;
}
@@ -310,7 +310,7 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
to_list->_length = 0;
to_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (len);
- cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
@@ -318,7 +318,7 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
}
for (l = attendees; l != NULL; l = l->next) {
- CalComponentAttendee *att = l->data;
+ ECalComponentAttendee *att = l->data;
if (users_has_attendee (users, att->value))
continue;
@@ -334,15 +334,15 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
to_list->_length++;
}
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
break;
- case CAL_COMPONENT_METHOD_REPLY:
- case CAL_COMPONENT_METHOD_ADD:
- case CAL_COMPONENT_METHOD_REFRESH:
- case CAL_COMPONENT_METHOD_COUNTER:
- case CAL_COMPONENT_METHOD_DECLINECOUNTER:
- cal_component_get_organizer (comp, &organizer);
+ case E_CAL_COMPONENT_METHOD_REPLY:
+ case E_CAL_COMPONENT_METHOD_ADD:
+ case E_CAL_COMPONENT_METHOD_REFRESH:
+ case E_CAL_COMPONENT_METHOD_COUNTER:
+ case E_CAL_COMPONENT_METHOD_DECLINECOUNTER:
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
@@ -375,25 +375,25 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
}
static CORBA_char *
-comp_subject (CalComponentItipMethod method, CalComponent *comp)
+comp_subject (ECalComponentItipMethod method, ECalComponent *comp)
{
- CalComponentText caltext;
+ ECalComponentText caltext;
const char *description, *prefix = NULL;
GSList *alist;
CORBA_char *subject;
- cal_component_get_summary (comp, &caltext);
+ e_cal_component_get_summary (comp, &caltext);
if (caltext.value != NULL)
description = caltext.value;
else {
- switch (cal_component_get_vtype (comp)) {
- case CAL_COMPONENT_EVENT:
+ switch (e_cal_component_get_vtype (comp)) {
+ case E_CAL_COMPONENT_EVENT:
description = _("Event information");
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
description = _("Task information");
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
description = _("Journal information");
- case CAL_COMPONENT_FREEBUSY:
+ case E_CAL_COMPONENT_FREEBUSY:
description = _("Free/Busy information");
default:
description = _("Calendar information");
@@ -401,18 +401,18 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
}
switch (method) {
- case CAL_COMPONENT_METHOD_PUBLISH:
- case CAL_COMPONENT_METHOD_REQUEST:
+ case E_CAL_COMPONENT_METHOD_PUBLISH:
+ case E_CAL_COMPONENT_METHOD_REQUEST:
/* FIXME: If this is an update to a previous
* PUBLISH or REQUEST, then
prefix = U_("Updated");
*/
break;
- case CAL_COMPONENT_METHOD_REPLY:
- cal_component_get_attendee_list (comp, &alist);
+ case E_CAL_COMPONENT_METHOD_REPLY:
+ e_cal_component_get_attendee_list (comp, &alist);
if (alist != NULL) {
- CalComponentAttendee *a = alist->data;
+ ECalComponentAttendee *a = alist->data;
switch (a->status) {
case ICAL_PARTSTAT_ACCEPTED:
@@ -427,27 +427,27 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
default:
break;
}
- cal_component_free_attendee_list (alist);
+ e_cal_component_free_attendee_list (alist);
}
break;
- case CAL_COMPONENT_METHOD_ADD:
+ case E_CAL_COMPONENT_METHOD_ADD:
prefix = _("Updated");
break;
- case CAL_COMPONENT_METHOD_CANCEL:
+ case E_CAL_COMPONENT_METHOD_CANCEL:
prefix = _("Cancel");
break;
- case CAL_COMPONENT_METHOD_REFRESH:
+ case E_CAL_COMPONENT_METHOD_REFRESH:
prefix = _("Refresh");
break;
- case CAL_COMPONENT_METHOD_COUNTER:
+ case E_CAL_COMPONENT_METHOD_COUNTER:
prefix = _("Counter-proposal");
break;
- case CAL_COMPONENT_METHOD_DECLINECOUNTER:
+ case E_CAL_COMPONENT_METHOD_DECLINECOUNTER:
prefix = _("Declined");
break;
@@ -466,22 +466,22 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
}
static CORBA_char *
-comp_content_type (CalComponent *comp, CalComponentItipMethod method)
+comp_content_type (ECalComponent *comp, ECalComponentItipMethod method)
{
char tmp[256];
sprintf (tmp, "text/calendar; name=\"%s\"; charset=utf-8; METHOD=%s",
- cal_component_get_vtype (comp) == CAL_COMPONENT_FREEBUSY ?
+ e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_FREEBUSY ?
"freebusy.ifb" : "calendar.ics", itip_methods[method]);
return CORBA_string_dup (tmp);
}
static CORBA_char *
-comp_filename (CalComponent *comp)
+comp_filename (ECalComponent *comp)
{
- switch (cal_component_get_vtype (comp)) {
- case CAL_COMPONENT_FREEBUSY:
+ switch (e_cal_component_get_vtype (comp)) {
+ case E_CAL_COMPONENT_FREEBUSY:
return CORBA_string_dup ("freebusy.ifb");
default:
return CORBA_string_dup ("calendar.ics");
@@ -489,29 +489,29 @@ comp_filename (CalComponent *comp)
}
static CORBA_char *
-comp_description (CalComponent *comp)
+comp_description (ECalComponent *comp)
{
CORBA_char *description;
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
char *start = NULL, *end = NULL;
- switch (cal_component_get_vtype (comp)) {
- case CAL_COMPONENT_EVENT:
+ switch (e_cal_component_get_vtype (comp)) {
+ case E_CAL_COMPONENT_EVENT:
return CORBA_string_dup (_("Event information"));
- case CAL_COMPONENT_TODO:
+ case E_CAL_COMPONENT_TODO:
return CORBA_string_dup (_("Task information"));
- case CAL_COMPONENT_JOURNAL:
+ case E_CAL_COMPONENT_JOURNAL:
return CORBA_string_dup (_("Journal information"));
- case CAL_COMPONENT_FREEBUSY:
- cal_component_get_dtstart (comp, &dt);
+ case E_CAL_COMPONENT_FREEBUSY:
+ e_cal_component_get_dtstart (comp, &dt);
if (dt.value)
start = get_label (dt.value);
- cal_component_free_datetime (&dt);
+ e_cal_component_free_datetime (&dt);
- cal_component_get_dtend (comp, &dt);
+ e_cal_component_get_dtend (comp, &dt);
if (dt.value)
end = get_label (dt.value);
- cal_component_free_datetime (&dt);
+ e_cal_component_free_datetime (&dt);
if (start != NULL && end != NULL) {
char *tmp;
@@ -530,7 +530,7 @@ comp_description (CalComponent *comp)
}
static gboolean
-comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client,
+comp_server_send (ECalComponentItipMethod method, ECalComponent *comp, ECal *client,
icalcomponent *zones, GList **users)
{
icalcomponent *top_level;
@@ -538,7 +538,7 @@ comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *
GError *error = NULL;
top_level = comp_toplevel_with_zones (method, comp, client, zones);
- if (!cal_client_send_objects (client, top_level, &error)) {
+ if (!e_cal_send_objects (client, top_level, &error)) {
/* FIXME Really need a book problem status code */
if (error->code != E_CALENDAR_STATUS_OK) {
/* FIXME Better error message */
@@ -556,14 +556,14 @@ comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *
}
static gboolean
-comp_limit_attendees (CalComponent *comp)
+comp_limit_attendees (ECalComponent *comp)
{
icalcomponent *icomp;
icalproperty *prop;
gboolean found = FALSE, match = FALSE;
GSList *l, *list = NULL;
- icomp = cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
for (prop = icalcomponent_get_first_property (icomp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
@@ -607,11 +607,11 @@ comp_limit_attendees (CalComponent *comp)
}
static void
-comp_sentby (CalComponent *comp, CalClient *client)
+comp_sentby (ECalComponent *comp, ECal *client)
{
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
- cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_organizer (comp, &organizer);
if (!organizer.value) {
EAccount *a = itip_addresses_get_default ();
@@ -620,7 +620,7 @@ comp_sentby (CalComponent *comp, CalClient *client)
organizer.cn = a->id->name;
organizer.language = NULL;
- cal_component_set_organizer (comp, &organizer);
+ e_cal_component_set_organizer (comp, &organizer);
g_free ((char *) organizer.value);
return;
@@ -634,7 +634,7 @@ comp_sentby (CalComponent *comp, CalClient *client)
organizer.cn = g_strdup (organizer.cn);
organizer.language = g_strdup (organizer.language);
- cal_component_set_organizer (comp, &organizer);
+ e_cal_component_set_organizer (comp, &organizer);
g_free ((char *)organizer.value);
g_free ((char *)organizer.sentby);
@@ -642,26 +642,26 @@ comp_sentby (CalComponent *comp, CalClient *client)
g_free ((char *)organizer.language);
}
}
-static CalComponent *
-comp_minimal (CalComponent *comp, gboolean attendee)
+static ECalComponent *
+comp_minimal (ECalComponent *comp, gboolean attendee)
{
- CalComponent *clone;
+ ECalComponent *clone;
icalcomponent *icomp, *icomp_clone;
icalproperty *prop;
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
const char *uid;
GSList *comments;
struct icaltimetype itt;
- CalComponentRange recur_id;
+ ECalComponentRange recur_id;
- clone = cal_component_new ();
- cal_component_set_new_vtype (clone, cal_component_get_vtype (comp));
+ clone = e_cal_component_new ();
+ e_cal_component_set_new_vtype (clone, e_cal_component_get_vtype (comp));
if (attendee) {
GSList *attendees;
- cal_component_get_attendee_list (comp, &attendees);
- cal_component_set_attendee_list (clone, attendees);
+ e_cal_component_get_attendee_list (comp, &attendees);
+ e_cal_component_set_attendee_list (clone, attendees);
if (!comp_limit_attendees (clone)) {
e_notice (NULL, GTK_MESSAGE_ERROR,
@@ -672,34 +672,34 @@ comp_minimal (CalComponent *comp, gboolean attendee)
itt = icaltime_from_timet_with_zone (time (NULL), FALSE,
icaltimezone_get_utc_timezone ());
- cal_component_set_dtstamp (clone, &itt);
+ e_cal_component_set_dtstamp (clone, &itt);
- cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL)
goto error;
- cal_component_set_organizer (clone, &organizer);
+ e_cal_component_set_organizer (clone, &organizer);
- cal_component_get_uid (comp, &uid);
- cal_component_set_uid (clone, uid);
+ e_cal_component_get_uid (comp, &uid);
+ e_cal_component_set_uid (clone, uid);
- cal_component_get_comment_list (comp, &comments);
+ e_cal_component_get_comment_list (comp, &comments);
if (g_slist_length (comments) <= 1) {
- cal_component_set_comment_list (clone, comments);
+ e_cal_component_set_comment_list (clone, comments);
} else {
GSList *l = comments;
comments = g_slist_remove_link (comments, l);
- cal_component_set_comment_list (clone, l);
- cal_component_free_text_list (l);
+ e_cal_component_set_comment_list (clone, l);
+ e_cal_component_free_text_list (l);
}
- cal_component_free_text_list (comments);
+ e_cal_component_free_text_list (comments);
- cal_component_get_recurid (comp, &recur_id);
+ e_cal_component_get_recurid (comp, &recur_id);
if (recur_id.datetime.value != NULL)
- cal_component_set_recurid (clone, &recur_id);
+ e_cal_component_set_recurid (clone, &recur_id);
- icomp = cal_component_get_icalcomponent (comp);
- icomp_clone = cal_component_get_icalcomponent (clone);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ icomp_clone = e_cal_component_get_icalcomponent (clone);
for (prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY))
@@ -710,7 +710,7 @@ comp_minimal (CalComponent *comp, gboolean attendee)
icalcomponent_add_property (icomp_clone, p);
}
- cal_component_rescan (clone);
+ e_cal_component_rescan (clone);
return clone;
@@ -719,31 +719,31 @@ comp_minimal (CalComponent *comp, gboolean attendee)
return NULL;
}
-static CalComponent *
-comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones)
+static ECalComponent *
+comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones)
{
- CalComponent *clone, *temp_clone;
+ ECalComponent *clone, *temp_clone;
struct icaltimetype itt;
- clone = cal_component_clone (comp);
+ clone = e_cal_component_clone (comp);
itt = icaltime_from_timet_with_zone (time (NULL), FALSE,
icaltimezone_get_utc_timezone ());
- cal_component_set_dtstamp (clone, &itt);
+ e_cal_component_set_dtstamp (clone, &itt);
/* Make UNTIL date a datetime in a simple recurrence */
- if (cal_component_has_recurrences (clone)
- && cal_component_has_simple_recurrence (clone)) {
+ if (e_cal_component_has_recurrences (clone)
+ && e_cal_component_has_simple_recurrence (clone)) {
GSList *rrule_list;
struct icalrecurrencetype *r;
- cal_component_get_rrule_list (clone, &rrule_list);
+ e_cal_component_get_rrule_list (clone, &rrule_list);
r = rrule_list->data;
if (!icaltime_is_null_time (r->until) && r->until.is_date) {
- CalComponentDateTime dt;
+ ECalComponentDateTime dt;
icaltimezone *from_zone = NULL, *to_zone;
- cal_component_get_dtstart (clone, &dt);
+ e_cal_component_get_dtstart (clone, &dt);
if (dt.value->is_date) {
from_zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ());
@@ -756,7 +756,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
from_zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid);
if (from_zone == NULL && client != NULL)
/* FIXME Error checking */
- cal_client_get_timezone (client, dt.tzid, &from_zone, NULL);
+ e_cal_get_timezone (client, dt.tzid, &from_zone, NULL);
}
to_zone = icaltimezone_get_utc_timezone ();
@@ -769,44 +769,44 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
icaltimezone_convert_time (&r->until, from_zone, to_zone);
r->until.is_utc = TRUE;
- cal_component_set_rrule_list (clone, rrule_list);
- cal_component_abort_sequence (clone);
+ e_cal_component_set_rrule_list (clone, rrule_list);
+ e_cal_component_abort_sequence (clone);
}
- cal_component_free_recur_list (rrule_list);
+ e_cal_component_free_recur_list (rrule_list);
}
/* We delete incoming alarms anyhow, and this helps with outlook */
- cal_component_remove_all_alarms (clone);
+ e_cal_component_remove_all_alarms (clone);
/* Strip X-LIC-ERROR stuff */
- cal_component_strip_errors (clone);
+ e_cal_component_strip_errors (clone);
/* Comply with itip spec */
switch (method) {
- case CAL_COMPONENT_METHOD_PUBLISH:
+ case E_CAL_COMPONENT_METHOD_PUBLISH:
comp_sentby (clone, client);
- cal_component_set_attendee_list (clone, NULL);
+ e_cal_component_set_attendee_list (clone, NULL);
break;
- case CAL_COMPONENT_METHOD_REQUEST:
+ case E_CAL_COMPONENT_METHOD_REQUEST:
comp_sentby (clone, client);
break;
- case CAL_COMPONENT_METHOD_CANCEL:
+ case E_CAL_COMPONENT_METHOD_CANCEL:
comp_sentby (clone, client);
break;
- case CAL_COMPONENT_METHOD_REPLY:
+ case E_CAL_COMPONENT_METHOD_REPLY:
break;
- case CAL_COMPONENT_METHOD_ADD:
+ case E_CAL_COMPONENT_METHOD_ADD:
break;
- case CAL_COMPONENT_METHOD_REFRESH:
+ case E_CAL_COMPONENT_METHOD_REFRESH:
/* Need to remove almost everything */
temp_clone = comp_minimal (clone, TRUE);
g_object_unref (clone);
clone = temp_clone;
break;
- case CAL_COMPONENT_METHOD_COUNTER:
+ case E_CAL_COMPONENT_METHOD_COUNTER:
break;
- case CAL_COMPONENT_METHOD_DECLINECOUNTER:
+ case E_CAL_COMPONENT_METHOD_DECLINECOUNTER:
/* Need to remove almost everything */
temp_clone = comp_minimal (clone, FALSE);
g_object_unref (clone);
@@ -820,11 +820,11 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
}
gboolean
-itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
- CalClient *client, icalcomponent *zones)
+itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
+ ECal *client, icalcomponent *zones)
{
GNOME_Evolution_Composer composer_server;
- CalComponent *comp = NULL;
+ ECalComponent *comp = NULL;
icalcomponent *top_level = NULL;
GList *users = NULL;
GNOME_Evolution_Composer_RecipientList *to_list = NULL;
@@ -840,7 +840,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
CORBA_exception_init (&ev);
/* Give the server a chance to manipulate the comp */
- if (method != CAL_COMPONENT_METHOD_PUBLISH) {
+ if (method != E_CAL_COMPONENT_METHOD_PUBLISH) {
if (!comp_server_send (method, send_comp, client, zones, &users))
goto cleanup;
}
@@ -852,7 +852,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
/* Recipients */
to_list = comp_to_list (method, comp, users);
- if (method != CAL_COMPONENT_METHOD_PUBLISH) {
+ if (method != E_CAL_COMPONENT_METHOD_PUBLISH) {
if (to_list == NULL || to_list->_length == 0) {
/* We sent them all via the server */
retval = TRUE;
@@ -894,7 +894,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
top_level = comp_toplevel_with_zones (method, comp, client, zones);
ical_string = icalcomponent_as_ical_string (top_level);
- if (cal_component_get_vtype (comp) == CAL_COMPONENT_EVENT) {
+ if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT) {
GNOME_Evolution_Composer_setBody (composer_server, ical_string, content_type, &ev);
} else {
GNOME_Evolution_Composer_setMultipartType (composer_server, GNOME_Evolution_Composer_MIXED, &ev);
@@ -929,7 +929,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
goto cleanup;
}
- if (method == CAL_COMPONENT_METHOD_PUBLISH) {
+ if (method == E_CAL_COMPONENT_METHOD_PUBLISH) {
GNOME_Evolution_Composer_show (composer_server, &ev);
if (BONOBO_EX (&ev))
g_warning ("Unable to show the composer while sending iTip message");
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 981fd2a12d..cf9dd37643 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -5,31 +5,31 @@
#include <libical/ical.h>
#include <string.h>
#include <glib.h>
-#include <cal-client/cal-client.h>
-#include <cal-util/cal-component.h>
+#include <libecal/e-cal.h>
+#include <libecal/e-cal-component.h>
#include <e-util/e-account-list.h>
typedef enum {
- CAL_COMPONENT_METHOD_PUBLISH,
- CAL_COMPONENT_METHOD_REQUEST,
- CAL_COMPONENT_METHOD_REPLY,
- CAL_COMPONENT_METHOD_ADD,
- CAL_COMPONENT_METHOD_CANCEL,
- CAL_COMPONENT_METHOD_REFRESH,
- CAL_COMPONENT_METHOD_COUNTER,
- CAL_COMPONENT_METHOD_DECLINECOUNTER
-} CalComponentItipMethod;
+ E_CAL_COMPONENT_METHOD_PUBLISH,
+ E_CAL_COMPONENT_METHOD_REQUEST,
+ E_CAL_COMPONENT_METHOD_REPLY,
+ E_CAL_COMPONENT_METHOD_ADD,
+ E_CAL_COMPONENT_METHOD_CANCEL,
+ E_CAL_COMPONENT_METHOD_REFRESH,
+ E_CAL_COMPONENT_METHOD_COUNTER,
+ E_CAL_COMPONENT_METHOD_DECLINECOUNTER
+} ECalComponentItipMethod;
EAccountList *itip_addresses_get (void);
EAccount *itip_addresses_get_default (void);
-gboolean itip_organizer_is_user (CalComponent *comp, CalClient *client);
-gboolean itip_sentby_is_user (CalComponent *comp);
+gboolean itip_organizer_is_user (ECalComponent *comp, ECal *client);
+gboolean itip_sentby_is_user (ECalComponent *comp);
const gchar *itip_strip_mailto (const gchar *address);
-gboolean itip_send_comp (CalComponentItipMethod method, CalComponent *comp,
- CalClient *client, icalcomponent *zones);
+gboolean itip_send_comp (ECalComponentItipMethod method, ECalComponent *comp,
+ ECal *client, icalcomponent *zones);
#endif
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 0c0fa44886..2bea5a915a 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -45,7 +45,7 @@
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-time-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "calendar-commands.h"
#include "calendar-config.h"
#include "e-day-view.h"
@@ -523,7 +523,7 @@ format_date(time_t time, int flags, char *buffer, int bufflen)
}
static gboolean
-instance_cb (CalComponent *comp, time_t instance_start, time_t instance_end, gpointer data)
+instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end, gpointer data)
{
gboolean *found = data;
@@ -543,7 +543,7 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, time_t month,
int bordertitle)
{
icaltimezone *zone = get_timezone ();
- CalClient *client;
+ ECal *client;
GnomeFont *font, *font_bold, *font_normal;
time_t now, next;
int x, y;
@@ -640,7 +640,7 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, time_t month,
sprintf (buf, "%d", day);
/* this is a slow messy way to do this ... but easy ... */
- cal_client_generate_instances (client, now, CALOBJ_TYPE_EVENT,
+ e_cal_generate_instances (client, now, CALOBJ_TYPE_EVENT,
time_day_end_with_zone (now, zone),
instance_cb, &found);
@@ -856,7 +856,7 @@ print_day_background (GnomePrintContext *pc, GnomeCalendar *gcal,
/* This adds one event to the view, adding it to the appropriate array. */
static gint
-print_day_add_event (CalComponent *comp,
+print_day_add_event (ECalComponent *comp,
time_t start,
time_t end,
gint days_shown,
@@ -932,7 +932,7 @@ print_day_add_event (CalComponent *comp,
static gboolean
-print_day_details_cb (CalComponent *comp, time_t istart, time_t iend,
+print_day_details_cb (ECalComponent *comp, time_t istart, time_t iend,
gpointer data)
{
struct pdinfo *pdi = (struct pdinfo *)data;
@@ -1124,7 +1124,7 @@ print_day_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
double left, double right, double top, double bottom)
{
icaltimezone *zone = get_timezone ();
- CalClient *client;
+ ECal *client;
EDayViewEvent *event;
GnomeFont *font;
time_t start, end;
@@ -1152,7 +1152,7 @@ print_day_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
/* Get the events from the server. */
client = gnome_calendar_get_default_client (gcal);
- cal_client_generate_instances (client, CALOBJ_TYPE_EVENT, start, end,
+ e_cal_generate_instances (client, CALOBJ_TYPE_EVENT, start, end,
print_day_details_cb, &pdi);
qsort (pdi.long_events->data, pdi.long_events->len,
sizeof (EDayViewEvent), e_day_view_event_sort_func);
@@ -1242,7 +1242,7 @@ print_day_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
/* This adds one event to the view, adding it to the appropriate array. */
static gboolean
-print_week_summary_cb (CalComponent *comp,
+print_week_summary_cb (ECalComponent *comp,
time_t start,
time_t end,
gpointer data)
@@ -1550,7 +1550,7 @@ print_week_summary (GnomePrintContext *pc, GnomeCalendar *gcal,
double left, double right, double top, double bottom)
{
icaltimezone *zone = get_timezone ();
- CalClient *client;
+ ECal *client;
EWeekViewEvent *event;
struct psinfo psi;
time_t day_start;
@@ -1588,7 +1588,7 @@ print_week_summary (GnomePrintContext *pc, GnomeCalendar *gcal,
/* Get the events from the server. */
client = gnome_calendar_get_default_client (gcal);
- cal_client_generate_instances (client, CALOBJ_TYPE_EVENT,
+ e_cal_generate_instances (client, CALOBJ_TYPE_EVENT,
psi.day_starts[0],
psi.day_starts[psi.days_shown],
print_week_summary_cb, &psi);
@@ -1773,7 +1773,7 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
time_t start, time_t end,
double left, double right, double top, double bottom)
{
- CalClient *client;
+ ECal *client;
GnomeFont *font_summary;
double y, yend, x, xend;
struct icaltimetype *tt;
@@ -1787,7 +1787,7 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
task_pad = gnome_calendar_get_task_pad (gcal);
table = e_calendar_table_get_table (task_pad);
model = e_calendar_table_get_model (task_pad);
- client = gnome_calendar_get_task_pad_cal_client (gcal);
+ client = gnome_calendar_get_task_pad_e_cal (gcal);
font_summary = get_font_for_size (10, GNOME_FONT_BOOK, FALSE);
@@ -1803,8 +1803,8 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
rows = e_table_model_row_count (E_TABLE_MODEL (model));
for (row = 0; row < rows; row++) {
ECalModelComponent *comp_data;
- CalComponent *comp;
- CalComponentText summary;
+ ECalComponent *comp;
+ ECalComponentText summary;
int model_row;
model_row = e_table_view_to_model_row (table, row);
@@ -1812,10 +1812,10 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
if (!comp_data)
continue;
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- cal_component_get_summary (comp, &summary);
+ e_cal_component_get_summary (comp, &summary);
if (!summary.value) {
g_object_unref (comp);
continue;
@@ -1831,9 +1831,9 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
print_border (pc, x + 2, x + 8, y - 3, y - 11, 0.1, -1.0);
/* If the task is complete, print a tick in the box. */
- cal_component_get_completed (comp, &tt);
+ e_cal_component_get_completed (comp, &tt);
if (tt) {
- cal_component_free_icaltimetype (tt);
+ e_cal_component_free_icaltimetype (tt);
gnome_print_setrgbcolor (pc, 0, 0, 0);
gnome_print_setlinewidth (pc, 1.0);
@@ -2163,7 +2163,7 @@ write_label_piece (time_t t, char *buffer, int size, char *stext, char *etext)
}
static icaltimezone*
-get_zone_from_tzid (CalClient *client, const char *tzid)
+get_zone_from_tzid (ECal *client, const char *tzid)
{
icaltimezone *zone;
@@ -2171,7 +2171,7 @@ get_zone_from_tzid (CalClient *client, const char *tzid)
the builtin timezone with the TZID first. */
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (!zone) {
- if (!cal_client_get_timezone (client, tzid, &zone, NULL))
+ if (!e_cal_get_timezone (client, tzid, &zone, NULL))
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
tzid ? tzid : "");
@@ -2181,44 +2181,44 @@ get_zone_from_tzid (CalClient *client, const char *tzid)
}
static void
-print_date_label (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
+print_date_label (GnomePrintContext *pc, ECalComponent *comp, ECal *client,
double left, double right, double top, double bottom)
{
icaltimezone *start_zone, *end_zone, *due_zone, *completed_zone;
- CalComponentDateTime datetime;
+ ECalComponentDateTime datetime;
time_t start = 0, end = 0, complete = 0, due = 0;
static char buffer[1024];
- cal_component_get_dtstart (comp, &datetime);
+ e_cal_component_get_dtstart (comp, &datetime);
if (datetime.value) {
start_zone = get_zone_from_tzid (client, datetime.tzid);
start = icaltime_as_timet_with_zone (*datetime.value,
start_zone);
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
- cal_component_get_dtend (comp, &datetime);
+ e_cal_component_get_dtend (comp, &datetime);
if (datetime.value) {
end_zone = get_zone_from_tzid (client, datetime.tzid);
end = icaltime_as_timet_with_zone (*datetime.value,
end_zone);
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
- cal_component_get_due (comp, &datetime);
+ e_cal_component_get_due (comp, &datetime);
if (datetime.value) {
due_zone = get_zone_from_tzid (client, datetime.tzid);
due = icaltime_as_timet_with_zone (*datetime.value,
due_zone);
}
- cal_component_free_datetime (&datetime);
+ e_cal_component_free_datetime (&datetime);
- cal_component_get_completed (comp, &datetime.value);
+ e_cal_component_get_completed (comp, &datetime.value);
if (datetime.value) {
completed_zone = icaltimezone_get_utc_timezone ();
complete = icaltime_as_timet_with_zone (*datetime.value,
completed_zone);
- cal_component_free_icaltimetype (datetime.value);
+ e_cal_component_free_icaltimetype (datetime.value);
}
buffer[0] = '\0';
@@ -2248,24 +2248,24 @@ print_date_label (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
}
static void
-print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
+print_comp_item (GnomePrintContext *pc, ECalComponent *comp, ECal *client,
double left, double right, double top, double bottom)
{
GnomeFont *font;
- CalComponentVType vtype;
- CalComponentText text;
+ ECalComponentVType vtype;
+ ECalComponentText text;
GSList *desc, *l;
const char *title, *categories;
char *categories_string;
GSList *contact_list, *elem;
gint header_size;
- vtype = cal_component_get_vtype (comp);
+ vtype = e_cal_component_get_vtype (comp);
/* We should only be asked to print VEVENTs or VTODOs. */
- if (vtype == CAL_COMPONENT_EVENT)
+ if (vtype == E_CAL_COMPONENT_EVENT)
title = _("Appointment");
- else if (vtype == CAL_COMPONENT_TODO)
+ else if (vtype == E_CAL_COMPONENT_TODO)
title = _("Task");
else
return;
@@ -2285,7 +2285,7 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
/* Summary */
font = get_font_for_size (18, GNOME_FONT_BOLD, FALSE);
- cal_component_get_summary (comp, &text);
+ e_cal_component_get_summary (comp, &text);
top = bound_text (pc, font, text.value, left, right,
top - 3, bottom, 0);
g_object_unref (font);
@@ -2297,7 +2297,7 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
font = get_font_for_size (12, GNOME_FONT_BOOK, FALSE);
/* For a VTODO we print the Status, Priority, % Complete and URL. */
- if (vtype == CAL_COMPONENT_TODO) {
+ if (vtype == E_CAL_COMPONENT_TODO) {
icalproperty_status status;
const char *status_string = NULL;
int *percent;
@@ -2305,7 +2305,7 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
const char *url;
/* Status */
- cal_component_get_status (comp, &status);
+ e_cal_component_get_status (comp, &status);
if (status != ICAL_STATUS_NONE) {
switch (status) {
case ICAL_STATUS_NEEDSACTION:
@@ -2335,12 +2335,12 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
}
/* Priority */
- cal_component_get_priority (comp, &priority);
+ e_cal_component_get_priority (comp, &priority);
if (priority && *priority >= 0) {
char *priority_string, *text;
- priority_string = cal_util_priority_to_string (*priority);
- cal_component_free_priority (priority);
+ priority_string = e_cal_util_priority_to_string (*priority);
+ e_cal_component_free_priority (priority);
text = g_strdup_printf (_("Priority: %s"), priority_string);
top = bound_text (pc, font, text,
@@ -2350,12 +2350,12 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
}
/* Percent Complete */
- cal_component_get_percent (comp, &percent);
+ e_cal_component_get_percent (comp, &percent);
if (percent) {
char *percent_string;
percent_string = g_strdup_printf (_("Percent Complete: %i"), *percent);
- cal_component_free_percent (percent);
+ e_cal_component_free_percent (percent);
top = bound_text (pc, font, percent_string,
left, right, top, bottom, 0);
@@ -2364,7 +2364,7 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
/* URL */
- cal_component_get_url (comp, &url);
+ e_cal_component_get_url (comp, &url);
if (url && url[0]) {
char *url_string = g_strdup_printf (_("URL: %s"),
url);
@@ -2378,7 +2378,7 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
}
/* Categories */
- cal_component_get_categories (comp, &categories);
+ e_cal_component_get_categories (comp, &categories);
if (categories && categories[0]) {
categories_string = g_strdup_printf (_("Categories: %s"),
categories);
@@ -2389,17 +2389,17 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
}
/* Contacts */
- cal_component_get_contact_list (comp, &contact_list);
+ e_cal_component_get_contact_list (comp, &contact_list);
if (contact_list) {
GString *contacts = g_string_new (_("Contacts: "));
for (elem = contact_list; elem; elem = elem->next) {
- CalComponentText *t = elem->data;
+ ECalComponentText *t = elem->data;
/* Put a comma between contacts. */
if (elem != contact_list)
g_string_append (contacts, ", ");
g_string_append (contacts, t->value);
}
- cal_component_free_text_list (contact_list);
+ e_cal_component_free_text_list (contact_list);
top = bound_text (pc, font, contacts->str,
left, right, top, bottom, 0);
@@ -2411,14 +2411,14 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
top -= 16;
/* Description */
- cal_component_get_description_list (comp, &desc);
+ e_cal_component_get_description_list (comp, &desc);
for (l = desc; l != NULL; l = l->next) {
- CalComponentText *text = l->data;
+ ECalComponentText *text = l->data;
if (text->value != NULL)
top = bound_text (pc, font, text->value, left, right, top-3, bottom, 0);
}
- cal_component_free_text_list (desc);
+ e_cal_component_free_text_list (desc);
g_object_unref (font);
gnome_print_showpage (pc);
@@ -2542,7 +2542,7 @@ print_calendar (GnomeCalendar *gcal, gboolean preview, time_t date,
void
-print_comp (CalComponent *comp, CalClient *client, gboolean preview)
+print_comp (ECalComponent *comp, ECal *client, gboolean preview)
{
GnomePrintJob *gpm;
GnomePrintContext *pc;
@@ -2550,7 +2550,7 @@ print_comp (CalComponent *comp, CalClient *client, gboolean preview)
double l, r, t, b;
g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
if (!print_config)
print_config = gnome_print_config_default ();
diff --git a/calendar/gui/print.h b/calendar/gui/print.h
index 4571b36976..495007d81d 100644
--- a/calendar/gui/print.h
+++ b/calendar/gui/print.h
@@ -34,7 +34,7 @@ typedef enum {
} PrintView;
void print_calendar (GnomeCalendar *gcal, gboolean preview, time_t at, PrintView default_view);
-void print_comp (CalComponent *comp, CalClient *client, gboolean preview);
+void print_comp (ECalComponent *comp, ECal *client, gboolean preview);
void print_setup (void);
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index 147a69f246..8e6937d08a 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -23,7 +23,7 @@
#include <config.h>
#endif
-#include <cal-util/timeutil.h>
+#include <libecal/e-cal-time-util.h>
#include "calendar-config.h"
#include "tag-calendar.h"
@@ -85,22 +85,22 @@ prepare_tag (ECalendar *ecal, struct calendar_tag_closure *c, icaltimezone *zone
return TRUE;
}
-/* Marks the specified range in an ECalendar; called from cal_client_generate_instances() */
+/* Marks the specified range in an ECalendar; called from e_cal_generate_instances() */
static gboolean
-tag_calendar_cb (CalComponent *comp,
+tag_calendar_cb (ECalComponent *comp,
time_t istart,
time_t iend,
gpointer data)
{
struct calendar_tag_closure *c = data;
struct icaltimetype start_tt, end_tt;
- CalComponentTransparency transparency;
+ ECalComponentTransparency transparency;
/* If we are skipping TRANSPARENT events, return if the event is
transparent. */
if (c->skip_transparent_events) {
- cal_component_get_transparency (comp, &transparency);
- if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ e_cal_component_get_transparency (comp, &transparency);
+ if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT)
return TRUE;
}
@@ -125,20 +125,20 @@ tag_calendar_cb (CalComponent *comp,
* range. The occurrences are extracted from the specified calendar @client.
**/
void
-tag_calendar_by_client (ECalendar *ecal, CalClient *client)
+tag_calendar_by_client (ECalendar *ecal, ECal *client)
{
struct calendar_tag_closure c;
g_return_if_fail (ecal != NULL);
g_return_if_fail (E_IS_CALENDAR (ecal));
g_return_if_fail (client != NULL);
- g_return_if_fail (IS_CAL_CLIENT (client));
+ g_return_if_fail (E_IS_CAL (client));
/* If the ECalendar isn't visible, we just return. */
if (!GTK_WIDGET_VISIBLE (ecal))
return;
- if (cal_client_get_load_state (client) != CAL_CLIENT_LOAD_LOADED)
+ if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED)
return;
if (!prepare_tag (ecal, &c, NULL, TRUE))
@@ -149,7 +149,7 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client)
#if 0
g_print ("DateNavigator generating instances\n");
#endif
- cal_client_generate_instances (client, CALOBJ_TYPE_EVENT,
+ e_cal_generate_instances (client, CALOBJ_TYPE_EVENT,
c.start_time, c.end_time,
tag_calendar_cb, &c);
}
@@ -160,20 +160,20 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client)
static icaltimezone*
resolve_tzid_cb (const char *tzid, gpointer data)
{
- CalClient *client;
+ ECal *client;
icaltimezone *zone = NULL;
g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (IS_CAL_CLIENT (data), NULL);
+ g_return_val_if_fail (E_IS_CAL (data), NULL);
- client = CAL_CLIENT (data);
+ client = E_CAL (data);
/* Try to find the builtin timezone first. */
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (!zone) {
/* FIXME: Handle errors. */
- cal_client_get_timezone (client, tzid, &zone, NULL);
+ e_cal_get_timezone (client, tzid, &zone, NULL);
}
return zone;
@@ -194,7 +194,7 @@ resolve_tzid_cb (const char *tzid, gpointer data)
* have been added to the calendar on the server yet.
**/
void
-tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, icaltimezone *display_zone,
+tag_calendar_by_comp (ECalendar *ecal, ECalComponent *comp, ECal *client, icaltimezone *display_zone,
gboolean clear_first, gboolean comp_is_on_server)
{
struct calendar_tag_closure c;
@@ -202,7 +202,7 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, ic
g_return_if_fail (ecal != NULL);
g_return_if_fail (E_IS_CALENDAR (ecal));
g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
/* If the ECalendar isn't visible, we just return. */
if (!GTK_WIDGET_VISIBLE (ecal))
@@ -217,12 +217,12 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, ic
g_print ("DateNavigator generating instances\n");
#endif
if (comp_is_on_server) {
- cal_recur_generate_instances (comp, c.start_time, c.end_time,
+ e_cal_recur_generate_instances (comp, c.start_time, c.end_time,
tag_calendar_cb, &c,
- cal_client_resolve_tzid_cb,
+ e_cal_resolve_tzid_cb,
client, c.zone);
} else {
- cal_recur_generate_instances (comp, c.start_time, c.end_time,
+ e_cal_recur_generate_instances (comp, c.start_time, c.end_time,
tag_calendar_cb, &c,
resolve_tzid_cb,
client, c.zone);
diff --git a/calendar/gui/tag-calendar.h b/calendar/gui/tag-calendar.h
index dc146e9c9f..d31d675543 100644
--- a/calendar/gui/tag-calendar.h
+++ b/calendar/gui/tag-calendar.h
@@ -23,11 +23,11 @@
#define TAG_CALENDAR_H
#include <widgets/misc/e-calendar.h>
-#include <cal-client/cal-client.h>
+#include <libecal/e-cal.h>
-void tag_calendar_by_client (ECalendar *ecal, CalClient *client);
-void tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp,
- CalClient *client, icaltimezone *display_zone,
+void tag_calendar_by_client (ECalendar *ecal, ECal *client);
+void tag_calendar_by_comp (ECalendar *ecal, ECalComponent *comp,
+ ECal *client, icaltimezone *display_zone,
gboolean clear_first, gboolean comp_is_on_server);
#endif
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 4e5de7c692..bdbe34db72 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -29,7 +29,7 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-i18n.h>
#include <gconf/gconf-client.h>
-#include "cal-client/cal-client.h"
+#include <libecal/e-cal.h>
#include "e-cal-model.h"
#include "e-tasks.h"
#include "tasks-component.h"
@@ -53,7 +53,7 @@ struct _TasksComponentPrivate {
static void
add_uri_for_source (ESource *source, ETasks *tasks)
{
- CalClient *client;
+ ECal *client;
ECalModel *model;
GError *error = NULL;
char *uri = e_source_get_uri (source);
@@ -61,8 +61,8 @@ add_uri_for_source (ESource *source, ETasks *tasks)
model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks));
client = e_cal_model_get_client_for_uri (model, uri);
if (!client) {
- client = cal_client_new (uri, CALOBJ_TYPE_TODO);
- if (cal_client_open (client, FALSE, &error)) {
+ client = e_cal_new (uri, CALOBJ_TYPE_TODO);
+ if (e_cal_open (client, FALSE, &error)) {
e_cal_model_add_client (model, client);
} else {
g_warning (G_STRLOC ": Could not open tasks at %s: %s", uri, error->message);
@@ -77,7 +77,7 @@ add_uri_for_source (ESource *source, ETasks *tasks)
static void
remove_uri_for_source (ESource *source, ETasks *tasks)
{
- CalClient *client;
+ ECal *client;
ECalModel *model;
char *uri = e_source_get_uri (source);
@@ -143,7 +143,7 @@ primary_source_selection_changed_cb (ESourceSelector *selector, TasksComponent *
{
TasksComponentPrivate *priv;
ESource *source;
- CalClient *client;
+ ECal *client;
char *uri;
ECalModel *model;
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 2729416ca8..8264393573 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -169,7 +169,7 @@ tasks_control_get_property (BonoboPropertyBag *bag,
case TASKS_CONTROL_PROPERTY_URI_IDX:
model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks));
- uri = cal_client_get_uri (e_cal_model_get_default_client (model));
+ uri = e_cal_get_uri (e_cal_model_get_default_client (model));
BONOBO_ARG_SET_STRING (arg, uri);
break;
@@ -240,7 +240,7 @@ sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected)
g_assert (uic != NULL);
model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks));
- cal_client_is_read_only (e_cal_model_get_default_client (model), &read_only, NULL);
+ e_cal_is_read_only (e_cal_model_get_default_client (model), &read_only, NULL);
bonobo_ui_component_set_prop (uic, "/commands/TasksCut", "sensitive",
n_selected == 0 || read_only ? "0" : "1",
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 8d0d344b5a..30f92dffc8 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -17,264 +17,9 @@ module GNOME {
module Evolution {
module Calendar {
- /* A calendar component (event/todo/journal/etc), represented as an
- * iCalendar string.
- */
- typedef string CalObj;
- typedef sequence<CalObj> CalObjSeq;
-
- typedef sequence<string> stringlist;
-
/* A unique identifier for a calendar component */
typedef string CalObjUID;
- /* A unique identified for an event recurrence */
- typedef string CalRecurID;
-
- /* Simple sequence of strings */
- typedef sequence<string> StringSeq;
-
- /* Sequence of unique identifiers */
- typedef sequence<CalObjUID> CalObjUIDSeq;
-
- /* A VTIMEZONE component, represented as an iCalendar string. */
- typedef string CalTimezoneObj;
-
- /* A unique identifier for a VTIMEZONE component, i.e. its TZID. */
- typedef string CalTimezoneObjUID;
-
- /* A unique identifier for an alarm subcomponent */
- typedef string CalAlarmUID;
-
- /* Flags for getting UID sequences */
- typedef long CalObjType;
- const CalObjType TYPE_EVENT = 1 << 0;
- const CalObjType TYPE_TODO = 1 << 1;
- const CalObjType TYPE_JOURNAL = 1 << 2;
- const CalObjType TYPE_ANY = 0x07;
-
- /* Flags for getting UID sequences */
- typedef long CalObjModType;
- const CalObjModType MOD_THIS = 1 << 0;
- const CalObjModType MOD_THISANDPRIOR = 1 << 1;
- const CalObjModType MOD_THISANDFUTURE = 1 << 2;
- const CalObjModType MOD_ALL = 0x07;
-
- /* Flags for getting URI sequences */
- typedef long CalMode;
- const CalMode MODE_LOCAL = 1 << 0;
- const CalMode MODE_REMOTE = 1 << 1;
- const CalMode MODE_ANY = 0x07;
-
- /* Types of object changes made */
- typedef long CalObjChangeType;
- const CalObjChangeType ADDED = 1 << 0;
- const CalObjChangeType MODIFIED = 1 << 1;
- const CalObjChangeType DELETED = 1 << 2;
-
- /* Used to store a time_t */
- typedef unsigned long Time_t;
-
- /* An instance of a calendar component that actually occurs. These are
- * "virtual" objects in that they are used to represent instances of
- * recurring events and alarms. "Real" objects just contain the
- * information required to figure out the times at which they recur or
- * trigger.
- */
- struct CalObjInstance {
- CalObjUID uid;
- Time_t start;
- Time_t end;
- };
-
- /* Used to transfer a list of component occurrences */
- typedef sequence<CalObjInstance> CalObjInstanceSeq;
-
- /* An object change */
- struct CalObjChange {
- CalObj calobj;
- CalObjChangeType type;
- };
-
- /* Used to transfer a list of changed components */
- typedef sequence<CalObjChange> CalObjChangeSeq;
-
- /* Used to represent users and lists of users */
- typedef string User;
- typedef sequence<User> UserList;
-
- enum CallStatus {
- Success,
- RepositoryOffline,
- PermissionDenied,
- InvalidRange,
- ObjectNotFound,
- InvalidObject,
- CardIdAlreadyExists,
- AuthenticationFailed,
- AuthenticationRequired,
- UnsupportedField,
- UnsupportedMethod,
- UnsupportedAuthenticationMethod,
- TLSNotAvailable,
- NoSuchCal,
-
- /* These can be returned for successful searches, but
- indicate the result set was truncated */
- SearchSizeLimitExceeded,
- SearchTimeLimitExceeded,
-
- InvalidQuery,
- QueryRefused,
-
- CouldNotCancel,
-
- OtherError
- };
-
- interface Query;
-
- interface Listener;
-
- interface QueryListener;
-
- /* Calendar client interface */
- interface Cal : Bonobo::Unknown {
- exception NotFound {};
- exception InvalidRange {};
-
- /* A calendar is identified by its URI */
- readonly attribute string uri;
-
- oneway void open (in boolean only_if_exists);
- oneway void remove ();
-
- /* Check write permissions for calendar */
- oneway void isReadOnly ();
-
- /* Information on the backend's capabilities */
- oneway void getStaticCapabilities ();
-
- /* Return the cal address associated with this calendar, if any. */
- oneway void getCalAddress ();
-
- oneway void getAlarmEmailAddress ();
-
- /* Returns the LDAP attribute to get attendees from */
- oneway void getLdapAttribute ();
-
- /* For going online/offline */
- void setMode (in CalMode mode);
-
- /* Get a default object of the backend's type */
- oneway void getDefaultObject ();
-
- /* Gets a component based on its URI */
- oneway void getObject (in CalObjUID uid, in CalRecurID rid);
-
- oneway void getObjectList (in string query);
-
- /* Methods for manipulating timezones */
- oneway void getTimezone (in CalTimezoneObjUID tzid);
- oneway void addTimezone (in CalTimezoneObj tz);
- /* The timezone used to resolve DATE and floating DATE-TIME values. */
- oneway void setDefaultTimezone (in CalTimezoneObjUID tzid);
-
- /* Gets a list of components that changed */
- oneway void getChanges (in string change_id);
-
- /* Returns free/busy objects for the given interval */
- oneway void getFreeBusy (in UserList users, in Time_t start, in Time_t end);
-
- /* Discards an alarm from a given component */
- oneway void discardAlarm (in CalObjUID uid, in CalAlarmUID auid);
-
- /* Methods for manipulating iCalendar objects */
- oneway void createObject (in CalObj calobj);
- oneway void modifyObject (in CalObj calobj, in CalObjModType mod);
- oneway void removeObject (in CalObjUID uid, in CalRecurID rid, in CalObjModType mod);
-
- /* Methods for getting/sending iCalendar VCALENDARS via iTip/iMip */
- oneway void receiveObjects (in CalObj calobj);
- oneway void sendObjects (in CalObj calobj);
-
- /* Query methods */
- oneway void getQuery (in string sexp, in QueryListener ql);
- };
-
- /* Listener for changes in a calendar */
- interface Listener : Bonobo::Unknown {
- /* Return status when setting calendar mode */
- enum SetModeStatus {
- MODE_SET, /* All OK */
- MODE_NOT_SET, /* Generic error */
- MODE_NOT_SUPPORTED /* Mode not supported */
- };
-
- oneway void notifyReadOnly (in CallStatus status, in boolean read_only);
- oneway void notifyCalAddress (in CallStatus status, in string address);
- oneway void notifyAlarmEmailAddress (in CallStatus status, in string address);
- oneway void notifyLDAPAttribute (in CallStatus status, in string ldap_attribute);
- oneway void notifyStaticCapabilities (in CallStatus status, in string capabilities);
-
- oneway void notifyCalOpened (in CallStatus status);
- oneway void notifyCalRemoved (in CallStatus status);
-
- oneway void notifyObjectCreated (in CallStatus status, in string uid);
- oneway void notifyObjectModified (in CallStatus status);
- oneway void notifyObjectRemoved (in CallStatus status);
-
- oneway void notifyAlarmDiscarded (in CallStatus status);
-
- oneway void notifyObjectsReceived (in CallStatus status);
- oneway void notifyObjectsSent (in CallStatus status);
-
- oneway void notifyDefaultObjectRequested (in CallStatus status, in CalObj object);
- oneway void notifyObjectRequested (in CallStatus status, in CalObj object);
- oneway void notifyObjectListRequested (in CallStatus status, in stringlist objects);
- oneway void notifyQuery (in CallStatus status, in Query query);
-
- oneway void notifyTimezoneRequested (in CallStatus status, in CalTimezoneObj tz);
- oneway void notifyTimezoneAdded (in CallStatus status, in CalTimezoneObjUID tzid);
- oneway void notifyDefaultTimezoneSet (in CallStatus status);
-
- oneway void notifyChanges (in CallStatus status, in CalObjChangeSeq changes);
- oneway void notifyFreeBusy (in CallStatus status, in CalObjSeq freebusy);
-
- /* Called from a Calendar when the mode is changed */
- oneway void notifyCalSetMode (in SetModeStatus status, in CalMode mode);
-
- /* Called from a Calendar when the list of categories changes */
- oneway void notifyCategoriesChanged (in StringSeq categories);
-
- /* Called from a Calendar when there is an error not notified otherwise */
- oneway void notifyErrorOccurred (in string message);
- };
-
- /* Handle to a live query on a calendar */
- interface Query : Bonobo::Unknown {
- oneway void start ();
- };
-
- /* Listener for changes in a query of a calendar */
- interface QueryListener : Bonobo::Unknown {
- oneway void notifyObjectsAdded (in stringlist objects);
- oneway void notifyObjectsModified (in stringlist objects);
- oneway void notifyObjectsRemoved (in CalObjUIDSeq uids);
- oneway void notifyQueryProgress (in string message, in short percent);
- oneway void notifyQueryDone (in CallStatus status);
- };
-
- /* A calendar factory, can load and create calendars */
- interface CalFactory : Bonobo::Unknown {
- exception NilListener {};
- exception InvalidURI {};
- exception UnsupportedMethod {};
-
- Cal getCal (in string uri, in CalObjType type, in Listener listener)
- raises (NilListener, InvalidURI, UnsupportedMethod);
- };
-
/* Interface to the alarm notification service */
interface AlarmNotify : Bonobo::Unknown {
exception InvalidURI {};
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);
diff --git a/calendar/pcs/.cvsignore b/calendar/pcs/.cvsignore
deleted file mode 100644
index ac51a554db..0000000000
--- a/calendar/pcs/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-.pure
-*.la
-*.lo
-evolution-calendar-stubs.c
-evolution-calendar-skels.c
-evolution-calendar-common.c
-evolution-calendar.h
diff --git a/calendar/pcs/Makefile.am b/calendar/pcs/Makefile.am
deleted file mode 100644
index 0e47694cee..0000000000
--- a/calendar/pcs/Makefile.am
+++ /dev/null
@@ -1,92 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"wombat-pcs\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/calendar \
- -I$(top_builddir)/calendar \
- -I$(top_srcdir)/libical/src \
- -I$(top_builddir)/libical/src \
- -I$(top_srcdir)/libwombat \
- -I$(top_builddir)/libwombat \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-AM_CFLAGS = \
- -DGTK_DISABLE_DEPRECATED=1 \
- -DGDK_DISABLE_DEPRECATED=1 \
- -DG_DISABLE_DEPRECATED=1 \
- -DGNOME_DISABLE_DEPRECATED=1
-
-CORBA_GENERATED_H = \
- evolution-calendar.h
-
-CORBA_GENERATED_C = \
- evolution-calendar-common.c \
- evolution-calendar-skels.c \
- evolution-calendar-stubs.c
-
-CORBA_GENERATED = $(CORBA_GENERATED_H) $(CORBA_GENERATED_C)
-
-idls = \
- $(srcdir)/../idl/evolution-calendar.idl
-
-idl_flags = -I $(srcdir) $(IDL_INCLUDES)
-
-$(CORBA_GENERATED_H): $(idls)
- $(ORBIT_IDL) $(idl_flags) $(srcdir)/../idl/evolution-calendar.idl
-
-$(CORBA_GENERATED_C): $(CORBA_GENERATED_H)
-
-pcsincludedir = $(privincludedir)/pcs
-
-privlib_LTLIBRARIES = libpcs.la
-noinst_LTLIBRARIES = libpcsfile.la libpcshttp.la
-
-pcsinclude_HEADERS = \
- $(CORBA_GENERATED_H) \
- cal.h \
- cal-backend.h \
- cal-backend-sync.h \
- cal-backend-util.h \
- cal-backend-object-sexp.h\
- cal-common.h \
- cal-factory.h \
- query.h
-
-libpcs_la_SOURCES = \
- $(pcsinclude_HEADERS) \
- $(CORBA_GENERATED_C) \
- cal.c \
- cal-backend.c \
- cal-backend-sync.c \
- cal-backend-util.c \
- cal-backend-object-sexp.c\
- cal-factory.c \
- query.c
-
-libpcs_la_LIBADD = \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/e-util/libeutil.la
-
-libpcsfile_la_SOURCES = \
- cal-backend-file-events.c\
- cal-backend-file-events.h\
- cal-backend-file-todos.c\
- cal-backend-file-todos.h\
- cal-backend-file.c \
- cal-backend-file.h
-
-libpcsfile_la_LIBADD = \
- libpcs.la
-
-libpcshttp_la_SOURCES = \
- cal-backend-http.c \
- cal-backend-http.h
-
-libpcshttp_la_LIBADD = \
- libpcs.la
-
-BUILT_SOURCES = $(CORBA_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
diff --git a/calendar/pcs/cal-backend-file-events.c b/calendar/pcs/cal-backend-file-events.c
deleted file mode 100644
index a7cf56fac6..0000000000
--- a/calendar/pcs/cal-backend-file-events.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <unistd.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include "e-util/e-xml-hash-utils.h"
-#include "cal-util/cal-recur.h"
-#include "cal-util/cal-util.h"
-#include "cal-backend-file-events.h"
-#include "cal-backend-util.h"
-
-
-
-/* Private part of the CalBackendFileEvents structure */
-struct _CalBackendFileEventsPrivate {
-};
-
-
-
-static void cal_backend_file_events_class_init (CalBackendFileEventsClass *class);
-static void cal_backend_file_events_init (CalBackendFileEvents *cbfile, CalBackendFileEventsClass *class);
-static void cal_backend_file_events_dispose (GObject *object);
-static void cal_backend_file_events_finalize (GObject *object);
-
-static GObjectClass *parent_class;
-
-
-
-/**
- * cal_backend_file_events_get_type:
- * @void:
- *
- * Registers the #CalBackendFileEvents class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalBackendFileEvents class.
- **/
-GType
-cal_backend_file_events_get_type (void)
-{
- static GType cal_backend_file_events_type = 0;
-
- if (!cal_backend_file_events_type) {
- static GTypeInfo info = {
- sizeof (CalBackendFileEventsClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_file_events_class_init,
- NULL, NULL,
- sizeof (CalBackendFileEvents),
- 0,
- (GInstanceInitFunc) cal_backend_file_events_init
- };
- cal_backend_file_events_type = g_type_register_static (CAL_BACKEND_FILE_TYPE,
- "CalBackendFileEvents", &info, 0);
- }
-
- return cal_backend_file_events_type;
-}
-
-/* Class initialization function for the file backend */
-static void
-cal_backend_file_events_class_init (CalBackendFileEventsClass *klass)
-{
- GObjectClass *object_class;
- CalBackendClass *backend_class;
-
- object_class = G_OBJECT_CLASS (klass);
- backend_class = CAL_BACKEND_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = cal_backend_file_events_dispose;
- object_class->finalize = cal_backend_file_events_finalize;
-
-// backend_class->get_uri = cal_backend_file_events_get_uri;
-}
-
-/* Object initialization function for the file backend */
-static void
-cal_backend_file_events_init (CalBackendFileEvents *cbfile, CalBackendFileEventsClass *class)
-{
- CalBackendFileEventsPrivate *priv;
-
- priv = g_new0 (CalBackendFileEventsPrivate, 1);
- cbfile->priv = priv;
-
- cal_backend_file_set_file_name (CAL_BACKEND_FILE (cbfile), "calendar.ics");
-}
-
-/* Dispose handler for the file backend */
-static void
-cal_backend_file_events_dispose (GObject *object)
-{
- CalBackendFileEvents *cbfile;
- CalBackendFileEventsPrivate *priv;
-
- cbfile = CAL_BACKEND_FILE_EVENTS (object);
- priv = cbfile->priv;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the file backend */
-static void
-cal_backend_file_events_finalize (GObject *object)
-{
- CalBackendFileEvents *cbfile;
- CalBackendFileEventsPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE_EVENTS (object));
-
- cbfile = CAL_BACKEND_FILE_EVENTS (object);
- priv = cbfile->priv;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
diff --git a/calendar/pcs/cal-backend-file-events.h b/calendar/pcs/cal-backend-file-events.h
deleted file mode 100644
index 3f812b3e09..0000000000
--- a/calendar/pcs/cal-backend-file-events.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_FILE_EVENTS_H
-#define CAL_BACKEND_FILE_EVENTS_H
-
-#include "cal-backend-file.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_BACKEND_FILE_EVENTS_TYPE (cal_backend_file_events_get_type ())
-#define CAL_BACKEND_FILE_EVENTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_FILE_EVENTS_TYPE, \
- CalBackendFileEvents))
-#define CAL_BACKEND_FILE_EVENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_FILE_EVENTS_TYPE, \
- CalBackendFileEventsClass))
-#define IS_CAL_BACKEND_FILE_EVENTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_FILE_EVENTS_TYPE))
-#define IS_CAL_BACKEND_FILE_EVENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_FILE_EVENTS_TYPE))
-
-typedef struct _CalBackendFileEvents CalBackendFileEvents;
-typedef struct _CalBackendFileEventsClass CalBackendFileEventsClass;
-
-typedef struct _CalBackendFileEventsPrivate CalBackendFileEventsPrivate;
-
-struct _CalBackendFileEvents {
- CalBackendFile backend;
-
- /* Private data */
- CalBackendFileEventsPrivate *priv;
-};
-
-struct _CalBackendFileEventsClass {
- CalBackendFileClass parent_class;
-};
-
-GType cal_backend_file_events_get_type (void);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-backend-file-todos.c b/calendar/pcs/cal-backend-file-todos.c
deleted file mode 100644
index 6f56dd1776..0000000000
--- a/calendar/pcs/cal-backend-file-todos.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Evolution calendar - iCalendar file backend for tasks
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <libgnome/gnome-i18n.h>
-#include "cal-backend-file-todos.h"
-
-
-
-/* Private part of the CalBackendFileTodos structure */
-struct _CalBackendFileTodosPrivate {
-};
-
-
-
-static void cal_backend_file_todos_class_init (CalBackendFileTodosClass *class);
-static void cal_backend_file_todos_init (CalBackendFileTodos *cbfile, CalBackendFileTodosClass *class);
-static void cal_backend_file_todos_dispose (GObject *object);
-static void cal_backend_file_todos_finalize (GObject *object);
-
-static CalBackendFileClass *parent_class;
-
-
-
-/**
- * cal_backend_file_todos_get_type:
- * @void:
- *
- * Registers the #CalBackendFileTodos class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalBackendFileTodos class.
- **/
-GType
-cal_backend_file_todos_get_type (void)
-{
- static GType cal_backend_file_todos_type = 0;
-
- if (!cal_backend_file_todos_type) {
- static GTypeInfo info = {
- sizeof (CalBackendFileTodosClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_file_todos_class_init,
- NULL, NULL,
- sizeof (CalBackendFileTodos),
- 0,
- (GInstanceInitFunc) cal_backend_file_todos_init
- };
- cal_backend_file_todos_type = g_type_register_static (CAL_BACKEND_FILE_TYPE,
- "CalBackendFileTodos", &info, 0);
- }
-
- return cal_backend_file_todos_type;
-}
-
-/* Class initialization function for the file backend */
-static void
-cal_backend_file_todos_class_init (CalBackendFileTodosClass *klass)
-{
- GObjectClass *object_class;
- CalBackendClass *backend_class;
-
- object_class = G_OBJECT_CLASS (klass);
- backend_class = CAL_BACKEND_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = cal_backend_file_todos_dispose;
- object_class->finalize = cal_backend_file_todos_finalize;
-
-// backend_class->get_uri = cal_backend_file_todos_get_uri;
-}
-
-/* Object initialization function for the file backend */
-static void
-cal_backend_file_todos_init (CalBackendFileTodos *cbfile, CalBackendFileTodosClass *class)
-{
- CalBackendFileTodosPrivate *priv;
-
- priv = g_new0 (CalBackendFileTodosPrivate, 1);
- cbfile->priv = priv;
-
- cal_backend_file_set_file_name (CAL_BACKEND_FILE (cbfile), "tasks.ics");
-}
-
-/* Dispose handler for the file backend */
-static void
-cal_backend_file_todos_dispose (GObject *object)
-{
- CalBackendFileTodos *cbfile;
- CalBackendFileTodosPrivate *priv;
-
- cbfile = CAL_BACKEND_FILE_TODOS (object);
- priv = cbfile->priv;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the file backend */
-static void
-cal_backend_file_todos_finalize (GObject *object)
-{
- CalBackendFileTodos *cbfile;
- CalBackendFileTodosPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE_TODOS (object));
-
- cbfile = CAL_BACKEND_FILE_TODOS (object);
- priv = cbfile->priv;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
diff --git a/calendar/pcs/cal-backend-file-todos.h b/calendar/pcs/cal-backend-file-todos.h
deleted file mode 100644
index 7f17122673..0000000000
--- a/calendar/pcs/cal-backend-file-todos.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_FILE_TODOS_H
-#define CAL_BACKEND_FILE_TODOS_H
-
-#include "cal-backend-file.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_BACKEND_FILE_TODOS_TYPE (cal_backend_file_todos_get_type ())
-#define CAL_BACKEND_FILE_TODOS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_FILE_TODOS_TYPE, \
- CalBackendFileTodos))
-#define CAL_BACKEND_FILE_TODOS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_FILE_TODOS_TYPE, \
- CalBackendFileTodosClass))
-#define IS_CAL_BACKEND_FILE_TODOS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_FILE_TODOS_TYPE))
-#define IS_CAL_BACKEND_FILE_TODOS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_FILE_TODOS_TYPE))
-
-typedef struct _CalBackendFileTodos CalBackendFileTodos;
-typedef struct _CalBackendFileTodosClass CalBackendFileTodosClass;
-
-typedef struct _CalBackendFileTodosPrivate CalBackendFileTodosPrivate;
-
-struct _CalBackendFileTodos {
- CalBackendFile backend;
-
- /* Private data */
- CalBackendFileTodosPrivate *priv;
-};
-
-struct _CalBackendFileTodosClass {
- CalBackendFileClass parent_class;
-};
-
-GType cal_backend_file_todos_get_type (void);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
deleted file mode 100644
index a3cd2c360f..0000000000
--- a/calendar/pcs/cal-backend-file.c
+++ /dev/null
@@ -1,1988 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000-2003 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <unistd.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include "e-util/e-xml-hash-utils.h"
-#include "cal-util/cal-recur.h"
-#include "cal-util/cal-util.h"
-#include "cal-backend-file-events.h"
-#include "cal-backend-util.h"
-#include "cal-backend-object-sexp.h"
-
-
-
-/* Placeholder for each component and its recurrences */
-typedef struct {
- CalComponent *full_object;
- GHashTable *recurrences;
-} CalBackendFileObject;
-
-/* Private part of the CalBackendFile structure */
-struct _CalBackendFilePrivate {
- /* URI where the calendar data is stored */
- char *uri;
-
- /* Filename in the dir */
- char *file_name;
- gboolean read_only;
-
- /* Toplevel VCALENDAR component */
- icalcomponent *icalcomp;
-
- /* All the objects in the calendar, hashed by UID. The
- * hash key *is* the uid returned by cal_component_get_uid(); it is not
- * copied, so don't free it when you remove an object from the hash
- * table. Each item in the hash table is a CalBackendFileObject.
- */
- GHashTable *comp_uid_hash;
-
- GList *comp;
-
- /* Config database handle for free/busy organizer information */
- EConfigListener *config_listener;
-
- /* The calendar's default timezone, used for resolving DATE and
- floating DATE-TIME values. */
- icaltimezone *default_zone;
-
- /* The list of live queries */
- GList *queries;
-};
-
-
-
-static void cal_backend_file_dispose (GObject *object);
-static void cal_backend_file_finalize (GObject *object);
-
-static CalBackendSyncClass *parent_class;
-
-
-
-/* g_hash_table_foreach() callback to destroy recurrences in the hash table */
-static void
-free_recurrence (gpointer key, gpointer value, gpointer data)
-{
- char *rid = key;
- CalComponent *comp = value;
-
- g_free (rid);
- g_object_unref (comp);
-}
-
-/* g_hash_table_foreach() callback to destroy a CalBackendFileObject */
-static void
-free_object (gpointer key, gpointer value, gpointer data)
-{
- CalBackendFileObject *obj_data = value;
-
- g_object_unref (obj_data->full_object);
- g_hash_table_foreach (obj_data->recurrences, (GHFunc) free_recurrence, NULL);
- g_hash_table_destroy (obj_data->recurrences);
-}
-
-/* Saves the calendar data */
-static void
-save (CalBackendFile *cbfile)
-{
- CalBackendFilePrivate *priv;
- GnomeVFSURI *uri, *backup_uri;
- GnomeVFSHandle *handle = NULL;
- GnomeVFSResult result = GNOME_VFS_ERROR_BAD_FILE;
- GnomeVFSFileSize out;
- gchar *tmp, *backup_uristr;
- char *buf;
-
- priv = cbfile->priv;
- g_assert (priv->uri != NULL);
- g_assert (priv->icalcomp != NULL);
-
- uri = gnome_vfs_uri_new (priv->uri);
- if (!uri)
- goto error_malformed_uri;
-
- /* save calendar to backup file */
- tmp = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- if (!tmp) {
- gnome_vfs_uri_unref (uri);
- goto error_malformed_uri;
- }
-
- backup_uristr = g_strconcat (tmp, "~", NULL);
- backup_uri = gnome_vfs_uri_new (backup_uristr);
-
- g_free (tmp);
- g_free (backup_uristr);
-
- if (!backup_uri) {
- gnome_vfs_uri_unref (uri);
- goto error_malformed_uri;
- }
-
- result = gnome_vfs_create_uri (&handle, backup_uri,
- GNOME_VFS_OPEN_WRITE,
- FALSE, 0666);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_uri_unref (uri);
- gnome_vfs_uri_unref (backup_uri);
- goto error;
- }
-
- buf = icalcomponent_as_ical_string (priv->icalcomp);
- result = gnome_vfs_write (handle, buf, strlen (buf) * sizeof (char), &out);
- gnome_vfs_close (handle);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_uri_unref (uri);
- gnome_vfs_uri_unref (backup_uri);
- goto error;
- }
-
- /* now copy the temporary file to the real file */
- result = gnome_vfs_move_uri (backup_uri, uri, TRUE);
-
- gnome_vfs_uri_unref (uri);
- gnome_vfs_uri_unref (backup_uri);
- if (result != GNOME_VFS_OK)
- goto error;
-
- return;
-
- error_malformed_uri:
- cal_backend_notify_error (CAL_BACKEND (cbfile),
- _("Can't save calendar data: Malformed URI."));
- return;
-
- error:
- cal_backend_notify_error (CAL_BACKEND (cbfile), gnome_vfs_result_to_string (result));
- return;
-}
-
-/* Dispose handler for the file backend */
-static void
-cal_backend_file_dispose (GObject *object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = CAL_BACKEND_FILE (object);
- priv = cbfile->priv;
-
- /* Save if necessary */
-
- if (priv->comp_uid_hash) {
- g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) free_object, NULL);
- g_hash_table_destroy (priv->comp_uid_hash);
- priv->comp_uid_hash = NULL;
- }
-
- g_list_free (priv->comp);
- priv->comp = NULL;
-
- if (priv->icalcomp) {
- icalcomponent_free (priv->icalcomp);
- priv->icalcomp = NULL;
- }
-
- if (priv->config_listener) {
- g_object_unref (priv->config_listener);
- priv->config_listener = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the file backend */
-static void
-cal_backend_file_finalize (GObject *object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE (object));
-
- cbfile = CAL_BACKEND_FILE (object);
- priv = cbfile->priv;
-
- /* Clean up */
-
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
- g_free (priv);
- cbfile->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-
-/* Looks up a component by its UID on the backend's component hash table */
-static CalComponent *
-lookup_component (CalBackendFile *cbfile, const char *uid)
-{
- CalBackendFilePrivate *priv;
- CalBackendFileObject *obj_data;
-
- priv = cbfile->priv;
-
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- return obj_data ? obj_data->full_object : NULL;
-}
-
-
-
-/* Calendar backend methods */
-
-/* Is_read_only handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_is_read_only (CalBackendSync *backend, Cal *cal, gboolean *read_only)
-{
- CalBackendFile *cbfile = (CalBackendFile *) backend;
-
- *read_only = cbfile->priv->read_only;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_email_address handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_cal_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- /* A file backend has no particular email address associated
- * with it (although that would be a useful feature some day).
- */
- *address = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_get_ldap_attribute (CalBackendSync *backend, Cal *cal, char **attribute)
-{
- *attribute = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_get_alarm_email_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- /* A file backend has no particular email address associated
- * with it (although that would be a useful feature some day).
- */
- *address = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_get_static_capabilities (CalBackendSync *backend, Cal *cal, char **capabilities)
-{
- *capabilities = CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* function to resolve timezones */
-static icaltimezone *
-resolve_tzid (const char *tzid, gpointer user_data)
-{
- icalcomponent *vcalendar_comp = user_data;
-
- if (!tzid || !tzid[0])
- return NULL;
- else if (!strcmp (tzid, "UTC"))
- return icaltimezone_get_utc_timezone ();
-
- return icalcomponent_get_timezone (vcalendar_comp, tzid);
-}
-
-/* Checks if the specified component has a duplicated UID and if so changes it */
-static void
-check_dup_uid (CalBackendFile *cbfile, CalComponent *comp)
-{
- CalBackendFilePrivate *priv;
- CalBackendFileObject *obj_data;
- const char *uid;
- char *new_uid;
-
- priv = cbfile->priv;
-
- cal_component_get_uid (comp, &uid);
-
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (!obj_data)
- return; /* Everything is fine */
-
- g_message ("check_dup_uid(): Got object with duplicated UID `%s', changing it...", uid);
-
- new_uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, new_uid);
- g_free (new_uid);
-
- /* FIXME: I think we need to reset the SEQUENCE property and reset the
- * CREATED/DTSTAMP/LAST-MODIFIED.
- */
-
- save (cbfile);
-}
-
-static const char *
-get_rid_string (CalComponent *comp)
-{
- CalComponentRange range;
- struct icaltimetype tt;
-
- cal_component_get_recurid (comp, &range);
- if (!range.datetime.value)
- return "0";
- tt = *range.datetime.value;
- cal_component_free_range (&range);
-
- return icaltime_is_valid_time (tt) && !icaltime_is_null_time (tt) ?
- icaltime_as_ical_string (tt) : "0";
-}
-
-static struct icaltimetype
-get_rid_icaltime (CalComponent *comp)
-{
- CalComponentRange range;
- struct icaltimetype tt;
-
- cal_component_get_recurid (comp, &range);
- if (!range.datetime.value)
- return icaltime_null_time ();
- tt = *range.datetime.value;
- cal_component_free_range (&range);
-
- return tt;
-}
-
-/* Tries to add an icalcomponent to the file backend. We only store the objects
- * of the types we support; all others just remain in the toplevel component so
- * that we don't lose them.
- */
-static void
-add_component (CalBackendFile *cbfile, CalComponent *comp, gboolean add_to_toplevel)
-{
- CalBackendFilePrivate *priv;
- CalBackendFileObject *obj_data;
- const char *uid;
- GSList *categories;
-
- priv = cbfile->priv;
-
- if (cal_component_is_instance (comp)) { /* FIXME: more checks needed, to detect detached instances */
- const char *rid;
-
- cal_component_get_uid (comp, &uid);
-
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (!obj_data) {
- g_warning (G_STRLOC ": Got an instance of a non-existing component");
- return;
- }
-
- rid = get_rid_string (comp);
- if (g_hash_table_lookup (obj_data->recurrences, rid)) {
- g_warning (G_STRLOC ": Tried to adding an already existing recurrence");
- return;
- }
-
- g_hash_table_insert (obj_data->recurrences, g_strdup (rid), comp);
- } else {
- /* Ensure that the UID is unique; some broken implementations spit
- * components with duplicated UIDs.
- */
- check_dup_uid (cbfile, comp);
- cal_component_get_uid (comp, &uid);
-
- obj_data = g_new0 (CalBackendFileObject, 1);
- obj_data->full_object = comp;
- obj_data->recurrences = g_hash_table_new (g_str_hash, g_str_equal);
-
- g_hash_table_insert (priv->comp_uid_hash, (gpointer) uid, obj_data);
- }
-
- priv->comp = g_list_prepend (priv->comp, comp);
-
- /* Put the object in the toplevel component if required */
-
- if (add_to_toplevel) {
- icalcomponent *icalcomp;
-
- icalcomp = cal_component_get_icalcomponent (comp);
- g_assert (icalcomp != NULL);
-
- icalcomponent_add_component (priv->icalcomp, icalcomp);
- }
-
- /* Update the set of categories */
- cal_component_get_categories_list (comp, &categories);
- cal_backend_ref_categories (CAL_BACKEND (cbfile), categories);
- cal_component_free_categories_list (categories);
-}
-
-/* g_hash_table_foreach() callback to remove recurrences from the calendar */
-static void
-remove_recurrence_cb (gpointer key, gpointer value, gpointer data)
-{
- GList *l;
- GSList *categories;
- icalcomponent *icalcomp;
- CalBackendFilePrivate *priv;
- CalComponent *comp = value;
- CalBackendFile *cbfile = data;
-
- priv = cbfile->priv;
-
- /* remove the recurrence from the top-level calendar */
- icalcomp = cal_component_get_icalcomponent (comp);
- g_assert (icalcomp != NULL);
-
- icalcomponent_remove_component (priv->icalcomp, icalcomp);
-
- /* remove it from our mapping */
- l = g_list_find (priv->comp, comp);
- priv->comp = g_list_delete_link (priv->comp, l);
-
- /* update the set of categories */
- cal_component_get_categories_list (comp, &categories);
- cal_backend_unref_categories (CAL_BACKEND (cbfile), categories);
- cal_component_free_categories_list (categories);
-}
-
-/* Removes a component from the backend's hash and lists. Does not perform
- * notification on the clients. Also removes the component from the toplevel
- * icalcomponent.
- */
-static void
-remove_component (CalBackendFile *cbfile, CalComponent *comp)
-{
- CalBackendFilePrivate *priv;
- icalcomponent *icalcomp;
- const char *uid;
- GList *l;
- GSList *categories;
- CalBackendFileObject *obj_data;
-
- priv = cbfile->priv;
-
- /* Remove the icalcomp from the toplevel */
-
- icalcomp = cal_component_get_icalcomponent (comp);
- g_assert (icalcomp != NULL);
-
- icalcomponent_remove_component (priv->icalcomp, icalcomp);
-
- /* Remove it from our mapping */
-
- cal_component_get_uid (comp, &uid);
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (!obj_data)
- return;
-
- g_hash_table_remove (priv->comp_uid_hash, uid);
-
- l = g_list_find (priv->comp, comp);
- g_assert (l != NULL);
- priv->comp = g_list_delete_link (priv->comp, l);
-
- /* remove the recurrences also */
- g_hash_table_foreach (obj_data->recurrences, (GHFunc) remove_recurrence_cb, cbfile);
-
- /* Update the set of categories */
- cal_component_get_categories_list (comp, &categories);
- cal_backend_unref_categories (CAL_BACKEND (cbfile), categories);
- cal_component_free_categories_list (categories);
-
- free_object ((gpointer) uid, (gpointer) obj_data, NULL);
-}
-
-/* Scans the toplevel VCALENDAR component and stores the objects it finds */
-static void
-scan_vcalendar (CalBackendFile *cbfile)
-{
- CalBackendFilePrivate *priv;
- icalcompiter iter;
-
- priv = cbfile->priv;
- g_assert (priv->icalcomp != NULL);
- g_assert (priv->comp_uid_hash != NULL);
-
- for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_ANY_COMPONENT);
- icalcompiter_deref (&iter) != NULL;
- icalcompiter_next (&iter)) {
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- CalComponent *comp;
-
- icalcomp = icalcompiter_deref (&iter);
-
- kind = icalcomponent_isa (icalcomp);
-
- if (!(kind == ICAL_VEVENT_COMPONENT
- || kind == ICAL_VTODO_COMPONENT
- || kind == ICAL_VJOURNAL_COMPONENT))
- continue;
-
- comp = cal_component_new ();
-
- if (!cal_component_set_icalcomponent (comp, icalcomp))
- continue;
-
- add_component (cbfile, comp, FALSE);
- }
-}
-
-/* Parses an open iCalendar file and loads it into the backend */
-static CalBackendSyncStatus
-open_cal (CalBackendFile *cbfile, const char *uristr)
-{
- CalBackendFilePrivate *priv;
- icalcomponent *icalcomp;
-
- priv = cbfile->priv;
-
- icalcomp = cal_util_parse_ics_file (uristr);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_OtherError;
-
- /* FIXME: should we try to demangle XROOT components and
- * individual components as well?
- */
-
- if (icalcomponent_isa (icalcomp) != ICAL_VCALENDAR_COMPONENT) {
- icalcomponent_free (icalcomp);
-
- return GNOME_Evolution_Calendar_OtherError;
- }
-
- priv->icalcomp = icalcomp;
-
- priv->comp_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
- scan_vcalendar (cbfile);
-
- priv->uri = g_strdup (uristr);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-create_cal (CalBackendFile *cbfile, const char *uristr)
-{
- CalBackendFilePrivate *priv;
-
- priv = cbfile->priv;
-
- /* Create the new calendar information */
- priv->icalcomp = cal_util_new_top_level ();
-
- /* Create our internal data */
- priv->comp_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- priv->uri = g_strdup (uristr);
-
- save (cbfile);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static char *
-get_uri_string (CalBackend *backend)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- const char *master_uri;
- char *full_uri, *str_uri;
- GnomeVFSURI *uri;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- master_uri = cal_backend_get_uri (backend);
- g_message (G_STRLOC ": Trying to open %s", master_uri);
-
- /* FIXME Check the error conditions a little more elegantly here */
- if (g_strrstr ("tasks.ics", master_uri) || g_strrstr ("calendar.ics", master_uri)) {
- g_warning (G_STRLOC ": Existing file name %s", master_uri);
-
- return NULL;
- }
-
- full_uri = g_strdup_printf ("%s%s%s", master_uri, G_DIR_SEPARATOR_S, priv->file_name);
- uri = gnome_vfs_uri_new (full_uri);
- g_free (full_uri);
-
- if (!uri)
- return NULL;
-
- str_uri = gnome_vfs_uri_to_string (uri,
- (GNOME_VFS_URI_HIDE_USER_NAME
- | GNOME_VFS_URI_HIDE_PASSWORD
- | GNOME_VFS_URI_HIDE_HOST_NAME
- | GNOME_VFS_URI_HIDE_HOST_PORT
- | GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD));
- gnome_vfs_uri_unref (uri);
-
- if (!str_uri || !strlen (str_uri)) {
- g_free (str_uri);
-
- return NULL;
- }
-
- return str_uri;
-}
-
-/* Open handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_open (CalBackendSync *backend, Cal *cal, gboolean only_if_exists)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- char *str_uri;
- CalBackendSyncStatus status;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- /* Claim a succesful open if we are already open */
- if (priv->uri && priv->comp_uid_hash)
- return GNOME_Evolution_Calendar_Success;
-
- str_uri = get_uri_string (CAL_BACKEND (backend));
- if (!str_uri)
- return GNOME_Evolution_Calendar_OtherError;
-
- if (access (str_uri, R_OK) == 0) {
- status = open_cal (cbfile, str_uri);
- if (access (str_uri, W_OK) != 0)
- priv->read_only = TRUE;
- } else {
- if (only_if_exists)
- status = GNOME_Evolution_Calendar_NoSuchCal;
- else
- status = create_cal (cbfile, str_uri);
- }
-
- g_free (str_uri);
-
- return status;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_remove (CalBackendSync *backend, Cal *cal)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- char *str_uri;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- str_uri = get_uri_string (CAL_BACKEND (backend));
- if (!str_uri)
- return GNOME_Evolution_Calendar_OtherError;
-
- if (access (str_uri, W_OK) != 0) {
- g_free (str_uri);
-
- return GNOME_Evolution_Calendar_PermissionDenied;
- }
-
- /* FIXME Remove backup file and whole directory too? */
- if (unlink (str_uri) != 0) {
- g_free (str_uri);
-
- return GNOME_Evolution_Calendar_OtherError;
- }
-
- g_free (str_uri);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* is_loaded handler for the file backend */
-static gboolean
-cal_backend_file_is_loaded (CalBackend *backend)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- return (priv->icalcomp != NULL);
-}
-
-/* is_remote handler for the file backend */
-static CalMode
-cal_backend_file_get_mode (CalBackend *backend)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- return CAL_MODE_LOCAL;
-}
-
-/* Set_mode handler for the file backend */
-static void
-cal_backend_file_set_mode (CalBackend *backend, CalMode mode)
-{
- cal_backend_notify_mode (backend,
- GNOME_Evolution_Calendar_Listener_MODE_NOT_SUPPORTED,
- GNOME_Evolution_Calendar_MODE_LOCAL);
-
-}
-
-static CalBackendSyncStatus
-cal_backend_file_get_default_object (CalBackendSync *backend, Cal *cal, char **object)
-{
- CalComponent *comp;
-
- comp = cal_component_new ();
-
- switch (cal_backend_get_kind (CAL_BACKEND (backend))) {
- case ICAL_VEVENT_COMPONENT:
- cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
- break;
- case ICAL_VTODO_COMPONENT:
- cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
- break;
- case ICAL_VJOURNAL_COMPONENT:
- cal_component_set_new_vtype (comp, CAL_COMPONENT_JOURNAL);
- break;
- default:
- g_object_unref (comp);
- return GNOME_Evolution_Calendar_ObjectNotFound;
- }
-
- *object = cal_component_get_as_string (comp);
- g_object_unref (comp);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_object_component handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_object (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, char **object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- CalBackendFileObject *obj_data;
- CalComponent *comp = NULL;
- gboolean free_comp = FALSE;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_InvalidObject);
- g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
- g_assert (priv->comp_uid_hash != NULL);
-
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (!obj_data)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- if (rid && *rid) {
- comp = g_hash_table_lookup (obj_data->recurrences, rid);
- if (!comp) {
- icalcomponent *icalcomp;
- struct icaltimetype itt;
-
- itt = icaltime_from_string (rid);
- icalcomp = cal_util_construct_instance (
- cal_component_get_icalcomponent (obj_data->full_object),
- itt);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- comp = cal_component_new ();
- free_comp = TRUE;
- cal_component_set_icalcomponent (comp, icalcomp);
- }
- } else
- comp = obj_data->full_object;
-
- if (!comp)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- *object = cal_component_get_as_string (comp);
-
- if (free_comp)
- g_object_unref (comp);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_timezone_object handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_timezone (CalBackendSync *backend, Cal *cal, const char *tzid, char **object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icaltimezone *zone;
- icalcomponent *icalcomp;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (tzid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- if (!strcmp (tzid, "UTC")) {
- zone = icaltimezone_get_utc_timezone ();
- } else {
- zone = icalcomponent_get_timezone (priv->icalcomp, tzid);
- if (!zone) {
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (!zone)
- return GNOME_Evolution_Calendar_ObjectNotFound;
- }
- }
-
- icalcomp = icaltimezone_get_component (zone);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Add_timezone handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_add_timezone (CalBackendSync *backend, Cal *cal, const char *tzobj)
-{
- icalcomponent *tz_comp;
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = (CalBackendFile *) backend;
-
- g_return_val_if_fail (IS_CAL_BACKEND_FILE (cbfile), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (tzobj != NULL, GNOME_Evolution_Calendar_OtherError);
-
- priv = cbfile->priv;
-
- tz_comp = icalparser_parse_string (tzobj);
- if (!tz_comp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- if (icalcomponent_isa (tz_comp) == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, tz_comp);
- if (!icalcomponent_get_timezone (priv->icalcomp,
- icaltimezone_get_tzid (zone))) {
- icalcomponent_add_component (priv->icalcomp, tz_comp);
- save (cbfile);
- }
-
- icaltimezone_free (zone, 1);
- }
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-
-static CalBackendSyncStatus
-cal_backend_file_set_default_timezone (CalBackendSync *backend, Cal *cal, const char *tzid)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icaltimezone *zone;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
-
- /* Look up the VTIMEZONE in our icalcomponent. */
- zone = icalcomponent_get_timezone (priv->icalcomp, tzid);
- if (!zone)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- /* Set the default timezone to it. */
- priv->default_zone = zone;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-typedef struct {
- GList *obj_list;
- gboolean search_needed;
- const char *query;
- CalBackendObjectSExp *obj_sexp;
- CalBackend *backend;
- icaltimezone *default_zone;
-} MatchObjectData;
-
-static void
-match_recurrence_sexp (gpointer key, gpointer value, gpointer data)
-{
- CalComponent *comp = value;
- MatchObjectData *match_data = data;
-
- if ((!match_data->search_needed) ||
- (cal_backend_object_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
- match_data->obj_list = g_list_append (match_data->obj_list,
- cal_component_get_as_string (comp));
- }
-}
-
-static void
-match_object_sexp (gpointer key, gpointer value, gpointer data)
-{
- CalBackendFileObject *obj_data = value;
- MatchObjectData *match_data = data;
-
- if ((!match_data->search_needed) ||
- (cal_backend_object_sexp_match_comp (match_data->obj_sexp, obj_data->full_object, match_data->backend))) {
- match_data->obj_list = g_list_append (match_data->obj_list,
- cal_component_get_as_string (obj_data->full_object));
-
- /* match also recurrences */
- g_hash_table_foreach (obj_data->recurrences,
- (GHFunc) match_recurrence_sexp,
- match_data);
- }
-}
-
-/* Get_objects_in_range handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_object_list (CalBackendSync *backend, Cal *cal, const char *sexp, GList **objects)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- MatchObjectData match_data;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_message (G_STRLOC ": Getting object list (%s)", sexp);
-
- match_data.search_needed = TRUE;
- match_data.query = sexp;
- match_data.obj_list = NULL;
- match_data.backend = CAL_BACKEND (backend);
- match_data.default_zone = priv->default_zone;
-
- if (!strcmp (sexp, "#t"))
- match_data.search_needed = FALSE;
-
- match_data.obj_sexp = cal_backend_object_sexp_new (sexp);
- if (!match_data.obj_sexp)
- return GNOME_Evolution_Calendar_InvalidQuery;
-
- g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) match_object_sexp, &match_data);
-
- *objects = match_data.obj_list;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* get_query handler for the file backend */
-static void
-cal_backend_file_start_query (CalBackend *backend, Query *query)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- MatchObjectData match_data;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_message (G_STRLOC ": Starting query (%s)", query_get_text (query));
-
- /* try to match all currently existing objects */
- match_data.search_needed = TRUE;
- match_data.query = query_get_text (query);
- match_data.obj_list = NULL;
- match_data.backend = backend;
- match_data.default_zone = priv->default_zone;
-
- if (!strcmp (match_data.query, "#t"))
- match_data.search_needed = FALSE;
-
- match_data.obj_sexp = query_get_object_sexp (query);
- if (!match_data.obj_sexp) {
- query_notify_query_done (query, GNOME_Evolution_Calendar_InvalidQuery);
- return;
- }
-
- g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) match_object_sexp, &match_data);
-
- /* notify listeners of all objects */
- if (match_data.obj_list) {
- query_notify_objects_added (query, (const GList *) match_data.obj_list);
-
- /* free memory */
- g_list_foreach (match_data.obj_list, (GFunc) g_free, NULL);
- g_list_free (match_data.obj_list);
- }
-
- query_notify_query_done (query, GNOME_Evolution_Calendar_Success);
-}
-
-static gboolean
-free_busy_instance (CalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
-{
- icalcomponent *vfb = data;
- icalproperty *prop;
- icalparameter *param;
- struct icalperiodtype ipt;
- icaltimezone *utc_zone;
-
- utc_zone = icaltimezone_get_utc_timezone ();
-
- ipt.start = icaltime_from_timet_with_zone (instance_start, FALSE, utc_zone);
- ipt.end = icaltime_from_timet_with_zone (instance_end, FALSE, utc_zone);
- ipt.duration = icaldurationtype_null_duration ();
-
- /* add busy information to the vfb component */
- prop = icalproperty_new (ICAL_FREEBUSY_PROPERTY);
- icalproperty_set_freebusy (prop, ipt);
-
- param = icalparameter_new_fbtype (ICAL_FBTYPE_BUSY);
- icalproperty_add_parameter (prop, param);
-
- icalcomponent_add_property (vfb, prop);
-
- return TRUE;
-}
-
-static icalcomponent *
-create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *cn,
- time_t start, time_t end)
-{
- CalBackendFilePrivate *priv;
- GList *l;
- icalcomponent *vfb;
- icaltimezone *utc_zone;
- CalBackendObjectSExp *obj_sexp;
- char *query;
-
- priv = cbfile->priv;
-
- /* create the (unique) VFREEBUSY object that we'll return */
- vfb = icalcomponent_new_vfreebusy ();
- if (address != NULL) {
- icalproperty *prop;
- icalparameter *param;
-
- prop = icalproperty_new_organizer (address);
- if (prop != NULL && cn != NULL) {
- param = icalparameter_new_cn (cn);
- icalproperty_add_parameter (prop, param);
- }
- if (prop != NULL)
- icalcomponent_add_property (vfb, prop);
- }
- utc_zone = icaltimezone_get_utc_timezone ();
- icalcomponent_set_dtstart (vfb, icaltime_from_timet_with_zone (start, FALSE, utc_zone));
- icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
-
- /* add all objects in the given interval */
- query = g_strdup_printf ("occur-in-time-range? %lu %lu", start, end);
- obj_sexp = cal_backend_object_sexp_new (query);
- g_free (query);
-
- if (!obj_sexp)
- return vfb;
-
- for (l = priv->comp; l; l = l->next) {
- CalComponent *comp = l->data;
- icalcomponent *icalcomp, *vcalendar_comp;
- icalproperty *prop;
-
- icalcomp = cal_component_get_icalcomponent (comp);
- if (!icalcomp)
- continue;
-
- /* If the event is TRANSPARENT, skip it. */
- prop = icalcomponent_get_first_property (icalcomp,
- ICAL_TRANSP_PROPERTY);
- if (prop) {
- icalproperty_transp transp_val = icalproperty_get_transp (prop);
- if (transp_val == ICAL_TRANSP_TRANSPARENT ||
- transp_val == ICAL_TRANSP_TRANSPARENTNOCONFLICT)
- continue;
- }
-
- if (!cal_backend_object_sexp_match_comp (obj_sexp, l->data, CAL_BACKEND (cbfile)))
- continue;
-
- vcalendar_comp = icalcomponent_get_parent (icalcomp);
- cal_recur_generate_instances (comp, start, end,
- free_busy_instance,
- vfb,
- resolve_tzid,
- vcalendar_comp,
- priv->default_zone);
- }
-
- return vfb;
-}
-
-/* Get_free_busy handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_free_busy (CalBackendSync *backend, Cal *cal, GList *users,
- time_t start, time_t end, GList **freebusy)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- gchar *address, *name;
- icalcomponent *vfb;
- char *calobj;
- GList *l;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (start != -1 && end != -1, GNOME_Evolution_Calendar_InvalidRange);
- g_return_val_if_fail (start <= end, GNOME_Evolution_Calendar_InvalidRange);
-
- *freebusy = NULL;
-
- if (users == NULL) {
- if (cal_backend_mail_account_get_default (priv->config_listener, &address, &name)) {
- vfb = create_user_free_busy (cbfile, address, name, start, end);
- calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
- icalcomponent_free (vfb);
- g_free (address);
- g_free (name);
- }
- } else {
- for (l = users; l != NULL; l = l->next ) {
- address = l->data;
- if (cal_backend_mail_account_is_valid (priv->config_listener, address, &name)) {
- vfb = create_user_free_busy (cbfile, address, name, start, end);
- calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
- icalcomponent_free (vfb);
- g_free (name);
- }
- }
- }
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-typedef struct
-{
- CalBackendFile *backend;
- icalcomponent_kind kind;
- GList *deletes;
- EXmlHash *ehash;
-} CalBackendFileComputeChangesData;
-
-static void
-cal_backend_file_compute_changes_foreach_key (const char *key, gpointer data)
-{
- CalBackendFileComputeChangesData *be_data = data;
-
- if (!lookup_component (be_data->backend, key)) {
- CalComponent *comp;
-
- comp = cal_component_new ();
- if (be_data->kind == ICAL_VTODO_COMPONENT)
- cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
- else
- cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
-
- cal_component_set_uid (comp, key);
- be_data->deletes = g_list_prepend (be_data->deletes, cal_component_get_as_string (comp));
-
- e_xmlhash_remove (be_data->ehash, key);
- }
-}
-
-static CalBackendSyncStatus
-cal_backend_file_compute_changes (CalBackendFile *cbfile, const char *change_id,
- GList **adds, GList **modifies, GList **deletes)
-{
- CalBackendFilePrivate *priv;
- char *filename;
- EXmlHash *ehash;
- CalBackendFileComputeChangesData be_data;
- GList *i;
-
- priv = cbfile->priv;
-
- /* FIXME Will this always work? */
- filename = g_strdup_printf ("%s/%s.db", priv->uri, change_id);
- ehash = e_xmlhash_new (filename);
- g_free (filename);
-
- /* Calculate adds and modifies */
- for (i = priv->comp; i != NULL; i = i->next) {
- const char *uid;
- char *calobj;
-
- cal_component_get_uid (i->data, &uid);
- calobj = cal_component_get_as_string (i->data);
-
- g_assert (calobj != NULL);
-
- /* check what type of change has occurred, if any */
- switch (e_xmlhash_compare (ehash, uid, calobj)) {
- case E_XMLHASH_STATUS_SAME:
- break;
- case E_XMLHASH_STATUS_NOT_FOUND:
- *adds = g_list_prepend (*adds, g_strdup (calobj));
- e_xmlhash_add (ehash, uid, calobj);
- break;
- case E_XMLHASH_STATUS_DIFFERENT:
- *modifies = g_list_prepend (*modifies, g_strdup (calobj));
- e_xmlhash_add (ehash, uid, calobj);
- break;
- }
-
- g_free (calobj);
- }
-
- /* Calculate deletions */
- be_data.backend = cbfile;
- be_data.kind = cal_backend_get_kind (CAL_BACKEND (cbfile));
- be_data.deletes = NULL;
- be_data.ehash = ehash;
- e_xmlhash_foreach_key (ehash, (EXmlHashFunc)cal_backend_file_compute_changes_foreach_key, &be_data);
-
- *deletes = be_data.deletes;
-
- e_xmlhash_write (ehash);
- e_xmlhash_destroy (ehash);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_changes handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_get_changes (CalBackendSync *backend, Cal *cal, const char *change_id,
- GList **adds, GList **modifies, GList **deletes)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (change_id != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return cal_backend_file_compute_changes (cbfile, change_id, adds, modifies, deletes);
-}
-
-/* Discard_alarm handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_discard_alarm (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid)
-{
- /* we just do nothing with the alarm */
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_create_object (CalBackendSync *backend, Cal *cal, const char *calobj, char **uid)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- CalComponent *comp;
- const char *comp_uid;
- struct icaltimetype current;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- icalcomp = icalparser_parse_string ((char *) calobj);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- /* FIXME Check kind with the parent */
- kind = icalcomponent_isa (icalcomp);
- if (kind != ICAL_VEVENT_COMPONENT && kind != ICAL_VTODO_COMPONENT) {
- icalcomponent_free (icalcomp);
- return GNOME_Evolution_Calendar_InvalidObject;
- }
-
- /* Get the UID */
- comp_uid = icalcomponent_get_uid (icalcomp);
-
- /* check the object is not in our cache */
- if (lookup_component (cbfile, comp_uid)) {
- icalcomponent_free (icalcomp);
- return GNOME_Evolution_Calendar_CardIdAlreadyExists;
- }
-
- /* Create the cal component */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
-
- /* Set the created and last modified times on the component */
- current = icaltime_from_timet (time (NULL), 0);
- cal_component_set_created (comp, &current);
- cal_component_set_last_modified (comp, &current);
-
- /* Add the object */
- add_component (cbfile, comp, TRUE);
-
- /* Save the file */
- save (cbfile);
-
- /* Return the UID */
- if (uid)
- *uid = g_strdup (comp_uid);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_modify_object (CalBackendSync *backend, Cal *cal, const char *calobj,
- CalObjModType mod, char **old_object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- const char *comp_uid, *rid;
- char *real_rid;
- CalComponent *comp, *recurrence;
- CalBackendFileObject *obj_data;
- struct icaltimetype current;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- icalcomp = icalparser_parse_string ((char *) calobj);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- /* check kind with the parent */
- kind = icalcomponent_isa (icalcomp);
- if (kind != ICAL_VEVENT_COMPONENT && kind != ICAL_VTODO_COMPONENT) {
- icalcomponent_free (icalcomp);
- return GNOME_Evolution_Calendar_InvalidObject;
- }
-
- /* Get the uid */
- comp_uid = icalcomponent_get_uid (icalcomp);
-
- /* Get the object from our cache */
- if (!(obj_data = g_hash_table_lookup (priv->comp_uid_hash, comp_uid))) {
- icalcomponent_free (icalcomp);
- return GNOME_Evolution_Calendar_ObjectNotFound;
- }
-
- /* Create the cal component */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
-
- /* Set the last modified time on the component */
- current = icaltime_from_timet (time (NULL), 0);
- cal_component_set_last_modified (comp, &current);
-
- /* handle mod_type */
- switch (mod) {
- case CALOBJ_MOD_THIS :
- rid = get_rid_string (comp);
- if (!rid || !*rid) {
- g_object_unref (comp);
- return GNOME_Evolution_Calendar_ObjectNotFound;
- }
-
- if (g_hash_table_lookup_extended (obj_data->recurrences, rid,
- &real_rid, &recurrence)) {
- /* remove the component from our data */
- icalcomponent_remove_component (priv->icalcomp,
- cal_component_get_icalcomponent (recurrence));
- priv->comp = g_list_remove (priv->comp, recurrence);
- g_hash_table_remove (obj_data->recurrences, rid);
-
- /* free memory */
- g_free (real_rid);
- g_object_unref (recurrence);
- } else {
- char *old, *new;
-
- old = cal_component_get_as_string (obj_data->full_object);
-
- cal_util_remove_instances (cal_component_get_icalcomponent (obj_data->full_object),
- get_rid_icaltime (comp),
- mod);
-
- new = cal_component_get_as_string (obj_data->full_object);
-
- cal_backend_notify_object_modified (CAL_BACKEND (backend), old, new);
-
- g_free (old);
- g_free (new);
- }
-
- /* add the detached instance */
- g_hash_table_insert (obj_data->recurrences, g_strdup (get_rid_string (comp)), comp);
- break;
- case CALOBJ_MOD_THISANDPRIOR :
- break;
- case CALOBJ_MOD_THISANDFUTURE :
- break;
- case CALOBJ_MOD_ALL :
- /* in this case, we blow away all recurrences, and start over
- with a clean component */
- /* Remove the old version */
- remove_component (cbfile, obj_data->full_object);
-
- /* Add the new object */
- add_component (cbfile, comp, TRUE);
- break;
- }
-
- save (cbfile);
-
- if (old_object)
- *old_object = cal_component_get_as_string (comp);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static void
-remove_instance (CalBackendFile *cbfile, CalBackendFileObject *obj_data, const char *rid)
-{
- char *hash_rid;
- CalComponent *comp;
- GSList *categories;
-
- if (!rid || !*rid)
- return;
-
- if (g_hash_table_lookup_extended (obj_data->recurrences, rid, &hash_rid, &comp)) {
- /* remove the component from our data */
- icalcomponent_remove_component (cbfile->priv->icalcomp,
- cal_component_get_icalcomponent (comp));
- cbfile->priv->comp = g_list_remove (cbfile->priv->comp, comp);
- g_hash_table_remove (obj_data->recurrences, rid);
-
- /* update the set of categories */
- cal_component_get_categories_list (comp, &categories);
- cal_backend_unref_categories (CAL_BACKEND (cbfile), categories);
- cal_component_free_categories_list (categories);
-
- /* free memory */
- g_free (hash_rid);
- g_object_unref (comp);
-
- return;
- }
-
- /* remove the component from our data, temporarily */
- icalcomponent_remove_component (cbfile->priv->icalcomp,
- cal_component_get_icalcomponent (obj_data->full_object));
- cbfile->priv->comp = g_list_remove (cbfile->priv->comp, obj_data->full_object);
-
- cal_util_remove_instances (cal_component_get_icalcomponent (obj_data->full_object),
- icaltime_from_string (rid), CALOBJ_MOD_THIS);
-
- /* add the modified object to the beginning of the list,
- so that it's always before any detached instance we
- might have */
- cbfile->priv->comp = g_list_prepend (cbfile->priv->comp, obj_data->full_object);
-}
-
-typedef struct {
- CalBackendFile *cbfile;
- CalBackendFileObject *obj_data;
- const char *rid;
- CalObjModType mod;
-} RemoveRecurrenceData;
-
-static gboolean
-remove_object_instance_cb (gpointer key, gpointer value, gpointer user_data)
-{
- time_t fromtt, instancett;
- GSList *categories;
- char *rid = key;
- CalComponent *instance = value;
- RemoveRecurrenceData *rrdata = user_data;
-
- fromtt = icaltime_as_timet (icaltime_from_string (rrdata->rid));
- instancett = icaltime_as_timet (get_rid_icaltime (instance));
-
- if (fromtt > 0 && instancett > 0) {
- if ((rrdata->mod == CALOBJ_MOD_THISANDPRIOR && instancett <= fromtt) ||
- (rrdata->mod == CALOBJ_MOD_THISANDFUTURE && instancett >= fromtt)) {
- /* remove the component from our data */
- icalcomponent_remove_component (rrdata->cbfile->priv->icalcomp,
- cal_component_get_icalcomponent (instance));
- rrdata->cbfile->priv->comp = g_list_remove (rrdata->cbfile->priv->comp, instance);
-
- /* update the set of categories */
- cal_component_get_categories_list (instance, &categories);
- cal_backend_unref_categories (CAL_BACKEND (rrdata->cbfile), categories);
- cal_component_free_categories_list (categories);
-
- /* free memory */
- g_free (rid);
- g_object_unref (instance);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* Remove_object handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_file_remove_object (CalBackendSync *backend, Cal *cal,
- const char *uid, const char *rid,
- CalObjModType mod, char **object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- CalBackendFileObject *obj_data;
- CalComponent *comp;
- GSList *categories;
- RemoveRecurrenceData rrdata;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
- g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (!obj_data)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- comp = obj_data->full_object;
-
- switch (mod) {
- case CALOBJ_MOD_ALL :
- *object = cal_component_get_as_string (comp);
- remove_component (cbfile, comp);
- break;
- case CALOBJ_MOD_THIS :
- if (!rid || !*rid)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- remove_instance (cbfile, obj_data, rid);
- break;
- case CALOBJ_MOD_THISANDPRIOR :
- case CALOBJ_MOD_THISANDFUTURE :
- if (!rid || !*rid)
- return GNOME_Evolution_Calendar_ObjectNotFound;
-
- /* remove the component from our data, temporarily */
- icalcomponent_remove_component (priv->icalcomp,
- cal_component_get_icalcomponent (comp));
- priv->comp = g_list_remove (priv->comp, comp);
-
- cal_util_remove_instances (cal_component_get_icalcomponent (comp),
- icaltime_from_string (rid), mod);
-
- /* now remove all detached instances */
- rrdata.cbfile = cbfile;
- rrdata.obj_data = obj_data;
- rrdata.rid = rid;
- rrdata.mod = mod;
- g_hash_table_foreach_remove (obj_data->recurrences, (GHRFunc) remove_object_instance_cb, &rrdata);
-
- /* add the modified object to the beginning of the list,
- so that it's always before any detached instance we
- might have */
- priv->comp = g_list_prepend (priv->comp, comp);
- break;
- }
-
- save (cbfile);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static gboolean
-cancel_received_object (CalBackendFile *cbfile, icalcomponent *icalcomp)
-{
- CalComponent *old_comp;
-
- /* Find the old version of the component. */
- old_comp = lookup_component (cbfile, icalcomponent_get_uid (icalcomp));
- if (!old_comp)
- return FALSE;
-
- /* And remove it */
- remove_component (cbfile, old_comp);
-
- return TRUE;
-}
-
-typedef struct {
- GHashTable *zones;
-
- gboolean found;
-} CalBackendFileTzidData;
-
-static void
-check_tzids (icalparameter *param, void *data)
-{
- CalBackendFileTzidData *tzdata = data;
- const char *tzid;
-
- tzid = icalparameter_get_tzid (param);
- if (!tzid || g_hash_table_lookup (tzdata->zones, tzid))
- tzdata->found = FALSE;
-}
-
-/* Update_objects handler for the file backend. */
-static CalBackendSyncStatus
-cal_backend_file_receive_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icalcomponent *toplevel_comp, *icalcomp = NULL;
- icalcomponent_kind kind;
- icalproperty_method method;
- icalcomponent *subcomp;
- GList *comps, *l;
- CalBackendFileTzidData tzdata;
- CalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_InvalidObject);
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
-
- /* Pull the component from the string and ensure that it is sane */
- toplevel_comp = icalparser_parse_string ((char *) calobj);
- if (!toplevel_comp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- kind = icalcomponent_isa (toplevel_comp);
- if (kind != ICAL_VCALENDAR_COMPONENT) {
- /* If its not a VCALENDAR, make it one to simplify below */
- icalcomp = toplevel_comp;
- toplevel_comp = cal_util_new_top_level ();
- icalcomponent_add_component (toplevel_comp, icalcomp);
- }
-
- method = icalcomponent_get_method (toplevel_comp);
-
- /* Build a list of timezones so we can make sure all the objects have valid info */
- tzdata.zones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
- subcomp = icalcomponent_get_first_component (toplevel_comp, ICAL_VTIMEZONE_COMPONENT);
- while (subcomp) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- if (icaltimezone_set_component (zone, subcomp))
- g_hash_table_insert (tzdata.zones, g_strdup (icaltimezone_get_tzid (zone)), NULL);
-
- subcomp = icalcomponent_get_next_component (toplevel_comp, ICAL_VTIMEZONE_COMPONENT);
- }
-
- /* First we make sure all the components are usuable */
- comps = NULL;
- subcomp = icalcomponent_get_first_component (toplevel_comp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- /* We ignore anything except VEVENT, VTODO and VJOURNAL
- components. */
- icalcomponent_kind child_kind = icalcomponent_isa (subcomp);
-
- switch (child_kind) {
- case ICAL_VEVENT_COMPONENT:
- case ICAL_VTODO_COMPONENT:
- case ICAL_VJOURNAL_COMPONENT:
- tzdata.found = TRUE;
- icalcomponent_foreach_tzid (subcomp, check_tzids, &tzdata);
-
- if (!tzdata.found) {
- status = GNOME_Evolution_Calendar_InvalidObject;
- goto error;
- }
-
- if (!icalcomponent_get_uid (subcomp)) {
- status = GNOME_Evolution_Calendar_InvalidObject;
- goto error;
- }
-
- comps = g_list_prepend (comps, subcomp);
- break;
- default:
- /* Ignore it */
- break;
- }
-
- subcomp = icalcomponent_get_next_component (toplevel_comp, ICAL_ANY_COMPONENT);
- }
-
- /* Now we manipulate the components we care about */
- for (l = comps; l; l = l->next) {
- subcomp = l->data;
-
- switch (method) {
- case ICAL_METHOD_PUBLISH:
- case ICAL_METHOD_REQUEST:
- /* FIXME Need to see the new create/modify stuff before we set this up */
- break;
- case ICAL_METHOD_REPLY:
- /* FIXME Update the status of the user, if we are the organizer */
- break;
- case ICAL_METHOD_ADD:
- /* FIXME This should be doable once all the recurid stuff is done */
- break;
- case ICAL_METHOD_COUNTER:
- status = GNOME_Evolution_Calendar_UnsupportedMethod;
- goto error;
- break;
- case ICAL_METHOD_DECLINECOUNTER:
- status = GNOME_Evolution_Calendar_UnsupportedMethod;
- goto error;
- break;
- case ICAL_METHOD_CANCEL:
- /* FIXME Do we need to remove the subcomp so it isn't merged? */
- if (cancel_received_object (cbfile, subcomp)) {
- const char *calobj = icalcomponent_as_ical_string (subcomp);
- cal_backend_notify_object_removed (CAL_BACKEND (backend), icalcomponent_get_uid (subcomp), calobj);
- }
- break;
- default:
- status = GNOME_Evolution_Calendar_UnsupportedMethod;
- goto error;
- }
- }
- g_list_free (comps);
-
- /* Merge the iCalendar components with our existing VCALENDAR,
- resolving any conflicting TZIDs. */
- icalcomponent_merge_component (priv->icalcomp, toplevel_comp);
-
- save (cbfile);
-
- error:
- g_hash_table_destroy (tzdata.zones);
-
- return status;
-}
-
-static CalBackendSyncStatus
-cal_backend_file_send_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- /* FIXME Put in a util routine to send stuff via email */
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static icaltimezone *
-cal_backend_file_internal_get_default_timezone (CalBackend *backend)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
- return priv->default_zone;
-}
-
-static icaltimezone *
-cal_backend_file_internal_get_timezone (CalBackend *backend, const char *tzid)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- icaltimezone *zone;
-
- cbfile = CAL_BACKEND_FILE (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
- if (!strcmp (tzid, "UTC"))
- zone = icaltimezone_get_utc_timezone ();
- else {
- zone = icalcomponent_get_timezone (priv->icalcomp, tzid);
- if (!zone)
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- }
-
- return zone;
-}
-
-/* Object initialization function for the file backend */
-static void
-cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class)
-{
- CalBackendFilePrivate *priv;
-
- priv = g_new0 (CalBackendFilePrivate, 1);
- cbfile->priv = priv;
-
- priv->uri = NULL;
- priv->file_name = g_strdup ("calendar.ics");
- priv->read_only = FALSE;
- priv->icalcomp = NULL;
- priv->comp_uid_hash = NULL;
- priv->comp = NULL;
-
- /* The timezone defaults to UTC. */
- priv->default_zone = icaltimezone_get_utc_timezone ();
-
- priv->config_listener = e_config_listener_new ();
-}
-
-/* Class initialization function for the file backend */
-static void
-cal_backend_file_class_init (CalBackendFileClass *class)
-{
- GObjectClass *object_class;
- CalBackendClass *backend_class;
- CalBackendSyncClass *sync_class;
-
- object_class = (GObjectClass *) class;
- backend_class = (CalBackendClass *) class;
- sync_class = (CalBackendSyncClass *) class;
-
- parent_class = (CalBackendSyncClass *) g_type_class_peek_parent (class);
-
- object_class->dispose = cal_backend_file_dispose;
- object_class->finalize = cal_backend_file_finalize;
-
- sync_class->is_read_only_sync = cal_backend_file_is_read_only;
- sync_class->get_cal_address_sync = cal_backend_file_get_cal_address;
- sync_class->get_alarm_email_address_sync = cal_backend_file_get_alarm_email_address;
- sync_class->get_ldap_attribute_sync = cal_backend_file_get_ldap_attribute;
- sync_class->get_static_capabilities_sync = cal_backend_file_get_static_capabilities;
- sync_class->open_sync = cal_backend_file_open;
- sync_class->remove_sync = cal_backend_file_remove;
- sync_class->create_object_sync = cal_backend_file_create_object;
- sync_class->modify_object_sync = cal_backend_file_modify_object;
- sync_class->remove_object_sync = cal_backend_file_remove_object;
- sync_class->discard_alarm_sync = cal_backend_file_discard_alarm;
- sync_class->receive_objects_sync = cal_backend_file_receive_objects;
- sync_class->send_objects_sync = cal_backend_file_send_objects;
- sync_class->get_default_object_sync = cal_backend_file_get_default_object;
- sync_class->get_object_sync = cal_backend_file_get_object;
- sync_class->get_object_list_sync = cal_backend_file_get_object_list;
- sync_class->get_timezone_sync = cal_backend_file_get_timezone;
- sync_class->add_timezone_sync = cal_backend_file_add_timezone;
- sync_class->set_default_timezone_sync = cal_backend_file_set_default_timezone;
- sync_class->get_freebusy_sync = cal_backend_file_get_free_busy;
- sync_class->get_changes_sync = cal_backend_file_get_changes;
-
- backend_class->is_loaded = cal_backend_file_is_loaded;
- backend_class->start_query = cal_backend_file_start_query;
- backend_class->get_mode = cal_backend_file_get_mode;
- backend_class->set_mode = cal_backend_file_set_mode;
-
- backend_class->internal_get_default_timezone = cal_backend_file_internal_get_default_timezone;
- backend_class->internal_get_timezone = cal_backend_file_internal_get_timezone;
-}
-
-
-/**
- * cal_backend_file_get_type:
- * @void:
- *
- * Registers the #CalBackendFile class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalBackendFile class.
- **/
-GType
-cal_backend_file_get_type (void)
-{
- static GType cal_backend_file_type = 0;
-
- if (!cal_backend_file_type) {
- static GTypeInfo info = {
- sizeof (CalBackendFileClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_file_class_init,
- NULL, NULL,
- sizeof (CalBackendFile),
- 0,
- (GInstanceInitFunc) cal_backend_file_init
- };
- cal_backend_file_type = g_type_register_static (CAL_TYPE_BACKEND_SYNC,
- "CalBackendFile", &info, 0);
- }
-
- return cal_backend_file_type;
-}
-
-void
-cal_backend_file_set_file_name (CalBackendFile *cbfile, const char *file_name)
-{
- CalBackendFilePrivate *priv;
-
- g_return_if_fail (cbfile != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE (cbfile));
- g_return_if_fail (file_name != NULL);
-
- priv = cbfile->priv;
-
- if (priv->file_name)
- g_free (priv->file_name);
-
- priv->file_name = g_strdup (file_name);
-}
-
-const char *
-cal_backend_file_get_file_name (CalBackendFile *cbfile)
-{
- CalBackendFilePrivate *priv;
-
- g_return_val_if_fail (cbfile != NULL, NULL);
- g_return_val_if_fail (IS_CAL_BACKEND_FILE (cbfile), NULL);
-
- priv = cbfile->priv;
-
- return priv->file_name;
-}
diff --git a/calendar/pcs/cal-backend-file.h b/calendar/pcs/cal-backend-file.h
deleted file mode 100644
index ebe190cb2a..0000000000
--- a/calendar/pcs/cal-backend-file.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_FILE_H
-#define CAL_BACKEND_FILE_H
-
-#include "pcs/cal-backend-sync.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_BACKEND_FILE_TYPE (cal_backend_file_get_type ())
-#define CAL_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_FILE_TYPE, \
- CalBackendFile))
-#define CAL_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_FILE_TYPE, \
- CalBackendFileClass))
-#define IS_CAL_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_FILE_TYPE))
-#define IS_CAL_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_FILE_TYPE))
-
-typedef struct _CalBackendFile CalBackendFile;
-typedef struct _CalBackendFileClass CalBackendFileClass;
-
-typedef struct _CalBackendFilePrivate CalBackendFilePrivate;
-
-struct _CalBackendFile {
- CalBackendSync backend;
-
- /* Private data */
- CalBackendFilePrivate *priv;
-};
-
-struct _CalBackendFileClass {
- CalBackendSyncClass parent_class;
-};
-
-GType cal_backend_file_get_type (void);
-
-void cal_backend_file_set_file_name (CalBackendFile *cbfile,
- const char *file_name);
-const char *cal_backend_file_get_file_name (CalBackendFile *cbfile);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-backend-http.c b/calendar/pcs/cal-backend-http.c
deleted file mode 100644
index d8cc343b3f..0000000000
--- a/calendar/pcs/cal-backend-http.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/* Evolution calendar - iCalendar http backend
- *
- * Copyright (C) 2003 Novell, Inc.
- *
- * Authors: Hans Petter Jansson <hpj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based in part on the file backend.
- */
-
-#include <config.h>
-#include <string.h>
-#include <unistd.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include "e-util/e-xml-hash-utils.h"
-#include "cal-util/cal-recur.h"
-#include "cal-util/cal-util.h"
-#include "cal-backend-http.h"
-#include "cal-backend-file.h"
-#include "cal-backend-util.h"
-#include "cal-backend-object-sexp.h"
-
-
-
-/* Private part of the CalBackendHttp structure */
-struct _CalBackendHttpPrivate {
- /* URI to get remote calendar data from */
- char *uri;
-
- /* Local/remote mode */
- CalMode mode;
-
- /* Cached-file backend */
- CalBackendFile file_backend;
-
- /* The calendar's default timezone, used for resolving DATE and
- floating DATE-TIME values. */
- icaltimezone *default_zone;
-
- /* The list of live queries */
- GList *queries;
-};
-
-
-
-static void cal_backend_http_dispose (GObject *object);
-static void cal_backend_http_finalize (GObject *object);
-
-static CalBackendSyncClass *parent_class;
-
-
-
-/* Dispose handler for the file backend */
-static void
-cal_backend_http_dispose (GObject *object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (object);
- priv = cbfile->priv;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the file backend */
-static void
-cal_backend_http_finalize (GObject *object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_HTTP (object));
-
- cbfile = CAL_BACKEND_HTTP (object);
- priv = cbfile->priv;
-
- /* Clean up */
-
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
- g_free (priv);
- cbfile->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-
-/* Calendar backend methods */
-
-/* Is_read_only handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_is_read_only (CalBackendSync *backend, Cal *cal, gboolean *read_only)
-{
- CalBackendHttp *cbfile = backend;
-
- *read_only = TRUE;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_email_address handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_cal_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- /* A file backend has no particular email address associated
- * with it (although that would be a useful feature some day).
- */
- *address = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_get_ldap_attribute (CalBackendSync *backend, Cal *cal, char **attribute)
-{
- *attribute = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_get_alarm_email_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- /* A file backend has no particular email address associated
- * with it (although that would be a useful feature some day).
- */
- *address = NULL;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_get_static_capabilities (CalBackendSync *backend, Cal *cal, char **capabilities)
-{
- *capabilities = CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Open handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_open (CalBackendSync *backend, Cal *cal, gboolean only_if_exists)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- char *str_uri;
- CalBackendSyncStatus status = GNOME_Evolution_Calendar_NoSuchCal;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_message ("Open URI '%s'.", cal_backend_get_uri (CAL_BACKEND (cbfile)));
-
- return status;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_remove (CalBackendSync *backend, Cal *cal)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- char *str_uri;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- return GNOME_Evolution_Calendar_OtherError;
-}
-
-/* is_loaded handler for the file backend */
-static gboolean
-cal_backend_http_is_loaded (CalBackend *backend)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- return FALSE;
-}
-
-/* is_remote handler for the file backend */
-static CalMode
-cal_backend_http_get_mode (CalBackend *backend)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- return priv->mode;
-}
-
-#define cal_mode_to_corba(mode) \
- (mode == CAL_MODE_LOCAL ? GNOME_Evolution_Calendar_MODE_LOCAL : \
- mode == CAL_MODE_REMOTE ? GNOME_Evolution_Calendar_MODE_REMOTE : \
- GNOME_Evolution_Calendar_MODE_ANY)
-
-/* Set_mode handler for the file backend */
-static void
-cal_backend_http_set_mode (CalBackend *backend, CalMode mode)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- GNOME_Evolution_Calendar_CalMode set_mode;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- switch (mode) {
- case CAL_MODE_LOCAL:
- case CAL_MODE_REMOTE:
- priv->mode = mode;
- set_mode = cal_mode_to_corba (mode);
- break;
- case CAL_MODE_ANY:
- priv->mode = CAL_MODE_REMOTE;
- set_mode = GNOME_Evolution_Calendar_MODE_REMOTE;
- break;
- default:
- set_mode = GNOME_Evolution_Calendar_MODE_ANY;
- break;
- }
-
- if (set_mode == GNOME_Evolution_Calendar_MODE_ANY)
- cal_backend_notify_mode (backend,
- GNOME_Evolution_Calendar_Listener_MODE_NOT_SUPPORTED,
- cal_mode_to_corba (priv->mode));
- else
- cal_backend_notify_mode (backend,
- GNOME_Evolution_Calendar_Listener_MODE_SET,
- set_mode);
-}
-
-static CalBackendSyncStatus
-cal_backend_http_get_default_object (CalBackendSync *backend, Cal *cal, char **object)
-{
- CalComponent *comp;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_object_component handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_object (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, char **object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- CalComponent *comp = NULL;
- gboolean free_comp = FALSE;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_timezone_object handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_timezone (CalBackendSync *backend, Cal *cal, const char *tzid, char **object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icaltimezone *zone;
- icalcomponent *icalcomp;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (tzid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Add_timezone handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_add_timezone (CalBackendSync *backend, Cal *cal, const char *tzobj)
-{
- icalcomponent *tz_comp;
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = (CalBackendHttp *) backend;
-
- g_return_val_if_fail (IS_CAL_BACKEND_HTTP (cbfile), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (tzobj != NULL, GNOME_Evolution_Calendar_OtherError);
-
- priv = cbfile->priv;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_set_default_timezone (CalBackendSync *backend, Cal *cal, const char *tzid)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icaltimezone *zone;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_objects_in_range handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_object_list (CalBackendSync *backend, Cal *cal, const char *sexp, GList **objects)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* get_query handler for the file backend */
-static void
-cal_backend_http_start_query (CalBackend *backend, Query *query)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-}
-
-/* Get_free_busy handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_free_busy (CalBackendSync *backend, Cal *cal, GList *users,
- time_t start, time_t end, GList **freebusy)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- gchar *address, *name;
- icalcomponent *vfb;
- char *calobj;
- GList *l;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (start != -1 && end != -1, GNOME_Evolution_Calendar_InvalidRange);
- g_return_val_if_fail (start <= end, GNOME_Evolution_Calendar_InvalidRange);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Get_changes handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_get_changes (CalBackendSync *backend, Cal *cal, const char *change_id,
- GList **adds, GList **modifies, GList **deletes)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (change_id != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Discard_alarm handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_discard_alarm (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid)
-{
- /* we just do nothing with the alarm */
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_create_object (CalBackendSync *backend, Cal *cal, const char *calobj, char **uid)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- CalComponent *comp;
- const char *comp_uid;
- struct icaltimetype current;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_modify_object (CalBackendSync *backend, Cal *cal, const char *calobj,
- CalObjModType mod, char **old_object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- const char *comp_uid;
- CalComponent *comp;
- struct icaltimetype current;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Remove_object handler for the file backend */
-static CalBackendSyncStatus
-cal_backend_http_remove_object (CalBackendSync *backend, Cal *cal,
- const char *uid, const char *rid,
- CalObjModType mod, char **object)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- CalComponent *comp;
- char *hash_rid;
- GSList *categories;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-/* Update_objects handler for the file backend. */
-static CalBackendSyncStatus
-cal_backend_http_receive_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icalcomponent *toplevel_comp, *icalcomp = NULL;
- icalcomponent_kind kind;
- icalproperty_method method;
- icalcomponent *subcomp;
- GList *comps, *l;
- CalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
-
- return status;
-}
-
-static CalBackendSyncStatus
-cal_backend_http_send_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- /* FIXME Put in a util routine to send stuff via email */
-
- return GNOME_Evolution_Calendar_Success;
-}
-
-static icaltimezone *
-cal_backend_http_internal_get_default_timezone (CalBackend *backend)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
-
- return priv->default_zone;
-}
-
-static icaltimezone *
-cal_backend_http_internal_get_timezone (CalBackend *backend, const char *tzid)
-{
- CalBackendHttp *cbfile;
- CalBackendHttpPrivate *priv;
- icaltimezone *zone;
-
- cbfile = CAL_BACKEND_HTTP (backend);
- priv = cbfile->priv;
-
- if (!strcmp (tzid, "UTC"))
- zone = icaltimezone_get_utc_timezone ();
- else {
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- }
-
- return zone;
-}
-
-/* Object initialization function for the file backend */
-static void
-cal_backend_http_init (CalBackendHttp *cbfile, CalBackendHttpClass *class)
-{
- CalBackendHttpPrivate *priv;
-
- g_message ("Webcal backend init.");
-
- priv = g_new0 (CalBackendHttpPrivate, 1);
- cbfile->priv = priv;
-
- priv->uri = NULL;
-
-#if 0
- priv->config_listener = e_config_listener_new ();
-#endif
-}
-
-/* Class initialization function for the file backend */
-static void
-cal_backend_http_class_init (CalBackendHttpClass *class)
-{
- GObjectClass *object_class;
- CalBackendClass *backend_class;
- CalBackendSyncClass *sync_class;
-
- object_class = (GObjectClass *) class;
- backend_class = (CalBackendClass *) class;
- sync_class = (CalBackendSyncClass *) class;
-
- parent_class = (CalBackendSyncClass *) g_type_class_peek_parent (class);
-
- object_class->dispose = cal_backend_http_dispose;
- object_class->finalize = cal_backend_http_finalize;
-
- sync_class->is_read_only_sync = cal_backend_http_is_read_only;
- sync_class->get_cal_address_sync = cal_backend_http_get_cal_address;
- sync_class->get_alarm_email_address_sync = cal_backend_http_get_alarm_email_address;
- sync_class->get_ldap_attribute_sync = cal_backend_http_get_ldap_attribute;
- sync_class->get_static_capabilities_sync = cal_backend_http_get_static_capabilities;
- sync_class->open_sync = cal_backend_http_open;
- sync_class->remove_sync = cal_backend_http_remove;
- sync_class->create_object_sync = cal_backend_http_create_object;
- sync_class->modify_object_sync = cal_backend_http_modify_object;
- sync_class->remove_object_sync = cal_backend_http_remove_object;
- sync_class->discard_alarm_sync = cal_backend_http_discard_alarm;
- sync_class->receive_objects_sync = cal_backend_http_receive_objects;
- sync_class->send_objects_sync = cal_backend_http_send_objects;
- sync_class->get_default_object_sync = cal_backend_http_get_default_object;
- sync_class->get_object_sync = cal_backend_http_get_object;
- sync_class->get_object_list_sync = cal_backend_http_get_object_list;
- sync_class->get_timezone_sync = cal_backend_http_get_timezone;
- sync_class->add_timezone_sync = cal_backend_http_add_timezone;
- sync_class->set_default_timezone_sync = cal_backend_http_set_default_timezone;
- sync_class->get_freebusy_sync = cal_backend_http_get_free_busy;
- sync_class->get_changes_sync = cal_backend_http_get_changes;
-
- backend_class->is_loaded = cal_backend_http_is_loaded;
- backend_class->start_query = cal_backend_http_start_query;
- backend_class->get_mode = cal_backend_http_get_mode;
- backend_class->set_mode = cal_backend_http_set_mode;
-
- backend_class->internal_get_default_timezone = cal_backend_http_internal_get_default_timezone;
- backend_class->internal_get_timezone = cal_backend_http_internal_get_timezone;
-}
-
-
-/**
- * cal_backend_http_get_type:
- * @void:
- *
- * Registers the #CalBackendHttp class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalBackendHttp class.
- **/
-GType
-cal_backend_http_get_type (void)
-{
- static GType cal_backend_http_type = 0;
-
- g_message (G_STRLOC);
-
- if (!cal_backend_http_type) {
- static GTypeInfo info = {
- sizeof (CalBackendHttpClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_http_class_init,
- NULL, NULL,
- sizeof (CalBackendHttp),
- 0,
- (GInstanceInitFunc) cal_backend_http_init
- };
- cal_backend_http_type = g_type_register_static (CAL_TYPE_BACKEND_SYNC,
- "CalBackendHttp", &info, 0);
- }
-
- return cal_backend_http_type;
-}
diff --git a/calendar/pcs/cal-backend-http.h b/calendar/pcs/cal-backend-http.h
deleted file mode 100644
index 35f47cae16..0000000000
--- a/calendar/pcs/cal-backend-http.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Evolution calendar - iCalendar file backend
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_HTTP_H
-#define CAL_BACKEND_HTTP_H
-
-#include "pcs/cal-backend-sync.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_BACKEND_HTTP_TYPE (cal_backend_http_get_type ())
-#define CAL_BACKEND_HTTP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_HTTP_TYPE, \
- CalBackendHttp))
-#define CAL_BACKEND_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_HTTP_TYPE, \
- CalBackendHttpClass))
-#define IS_CAL_BACKEND_HTTP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_HTTP_TYPE))
-#define IS_CAL_BACKEND_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_HTTP_TYPE))
-
-typedef struct _CalBackendHttp CalBackendHttp;
-typedef struct _CalBackendHttpClass CalBackendHttpClass;
-
-typedef struct _CalBackendHttpPrivate CalBackendHttpPrivate;
-
-struct _CalBackendHttp {
- CalBackendSync backend;
-
- /* Private data */
- CalBackendHttpPrivate *priv;
-};
-
-struct _CalBackendHttpClass {
- CalBackendSyncClass parent_class;
-};
-
-GType cal_backend_http_get_type (void);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-backend-object-sexp.c b/calendar/pcs/cal-backend-object-sexp.c
deleted file mode 100644
index 4bc6b78ebe..0000000000
--- a/calendar/pcs/cal-backend-object-sexp.c
+++ /dev/null
@@ -1,1007 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * cal-backend-card-sexp.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <string.h>
-#include <libgnome/gnome-i18n.h>
-#include <e-util/e-sexp.h>
-#include <gal/widgets/e-unicode.h>
-#include <cal-util/timeutil.h>
-
-#include "cal-backend-object-sexp.h"
-
-static GObjectClass *parent_class;
-
-typedef struct _SearchContext SearchContext;
-
-struct _CalBackendObjectSExpPrivate {
- ESExp *search_sexp;
- char *text;
- SearchContext *search_context;
-};
-
-struct _SearchContext {
- CalComponent *comp;
- CalBackend *backend;
-};
-
-static ESExpResult *
-func_time_now (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- ESExpResult *result;
-
- if (argc != 0) {
- e_sexp_fatal_error (esexp, _("time-now expects 0 arguments"));
- return NULL;
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
- result->value.time = time (NULL);
-
- return result;
-}
-
-/* (make-time ISODATE)
- *
- * ISODATE - string, ISO 8601 date/time representation
- *
- * Constructs a time_t value for the specified date.
- */
-static ESExpResult *
-func_make_time (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- const char *str;
- time_t t;
- ESExpResult *result;
-
- if (argc != 1) {
- e_sexp_fatal_error (esexp, _("make-time expects 1 argument"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_STRING) {
- e_sexp_fatal_error (esexp, _("make-time expects argument 1 "
- "to be a string"));
- return NULL;
- }
- str = argv[0]->value.string;
-
- t = time_from_isodate (str);
- if (t == -1) {
- e_sexp_fatal_error (esexp, _("make-time argument 1 must be an "
- "ISO 8601 date/time string"));
- return NULL;
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
- result->value.time = t;
-
- return result;
-}
-
-/* (time-add-day TIME N)
- *
- * TIME - time_t, base time
- * N - int, number of days to add
- *
- * Adds the specified number of days to a time value.
- *
- * FIXME: TIMEZONES - need to use a timezone or daylight saving changes will
- * make the result incorrect.
- */
-static ESExpResult *
-func_time_add_day (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- ESExpResult *result;
- time_t t;
- int n;
-
- if (argc != 2) {
- e_sexp_fatal_error (esexp, _("time-add-day expects 2 arguments"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("time-add-day expects argument 1 "
- "to be a time_t"));
- return NULL;
- }
- t = argv[0]->value.time;
-
- if (argv[1]->type != ESEXP_RES_INT) {
- e_sexp_fatal_error (esexp, _("time-add-day expects argument 2 "
- "to be an integer"));
- return NULL;
- }
- n = argv[1]->value.number;
-
- result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
- result->value.time = time_add_day (t, n);
-
- return result;
-}
-
-/* (time-day-begin TIME)
- *
- * TIME - time_t, base time
- *
- * Returns the start of the day, according to the local time.
- *
- * FIXME: TIMEZONES - this uses the current Unix timezone.
- */
-static ESExpResult *
-func_time_day_begin (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- time_t t;
- ESExpResult *result;
-
- if (argc != 1) {
- e_sexp_fatal_error (esexp, _("time-day-begin expects 1 argument"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("time-day-begin expects argument 1 "
- "to be a time_t"));
- return NULL;
- }
- t = argv[0]->value.time;
-
- result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
- result->value.time = time_day_begin (t);
-
- return result;
-}
-
-/* (time-day-end TIME)
- *
- * TIME - time_t, base time
- *
- * Returns the end of the day, according to the local time.
- *
- * FIXME: TIMEZONES - this uses the current Unix timezone.
- */
-static ESExpResult *
-func_time_day_end (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- time_t t;
- ESExpResult *result;
-
- if (argc != 1) {
- e_sexp_fatal_error (esexp, _("time-day-end expects 1 argument"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("time-day-end expects argument 1 "
- "to be a time_t"));
- return NULL;
- }
- t = argv[0]->value.time;
-
- result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
- result->value.time = time_day_end (t);
-
- return result;
-}
-
-/* (get-vtype)
- *
- * Returns a string indicating the type of component (VEVENT, VTODO, VJOURNAL,
- * VFREEBUSY, VTIMEZONE, UNKNOWN).
- */
-static ESExpResult *
-func_get_vtype (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- CalComponentVType vtype;
- char *str;
- ESExpResult *result;
-
- /* Check argument types */
-
- if (argc != 0) {
- e_sexp_fatal_error (esexp, _("get-vtype expects 0 arguments"));
- return NULL;
- }
-
- /* Get the type */
-
- vtype = cal_component_get_vtype (ctx->comp);
-
- switch (vtype) {
- case CAL_COMPONENT_EVENT:
- str = g_strdup ("VEVENT");
- break;
-
- case CAL_COMPONENT_TODO:
- str = g_strdup ("VTODO");
- break;
-
- case CAL_COMPONENT_JOURNAL:
- str = g_strdup ("VJOURNAL");
- break;
-
- case CAL_COMPONENT_FREEBUSY:
- str = g_strdup ("VFREEBUSY");
- break;
-
- case CAL_COMPONENT_TIMEZONE:
- str = g_strdup ("VTIMEZONE");
- break;
-
- default:
- str = g_strdup ("UNKNOWN");
- break;
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_STRING);
- result->value.string = str;
-
- return result;
-}
-
-/* (occur-in-time-range? START END)
- *
- * START - time_t, start of the time range
- * END - time_t, end of the time range
- *
- * Returns a boolean indicating whether the component has any occurrences in the
- * specified time range.
- */
-static ESExpResult *
-func_occur_in_time_range (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- time_t start, end, tt;
- gboolean occurs;
- ESExpResult *result;
- CalComponentDateTime dt;
-
- /* Check argument types */
-
- if (argc != 2) {
- e_sexp_fatal_error (esexp, _("occur-in-time-range? expects 2 arguments"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("occur-in-time-range? expects argument 1 "
- "to be a time_t"));
- return NULL;
- }
- start = argv[0]->value.time;
-
- if (argv[1]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("occur-in-time-range? expects argument 2 "
- "to be a time_t"));
- return NULL;
- }
- end = argv[1]->value.time;
-
- /* See if the object occurs in the specified time range */
- occurs = FALSE;
-
- cal_component_get_dtstart (ctx->comp, &dt);
- if (dt.value) {
- icaltimezone *zone;
-
- if (dt.tzid)
- zone = cal_backend_internal_get_timezone (ctx->backend, dt.tzid);
- else
- zone = cal_backend_internal_get_default_timezone (ctx->backend);
-
- tt = icaltime_as_timet_with_zone (*dt.value, zone);
- if (tt >= start && tt <= end)
- occurs = TRUE;
- else {
- cal_component_get_dtend (ctx->comp, &dt);
- if (dt.value) {
- if (dt.tzid)
- zone = cal_backend_internal_get_timezone (ctx->backend, dt.tzid);
- else
- zone = cal_backend_internal_get_default_timezone (ctx->backend);
-
- tt = icaltime_as_timet_with_zone (*dt.value, zone);
- if (tt >= start && tt <= end)
- occurs = TRUE;
- }
- }
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = occurs;
-
- return result;
-}
-
-/* Returns whether a list of CalComponentText items matches the specified string */
-static gboolean
-matches_text_list (GSList *text_list, const char *str)
-{
- GSList *l;
- gboolean matches;
-
- matches = FALSE;
-
- for (l = text_list; l; l = l->next) {
- CalComponentText *text;
-
- text = l->data;
- g_assert (text->value != NULL);
-
- if (e_utf8_strstrcasedecomp (text->value, str) != NULL) {
- matches = TRUE;
- break;
- }
- }
-
- return matches;
-}
-
-/* Returns whether the comments in a component matches the specified string */
-static gboolean
-matches_comment (CalComponent *comp, const char *str)
-{
- GSList *list;
- gboolean matches;
-
- cal_component_get_comment_list (comp, &list);
- matches = matches_text_list (list, str);
- cal_component_free_text_list (list);
-
- return matches;
-}
-
-/* Returns whether the description in a component matches the specified string */
-static gboolean
-matches_description (CalComponent *comp, const char *str)
-{
- GSList *list;
- gboolean matches;
-
- cal_component_get_description_list (comp, &list);
- matches = matches_text_list (list, str);
- cal_component_free_text_list (list);
-
- return matches;
-}
-
-/* Returns whether the summary in a component matches the specified string */
-static gboolean
-matches_summary (CalComponent *comp, const char *str)
-{
- CalComponentText text;
-
- cal_component_get_summary (comp, &text);
-
- if (!text.value)
- return FALSE;
-
- return e_utf8_strstrcasedecomp (text.value, str) != NULL;
-}
-
-/* Returns whether any text field in a component matches the specified string */
-static gboolean
-matches_any (CalComponent *comp, const char *str)
-{
- /* As an optimization, and to make life easier for the individual
- * predicate functions, see if we are looking for the empty string right
- * away.
- */
- if (strlen (str) == 0)
- return TRUE;
-
- return (matches_comment (comp, str)
- || matches_description (comp, str)
- || matches_summary (comp, str));
-}
-
-/* (contains? FIELD STR)
- *
- * FIELD - string, name of field to match (any, comment, description, summary)
- * STR - string, match string
- *
- * Returns a boolean indicating whether the specified field contains the
- * specified string.
- */
-static ESExpResult *
-func_contains (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- const char *field;
- const char *str;
- gboolean matches;
- ESExpResult *result;
-
- /* Check argument types */
-
- if (argc != 2) {
- e_sexp_fatal_error (esexp, _("contains? expects 2 arguments"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_STRING) {
- e_sexp_fatal_error (esexp, _("contains? expects argument 1 "
- "to be a string"));
- return NULL;
- }
- field = argv[0]->value.string;
-
- if (argv[1]->type != ESEXP_RES_STRING) {
- e_sexp_fatal_error (esexp, _("contains? expects argument 2 "
- "to be a string"));
- return NULL;
- }
- str = argv[1]->value.string;
-
- /* See if it matches */
-
- if (strcmp (field, "any") == 0)
- matches = matches_any (ctx->comp, str);
- else if (strcmp (field, "comment") == 0)
- matches = matches_comment (ctx->comp, str);
- else if (strcmp (field, "description") == 0)
- matches = matches_description (ctx->comp, str);
- else if (strcmp (field, "summary") == 0)
- matches = matches_summary (ctx->comp, str);
- else {
- e_sexp_fatal_error (esexp, _("contains? expects argument 1 to "
- "be one of \"any\", \"summary\", \"description\""));
- return NULL;
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = matches;
-
- return result;
-}
-
-/* (has-alarms? #f|#t)
- *
- * A boolean value for components that have/dont have alarms.
- *
- * Returns: a boolean indicating whether the component has alarms or not.
- */
-static ESExpResult *
-func_has_alarms (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- ESExpResult *result;
- gboolean has_to_have_alarms;
-
- /* Check argument types */
-
- if (argc != 1) {
- e_sexp_fatal_error (esexp, _("has-alarms? expects at least 1 argument"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_BOOL) {
- e_sexp_fatal_error (esexp, _("has-alarms? excepts argument to be a boolean"));
- return NULL;
- }
-
- has_to_have_alarms = argv[0]->value.bool;
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
-
- if (has_to_have_alarms && cal_component_has_alarms (ctx->comp))
- result->value.bool = TRUE;
- else if (!has_to_have_alarms && !cal_component_has_alarms (ctx->comp))
- result->value.bool = TRUE;
- else
- result->value.bool = FALSE;
-
- return result;
-}
-
-/* (has-categories? STR+)
- * (has-categories? #f)
- *
- * STR - At least one string specifying a category
- * Or you can specify a single #f (boolean false) value for components
- * that have no categories assigned to them ("unfiled").
- *
- * Returns a boolean indicating whether the component has all the specified
- * categories.
- */
-static ESExpResult *
-func_has_categories (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- gboolean unfiled;
- int i;
- GSList *categories;
- gboolean matches;
- ESExpResult *result;
-
- /* Check argument types */
-
- if (argc < 1) {
- e_sexp_fatal_error (esexp, _("has-categories? expects at least 1 argument"));
- return NULL;
- }
-
- if (argc == 1 && argv[0]->type == ESEXP_RES_BOOL)
- unfiled = TRUE;
- else
- unfiled = FALSE;
-
- if (!unfiled)
- for (i = 0; i < argc; i++)
- if (argv[i]->type != ESEXP_RES_STRING) {
- e_sexp_fatal_error (esexp, _("has-categories? expects all arguments "
- "to be strings or one and only one "
- "argument to be a boolean false (#f)"));
- return NULL;
- }
-
- /* Search categories. First, if there are no categories we return
- * whether unfiled components are supposed to match.
- */
-
- cal_component_get_categories_list (ctx->comp, &categories);
- if (!categories) {
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = unfiled;
-
- return result;
- }
-
- /* Otherwise, we *do* have categories but unfiled components were
- * requested, so this component does not match.
- */
- if (unfiled) {
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = FALSE;
-
- return result;
- }
-
- matches = TRUE;
-
- for (i = 0; i < argc; i++) {
- const char *sought;
- GSList *l;
- gboolean has_category;
-
- sought = argv[i]->value.string;
-
- has_category = FALSE;
-
- for (l = categories; l; l = l->next) {
- const char *category;
-
- category = l->data;
-
- if (strcmp (category, sought) == 0) {
- has_category = TRUE;
- break;
- }
- }
-
- if (!has_category) {
- matches = FALSE;
- break;
- }
- }
-
- cal_component_free_categories_list (categories);
-
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = matches;
-
- return result;
-}
-
-/* (is-completed?)
- *
- * Returns a boolean indicating whether the component is completed (i.e. has
- * a COMPLETED property. This is really only useful for TODO components.
- */
-static ESExpResult *
-func_is_completed (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- ESExpResult *result;
- struct icaltimetype *t;
- gboolean complete = FALSE;
-
- /* Check argument types */
-
- if (argc != 0) {
- e_sexp_fatal_error (esexp, _("is-completed? expects 0 arguments"));
- return NULL;
- }
-
- cal_component_get_completed (ctx->comp, &t);
- if (t) {
- complete = TRUE;
- cal_component_free_icaltimetype (t);
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = complete;
-
- return result;
-}
-
-/* (completed-before? TIME)
- *
- * TIME - time_t
- *
- * Returns a boolean indicating whether the component was completed on or
- * before the given time (i.e. it checks the COMPLETED property).
- * This is really only useful for TODO components.
- */
-static ESExpResult *
-func_completed_before (ESExp *esexp, int argc, ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- ESExpResult *result;
- struct icaltimetype *tt;
- icaltimezone *zone;
- gboolean retval = FALSE;
- time_t before_time, completed_time;
-
- /* Check argument types */
-
- if (argc != 1) {
- e_sexp_fatal_error (esexp, _("completed-before? expects 1 argument"));
- return NULL;
- }
-
- if (argv[0]->type != ESEXP_RES_TIME) {
- e_sexp_fatal_error (esexp, _("completed-before? expects argument 1 "
- "to be a time_t"));
- return NULL;
- }
- before_time = argv[0]->value.time;
-
- cal_component_get_completed (ctx->comp, &tt);
- if (tt) {
- /* COMPLETED must be in UTC. */
- zone = icaltimezone_get_utc_timezone ();
- completed_time = icaltime_as_timet_with_zone (*tt, zone);
-
-#if 0
- g_print ("Query Time : %s", ctime (&before_time));
- g_print ("Completed Time: %s", ctime (&completed_time));
-#endif
-
- /* We want to return TRUE if before_time is after
- completed_time. */
- if (difftime (before_time, completed_time) > 0) {
-#if 0
- g_print (" Returning TRUE\n");
-#endif
- retval = TRUE;
- }
-
- cal_component_free_icaltimetype (tt);
- }
-
- result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
- result->value.bool = retval;
-
- return result;
-}
-
-#if 0
-static struct prop_info {
- ECardSimpleField field_id;
- const char *query_prop;
- const char *ecard_prop;
-#define PROP_TYPE_NORMAL 0x01
-#define PROP_TYPE_LIST 0x02
-#define PROP_TYPE_LISTITEM 0x03
-#define PROP_TYPE_ID 0x04
- int prop_type;
- gboolean (*list_compare)(ECardSimple *ecard, const char *str,
- char *(*compare)(const char*, const char*));
-
-} prop_info_table[] = {
-#define NORMAL_PROP(f,q,e) {f, q, e, PROP_TYPE_NORMAL, NULL}
-#define ID_PROP {0, "id", NULL, PROP_TYPE_ID, NULL}
-#define LIST_PROP(q,e,c) {0, q, e, PROP_TYPE_LIST, c}
-
- /* query prop, ecard prop, type, list compare function */
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "file_as" ),
- LIST_PROP ( "full_name", "full_name", compare_name), /* not really a list, but we need to compare both full and surname */
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_URL, "url", "url" ),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MAILER, "mailer", "mailer"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG, "org", "org"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "org_unit"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_OFFICE, "office", "office"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_TITLE, "title", "title"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ROLE, "role", "role"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MANAGER, "manager", "manager"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "assistant"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "nickname"),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "spouse" ),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NOTE, "note", "note"),
- ID_PROP,
- LIST_PROP ( "email", "email", compare_email ),
- LIST_PROP ( "phone", "phone", compare_phone ),
- LIST_PROP ( "address", "address", compare_address ),
- LIST_PROP ( "category", "category", compare_category ),
- LIST_PROP ( "arbitrary", "arbitrary", compare_arbitrary )
-};
-static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
-
-static ESExpResult *
-entry_compare(SearchContext *ctx, struct _ESExp *f,
- int argc, struct _ESExpResult **argv,
- char *(*compare)(const char*, const char*))
-{
- ESExpResult *r;
- int truth = FALSE;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname;
- struct prop_info *info = NULL;
- int i;
- gboolean any_field;
-
- propname = argv[0]->value.string;
-
- any_field = !strcmp(propname, "x-evolution-any-field");
- for (i = 0; i < num_prop_infos; i ++) {
- if (any_field
- || !strcmp (prop_info_table[i].query_prop, propname)) {
- info = &prop_info_table[i];
-
- if (info->prop_type == PROP_TYPE_NORMAL) {
- char *prop = NULL;
- /* searches where the query's property
- maps directly to an ecard property */
-
- prop = e_card_simple_get (ctx->card, info->field_id);
-
- if (prop && compare(prop, argv[1]->value.string)) {
- truth = TRUE;
- }
- if ((!prop) && compare("", argv[1]->value.string)) {
- truth = TRUE;
- }
- g_free (prop);
- } else if (info->prop_type == PROP_TYPE_LIST) {
- /* the special searches that match any of the list elements */
- truth = info->list_compare (ctx->card, argv[1]->value.string, compare);
- } else if (info->prop_type == PROP_TYPE_ID) {
- const char *prop = NULL;
- /* searches where the query's property
- maps directly to an ecard property */
-
- prop = e_card_get_id (ctx->card->card);
-
- if (prop && compare(prop, argv[1]->value.string)) {
- truth = TRUE;
- }
- if ((!prop) && compare("", argv[1]->value.string)) {
- truth = TRUE;
- }
- }
-
- /* if we're looking at all fields and find a match,
- or if we're just looking at this one field,
- break. */
- if ((any_field && truth)
- || !any_field)
- break;
- }
- }
-
- }
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-#endif
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- /* Time-related functions */
- { "time-now", func_time_now, 0 },
- { "make-time", func_make_time, 0 },
- { "time-add-day", func_time_add_day, 0 },
- { "time-day-begin", func_time_day_begin, 0 },
- { "time-day-end", func_time_day_end, 0 },
-
- /* Component-related functions */
- { "get-vtype", func_get_vtype, 0 },
- { "occur-in-time-range?", func_occur_in_time_range, 0 },
- { "contains?", func_contains, 0 },
- { "has-alarms?", func_has_alarms, 0 },
- { "has-categories?", func_has_categories, 0 },
- { "is-completed?", func_is_completed, 0 },
- { "completed-before?", func_completed_before, 0 }
-};
-
-gboolean
-cal_backend_object_sexp_match_comp (CalBackendObjectSExp *sexp, CalComponent *comp, CalBackend *backend)
-{
- ESExpResult *r;
- gboolean retval;
-
- sexp->priv->search_context->comp = g_object_ref (comp);
- sexp->priv->search_context->backend = g_object_ref (backend);
-
- /* if it's not a valid vcard why is it in our db? :) */
- if (!sexp->priv->search_context->comp)
- return FALSE;
-
- r = e_sexp_eval(sexp->priv->search_sexp);
-
- retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool);
-
- g_object_unref (sexp->priv->search_context->comp);
- g_object_unref (sexp->priv->search_context->backend);
-
- e_sexp_result_free(sexp->priv->search_sexp, r);
-
- return retval;
-}
-
-gboolean
-cal_backend_object_sexp_match_object (CalBackendObjectSExp *sexp, const char *object, CalBackend *backend)
-{
- CalComponent *comp;
- icalcomponent *icalcomp;
- gboolean retval;
-
- icalcomp = icalcomponent_new_from_string ((char *) object);
- if (!icalcomp)
- return FALSE;
-
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
-
- retval = cal_backend_object_sexp_match_comp (sexp, comp, backend);
-
- g_object_unref (comp);
-
- return retval;
-}
-
-
-
-/**
- * cal_backend_card_sexp_new:
- */
-CalBackendObjectSExp *
-cal_backend_object_sexp_new (const char *text)
-{
- CalBackendObjectSExp *sexp = g_object_new (CAL_TYPE_BACKEND_OBJECT_SEXP, NULL);
- int esexp_error;
- int i;
-
- sexp->priv->search_sexp = e_sexp_new();
- sexp->priv->text = g_strdup (text);
-
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp->priv->search_sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, sexp->priv->search_context);
- } else {
- e_sexp_add_function(sexp->priv->search_sexp, 0, symbols[i].name,
- symbols[i].func, sexp->priv->search_context);
- }
- }
-
- e_sexp_input_text(sexp->priv->search_sexp, text, strlen(text));
- esexp_error = e_sexp_parse(sexp->priv->search_sexp);
-
- if (esexp_error == -1) {
- g_object_unref (sexp);
- sexp = NULL;
- }
-
- return sexp;
-}
-
-const char *
-cal_backend_object_sexp_text (CalBackendObjectSExp *sexp)
-{
- CalBackendObjectSExpPrivate *priv;
-
- g_return_val_if_fail (sexp != NULL, NULL);
- g_return_val_if_fail (CAL_IS_BACKEND_OBJECT_SEXP (sexp), NULL);
-
- priv = sexp->priv;
-
- return priv->text;
-}
-
-static void
-cal_backend_object_sexp_dispose (GObject *object)
-{
- CalBackendObjectSExp *sexp = CAL_BACKEND_OBJECT_SEXP (object);
-
- if (sexp->priv) {
- e_sexp_unref(sexp->priv->search_sexp);
-
- g_free (sexp->priv->text);
-
- g_free (sexp->priv->search_context);
- g_free (sexp->priv);
- sexp->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-cal_backend_object_sexp_class_init (CalBackendObjectSExpClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- /* Set the virtual methods. */
-
- object_class->dispose = cal_backend_object_sexp_dispose;
-}
-
-static void
-cal_backend_object_sexp_init (CalBackendObjectSExp *sexp)
-{
- CalBackendObjectSExpPrivate *priv;
-
- priv = g_new0 (CalBackendObjectSExpPrivate, 1);
-
- sexp->priv = priv;
- priv->search_context = g_new (SearchContext, 1);
-}
-
-/**
- * cal_backend_object_sexp_get_type:
- */
-GType
-cal_backend_object_sexp_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (CalBackendObjectSExpClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) cal_backend_object_sexp_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (CalBackendObjectSExp),
- 0, /* n_preallocs */
- (GInstanceInitFunc) cal_backend_object_sexp_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "CalBackendObjectSExp", &info, 0);
- }
-
- return type;
-}
diff --git a/calendar/pcs/cal-backend-object-sexp.h b/calendar/pcs/cal-backend-object-sexp.h
deleted file mode 100644
index dbac3b6abc..0000000000
--- a/calendar/pcs/cal-backend-object-sexp.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * cal-backend-card-sexp.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __CAL_BACKEND_OBJECT_SEXP_H__
-#define __CAL_BACKEND_OBJECT_SEXP_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <pcs/cal-backend.h>
-#include <cal-util/cal-component.h>
-
-G_BEGIN_DECLS
-
-#define CAL_TYPE_BACKEND_OBJECT_SEXP (cal_backend_object_sexp_get_type ())
-#define CAL_BACKEND_OBJECT_SEXP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAL_TYPE_BACKEND_OBJECT_SEXP, CalBackendObjectSExp))
-#define CAL_BACKEND_OBJECT_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CAL_BACKEND_TYPE, CalBackendObjectSExpClass))
-#define CAL_IS_BACKEND_OBJECT_SEXP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAL_TYPE_BACKEND_OBJECT_SEXP))
-#define CAL_IS_BACKEND_OBJECT_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CAL_TYPE_BACKEND_OBJECT_SEXP))
-#define CAL_BACKEND_OBJECT_SEXP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), CAL_TYPE_BACKEND_OBJECT_SEXP, CALBackendObjectSExpClass))
-
-typedef struct _CalBackendObjectSExpPrivate CalBackendObjectSExpPrivate;
-
-struct _CalBackendObjectSExp {
- GObject parent_object;
-
- CalBackendObjectSExpPrivate *priv;
-};
-
-struct _CalBackendObjectSExpClass {
- GObjectClass parent_class;
-};
-
-GType cal_backend_object_sexp_get_type (void);
-CalBackendObjectSExp *cal_backend_object_sexp_new (const char *text);
-const char *cal_backend_object_sexp_text (CalBackendObjectSExp *sexp);
-
-
-gboolean cal_backend_object_sexp_match_object (CalBackendObjectSExp *sexp,
- const char *object,
- CalBackend *backend);
-gboolean cal_backend_object_sexp_match_comp (CalBackendObjectSExp *sexp,
- CalComponent *comp,
- CalBackend *backend);
-
-G_END_DECLS
-
-#endif /* __CAL_BACKEND_OBJECT_SEXP_H__ */
diff --git a/calendar/pcs/cal-backend-sync.c b/calendar/pcs/cal-backend-sync.c
deleted file mode 100644
index c385a89b72..0000000000
--- a/calendar/pcs/cal-backend-sync.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 2003, Ximian, Inc.
- */
-
-#ifdef CONFIG_H
-#include <config.h>
-#endif
-
-#include "cal-backend-sync.h"
-
-struct _CalBackendSyncPrivate {
- int mumble;
-};
-
-static GObjectClass *parent_class;
-
-G_LOCK_DEFINE_STATIC (cal_sync_mutex);
-#define SYNC_LOCK() G_LOCK (cal_sync_mutex)
-#define SYNC_UNLOCK() G_UNLOCK (cal_sync_mutex)
-
-CalBackendSyncStatus
-cal_backend_sync_is_read_only (CalBackendSync *backend, Cal *cal, gboolean *read_only)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (read_only, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->is_read_only_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->is_read_only_sync) (backend, cal, read_only);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_cal_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (address, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_cal_address_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_cal_address_sync) (backend, cal, address);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_alarm_email_address (CalBackendSync *backend, Cal *cal, char **address)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (address, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_alarm_email_address_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_alarm_email_address_sync) (backend, cal, address);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_ldap_attribute (CalBackendSync *backend, Cal *cal, char **attribute)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (attribute, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_ldap_attribute_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_ldap_attribute_sync) (backend, cal, attribute);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_static_capabilities (CalBackendSync *backend, Cal *cal, char **capabilities)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (capabilities, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_static_capabilities_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_static_capabilities_sync) (backend, cal, capabilities);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_open (CalBackendSync *backend, Cal *cal, gboolean only_if_exists)
-{
- CalBackendSyncStatus status;
-
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->open_sync);
-
- SYNC_LOCK ();
-
- status = (* CAL_BACKEND_SYNC_GET_CLASS (backend)->open_sync) (backend, cal, only_if_exists);
-
- SYNC_UNLOCK ();
-
- return status;
-}
-
-CalBackendSyncStatus
-cal_backend_sync_remove (CalBackendSync *backend, Cal *cal)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_sync) (backend, cal);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_create_object (CalBackendSync *backend, Cal *cal, const char *calobj, char **uid)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->create_object_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->create_object_sync) (backend, cal, calobj, uid);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_modify_object (CalBackendSync *backend, Cal *cal, const char *calobj,
- CalObjModType mod, char **old_object)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->modify_object_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->modify_object_sync) (backend, cal,
- calobj, mod, old_object);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_remove_object (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid,
- CalObjModType mod, char **object)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync) (backend, cal, uid, rid, mod, object);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_discard_alarm (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->discard_alarm_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->discard_alarm_sync) (backend, cal, uid, auid);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_receive_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->receive_objects_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->receive_objects_sync) (backend, cal, calobj);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_send_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync) (backend, cal, calobj);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_default_object (CalBackendSync *backend, Cal *cal, char **object)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (object, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_default_object_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_default_object_sync) (backend, cal, object);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_object (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, char **object)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (object, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_object_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_object_sync) (backend, cal, uid, rid, object);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_object_list (CalBackendSync *backend, Cal *cal, const char *sexp, GList **objects)
-{
- g_return_val_if_fail (backend && CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
- g_return_val_if_fail (objects, GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_object_list_sync);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_object_list_sync) (backend, cal, sexp, objects);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_timezone (CalBackendSync *backend, Cal *cal, const char *tzid, char **object)
-{
- g_return_val_if_fail (CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_timezone_sync != NULL);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_timezone_sync) (backend, cal, tzid, object);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_add_timezone (CalBackendSync *backend, Cal *cal, const char *tzobj)
-{
- g_return_val_if_fail (CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->add_timezone_sync != NULL);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->add_timezone_sync) (backend, cal, tzobj);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_set_default_timezone (CalBackendSync *backend, Cal *cal, const char *tzid)
-{
- g_return_val_if_fail (CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->set_default_timezone_sync != NULL);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->set_default_timezone_sync) (backend, cal, tzid);
-}
-
-
-CalBackendSyncStatus
-cal_backend_sync_get_changes (CalBackendSync *backend, Cal *cal, const char *change_id,
- GList **adds, GList **modifies, GList **deletes)
-{
- g_return_val_if_fail (CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync != NULL);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync) (backend, cal, change_id,
- adds, modifies, deletes);
-}
-
-CalBackendSyncStatus
-cal_backend_sync_get_free_busy (CalBackendSync *backend, Cal *cal, GList *users,
- time_t start, time_t end, GList **freebusy)
-{
- g_return_val_if_fail (CAL_IS_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
-
- g_assert (CAL_BACKEND_SYNC_GET_CLASS (backend)->get_freebusy_sync != NULL);
-
- return (* CAL_BACKEND_SYNC_GET_CLASS (backend)->get_freebusy_sync) (backend, cal, users,
- start, end, freebusy);
-}
-
-
-static void
-_cal_backend_is_read_only (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- gboolean read_only = TRUE;
-
- status = cal_backend_sync_is_read_only (CAL_BACKEND_SYNC (backend), cal, &read_only);
-
- cal_notify_read_only (cal, status, read_only);
-}
-
-static void
-_cal_backend_get_cal_address (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- char *address = NULL;
-
- status = cal_backend_sync_get_cal_address (CAL_BACKEND_SYNC (backend), cal, &address);
-
- cal_notify_cal_address (cal, status, address);
-
- g_free (address);
-}
-
-static void
-_cal_backend_get_alarm_email_address (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- char *address = NULL;
-
- status = cal_backend_sync_get_cal_address (CAL_BACKEND_SYNC (backend), cal, &address);
-
- cal_notify_alarm_email_address (cal, status, address);
-
- g_free (address);
-}
-
-static void
-_cal_backend_get_ldap_attribute (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- char *attribute = NULL;
-
- status = cal_backend_sync_get_cal_address (CAL_BACKEND_SYNC (backend), cal, &attribute);
-
- cal_notify_ldap_attribute (cal, status, attribute);
-
- g_free (attribute);
-}
-
-static void
-_cal_backend_get_static_capabilities (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- char *capabilities = NULL;
-
- status = cal_backend_sync_get_cal_address (CAL_BACKEND_SYNC (backend), cal, &capabilities);
-
- cal_notify_static_capabilities (cal, status, capabilities);
-
- g_free (capabilities);
-}
-
-static void
-_cal_backend_open (CalBackend *backend, Cal *cal, gboolean only_if_exists)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_open (CAL_BACKEND_SYNC (backend), cal, only_if_exists);
-
- cal_notify_open (cal, status);
-}
-
-static void
-_cal_backend_remove (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_remove (CAL_BACKEND_SYNC (backend), cal);
-
- cal_notify_remove (cal, status);
-}
-
-static void
-_cal_backend_create_object (CalBackend *backend, Cal *cal, const char *calobj)
-{
- CalBackendSyncStatus status;
- char *uid = NULL;
-
- status = cal_backend_sync_create_object (CAL_BACKEND_SYNC (backend), cal, calobj, &uid);
-
- cal_notify_object_created (cal, status, uid, calobj);
-
- if (uid)
- g_free (uid);
-}
-
-static void
-_cal_backend_modify_object (CalBackend *backend, Cal *cal, const char *calobj, CalObjModType mod)
-{
- CalBackendSyncStatus status;
- char *old_object = NULL;
-
- status = cal_backend_sync_modify_object (CAL_BACKEND_SYNC (backend), cal,
- calobj, mod, &old_object);
-
- cal_notify_object_modified (cal, status, old_object, calobj);
-}
-
-static void
-_cal_backend_remove_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid, CalObjModType mod)
-{
- CalBackendSyncStatus status;
- char *object = NULL;
-
- status = cal_backend_sync_remove_object (CAL_BACKEND_SYNC (backend), cal, uid, rid, mod, &object);
-
- cal_notify_object_removed (cal, status, uid, object);
-}
-
-static void
-_cal_backend_discard_alarm (CalBackend *backend, Cal *cal, const char *uid, const char *auid)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_discard_alarm (CAL_BACKEND_SYNC (backend), cal, uid, auid);
-
- cal_notify_alarm_discarded (cal, status);
-}
-
-static void
-_cal_backend_receive_objects (CalBackend *backend, Cal *cal, const char *calobj)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_receive_objects (CAL_BACKEND_SYNC (backend), cal, calobj);
-
- cal_notify_objects_received (cal, status);
-}
-
-static void
-_cal_backend_send_objects (CalBackend *backend, Cal *cal, const char *calobj)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_send_objects (CAL_BACKEND_SYNC (backend), cal, calobj);
-
- cal_notify_objects_sent (cal, status);
-}
-
-static void
-_cal_backend_get_default_object (CalBackend *backend, Cal *cal)
-{
- CalBackendSyncStatus status;
- char *object = NULL;
-
- status = cal_backend_sync_get_default_object (CAL_BACKEND_SYNC (backend), cal, &object);
-
- cal_notify_default_object (cal, status, object);
-
- g_free (object);
-}
-
-static void
-_cal_backend_get_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid)
-{
- CalBackendSyncStatus status;
- char *object = NULL;
-
- status = cal_backend_sync_get_object (CAL_BACKEND_SYNC (backend), cal, uid, rid, &object);
-
- cal_notify_object (cal, status, object);
-
- g_free (object);
-}
-
-static void
-_cal_backend_get_object_list (CalBackend *backend, Cal *cal, const char *sexp)
-{
- CalBackendSyncStatus status;
- GList *objects = NULL, *l;
-
- status = cal_backend_sync_get_object_list (CAL_BACKEND_SYNC (backend), cal, sexp, &objects);
-
- cal_notify_object_list (cal, status, objects);
-
- for (l = objects; l; l = l->next)
- g_free (l->data);
- g_list_free (objects);
-}
-
-static void
-_cal_backend_get_timezone (CalBackend *backend, Cal *cal, const char *tzid)
-{
- CalBackendSyncStatus status;
- char *object = NULL;
-
- status = cal_backend_sync_get_timezone (CAL_BACKEND_SYNC (backend), cal, tzid, &object);
-
- cal_notify_timezone_requested (cal, status, object);
-}
-
-static void
-_cal_backend_add_timezone (CalBackend *backend, Cal *cal, const char *tzobj)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_add_timezone (CAL_BACKEND_SYNC (backend), cal, tzobj);
-
- cal_notify_timezone_added (cal, status, tzobj);
-}
-
-static void
-_cal_backend_set_default_timezone (CalBackend *backend, Cal *cal, const char *tzid)
-{
- CalBackendSyncStatus status;
-
- status = cal_backend_sync_set_default_timezone (CAL_BACKEND_SYNC (backend), cal, tzid);
-
- cal_notify_default_timezone_set (cal, status);
-}
-
-static void
-_cal_backend_get_changes (CalBackend *backend, Cal *cal, const char *change_id)
-{
- CalBackendSyncStatus status;
- GList *adds = NULL, *modifies = NULL, *deletes = NULL, *l;
-
- status = cal_backend_sync_get_changes (CAL_BACKEND_SYNC (backend), cal, change_id,
- &adds, &modifies, &deletes);
-
- cal_notify_changes (cal, status, adds, modifies, deletes);
-
- for (l = adds; l; l = l->next)
- g_free (l->data);
- g_list_free (adds);
-
- for (l = modifies; l; l = l->next)
- g_free (l->data);
- g_list_free (modifies);
-
- for (l = deletes; l; l = l->next)
- g_free (l->data);
- g_list_free (deletes);
-}
-
-static void
-_cal_backend_get_free_busy (CalBackend *backend, Cal *cal, GList *users, time_t start, time_t end)
-{
- CalBackendSyncStatus status;
- GList *freebusy = NULL, *l;
-
- status = cal_backend_sync_get_free_busy (CAL_BACKEND_SYNC (backend), cal, users, start, end, &freebusy);
-
- cal_notify_free_busy (cal, status, freebusy);
-
- for (l = freebusy; l; l = l->next)
- g_free (l->data);
- g_list_free (freebusy);
-}
-
-static void
-cal_backend_sync_init (CalBackendSync *backend)
-{
- CalBackendSyncPrivate *priv;
-
- priv = g_new0 (CalBackendSyncPrivate, 1);
-
- backend->priv = priv;
-}
-
-static void
-cal_backend_sync_dispose (GObject *object)
-{
- CalBackendSync *backend;
-
- backend = CAL_BACKEND_SYNC (object);
-
- if (backend->priv) {
- g_free (backend->priv);
-
- backend->priv = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-cal_backend_sync_class_init (CalBackendSyncClass *klass)
-{
- GObjectClass *object_class;
- CalBackendClass *backend_class = CAL_BACKEND_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class = (GObjectClass *) klass;
-
- backend_class->is_read_only = _cal_backend_is_read_only;
- backend_class->get_cal_address = _cal_backend_get_cal_address;
- backend_class->get_alarm_email_address = _cal_backend_get_alarm_email_address;
- backend_class->get_ldap_attribute = _cal_backend_get_ldap_attribute;
- backend_class->get_static_capabilities = _cal_backend_get_static_capabilities;
- backend_class->open = _cal_backend_open;
- backend_class->remove = _cal_backend_remove;
- backend_class->create_object = _cal_backend_create_object;
- backend_class->modify_object = _cal_backend_modify_object;
- backend_class->remove_object = _cal_backend_remove_object;
- backend_class->discard_alarm = _cal_backend_discard_alarm;
- backend_class->receive_objects = _cal_backend_receive_objects;
- backend_class->send_objects = _cal_backend_send_objects;
- backend_class->get_default_object = _cal_backend_get_default_object;
- backend_class->get_object = _cal_backend_get_object;
- backend_class->get_object_list = _cal_backend_get_object_list;
- backend_class->get_timezone = _cal_backend_get_timezone;
- backend_class->add_timezone = _cal_backend_add_timezone;
- backend_class->set_default_timezone = _cal_backend_set_default_timezone;
- backend_class->get_changes = _cal_backend_get_changes;
- backend_class->get_free_busy = _cal_backend_get_free_busy;
-
- object_class->dispose = cal_backend_sync_dispose;
-}
-
-/**
- * cal_backend_get_type:
- */
-GType
-cal_backend_sync_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (CalBackendSyncClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) cal_backend_sync_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (CalBackendSync),
- 0, /* n_preallocs */
- (GInstanceInitFunc) cal_backend_sync_init
- };
-
- type = g_type_register_static (CAL_BACKEND_TYPE, "CalBackendSync", &info, 0);
- }
-
- return type;
-}
diff --git a/calendar/pcs/cal-backend-sync.h b/calendar/pcs/cal-backend-sync.h
deleted file mode 100644
index 2953ac2afa..0000000000
--- a/calendar/pcs/cal-backend-sync.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- */
-
-#ifndef __Cal_BACKEND_SYNC_H__
-#define __Cal_BACKEND_SYNC_H__
-
-#include <glib.h>
-#include <pcs/cal-backend.h>
-#include <pcs/evolution-calendar.h>
-
-G_BEGIN_DECLS
-
-#define CAL_TYPE_BACKEND_SYNC (cal_backend_sync_get_type ())
-#define CAL_BACKEND_SYNC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAL_TYPE_BACKEND_SYNC, CalBackendSync))
-#define CAL_BACKEND_SYNC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CAL_TYPE_BACKEND_SYNC, CalBackendSyncClass))
-#define CAL_IS_BACKEND_SYNC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAL_TYPE_BACKEND_SYNC))
-#define CAL_IS_BACKEND_SYNC_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CAL_TYPE_BACKEND_SYNC))
-#define CAL_BACKEND_SYNC_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), CAL_TYPE_BACKEND_SYNC, CalBackendSyncClass))
-typedef struct _CalBackendSync CalBackendSync;
-typedef struct _CalBackendSyncClass CalBackendSyncClass;
-typedef struct _CalBackendSyncPrivate CalBackendSyncPrivate;
-
-typedef GNOME_Evolution_Calendar_CallStatus CalBackendSyncStatus;
-
-struct _CalBackendSync {
- CalBackend parent_object;
-
- CalBackendSyncPrivate *priv;
-};
-
-struct _CalBackendSyncClass {
- CalBackendClass parent_class;
-
- /* Virtual methods */
- CalBackendSyncStatus (*is_read_only_sync) (CalBackendSync *backend, Cal *cal, gboolean *read_only);
- CalBackendSyncStatus (*get_cal_address_sync) (CalBackendSync *backend, Cal *cal, char **address);
- CalBackendSyncStatus (*get_alarm_email_address_sync) (CalBackendSync *backend, Cal *cal, char **address);
- CalBackendSyncStatus (*get_ldap_attribute_sync) (CalBackendSync *backend, Cal *cal, char **attribute);
- CalBackendSyncStatus (*get_static_capabilities_sync) (CalBackendSync *backend, Cal *cal, char **capabilities);
-
- CalBackendSyncStatus (*open_sync) (CalBackendSync *backend, Cal *cal, gboolean only_if_exists);
- CalBackendSyncStatus (*remove_sync) (CalBackendSync *backend, Cal *cal);
-
- CalBackendSyncStatus (*create_object_sync) (CalBackendSync *backend, Cal *cal, const char *calobj, char **uid);
- CalBackendSyncStatus (*modify_object_sync) (CalBackendSync *backend, Cal *cal, const char *calobj, CalObjModType mod, char **old_object);
- CalBackendSyncStatus (*remove_object_sync) (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, CalObjModType mod, char **object);
-
- CalBackendSyncStatus (*discard_alarm_sync) (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid);
-
- CalBackendSyncStatus (*receive_objects_sync) (CalBackendSync *backend, Cal *cal, const char *calobj);
- CalBackendSyncStatus (*send_objects_sync) (CalBackendSync *backend, Cal *cal, const char *calobj);
-
- CalBackendSyncStatus (*get_default_object_sync) (CalBackendSync *backend, Cal *cal, char **object);
- CalBackendSyncStatus (*get_object_sync) (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, char **object);
- CalBackendSyncStatus (*get_object_list_sync) (CalBackendSync *backend, Cal *cal, const char *sexp, GList **objects);
-
- CalBackendSyncStatus (*get_timezone_sync) (CalBackendSync *backend, Cal *cal, const char *tzid, char **object);
- CalBackendSyncStatus (*add_timezone_sync) (CalBackendSync *backend, Cal *cal, const char *tzobj);
- CalBackendSyncStatus (*set_default_timezone_sync) (CalBackendSync *backend, Cal *cal, const char *tzid);
-
- CalBackendSyncStatus (*get_changes_sync) (CalBackendSync *backend, Cal *cal, const char *change_id, GList **adds, GList **modifies, GList **deletes);
- CalBackendSyncStatus (*get_freebusy_sync) (CalBackendSync *backend, Cal *cal, GList *users, time_t start, time_t end, GList **freebusy);
-
- /* Padding for future expansion */
- void (*_cal_reserved0) (void);
- void (*_cal_reserved1) (void);
- void (*_cal_reserved2) (void);
- void (*_cal_reserved3) (void);
- void (*_cal_reserved4) (void);
-
-};
-
-typedef CalBackendSync * (*CalBackendSyncFactoryFn) (void);
-GType cal_backend_sync_get_type (void);
-CalBackendSyncStatus cal_backend_sync_is_read_only (CalBackendSync *backend,
- Cal *cal,
- gboolean *read_only);
-CalBackendSyncStatus cal_backend_sync_get_cal_address (CalBackendSync *backend,
- Cal *cal,
- char **address);
-CalBackendSyncStatus cal_backend_sync_get_alarm_email_address (CalBackendSync *backend,
- Cal *cal,
- char **address);
-CalBackendSyncStatus cal_backend_sync_get_ldap_attribute (CalBackendSync *backend,
- Cal *cal,
- char **attribute);
-CalBackendSyncStatus cal_backend_sync_get_static_capabilities (CalBackendSync *backend,
- Cal *cal,
- char **capabiliites);
-CalBackendSyncStatus cal_backend_sync_open (CalBackendSync *backend,
- Cal *cal,
- gboolean only_if_exists);
-CalBackendSyncStatus cal_backend_sync_remove (CalBackendSync *backend,
- Cal *cal);
-CalBackendSyncStatus cal_backend_sync_create_object (CalBackendSync *backend,
- Cal *cal,
- const char *calobj,
- char **uid);
-CalBackendSyncStatus cal_backend_sync_modify_object (CalBackendSync *backend,
- Cal *cal,
- const char *calobj,
- CalObjModType mod,
- char **old_object);
-CalBackendSyncStatus cal_backend_sync_remove_object (CalBackendSync *backend,
- Cal *cal,
- const char *uid,
- const char *rid,
- CalObjModType mod,
- char **object);
-CalBackendSyncStatus cal_backend_sync_discard_alarm (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid);
-
-CalBackendSyncStatus cal_backend_sync_receive_objects (CalBackendSync *backend,
- Cal *cal,
- const char *calobj);
-CalBackendSyncStatus cal_backend_sync_send_objects (CalBackendSync *backend,
- Cal *cal,
- const char *calobj);
-CalBackendSyncStatus cal_backend_sync_get_default_object (CalBackendSync *backend,
- Cal *cal,
- char **object);
-
-CalBackendSyncStatus cal_backend_sync_get_object (CalBackendSync *backend,
- Cal *cal,
- const char *uid,
- const char *rid,
- char **object);
-
-CalBackendSyncStatus cal_backend_sync_get_object_list (CalBackendSync *backend,
- Cal *cal,
- const char *sexp,
- GList **objects);
-
-CalBackendSyncStatus cal_backend_sync_get_timezone (CalBackendSync *backend, Cal *cal, const char *tzid, char **object);
-CalBackendSyncStatus cal_backend_sync_add_timezone (CalBackendSync *backend, Cal *cal, const char *tzobj);
-CalBackendSyncStatus cal_backend_sync_set_default_timezone (CalBackendSync *backend, Cal *cal, const char *tzid);
-
-CalBackendSyncStatus cal_backend_sync_get_changes (CalBackendSync *backend, Cal *cal, const char *change_id, GList **adds, GList **modifies, GList **deletes);
-CalBackendSyncStatus cal_backend_sync_get_free_busy (CalBackendSync *backend, Cal *cal, GList *users, time_t start, time_t end, GList **freebusy);
-
-G_END_DECLS
-
-#endif /* ! __CAL_BACKEND_SYNC_H__ */
diff --git a/calendar/pcs/cal-backend-util.c b/calendar/pcs/cal-backend-util.c
deleted file mode 100644
index 86bf761878..0000000000
--- a/calendar/pcs/cal-backend-util.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - generic backend class
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Authors: Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include "cal-backend-util.h"
-#include <e-util/e-account-list.h>
-
-static EAccountList *accounts;
-
-gboolean
-cal_backend_mail_account_get_default (EConfigListener *db,
- char **address,
- char **name)
-{
- const EAccount *account;
-
- if (accounts == NULL)
- accounts = e_account_list_new(gconf_client_get_default());
-
- account = e_account_list_get_default(accounts);
- if (account) {
- *address = g_strdup(account->id->address);
- *name = g_strdup(account->id->name);
- }
-
- return account != NULL;
-}
-
-gboolean
-cal_backend_mail_account_is_valid (EConfigListener *db, char *user, char **name)
-{
- const EAccount *account;
-
- if (accounts == NULL)
- accounts = e_account_list_new(gconf_client_get_default());
-
- account = e_account_list_find(accounts, E_ACCOUNT_FIND_ID_ADDRESS, user);
- if (account)
- *name = g_strdup(account->id->name);
-
- return account != NULL;
-}
diff --git a/calendar/pcs/cal-backend-util.h b/calendar/pcs/cal-backend-util.h
deleted file mode 100644
index 228179b8c7..0000000000
--- a/calendar/pcs/cal-backend-util.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - generic backend class
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Authors: Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_UTIL_H
-#define CAL_BACKEND_UTIL_H
-
-#include <e-util/e-config-listener.h>
-#include <pcs/cal-backend.h>
-
-G_BEGIN_DECLS
-
-/*
- * Functions for accessing mail configuration
- */
-
-gboolean cal_backend_mail_account_get_default (EConfigListener *db,
- char **address, char **name);
-gboolean cal_backend_mail_account_is_valid (EConfigListener *db,
- char *user, char **name);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
deleted file mode 100644
index df2f7408e4..0000000000
--- a/calendar/pcs/cal-backend.c
+++ /dev/null
@@ -1,1199 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - generic backend class
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * JP Rosevear <jpr@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlmemory.h>
-
-#include "cal-backend.h"
-#include "libversit/vcc.h"
-
-
-
-/* A category that exists in some of the objects of the calendar */
-typedef struct {
- /* Category name, also used as the key in the categories hash table */
- char *name;
-
- /* Number of objects that have this category */
- int refcount;
-} CalBackendCategory;
-
-/* Private part of the CalBackend structure */
-struct _CalBackendPrivate {
- /* The uri for this backend */
- char *uri;
-
- /* The kind of components for this backend */
- icalcomponent_kind kind;
-
- /* List of Cal objects */
- GMutex *clients_mutex;
- GList *clients;
-
- GMutex *queries_mutex;
- EList *queries;
-
- /* Hash table of live categories, temporary hash of
- * added/removed categories, and idle handler for sending
- * category_changed.
- */
- GHashTable *categories;
- GHashTable *changed_categories;
- guint category_idle_id;
-};
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_URI,
- PROP_KIND
-};
-
-/* Signal IDs */
-enum {
- LAST_CLIENT_GONE,
- OPENED,
- REMOVED,
- LAST_SIGNAL
-};
-static guint cal_backend_signals[LAST_SIGNAL];
-
-static void cal_backend_class_init (CalBackendClass *class);
-static void cal_backend_init (CalBackend *backend);
-static void cal_backend_finalize (GObject *object);
-
-static void notify_categories_changed (CalBackend *backend);
-
-#define CLASS(backend) (CAL_BACKEND_CLASS (G_OBJECT_GET_CLASS (backend)))
-
-static GObjectClass *parent_class;
-
-
-
-/**
- * cal_backend_get_type:
- * @void:
- *
- * Registers the #CalBackend class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CalBackend class.
- **/
-GType
-cal_backend_get_type (void)
-{
- static GType cal_backend_type = 0;
-
- if (!cal_backend_type) {
- static GTypeInfo info = {
- sizeof (CalBackendClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_class_init,
- NULL, NULL,
- sizeof (CalBackend),
- 0,
- (GInstanceInitFunc) cal_backend_init,
- };
- cal_backend_type = g_type_register_static (G_TYPE_OBJECT, "CalBackend", &info, 0);
- }
-
- return cal_backend_type;
-}
-
-static void
-cal_backend_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- CalBackend *backend;
- CalBackendPrivate *priv;
-
- backend = CAL_BACKEND (object);
- priv = backend->priv;
-
- switch (property_id) {
- case PROP_URI:
- g_free (priv->uri);
- priv->uri = g_value_dup_string (value);
- break;
- case PROP_KIND:
- priv->kind = g_value_get_ulong (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-cal_backend_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- CalBackend *backend;
- CalBackendPrivate *priv;
-
- backend = CAL_BACKEND (object);
- priv = backend->priv;
-
- switch (property_id) {
- case PROP_URI:
- g_value_set_string (value, cal_backend_get_uri (backend));
- break;
- case PROP_KIND:
- g_value_set_ulong (value, cal_backend_get_kind (backend));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-/* Class initialization function for the calendar backend */
-static void
-cal_backend_class_init (CalBackendClass *class)
-{
- GObjectClass *object_class;
-
- parent_class = (GObjectClass *) g_type_class_peek_parent (class);
-
- object_class = (GObjectClass *) class;
-
- object_class->set_property = cal_backend_set_property;
- object_class->get_property = cal_backend_get_property;
- object_class->finalize = cal_backend_finalize;
-
- g_object_class_install_property (object_class, PROP_URI,
- g_param_spec_string ("uri", NULL, NULL, "",
- G_PARAM_READABLE | G_PARAM_WRITABLE
- | G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class, PROP_KIND,
- g_param_spec_ulong ("kind", NULL, NULL,
- ICAL_NO_COMPONENT, ICAL_XLICMIMEPART_COMPONENT,
- ICAL_NO_COMPONENT,
- G_PARAM_READABLE | G_PARAM_WRITABLE
- | G_PARAM_CONSTRUCT_ONLY));
- cal_backend_signals[LAST_CLIENT_GONE] =
- g_signal_new ("last_client_gone",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalBackendClass, last_client_gone),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- cal_backend_signals[OPENED] =
- g_signal_new ("opened",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalBackendClass, opened),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
- cal_backend_signals[REMOVED] =
- g_signal_new ("removed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalBackendClass, removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- class->last_client_gone = NULL;
- class->opened = NULL;
- class->obj_updated = NULL;
-
- class->get_cal_address = NULL;
- class->get_alarm_email_address = NULL;
- class->get_static_capabilities = NULL;
- class->open = NULL;
- class->is_loaded = NULL;
- class->is_read_only = NULL;
- class->start_query = NULL;
- class->get_mode = NULL;
- class->set_mode = NULL;
- class->get_object = NULL;
- class->get_default_object = NULL;
- class->get_object_list = NULL;
- class->get_free_busy = NULL;
- class->get_changes = NULL;
- class->discard_alarm = NULL;
- class->create_object = NULL;
- class->modify_object = NULL;
- class->remove_object = NULL;
- class->receive_objects = NULL;
- class->send_objects = NULL;
- class->get_timezone = NULL;
- class->add_timezone = NULL;
- class->set_default_timezone = NULL;
-}
-
-/* Object initialization func for the calendar backend */
-void
-cal_backend_init (CalBackend *backend)
-{
- CalBackendPrivate *priv;
-
- priv = g_new0 (CalBackendPrivate, 1);
- backend->priv = priv;
-
- priv->clients = NULL;
- priv->clients_mutex = g_mutex_new ();
-
- /* FIXME bonobo_object_ref/unref? */
- priv->queries = e_list_new((EListCopyFunc) g_object_ref, (EListFreeFunc) g_object_unref, NULL);
- priv->queries_mutex = g_mutex_new ();
-
- priv->categories = g_hash_table_new (g_str_hash, g_str_equal);
- priv->changed_categories = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-/* Used from g_hash_table_foreach(), frees a CalBackendCategory structure */
-static void
-free_category_cb (gpointer key, gpointer value, gpointer data)
-{
- CalBackendCategory *c = value;
-
- g_free (c->name);
- g_free (c);
-}
-
-static gboolean
-prune_changed_categories (gpointer key, gpointer value, gpointer data)
-{
- CalBackendCategory *c = value;
-
- if (!c->refcount)
- free_category_cb (key, value, data);
- return TRUE;
-}
-
-void
-cal_backend_finalize (GObject *object)
-{
- CalBackend *backend = (CalBackend *)object;
- CalBackendPrivate *priv;
-
- priv = backend->priv;
-
- g_assert (priv->clients == NULL);
-
- g_object_unref (priv->queries);
-
- g_hash_table_foreach_remove (priv->changed_categories, prune_changed_categories, NULL);
- g_hash_table_destroy (priv->changed_categories);
-
- g_hash_table_foreach (priv->categories, free_category_cb, NULL);
- g_hash_table_destroy (priv->categories);
-
- g_mutex_free (priv->clients_mutex);
- g_mutex_free (priv->queries_mutex);
-
- if (priv->category_idle_id)
- g_source_remove (priv->category_idle_id);
-
- g_free (priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-/**
- * cal_backend_get_uri:
- * @backend: A calendar backend.
- *
- * Queries the URI of a calendar backend, which must already have an open
- * calendar.
- *
- * Return value: The URI where the calendar is stored.
- **/
-const char *
-cal_backend_get_uri (CalBackend *backend)
-{
- CalBackendPrivate *priv;
-
- g_return_val_if_fail (backend != NULL, NULL);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
-
- priv = backend->priv;
-
- return priv->uri;
-}
-
-icalcomponent_kind
-cal_backend_get_kind (CalBackend *backend)
-{
- CalBackendPrivate *priv;
-
- g_return_val_if_fail (backend != NULL, ICAL_NO_COMPONENT);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), ICAL_NO_COMPONENT);
-
- priv = backend->priv;
-
- return priv->kind;
-}
-
-static void
-cal_destroy_cb (gpointer data, GObject *where_cal_was)
-{
- CalBackend *backend = CAL_BACKEND (data);
-
- cal_backend_remove_client (backend, (Cal *) where_cal_was);
-}
-
-static void
-listener_died_cb (gpointer cnx, gpointer data)
-{
- Cal *cal = CAL (data);
-
- cal_backend_remove_client (cal_get_backend (cal), cal);
-}
-
-static void
-last_client_gone (CalBackend *backend)
-{
- g_signal_emit (backend, cal_backend_signals[LAST_CLIENT_GONE], 0);
-}
-
-void
-cal_backend_add_client (CalBackend *backend, Cal *cal)
-{
- CalBackendPrivate *priv;
-
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = backend->priv;
-
- bonobo_object_set_immortal (BONOBO_OBJECT (cal), TRUE);
-
- g_object_weak_ref (G_OBJECT (cal), cal_destroy_cb, backend);
-
- ORBit_small_listen_for_broken (cal_get_listener (cal), G_CALLBACK (listener_died_cb), cal);
-
- g_mutex_lock (priv->clients_mutex);
- priv->clients = g_list_append (priv->clients, cal);
- g_mutex_unlock (priv->clients_mutex);
-
- /* Tell the new client about the list of categories.
- * (Ends up telling all the other clients too, but *shrug*.)
- */
- /* FIXME This doesn't seem right at all */
- notify_categories_changed (backend);
-}
-
-void
-cal_backend_remove_client (CalBackend *backend, Cal *cal)
-{
- CalBackendPrivate *priv;
-
- /* XXX this needs a bit more thinking wrt the mutex - we
- should be holding it when we check to see if clients is
- NULL */
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = backend->priv;
-
- /* Disconnect */
- g_mutex_lock (priv->clients_mutex);
- priv->clients = g_list_remove (priv->clients, cal);
- g_mutex_unlock (priv->clients_mutex);
-
- /* When all clients go away, notify the parent factory about it so that
- * it may decide whether to kill the backend or not.
- */
- if (!priv->clients)
- last_client_gone (backend);
-}
-
-void
-cal_backend_add_query (CalBackend *backend, Query *query)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_mutex_lock (backend->priv->queries_mutex);
-
- e_list_append (backend->priv->queries, query);
-
- g_mutex_unlock (backend->priv->queries_mutex);
-}
-
-EList *
-cal_backend_get_queries (CalBackend *backend)
-{
- g_return_val_if_fail (backend != NULL, NULL);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
-
- return g_object_ref (backend->priv->queries);
-}
-
-
-/**
- * cal_backend_get_cal_address:
- * @backend: A calendar backend.
- *
- * Queries the cal address associated with a calendar backend, which
- * must already have an open calendar.
- *
- * Return value: The cal address associated with the calendar.
- **/
-void
-cal_backend_get_cal_address (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_cal_address != NULL);
- (* CLASS (backend)->get_cal_address) (backend, cal);
-}
-
-void
-cal_backend_get_alarm_email_address (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_alarm_email_address != NULL);
- (* CLASS (backend)->get_alarm_email_address) (backend, cal);
-}
-
-void
-cal_backend_get_ldap_attribute (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_ldap_attribute != NULL);
- (* CLASS (backend)->get_ldap_attribute) (backend, cal);
-}
-
-void
-cal_backend_get_static_capabilities (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_static_capabilities != NULL);
- (* CLASS (backend)->get_static_capabilities) (backend, cal);
-}
-
-/**
- * cal_backend_open:
- * @backend: A calendar backend.
- * @uristr: URI that contains the calendar data.
- * @only_if_exists: Whether the calendar should be opened only if it already
- * exists. If FALSE, a new calendar will be created when the specified @uri
- * does not exist.
- *
- * Opens a calendar backend with data from a calendar stored at the specified
- * URI.
- *
- * Return value: An operation status code.
- **/
-void
-cal_backend_open (CalBackend *backend, Cal *cal, gboolean only_if_exists)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->open != NULL);
- (* CLASS (backend)->open) (backend, cal, only_if_exists);
-}
-
-void
-cal_backend_remove (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->remove != NULL);
- (* CLASS (backend)->remove) (backend, cal);
-}
-
-/**
- * cal_backend_is_loaded:
- * @backend: A calendar backend.
- *
- * Queries whether a calendar backend has been loaded yet.
- *
- * Return value: TRUE if the backend has been loaded with data, FALSE
- * otherwise.
- **/
-gboolean
-cal_backend_is_loaded (CalBackend *backend)
-{
- gboolean result;
-
- g_return_val_if_fail (backend != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
-
- g_assert (CLASS (backend)->is_loaded != NULL);
- result = (* CLASS (backend)->is_loaded) (backend);
-
- return result;
-}
-
-/**
- * cal_backend_is_read_only
- * @backend: A calendar backend.
- *
- * Queries whether a calendar backend is read only or not.
- *
- * Return value: TRUE if the calendar is read only, FALSE otherwise.
- */
-void
-cal_backend_is_read_only (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->is_read_only != NULL);
- (* CLASS (backend)->is_read_only) (backend, cal);
-}
-
-void
-cal_backend_start_query (CalBackend *backend, Query *query)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->start_query != NULL);
- (* CLASS (backend)->start_query) (backend, query);
-}
-
-/**
- * cal_backend_get_mode:
- * @backend: A calendar backend.
- *
- * Queries whether a calendar backend is connected remotely.
- *
- * Return value: The current mode the calendar is in
- **/
-CalMode
-cal_backend_get_mode (CalBackend *backend)
-{
- CalMode result;
-
- g_return_val_if_fail (backend != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
-
- g_assert (CLASS (backend)->get_mode != NULL);
- result = (* CLASS (backend)->get_mode) (backend);
-
- return result;
-}
-
-
-/**
- * cal_backend_set_mode:
- * @backend: A calendar backend
- * @mode: Mode to change to
- *
- * Sets the mode of the calendar
- *
- **/
-void
-cal_backend_set_mode (CalBackend *backend, CalMode mode)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->set_mode != NULL);
- (* CLASS (backend)->set_mode) (backend, mode);
-}
-
-void
-cal_backend_get_default_object (CalBackend *backend, Cal *cal)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_default_object != NULL);
- (* CLASS (backend)->get_default_object) (backend, cal);
-}
-
-/**
- * cal_backend_get_object:
- * @backend: A calendar backend.
- * @uid: Unique identifier for a calendar object.
- * @rid: ID for the object's recurrence to get.
- *
- * Queries a calendar backend for a calendar object based on its unique
- * identifier and its recurrence ID (if a recurrent appointment).
- *
- * Return value: The string representation of a complete calendar wrapping the
- * the sought object, or NULL if no object had the specified UID.
- **/
-void
-cal_backend_get_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (uid != NULL);
-
- g_assert (CLASS (backend)->get_object != NULL);
- (* CLASS (backend)->get_object) (backend, cal, uid, rid);
-}
-
-/**
- * cal_backend_get_object_list:
- * @backend:
- * @type:
- *
- *
- *
- * Return value:
- **/
-void
-cal_backend_get_object_list (CalBackend *backend, Cal *cal, const char *sexp)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
-
- g_assert (CLASS (backend)->get_object_list != NULL);
- return (* CLASS (backend)->get_object_list) (backend, cal, sexp);
-}
-
-/**
- * cal_backend_get_free_busy:
- * @backend: A calendar backend.
- * @users: List of users to get free/busy information for.
- * @start: Start time for query.
- * @end: End time for query.
- *
- * Gets a free/busy object for the given time interval
- *
- * Return value: a list of CalObj's
- **/
-void
-cal_backend_get_free_busy (CalBackend *backend, Cal *cal, GList *users, time_t start, time_t end)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (start != -1 && end != -1);
- g_return_if_fail (start <= end);
-
- g_assert (CLASS (backend)->get_free_busy != NULL);
- (* CLASS (backend)->get_free_busy) (backend, cal, users, start, end);
-}
-
-/**
- * cal_backend_get_changes:
- * @backend: A calendar backend
- * @change_id: A unique uid for the callers change list
- *
- * Builds a sequence of objects and the type of change that occurred on them since
- * the last time the give change_id was seen
- *
- * Return value: A list of the objects that changed and the type of change
- **/
-void
-cal_backend_get_changes (CalBackend *backend, Cal *cal, const char *change_id)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (change_id != NULL);
-
- g_assert (CLASS (backend)->get_changes != NULL);
- (* CLASS (backend)->get_changes) (backend, cal, change_id);
-}
-
-/**
- * cal_backend_discard_alarm
- * @backend: A calendar backend.
- * @uid: UID of the component to discard the alarm from.
- * @auid: Alarm ID.
- *
- * Discards an alarm from the given component. This allows the specific backend
- * to do whatever is needed to really discard the alarm.
- *
- **/
-void
-cal_backend_discard_alarm (CalBackend *backend, Cal *cal, const char *uid, const char *auid)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (uid != NULL);
- g_return_if_fail (auid != NULL);
-
- g_assert (CLASS (backend)->discard_alarm != NULL);
- (* CLASS (backend)->discard_alarm) (backend, cal, uid, auid);
-}
-
-void
-cal_backend_create_object (CalBackend *backend, Cal *cal, const char *calobj)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (calobj != NULL);
-
- g_assert (CLASS (backend)->create_object != NULL);
- (* CLASS (backend)->create_object) (backend, cal, calobj);
-}
-
-void
-cal_backend_modify_object (CalBackend *backend, Cal *cal, const char *calobj, CalObjModType mod)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (calobj != NULL);
-
- g_assert (CLASS (backend)->modify_object != NULL);
- (* CLASS (backend)->modify_object) (backend, cal, calobj, mod);
-}
-
-/**
- * cal_backend_remove_object:
- * @backend: A calendar backend.
- * @uid: Unique identifier of the object to remove.
- * @rid: A recurrence ID.
- *
- * Removes an object in a calendar backend. The backend will notify all of its
- * clients about the change.
- *
- **/
-void
-cal_backend_remove_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid, CalObjModType mod)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (uid != NULL);
-
- g_assert (CLASS (backend)->remove_object != NULL);
- (* CLASS (backend)->remove_object) (backend, cal, uid, rid, mod);
-}
-
-void
-cal_backend_receive_objects (CalBackend *backend, Cal *cal, const char *calobj)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (calobj != NULL);
-
- g_assert (CLASS (backend)->receive_objects != NULL);
- return (* CLASS (backend)->receive_objects) (backend, cal, calobj);
-}
-
-void
-cal_backend_send_objects (CalBackend *backend, Cal *cal, const char *calobj)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (calobj != NULL);
-
- g_assert (CLASS (backend)->send_objects != NULL);
- return (* CLASS (backend)->send_objects) (backend, cal, calobj);
-}
-
-/**
- * cal_backend_get_timezone:
- * @backend: A calendar backend.
- * @tzid: Unique identifier of a VTIMEZONE object. Note that this must not be
- * NULL.
- *
- * Returns the icaltimezone* corresponding to the TZID, or NULL if the TZID
- * can't be found.
- *
- * Returns: The icaltimezone* corresponding to the given TZID, or NULL.
- **/
-void
-cal_backend_get_timezone (CalBackend *backend, Cal *cal, const char *tzid)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (tzid != NULL);
-
- g_assert (CLASS (backend)->get_timezone != NULL);
- (* CLASS (backend)->get_timezone) (backend, cal, tzid);
-}
-
-/**
- * cal_backend_set_default_timezone:
- * @backend: A calendar backend.
- * @tzid: The TZID identifying the timezone.
- *
- * Sets the default timezone for the calendar, which is used to resolve
- * DATE and floating DATE-TIME values.
- *
- * Returns: TRUE if the VTIMEZONE data for the timezone was found, or FALSE if
- * not.
- **/
-void
-cal_backend_set_default_timezone (CalBackend *backend, Cal *cal, const char *tzid)
-{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (tzid != NULL);
-
- g_assert (CLASS (backend)->set_default_timezone != NULL);
- (* CLASS (backend)->set_default_timezone) (backend, cal, tzid);
-}
-
-/**
- * cal_backend_add_timezone
- * @backend: A calendar backend.
- * @tzobj: The timezone object, in a string.
- *
- * Add a timezone object to the given backend.
- *
- * Returns: TRUE if successful, or FALSE if not.
- */
-void
-cal_backend_add_timezone (CalBackend *backend, Cal *cal, const char *tzobj)
-{
- g_return_if_fail (IS_CAL_BACKEND (backend));
- g_return_if_fail (tzobj != NULL);
- g_return_if_fail (CLASS (backend)->add_timezone != NULL);
-
- (* CLASS (backend)->add_timezone) (backend, cal, tzobj);
-}
-
-icaltimezone *
-cal_backend_internal_get_default_timezone (CalBackend *backend)
-{
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
- g_return_val_if_fail (CLASS (backend)->internal_get_default_timezone != NULL, NULL);
-
- return (* CLASS (backend)->internal_get_default_timezone) (backend);
-}
-
-icaltimezone *
-cal_backend_internal_get_timezone (CalBackend *backend, const char *tzid)
-{
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
- g_return_val_if_fail (tzid != NULL, NULL);
- g_return_val_if_fail (CLASS (backend)->internal_get_timezone != NULL, NULL);
-
- return (* CLASS (backend)->internal_get_timezone) (backend, tzid);
-}
-
-/**
- * cal_backend_notify_object_created:
- * @backend: A calendar backend.
- * @calobj: iCalendar representation of new object
- *
- * Notifies each of the backend's listeners about a new object.
- *
- * cal_notify_object_created() calls this for you. You only need to
- * call cal_backend_notify_object_created() yourself to report objects
- * created by non-PCS clients.
- **/
-void
-cal_backend_notify_object_created (CalBackend *backend, const char *calobj)
-{
- EList *queries;
- EIterator *iter;
- Query *query;
-
- queries = cal_backend_get_queries (backend);
- iter = e_list_get_iterator (queries);
-
- while (e_iterator_is_valid (iter)) {
- query = QUERY (e_iterator_get (iter));
-
- bonobo_object_ref (query);
- if (query_object_matches (query, calobj))
- query_notify_objects_added_1 (query, calobj);
- bonobo_object_unref (query);
-
- e_iterator_next (iter);
- }
- g_object_unref (iter);
- g_object_unref (queries);
-}
-
-/**
- * cal_backend_notify_object_modified:
- * @backend: A calendar backend.
- * @old_object: iCalendar representation of the original form of the object
- * @object: iCalendar representation of the new form of the object
- *
- * Notifies each of the backend's listeners about a modified object.
- *
- * cal_notify_object_modified() calls this for you. You only need to
- * call cal_backend_notify_object_modified() yourself to report objects
- * modified by non-PCS clients.
- **/
-void
-cal_backend_notify_object_modified (CalBackend *backend,
- const char *old_object, const char *object)
-{
- EList *queries;
- EIterator *iter;
- Query *query;
- gboolean old_match, new_match;
-
- queries = cal_backend_get_queries (backend);
- iter = e_list_get_iterator (queries);
-
- while (e_iterator_is_valid (iter)) {
- query = QUERY (e_iterator_get (iter));
-
- bonobo_object_ref (query);
-
- old_match = query_object_matches (query, old_object);
- new_match = query_object_matches (query, object);
- if (old_match && new_match)
- query_notify_objects_modified_1 (query, object);
- else if (new_match)
- query_notify_objects_added_1 (query, object);
- else /* if (old_match) */ {
- icalcomponent *comp;
-
- comp = icalcomponent_new_from_string ((char *)old_object);
- query_notify_objects_removed_1 (query, icalcomponent_get_uid (comp));
- icalcomponent_free (comp);
- }
-
- bonobo_object_unref (query);
-
- e_iterator_next (iter);
- }
- g_object_unref (iter);
- g_object_unref (queries);
-}
-
-/**
- * cal_backend_notify_object_removed:
- * @backend: A calendar backend.
- * @uid: the UID of the removed object
- * @old_object: iCalendar representation of the removed object
- *
- * Notifies each of the backend's listeners about a removed object.
- *
- * cal_notify_object_removed() calls this for you. You only need to
- * call cal_backend_notify_object_removed() yourself to report objects
- * removed by non-PCS clients.
- **/
-void
-cal_backend_notify_object_removed (CalBackend *backend, const char *uid,
- const char *old_object)
-{
- EList *queries;
- EIterator *iter;
- Query *query;
-
- queries = cal_backend_get_queries (backend);
- iter = e_list_get_iterator (queries);
-
- while (e_iterator_is_valid (iter)) {
- query = QUERY (e_iterator_get (iter));
-
- bonobo_object_ref (query);
- if (query_object_matches (query, old_object))
- query_notify_objects_removed_1 (query, uid);
- bonobo_object_unref (query);
-
- e_iterator_next (iter);
- }
- g_object_unref (iter);
- g_object_unref (queries);
-}
-
-/**
- * cal_backend_notify_mode:
- * @backend: A calendar backend.
- * @status: Status of the mode set
- * @mode: the current mode
- *
- * Notifies each of the backend's listeners about the results of a
- * setMode call.
- **/
-void
-cal_backend_notify_mode (CalBackend *backend,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode)
-{
- CalBackendPrivate *priv = backend->priv;
- GList *l;
-
- for (l = priv->clients; l; l = l->next)
- cal_notify_mode (l->data, status, mode);
-}
-
-/**
- * cal_backend_notify_error:
- * @backend: A calendar backend.
- * @message: Error message
- *
- * Notifies each of the backend's listeners about an error
- **/
-void
-cal_backend_notify_error (CalBackend *backend, const char *message)
-{
- CalBackendPrivate *priv = backend->priv;
- GList *l;
-
- for (l = priv->clients; l; l = l->next)
- cal_notify_error (l->data, message);
-}
-
-static void
-add_category_cb (gpointer name, gpointer category, gpointer data)
-{
- GNOME_Evolution_Calendar_StringSeq *seq = data;
-
- seq->_buffer[seq->_length++] = CORBA_string_dup (name);
-}
-
-static void
-notify_categories_changed (CalBackend *backend)
-{
- CalBackendPrivate *priv = backend->priv;
- GNOME_Evolution_Calendar_StringSeq *seq;
- GList *l;
-
- /* Build the sequence of category names */
- seq = GNOME_Evolution_Calendar_StringSeq__alloc ();
- seq->_length = 0;
- seq->_maximum = g_hash_table_size (priv->categories);
- seq->_buffer = CORBA_sequence_CORBA_string_allocbuf (seq->_maximum);
- CORBA_sequence_set_release (seq, TRUE);
-
- g_hash_table_foreach (priv->categories, add_category_cb, seq);
-
- /* Notify the clients */
- for (l = priv->clients; l; l = l->next)
- cal_notify_categories_changed (l->data, seq);
-
- CORBA_free (seq);
-}
-
-static gboolean
-idle_notify_categories_changed (gpointer data)
-{
- CalBackend *backend = CAL_BACKEND (data);
- CalBackendPrivate *priv = backend->priv;
-
- if (g_hash_table_size (priv->changed_categories)) {
- notify_categories_changed (backend);
- g_hash_table_foreach_remove (priv->changed_categories, prune_changed_categories, NULL);
- }
-
- priv->category_idle_id = 0;
-
- return FALSE;
-}
-
-/**
- * cal_backend_ref_categories:
- * @backend: A calendar backend
- * @categories: a list of categories
- *
- * Adds 1 to the refcount of each of the named categories. If any of
- * the categories are new, clients will be notified of the updated
- * category list at idle time.
- **/
-void
-cal_backend_ref_categories (CalBackend *backend, GSList *categories)
-{
- CalBackendPrivate *priv;
- CalBackendCategory *c;
- const char *name;
-
- priv = backend->priv;
-
- while (categories) {
- name = categories->data;
- c = g_hash_table_lookup (priv->categories, name);
-
- if (c)
- c->refcount++;
- else {
- /* See if it was recently removed */
-
- c = g_hash_table_lookup (priv->changed_categories, name);
- if (c && c->refcount == 0) {
- /* Move it back to the set of live categories */
- g_hash_table_remove (priv->changed_categories, c->name);
-
- c->refcount = 1;
- g_hash_table_insert (priv->categories, c->name, c);
- } else {
- /* Create a new category */
- c = g_new (CalBackendCategory, 1);
- c->name = g_strdup (name);
- c->refcount = 1;
- g_hash_table_insert (priv->categories, c->name, c);
- g_hash_table_insert (priv->changed_categories, c->name, c);
- }
- }
-
- categories = categories->next;
- }
-
- if (g_hash_table_size (priv->changed_categories) &&
- !priv->category_idle_id)
- priv->category_idle_id = g_idle_add (idle_notify_categories_changed, backend);
-}
-
-/**
- * cal_backend_unref_categories:
- * @backend: A calendar backend
- * @categories: a list of categories
- *
- * Subtracts 1 from the refcount of each of the named categories. If
- * any of the refcounts go down to 0, clients will be notified of the
- * updated category list at idle time.
- **/
-void
-cal_backend_unref_categories (CalBackend *backend, GSList *categories)
-{
- CalBackendPrivate *priv;
- CalBackendCategory *c;
- const char *name;
-
- priv = backend->priv;
-
- while (categories) {
- name = categories->data;
- c = g_hash_table_lookup (priv->categories, name);
-
- if (c) {
- g_assert (c != NULL);
- g_assert (c->refcount > 0);
-
- c->refcount--;
-
- if (c->refcount == 0) {
- g_hash_table_remove (priv->categories, c->name);
- g_hash_table_insert (priv->changed_categories, c->name, c);
- }
- }
-
- categories = categories->next;
- }
-
- if (g_hash_table_size (priv->changed_categories) &&
- !priv->category_idle_id)
- priv->category_idle_id = g_idle_add (idle_notify_categories_changed, backend);
-}
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
deleted file mode 100644
index 5b4e59a6a8..0000000000
--- a/calendar/pcs/cal-backend.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - generic backend class
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_BACKEND_H
-#define CAL_BACKEND_H
-
-#include <e-util/e-list.h>
-#include <cal-util/cal-util.h>
-#include <cal-util/cal-component.h>
-#include "pcs/evolution-calendar.h"
-#include "pcs/cal-common.h"
-#include "pcs/cal.h"
-#include "pcs/query.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_BACKEND_TYPE (cal_backend_get_type ())
-#define CAL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_TYPE, CalBackend))
-#define CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \
- CalBackendClass))
-#define IS_CAL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_TYPE))
-#define IS_CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE))
-
-typedef struct _CalBackendPrivate CalBackendPrivate;
-
-struct _CalBackend {
- GObject object;
-
- CalBackendPrivate *priv;
-};
-
-struct _CalBackendClass {
- GObjectClass parent_class;
-
- /* Notification signals */
- void (* last_client_gone) (CalBackend *backend);
- void (* cal_added) (CalBackend *backend, Cal *cal);
-
- gboolean (* is_loaded) (CalBackend *backend);
-
- /* FIXME What to pass back here */
- void (* opened) (CalBackend *backend, int status);
- void (* removed) (CalBackend *backend, int status);
- void (* obj_updated) (CalBackend *backend, const char *uid);
-
- /* Virtual methods */
- void (* is_read_only) (CalBackend *backend, Cal *cal);
- void (* get_cal_address) (CalBackend *backend, Cal *cal);
- void (* get_alarm_email_address) (CalBackend *backend, Cal *cal);
- void (* get_ldap_attribute) (CalBackend *backend, Cal *cal);
- void (* get_static_capabilities) (CalBackend *backend, Cal *cal);
-
- void (* open) (CalBackend *backend, Cal *cal, gboolean only_if_exists);
- void (* remove) (CalBackend *backend, Cal *cal);
-
- /* Object related virtual methods */
- void (* create_object) (CalBackend *backend, Cal *cal, const char *calobj);
- void (* modify_object) (CalBackend *backend, Cal *cal, const char *calobj, CalObjModType mod);
- void (* remove_object) (CalBackend *backend, Cal *cal, const char *uid, const char *rid, CalObjModType mod);
-
- void (* discard_alarm) (CalBackend *backend, Cal *cal, const char *uid, const char *auid);
-
- void (* receive_objects) (CalBackend *backend, Cal *cal, const char *calobj);
- void (* send_objects) (CalBackend *backend, Cal *cal, const char *calobj);
-
- void (* get_default_object) (CalBackend *backend, Cal *cal);
- void (* get_object) (CalBackend *backend, Cal *cal, const char *uid, const char *rid);
- void (* get_object_list) (CalBackend *backend, Cal *cal, const char *sexp);
-
- /* Timezone related virtual methods */
- void (* get_timezone) (CalBackend *backend, Cal *cal, const char *tzid);
- void (* add_timezone) (CalBackend *backend, Cal *cal, const char *object);
- void (* set_default_timezone) (CalBackend *backend, Cal *cal, const char *tzid);
-
- void (* start_query) (CalBackend *backend, Query *query);
-
- /* Mode relate virtual methods */
- CalMode (* get_mode) (CalBackend *backend);
- void (* set_mode) (CalBackend *backend, CalMode mode);
-
- void (* get_free_busy) (CalBackend *backend, Cal *cal, GList *users, time_t start, time_t end);
- void (* get_changes) (CalBackend *backend, Cal *cal, const char *change_id);
-
- /* Internal methods for use only in the pcs */
- icaltimezone *(* internal_get_default_timezone) (CalBackend *backend);
- icaltimezone *(* internal_get_timezone) (CalBackend *backend, const char *tzid);
-};
-
-GType cal_backend_get_type (void);
-
-const char *cal_backend_get_uri (CalBackend *backend);
-icalcomponent_kind cal_backend_get_kind (CalBackend *backend);
-
-void cal_backend_add_client (CalBackend *backend, Cal *cal);
-void cal_backend_remove_client (CalBackend *backend, Cal *cal);
-
-void cal_backend_add_query (CalBackend *backend, Query *query);
-EList *cal_backend_get_queries (CalBackend *backend);
-
-void cal_backend_is_read_only (CalBackend *backend, Cal *cal);
-void cal_backend_get_cal_address (CalBackend *backend, Cal *cal);
-void cal_backend_get_alarm_email_address (CalBackend *backend, Cal *cal);
-void cal_backend_get_ldap_attribute (CalBackend *backend, Cal *cal);
-void cal_backend_get_static_capabilities (CalBackend *backend, Cal *cal);
-
-void cal_backend_open (CalBackend *backend, Cal *cal, gboolean only_if_exists);
-void cal_backend_remove (CalBackend *backend, Cal *cal);
-
-void cal_backend_create_object (CalBackend *backend, Cal *cal, const char *calobj);
-void cal_backend_modify_object (CalBackend *backend, Cal *cal, const char *calobj, CalObjModType mod);
-void cal_backend_remove_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid, CalObjModType mod);
-
-void cal_backend_discard_alarm (CalBackend *backend, Cal *cal, const char *uid, const char *auid);
-
-void cal_backend_receive_objects (CalBackend *backend, Cal *cal, const char *calobj);
-void cal_backend_send_objects (CalBackend *backend, Cal *cal, const char *calobj);
-
-void cal_backend_get_default_object (CalBackend *backend, Cal *cal);
-void cal_backend_get_object (CalBackend *backend, Cal *cal, const char *uid, const char *rid);
-void cal_backend_get_object_list (CalBackend *backend, Cal *cal, const char *sexp);
-
-gboolean cal_backend_is_loaded (CalBackend *backend);
-
-void cal_backend_start_query (CalBackend *backend, Query *query);
-
-CalMode cal_backend_get_mode (CalBackend *backend);
-void cal_backend_set_mode (CalBackend *backend, CalMode mode);
-
-void cal_backend_get_timezone (CalBackend *backend, Cal *cal, const char *tzid);
-void cal_backend_add_timezone (CalBackend *backend, Cal *cal, const char *object);
-void cal_backend_set_default_timezone (CalBackend *backend, Cal *cal, const char *tzid);
-
-void cal_backend_get_changes (CalBackend *backend, Cal *cal, const char *change_id);
-void cal_backend_get_free_busy (CalBackend *backend, Cal *cal, GList *users, time_t start, time_t end);
-
-icaltimezone* cal_backend_internal_get_default_timezone (CalBackend *backend);
-icaltimezone* cal_backend_internal_get_timezone (CalBackend *backend, const char *tzid);
-
-void cal_backend_last_client_gone (CalBackend *backend);
-
-void cal_backend_notify_object_created (CalBackend *backend, const char *calobj);
-void cal_backend_notify_object_modified (CalBackend *backend, const char *old_object, const char *object);
-void cal_backend_notify_object_removed (CalBackend *backend, const char *uid, const char *old_object);
-
-void cal_backend_notify_mode (CalBackend *backend,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode);
-void cal_backend_notify_error (CalBackend *backend, const char *message);
-void cal_backend_ref_categories (CalBackend *backend, GSList *categories);
-void cal_backend_unref_categories (CalBackend *backend, GSList *categories);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-common.h b/calendar/pcs/cal-common.h
deleted file mode 100644
index 5a588c93c8..0000000000
--- a/calendar/pcs/cal-common.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Evolution calendar server - common declarations
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_COMMON_H
-#define CAL_COMMON_H
-
-#include <glib/gmacros.h>
-
-G_BEGIN_DECLS
-
-
-
-typedef struct _CalBackend CalBackend;
-typedef struct _CalBackendClass CalBackendClass;
-
-typedef struct _Cal Cal;
-typedef struct _CalClass CalClass;
-
-typedef struct _Query Query;
-typedef struct _QueryClass QueryClass;
-
-typedef struct _CalBackendObjectSExp CalBackendObjectSExp;
-typedef struct _CalBackendObjectSExpClass CalBackendObjectSExpClass;
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c
deleted file mode 100644
index 2f72ec5911..0000000000
--- a/calendar/pcs/cal-factory.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/* Evolution calendar factory
- *
- * Copyright (C) 2000-2003 Ximian, Inc.
- *
- * Authors:
- * Federico Mena-Quintero <federico@ximian.com>
- * JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-main.h>
-#include "e-util/e-url.h"
-#include "evolution-calendar.h"
-#include "cal-backend.h"
-#include "cal.h"
-#include "cal-factory.h"
-
-#define PARENT_TYPE BONOBO_TYPE_OBJECT
-#define DEFAULT_CAL_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_CalendarFactory"
-
-static BonoboObjectClass *parent_class;
-
-/* Private part of the CalFactory structure */
-struct _CalFactoryPrivate {
- /* Hash table from URI method strings to GType * for backend class types */
- GHashTable *methods;
-
- /* Hash table from GnomeVFSURI structures to CalBackend objects */
- GHashTable *backends;
-
- /* OAFIID of the factory */
- char *iid;
-
- /* Whether we have been registered with OAF yet */
- guint registered : 1;
-};
-
-/* Signal IDs */
-enum SIGNALS {
- LAST_CALENDAR_GONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-/* Opening calendars */
-static icalcomponent_kind
-calobjtype_to_icalkind (const GNOME_Evolution_Calendar_CalObjType type)
-{
- switch (type){
- case GNOME_Evolution_Calendar_TYPE_EVENT:
- return ICAL_VEVENT_COMPONENT;
- case GNOME_Evolution_Calendar_TYPE_TODO:
- return ICAL_VTODO_COMPONENT;
- case GNOME_Evolution_Calendar_TYPE_JOURNAL:
- return ICAL_VJOURNAL_COMPONENT;
- }
-
- return ICAL_NO_COMPONENT;
-}
-
-static GType
-get_backend_type (GHashTable *methods, const char *method, icalcomponent_kind kind)
-{
- GHashTable *kinds;
- GType type;
-
- kinds = g_hash_table_lookup (methods, method);
- if (!kinds)
- return 0;
-
- type = GPOINTER_TO_INT (g_hash_table_lookup (kinds, GINT_TO_POINTER (kind)));
-
- return type;
-}
-
-/* Looks up a calendar backend in a factory's hash table of uri->cal. If
- * *non-NULL, orig_uri_return will be set to point to the original key in the
- * *hash table.
- */
-static CalBackend *
-lookup_backend (CalFactory *factory, const char *uristr)
-{
- CalFactoryPrivate *priv;
- EUri *uri;
- CalBackend *backend;
- char *tmp;
-
- priv = factory->priv;
-
- uri = e_uri_new (uristr);
- if (!uri)
- return NULL;
-
- tmp = e_uri_to_string (uri, FALSE);
- backend = g_hash_table_lookup (priv->backends, tmp);
- g_free (tmp);
- e_uri_free (uri);
-
- return backend;
-}
-
-/* Callback used when a backend loses its last connected client */
-static void
-backend_last_client_gone_cb (CalBackend *backend, gpointer data)
-{
- CalFactory *factory;
- CalFactoryPrivate *priv;
- CalBackend *ret_backend;
- const char *uristr;
-
- fprintf (stderr, "backend_last_client_gone_cb() called!\n");
-
- factory = CAL_FACTORY (data);
- priv = factory->priv;
-
- /* Remove the backend from the hash table */
-
- uristr = cal_backend_get_uri (backend);
- g_assert (uristr != NULL);
-
- ret_backend = lookup_backend (factory, uristr);
- g_assert (ret_backend != NULL);
- g_assert (ret_backend == backend);
-
- g_hash_table_remove (priv->backends, uristr);
-
- /* Notify upstream if there are no more backends */
-
- if (g_hash_table_size (priv->backends) == 0)
- g_signal_emit (G_OBJECT (factory), signals[LAST_CALENDAR_GONE], 0);
-}
-
-
-
-static GNOME_Evolution_Calendar_Cal
-impl_CalFactory_getCal (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- const GNOME_Evolution_Calendar_CalObjType type,
- const GNOME_Evolution_Calendar_Listener listener,
- CORBA_Environment *ev)
-{
- CalFactory *factory;
- CalFactoryPrivate *priv;
- Cal *cal = CORBA_OBJECT_NIL;
- CalBackend *backend;
- CORBA_Environment ev2;
- GNOME_Evolution_Calendar_Listener listener_copy;
- GType backend_type;
- EUri *uri;
- char *uri_string;
-
- factory = CAL_FACTORY (bonobo_object_from_servant (servant));
- priv = factory->priv;
-
- /* Parse the uri */
- uri = e_uri_new (str_uri);
- if (!uri) {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI);
-
- return CORBA_OBJECT_NIL;
- }
- uri_string = e_uri_to_string (uri, FALSE);
-
- /* Find the associated backend type (if any) */
- backend_type = get_backend_type (priv->methods, uri->protocol, calobjtype_to_icalkind (type));
- if (!backend_type) {
- /* FIXME Distinguish between method and kind failures? */
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod);
- goto cleanup;
- }
-
- /* Duplicate the listener object */
- CORBA_exception_init (&ev2);
- listener_copy = CORBA_Object_duplicate (listener, &ev2);
-
- if (BONOBO_EX (&ev2)) {
- g_warning (G_STRLOC ": could not duplicate the listener");
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_NilListener);
- CORBA_exception_free (&ev2);
- goto cleanup;
- }
- CORBA_exception_free (&ev2);
-
- /* Look for an existing backend */
- backend = lookup_backend (factory, uri_string);
- if (!backend) {
- /* There was no existing backend, create a new one */
- backend = g_object_new (backend_type, "uri", uri_string, "kind", calobjtype_to_icalkind (type), NULL);
- if (!backend) {
- g_warning (G_STRLOC ": could not instantiate backend");
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod);
- goto cleanup;
- }
-
- /* Track the backend */
- g_hash_table_insert (priv->backends, g_strdup (uri_string), backend);
-
- g_signal_connect (G_OBJECT (backend), "last_client_gone",
- G_CALLBACK (backend_last_client_gone_cb),
- factory);
- }
-
- /* Create the corba calendar */
- cal = cal_new (backend, uri_string, listener);
- if (!cal) {
- g_warning (G_STRLOC ": could not create the corba calendar");
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod);
- goto cleanup;
- }
-
- /* Let the backend know about its clients corba clients */
- cal_backend_add_client (backend, cal);
-
- cleanup:
- e_uri_free (uri);
- g_free (uri_string);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (cal), ev);
-}
-
-
-
-/**
- * cal_factory_new:
- * @void:
- *
- * Creates a new #CalFactory object.
- *
- * Return value: A newly-created #CalFactory, or NULL if its corresponding CORBA
- * object could not be created.
- **/
-CalFactory *
-cal_factory_new (void)
-{
- CalFactory *factory;
-
- factory = g_object_new (CAL_FACTORY_TYPE,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
-
- return factory;
-}
-
-/* Destroy handler for the calendar */
-static void
-cal_factory_finalize (GObject *object)
-{
- CalFactory *factory;
- CalFactoryPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_FACTORY (object));
-
- factory = CAL_FACTORY (object);
- priv = factory->priv;
-
- g_hash_table_destroy (priv->methods);
- priv->methods = NULL;
-
- /* Should we assert that there are no more backends? */
- g_hash_table_destroy (priv->backends);
- priv->backends = NULL;
-
- if (priv->registered) {
- bonobo_activation_active_server_unregister (priv->iid, BONOBO_OBJREF (factory));
- priv->registered = FALSE;
- }
- g_free (priv->iid);
-
- g_free (priv);
- factory->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Class initialization function for the calendar factory */
-static void
-cal_factory_class_init (CalFactoryClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
- POA_GNOME_Evolution_Calendar_CalFactory__epv *epv = &klass->epv;
-
- parent_class = g_type_class_peek_parent (klass);
-
- signals[LAST_CALENDAR_GONE] =
- g_signal_new ("last_calendar_gone",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalFactoryClass, last_calendar_gone),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /* Class method overrides */
- object_class->finalize = cal_factory_finalize;
-
- /* Epv methods */
- epv->getCal = impl_CalFactory_getCal;
-}
-
-/* Object initialization function for the calendar factory */
-static void
-cal_factory_init (CalFactory *factory, CalFactoryClass *klass)
-{
- CalFactoryPrivate *priv;
-
- priv = g_new0 (CalFactoryPrivate, 1);
- factory->priv = priv;
-
- priv->methods = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free, (GDestroyNotify) g_hash_table_destroy);
- priv->backends = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref);
- priv->registered = FALSE;
-}
-
-BONOBO_TYPE_FUNC_FULL (CalFactory,
- GNOME_Evolution_Calendar_CalFactory,
- PARENT_TYPE,
- cal_factory);
-
-/**
- * cal_factory_register_storage:
- * @factory: A calendar factory.
- * @iid: OAFIID for the factory to be registered.
- *
- * Registers a calendar factory with the OAF object activation daemon. This
- * function must be called before any clients can activate the factory.
- *
- * Return value: TRUE on success, FALSE otherwise.
- **/
-gboolean
-cal_factory_register_storage (CalFactory *factory, const char *iid)
-{
- CalFactoryPrivate *priv;
- Bonobo_RegistrationResult result;
- char *tmp_iid;
-
- g_return_val_if_fail (factory != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_FACTORY (factory), FALSE);
-
- priv = factory->priv;
-
- g_return_val_if_fail (!priv->registered, FALSE);
-
- /* if iid is NULL, use the default factory OAFIID */
- if (iid)
- tmp_iid = g_strdup (iid);
- else
- tmp_iid = g_strdup (DEFAULT_CAL_FACTORY_OAF_ID);
-
- result = bonobo_activation_active_server_register (tmp_iid, BONOBO_OBJREF (factory));
-
- switch (result) {
- case Bonobo_ACTIVATION_REG_SUCCESS:
- priv->registered = TRUE;
- priv->iid = tmp_iid;
- return TRUE;
-
- case Bonobo_ACTIVATION_REG_NOT_LISTED:
- g_warning (G_STRLOC ": cannot register the calendar factory (not listed)");
- break;
-
- case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
- g_warning (G_STRLOC ": cannot register the calendar factory (already active)");
- break;
-
- case Bonobo_ACTIVATION_REG_ERROR:
- default:
- g_warning (G_STRLOC ": cannot register the calendar factory (generic error)");
- break;
- }
-
- g_free (tmp_iid);
-
- return FALSE;
-}
-
-/**
- * cal_factory_register_method:
- * @factory: A calendar factory.
- * @method: Method for the URI, i.e. "http", "file", etc.
- * @backend_type: Class type of the backend to create for this @method.
- *
- * Registers the type of a #CalBackend subclass that will be used to handle URIs
- * with a particular method. When the factory is asked to open a particular
- * URI, it will look in its list of registered methods and create a backend of
- * the appropriate type.
- **/
-void
-cal_factory_register_method (CalFactory *factory, const char *method, icalcomponent_kind kind, GType backend_type)
-{
- CalFactoryPrivate *priv;
- char *method_str;
- GHashTable *kinds;
- GType type;
-
- g_return_if_fail (factory != NULL);
- g_return_if_fail (IS_CAL_FACTORY (factory));
- g_return_if_fail (method != NULL);
- g_return_if_fail (backend_type != 0);
- g_return_if_fail (g_type_is_a (backend_type, CAL_BACKEND_TYPE));
-
- priv = factory->priv;
-
- method_str = g_ascii_strdown (method, -1);
-
- kinds = g_hash_table_lookup (priv->methods, method_str);
- if (kinds) {
- type = GPOINTER_TO_INT (g_hash_table_lookup (kinds, GINT_TO_POINTER (kind)));
- if (type) {
- g_warning (G_STRLOC ": method `%s' already registered", method_str);
- g_free (method_str);
-
- return;
- }
- } else {
- kinds = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
- g_hash_table_insert (priv->methods, method_str, kinds);
- }
-
- g_hash_table_insert (kinds, GINT_TO_POINTER (kind), GINT_TO_POINTER (backend_type));
-}
-
-/**
- * cal_factory_get_n_backends
- * @factory: A calendar factory.
- *
- * Get the number of backends currently active in the given factory.
- *
- * Returns: the number of backends.
- */
-int
-cal_factory_get_n_backends (CalFactory *factory)
-{
- CalFactoryPrivate *priv;
-
- g_return_val_if_fail (IS_CAL_FACTORY (factory), 0);
-
- priv = factory->priv;
- return g_hash_table_size (priv->backends);
-}
-
-/* Frees a uri/backend pair from the backends hash table */
-static void
-dump_backend (gpointer key, gpointer value, gpointer data)
-{
- char *uri;
- CalBackend *backend;
-
- uri = key;
- backend = value;
-
- g_message (" %s: %p", uri, backend);
-}
-
-void
-cal_factory_dump_active_backends (CalFactory *factory)
-{
- CalFactoryPrivate *priv;
-
- g_message ("Active PCS backends");
-
- priv = factory->priv;
- g_hash_table_foreach (priv->backends, dump_backend, NULL);
-}
diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h
deleted file mode 100644
index d6d2b895ed..0000000000
--- a/calendar/pcs/cal-factory.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Evolution calendar factory
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_FACTORY_H
-#define CAL_FACTORY_H
-
-#include <bonobo/bonobo-object.h>
-#include <libical/ical.h>
-
-#include "pcs/evolution-calendar.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_FACTORY_TYPE (cal_factory_get_type ())
-#define CAL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_FACTORY_TYPE, CalFactory))
-#define CAL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \
- CalFactoryClass))
-#define IS_CAL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_FACTORY_TYPE))
-#define IS_CAL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE))
-
-typedef struct _CalFactory CalFactory;
-typedef struct _CalFactoryClass CalFactoryClass;
-
-typedef struct _CalFactoryPrivate CalFactoryPrivate;
-
-struct _CalFactory {
- BonoboObject object;
-
- /* Private data */
- CalFactoryPrivate *priv;
-};
-
-struct _CalFactoryClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_CalFactory__epv epv;
-
- /* Notification signals */
- void (* last_calendar_gone) (CalFactory *factory);
-};
-
-GType cal_factory_get_type (void);
-CalFactory *cal_factory_new (void);
-
-gboolean cal_factory_register_storage (CalFactory *factory, const char *iid);
-void cal_factory_register_method (CalFactory *factory,
- const char *method,
- icalcomponent_kind kind,
- GType backend_type);
-int cal_factory_get_n_backends (CalFactory *factory);
-void cal_factory_dump_active_backends (CalFactory *factory);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
deleted file mode 100644
index aec1591da3..0000000000
--- a/calendar/pcs/cal.c
+++ /dev/null
@@ -1,1244 +0,0 @@
-/* Evolution calendar client interface object
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libical/ical.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-exception.h>
-#include "cal-backend.h"
-#include "cal.h"
-
-#define PARENT_TYPE BONOBO_TYPE_OBJECT
-
-static BonoboObjectClass *parent_class;
-
-/* Private part of the Cal structure */
-struct _CalPrivate {
- /* Our backend */
- CalBackend *backend;
-
- /* Listener on the client we notify */
- GNOME_Evolution_Calendar_Listener listener;
-};
-
-/* Cal::get_uri method */
-static CORBA_char *
-impl_Cal_get_uri (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
- const char *str_uri;
- CORBA_char *str_uri_copy;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- str_uri = cal_backend_get_uri (priv->backend);
- str_uri_copy = CORBA_string_dup (str_uri);
-
- return str_uri_copy;
-}
-
-static void
-impl_Cal_open (PortableServer_Servant servant,
- CORBA_boolean only_if_exists,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_open (priv->backend, cal, only_if_exists);
-}
-
-static void
-impl_Cal_remove (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_remove (priv->backend, cal);
-}
-
-/* Cal::isReadOnly method */
-static void
-impl_Cal_isReadOnly (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_is_read_only (priv->backend, cal);
-}
-
-/* Cal::getEmailAddress method */
-static void
-impl_Cal_getCalAddress (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_cal_address (priv->backend, cal);
-}
-
-/* Cal::get_alarm_email_address method */
-static void
-impl_Cal_getAlarmEmailAddress (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_alarm_email_address (priv->backend, cal);
-}
-
-/* Cal::get_ldap_attribute method */
-static void
-impl_Cal_getLdapAttribute (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_ldap_attribute (priv->backend, cal);
-}
-
-/* Cal::getSchedulingInformation method */
-static void
-impl_Cal_getStaticCapabilities (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_static_capabilities (priv->backend, cal);
-}
-
-/* Cal::setMode method */
-static void
-impl_Cal_setMode (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalMode mode,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_set_mode (priv->backend, mode);
-}
-
-static void
-impl_Cal_getDefaultObject (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_default_object (priv->backend, cal);
-}
-
-/* Cal::getObject method */
-static void
-impl_Cal_getObject (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_char *rid,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_object (priv->backend, cal, uid, rid);
-}
-
-/* Cal::getObjectsInRange method */
-static void
-impl_Cal_getObjectList (PortableServer_Servant servant,
- const CORBA_char *query,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_object_list (priv->backend, cal, query);
-}
-
-/* Cal::getChanges method */
-static void
-impl_Cal_getChanges (PortableServer_Servant servant,
- const CORBA_char *change_id,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_changes (priv->backend, cal, change_id);
-}
-
-/* Cal::getFreeBusy method */
-static void
-impl_Cal_getFreeBusy (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_UserList *user_list,
- const GNOME_Evolution_Calendar_Time_t start,
- const GNOME_Evolution_Calendar_Time_t end,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
- GList *users = NULL;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- /* convert the CORBA user list to a GList */
- if (user_list) {
- int i;
-
- for (i = 0; i < user_list->_length; i++)
- users = g_list_append (users, user_list->_buffer[i]);
- }
-
- /* call the backend's get_free_busy method */
- cal_backend_get_free_busy (priv->backend, cal, users, start, end);
-}
-
-/* Cal::discardAlarm method */
-static void
-impl_Cal_discardAlarm (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_char *auid,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_discard_alarm (priv->backend, cal, uid, auid);
-}
-
-static void
-impl_Cal_createObject (PortableServer_Servant servant,
- const CORBA_char *calobj,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_create_object (priv->backend, cal, calobj);
-}
-
-static void
-impl_Cal_modifyObject (PortableServer_Servant servant,
- const CORBA_char *calobj,
- const GNOME_Evolution_Calendar_CalObjModType mod,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_modify_object (priv->backend, cal, calobj, mod);
-}
-
-/* Cal::removeObject method */
-static void
-impl_Cal_removeObject (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_char *rid,
- const GNOME_Evolution_Calendar_CalObjModType mod,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_remove_object (priv->backend, cal, uid, rid, mod);
-}
-
-static void
-impl_Cal_receiveObjects (PortableServer_Servant servant, const CORBA_char *calobj, CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_receive_objects (priv->backend, cal, calobj);
-}
-
-static void
-impl_Cal_sendObjects (PortableServer_Servant servant, const CORBA_char *calobj, CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_send_objects (priv->backend, cal, calobj);
-}
-
-/* Cal::getQuery implementation */
-static void
-impl_Cal_getQuery (PortableServer_Servant servant,
- const CORBA_char *sexp,
- GNOME_Evolution_Calendar_QueryListener ql,
- CORBA_Environment *ev)
-{
-
- Cal *cal;
- CalPrivate *priv;
- Query *query;
- CalBackendObjectSExp *obj_sexp;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- /* we handle this entirely here, since it doesn't require any
- backend involvement now that we have pas_book_view_start to
- actually kick off the search. */
-
- obj_sexp = cal_backend_object_sexp_new (sexp);
- if (!obj_sexp) {
- cal_notify_query (cal, GNOME_Evolution_Calendar_InvalidQuery, NULL);
-
- return;
- }
-
- query = query_new (priv->backend, ql, obj_sexp);
- if (!query) {
- g_object_unref (obj_sexp);
- cal_notify_query (cal, GNOME_Evolution_Calendar_OtherError, NULL);
-
- return;
- }
-
- cal_backend_add_query (priv->backend, query);
-
- cal_notify_query (cal, GNOME_Evolution_Calendar_Success, query);
-
- g_object_unref (query);
-}
-
-
-/* Cal::getTimezone method */
-static void
-impl_Cal_getTimezone (PortableServer_Servant servant,
- const CORBA_char *tzid,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_get_timezone (priv->backend, cal, tzid);
-}
-
-/* Cal::addTimezone method */
-static void
-impl_Cal_addTimezone (PortableServer_Servant servant,
- const CORBA_char *tz,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_add_timezone (priv->backend, cal, tz);
-}
-
-/* Cal::setDefaultTimezone method */
-static void
-impl_Cal_setDefaultTimezone (PortableServer_Servant servant,
- const CORBA_char *tzid,
- CORBA_Environment *ev)
-{
- Cal *cal;
- CalPrivate *priv;
-
- cal = CAL (bonobo_object_from_servant (servant));
- priv = cal->priv;
-
- cal_backend_set_default_timezone (priv->backend, cal, tzid);
-}
-
-/**
- * cal_construct:
- * @cal: A calendar client interface.
- * @corba_cal: CORBA object for the calendar.
- * @backend: Calendar backend that this @cal presents an interface to.
- * @listener: Calendar listener for notification.
- *
- * Constructs a calendar client interface object by binding the corresponding
- * CORBA object to it. The calendar interface is bound to the specified
- * @backend, and will notify the @listener about changes to the calendar.
- *
- * Return value: The same object as the @cal argument.
- **/
-Cal *
-cal_construct (Cal *cal,
- CalBackend *backend,
- GNOME_Evolution_Calendar_Listener listener)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (IS_CAL (cal), NULL);
- g_return_val_if_fail (backend != NULL, NULL);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
-
- priv = cal->priv;
-
- CORBA_exception_init (&ev);
- priv->listener = CORBA_Object_duplicate (listener, &ev);
- if (BONOBO_EX (&ev)) {
- g_message ("cal_construct: could not duplicate the listener");
- priv->listener = CORBA_OBJECT_NIL;
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- priv->backend = backend;
-
- return cal;
-}
-
-/**
- * cal_new:
- * @backend: A calendar backend.
- * @listener: A calendar listener.
- *
- * Creates a new calendar client interface object and binds it to the specified
- * @backend and @listener objects.
- *
- * Return value: A newly-created #Cal calendar client interface object, or NULL
- * if its corresponding CORBA object could not be created.
- **/
-Cal *
-cal_new (CalBackend *backend, const char *uri, GNOME_Evolution_Calendar_Listener listener)
-{
- Cal *cal, *retval;
-
- g_return_val_if_fail (backend != NULL, NULL);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
-
- cal = CAL (g_object_new (CAL_TYPE,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL));
-
- retval = cal_construct (cal, backend, listener);
- if (!retval) {
- g_message (G_STRLOC ": could not construct the calendar client interface");
- bonobo_object_unref (BONOBO_OBJECT (cal));
- return NULL;
- }
-
- return retval;
-}
-
-CalBackend *
-cal_get_backend (Cal *cal)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (IS_CAL (cal), NULL);
-
- return cal->priv->backend;
-}
-
-GNOME_Evolution_Calendar_Listener
-cal_get_listener (Cal *cal)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (IS_CAL (cal), NULL);
-
- return cal->priv->listener;
-}
-
-/* Destroy handler for the calendar */
-static void
-cal_finalize (GObject *object)
-{
- Cal *cal;
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL (object));
-
- cal = CAL (object);
- priv = cal->priv;
-
- priv->backend = NULL;
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (priv->listener, &ev);
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not release the listener");
-
- priv->listener = NULL;
- CORBA_exception_free (&ev);
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-
-/* Class initialization function for the calendar */
-static void
-cal_class_init (CalClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
- POA_GNOME_Evolution_Calendar_Cal__epv *epv = &klass->epv;
-
- parent_class = g_type_class_peek_parent (klass);
-
- /* Class method overrides */
- object_class->finalize = cal_finalize;
-
- /* Epv methods */
- epv->_get_uri = impl_Cal_get_uri;
- epv->open = impl_Cal_open;
- epv->remove = impl_Cal_remove;
- epv->isReadOnly = impl_Cal_isReadOnly;
- epv->getCalAddress = impl_Cal_getCalAddress;
- epv->getAlarmEmailAddress = impl_Cal_getAlarmEmailAddress;
- epv->getLdapAttribute = impl_Cal_getLdapAttribute;
- epv->getStaticCapabilities = impl_Cal_getStaticCapabilities;
- epv->setMode = impl_Cal_setMode;
- epv->getDefaultObject = impl_Cal_getDefaultObject;
- epv->getObject = impl_Cal_getObject;
- epv->getTimezone = impl_Cal_getTimezone;
- epv->addTimezone = impl_Cal_addTimezone;
- epv->setDefaultTimezone = impl_Cal_setDefaultTimezone;
- epv->getObjectList = impl_Cal_getObjectList;
- epv->getChanges = impl_Cal_getChanges;
- epv->getFreeBusy = impl_Cal_getFreeBusy;
- epv->discardAlarm = impl_Cal_discardAlarm;
- epv->createObject = impl_Cal_createObject;
- epv->modifyObject = impl_Cal_modifyObject;
- epv->removeObject = impl_Cal_removeObject;
- epv->receiveObjects = impl_Cal_receiveObjects;
- epv->sendObjects = impl_Cal_sendObjects;
- epv->getQuery = impl_Cal_getQuery;
-}
-
-
-/* Object initialization function for the calendar */
-static void
-cal_init (Cal *cal, CalClass *klass)
-{
- CalPrivate *priv;
-
- priv = g_new0 (CalPrivate, 1);
- cal->priv = priv;
-
- priv->listener = CORBA_OBJECT_NIL;
-}
-
-BONOBO_TYPE_FUNC_FULL (Cal, GNOME_Evolution_Calendar_Cal, PARENT_TYPE, cal);
-
-void
-cal_notify_read_only (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, gboolean read_only)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyReadOnly (priv->listener, status, read_only, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of read only");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_cal_address (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *address)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyCalAddress (priv->listener, status, address ? address : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of cal address");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_alarm_email_address (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *address)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyAlarmEmailAddress (priv->listener, status, address ? address : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of alarm address");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_ldap_attribute (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *attribute)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyLDAPAttribute (priv->listener, status, attribute ? attribute : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of ldap attribute");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_static_capabilities (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *capabilities)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyStaticCapabilities (priv->listener, status,
- capabilities ? capabilities : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of static capabilities");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_open (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyCalOpened (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of open");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_remove (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyCalRemoved (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of remove");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_object_created (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *uid, const char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- if (status == GNOME_Evolution_Calendar_Success)
- cal_backend_notify_object_created (priv->backend, object);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyObjectCreated (priv->listener, status, uid ? uid : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of object creation");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_object_modified (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *old_object, const char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- if (status == GNOME_Evolution_Calendar_Success)
- cal_backend_notify_object_modified (priv->backend, old_object, object);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyObjectModified (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of object creation");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_object_removed (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *uid, const char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- if (status == GNOME_Evolution_Calendar_Success)
- cal_backend_notify_object_removed (priv->backend, uid, object);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyObjectRemoved (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of object removal");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_objects_received (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyObjectsReceived (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of objects received");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_alarm_discarded (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyAlarmDiscarded (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of alarm discarded");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_objects_sent (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyObjectsSent (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of objects sent");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_default_object (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Listener_notifyDefaultObjectRequested (priv->listener, status,
- object ? object : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of default object");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_object (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_Listener_notifyObjectRequested (priv->listener, status,
- object ? object : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of object");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_object_list (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *objects)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_stringlist seq;
- GList *l;
- int i;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- seq._maximum = g_list_length (objects);
- seq._length = 0;
- seq._buffer = GNOME_Evolution_Calendar_stringlist_allocbuf (seq._maximum);
-
- for (l = objects, i = 0; l; l = l->next, i++) {
- seq._buffer[i] = CORBA_string_dup (l->data);
- seq._length++;
- }
-
- GNOME_Evolution_Calendar_Listener_notifyObjectListRequested (priv->listener, status, &seq, &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of object list");
-
- CORBA_exception_free (&ev);
-
- CORBA_free(seq._buffer);
-}
-
-void
-cal_notify_query (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, Query *query)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyQuery (priv->listener, status, BONOBO_OBJREF (query), &ev);
-
- if (BONOBO_EX (&ev))
- g_message (G_STRLOC ": could not notify the listener of query");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_timezone_requested (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *object)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyTimezoneRequested (priv->listener, status, object ? object : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of timezone requested");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_timezone_added (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *tzid)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyTimezoneAdded (priv->listener, status, tzid ? tzid : "", &ev);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of timezone added");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_default_timezone_set (Cal *cal, GNOME_Evolution_Calendar_CallStatus status)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyDefaultTimezoneSet (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of default timezone set");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_changes (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- GList *adds, GList *modifies, GList *deletes)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_CalObjChangeSeq seq;
- GList *l;
- int n, i;
-
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- n = g_list_length (adds) + g_list_length (modifies) + g_list_length (deletes);
- seq._maximum = n;
- seq._length = n;
- seq._buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObjChange_allocbuf (n);
-
- i = 0;
- for (l = adds; l; i++, l = l->next) {
- GNOME_Evolution_Calendar_CalObjChange *change = &seq._buffer[i];
-
- change->calobj = CORBA_string_dup (l->data);
- change->type = GNOME_Evolution_Calendar_ADDED;
- }
-
- for (l = modifies; l; i++, l = l->next) {
- GNOME_Evolution_Calendar_CalObjChange *change = &seq._buffer[i];
-
- change->calobj = CORBA_string_dup (l->data);
- change->type = GNOME_Evolution_Calendar_MODIFIED;
- }
-
- for (l = deletes; l; i++, l = l->next) {
- GNOME_Evolution_Calendar_CalObjChange *change = &seq._buffer[i];
-
- change->calobj = CORBA_string_dup (l->data);
- change->type = GNOME_Evolution_Calendar_DELETED;
- }
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyDefaultTimezoneSet (priv->listener, status, &ev);
-
- CORBA_free (seq._buffer);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of default timezone set");
-
- CORBA_exception_free (&ev);
-}
-
-void
-cal_notify_free_busy (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *freebusy)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_CalObjSeq seq;
- GList *l;
- int n, i;
-
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- n = g_list_length (freebusy);
- seq._maximum = n;
- seq._length = n;
- seq._buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObj_allocbuf (n);
-
- for (i = 0, l = freebusy; l; i++, l = l->next)
- seq._buffer[i] = CORBA_string_dup (l->data);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyDefaultTimezoneSet (priv->listener, status, &ev);
-
- CORBA_free (seq._buffer);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of freebusy");
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * cal_notify_mode:
- * @cal: A calendar client interface.
- * @status: Status of the mode set.
- * @mode: The current mode.
- *
- * Notifys the listener of the results of a setMode call.
- **/
-void
-cal_notify_mode (Cal *cal,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyCalSetMode (priv->listener, status, mode, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("cal_notify_mode(): could not notify the listener "
- "about a mode change");
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * cal_notify_error
- * @cal: A calendar client interface.
- * @message: Error message.
- *
- * Notify a calendar client of an error occurred in the backend.
- */
-void
-cal_notify_error (Cal *cal, const char *message)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
- g_return_if_fail (message != NULL);
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyErrorOccurred (priv->listener, (char *) message, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("cal_notify_remove(): could not notify the listener "
- "about a removed object");
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * cal_notify_categories_changed:
- * @cal: A calendar client interface.
- * @categories: List of categories.
- *
- * Notifies a listener attached to a calendar client interface object about the
- * current set of categories in a calendar backend.
- **/
-void
-cal_notify_categories_changed (Cal *cal, GNOME_Evolution_Calendar_StringSeq *categories)
-{
- CalPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (IS_CAL (cal));
- g_return_if_fail (categories != NULL);
-
- priv = cal->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Listener_notifyCategoriesChanged (priv->listener, categories, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("cal_notify_categories_changed(): Could not notify the listener "
- "about the current set of categories");
-
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h
deleted file mode 100644
index f3d35f1f5f..0000000000
--- a/calendar/pcs/cal.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Evolution calendar client interface object
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: Federico Mena-Quintero <federico@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef CAL_H
-#define CAL_H
-
-#include <bonobo/bonobo-object.h>
-#include "pcs/evolution-calendar.h"
-#include "pcs/cal-common.h"
-#include "pcs/query.h"
-
-G_BEGIN_DECLS
-
-
-
-#define CAL_TYPE (cal_get_type ())
-#define CAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_TYPE, Cal))
-#define CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass))
-#define IS_CAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_TYPE))
-#define IS_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_TYPE))
-
-typedef struct _CalPrivate CalPrivate;
-
-struct _Cal {
- BonoboObject object;
-
- /* Private data */
- CalPrivate *priv;
-};
-
-struct _CalClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_Cal__epv epv;
-};
-
-GType cal_get_type (void);
-
-Cal *cal_construct (Cal *cal,
- CalBackend *backend,
- GNOME_Evolution_Calendar_Listener listener);
-
-Cal *cal_new (CalBackend *backend, const char *uri, GNOME_Evolution_Calendar_Listener listener);
-
-CalBackend *cal_get_backend (Cal *cal);
-GNOME_Evolution_Calendar_Listener cal_get_listener (Cal *cal);
-
-void cal_notify_read_only (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, gboolean read_only);
-void cal_notify_cal_address (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *address);
-void cal_notify_alarm_email_address (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *address);
-void cal_notify_ldap_attribute (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *attribute);
-void cal_notify_static_capabilities (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *capabilities);
-
-void cal_notify_open (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-void cal_notify_remove (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-
-void cal_notify_object_created (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *uid, const char *object);
-void cal_notify_object_modified (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *old_object, const char *object);
-void cal_notify_object_removed (Cal *cal, GNOME_Evolution_Calendar_CallStatus status,
- const char *uid, const char *object);
-void cal_notify_alarm_discarded (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-
-void cal_notify_objects_received (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-void cal_notify_objects_sent (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-
-void cal_notify_default_object (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, char *object);
-void cal_notify_object (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, char *object);
-void cal_notify_object_list (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *objects);
-
-void cal_notify_query (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, Query *query);
-
-void cal_notify_timezone_requested (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *object);
-void cal_notify_timezone_added (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *tzid);
-void cal_notify_default_timezone_set (Cal *cal, GNOME_Evolution_Calendar_CallStatus status);
-
-void cal_notify_changes (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *adds, GList *modifies, GList *deletes);
-void cal_notify_free_busy (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *freebusy);
-
-void cal_notify_mode (Cal *cal,
- GNOME_Evolution_Calendar_Listener_SetModeStatus status,
- GNOME_Evolution_Calendar_CalMode mode);
-void cal_notify_error (Cal *cal, const char *message);
-
-void cal_notify_categories_changed (Cal *cal, GNOME_Evolution_Calendar_StringSeq *categories);
-
-
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
deleted file mode 100644
index 453c1cc4ce..0000000000
--- a/calendar/pcs/query.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* Evolution calendar - Live search query implementation
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <bonobo/bonobo-exception.h>
-#include <e-util/e-component-listener.h>
-#include <pcs/cal-backend-object-sexp.h>
-#include "query.h"
-
-
-
-/* Private part of the Query structure */
-struct _QueryPrivate {
- /* The backend we are monitoring */
- CalBackend *backend;
-
- /* The listener we report to */
- GNOME_Evolution_Calendar_QueryListener listener;
- EComponentListener *component_listener;
-
- /* Sexp that defines the query */
- CalBackendObjectSExp *sexp;
-};
-
-
-
-
-static void query_class_init (QueryClass *class);
-static void query_init (Query *query, QueryClass *class);
-static void query_finalize (GObject *object);
-
-static BonoboObjectClass *parent_class;
-
-
-
-BONOBO_TYPE_FUNC_FULL (Query,
- GNOME_Evolution_Calendar_Query,
- BONOBO_TYPE_OBJECT,
- query);
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_BACKEND,
- PROP_LISTENER,
- PROP_SEXP
-};
-
-
-static void
-listener_died_cb (EComponentListener *cl, gpointer data)
-{
- Query *query = QUERY (data);
- QueryPrivate *priv;
-
- priv = query->priv;
-
- g_object_unref (priv->component_listener);
- priv->component_listener = NULL;
-
- bonobo_object_release_unref (priv->listener, NULL);
- priv->listener = NULL;
-}
-
-static void
-impl_Query_start (PortableServer_Servant servant, CORBA_Environment *ev)
-{
- Query *query;
- QueryPrivate *priv;
-
- query = QUERY (bonobo_object_from_servant (servant));
- priv = query->priv;
-
- cal_backend_start_query (priv->backend, query);
-}
-
-static void
-query_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- Query *query;
- QueryPrivate *priv;
- CORBA_Environment ev;
-
- query = QUERY (object);
- priv = query->priv;
-
- switch (property_id) {
- case PROP_BACKEND:
- priv->backend = CAL_BACKEND (g_value_dup_object (value));
- break;
- case PROP_LISTENER:
- CORBA_exception_init (&ev);
- priv->listener = CORBA_Object_duplicate (g_value_get_pointer (value), &ev);
- CORBA_exception_free (&ev);
-
- priv->component_listener = e_component_listener_new (priv->listener);
- g_signal_connect (G_OBJECT (priv->component_listener), "component_died",
- G_CALLBACK (listener_died_cb), query);
- break;
- case PROP_SEXP:
- priv->sexp = CAL_BACKEND_OBJECT_SEXP (g_value_dup_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-query_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- Query *query;
- QueryPrivate *priv;
-
- query = QUERY (object);
- priv = query->priv;
-
- switch (property_id) {
- case PROP_BACKEND:
- g_value_set_object (value, priv->backend);
- case PROP_LISTENER:
- g_value_set_pointer (value, priv->listener);
- break;
- case PROP_SEXP:
- g_value_set_object (value, priv->sexp);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-/* Class initialization function for the live search query */
-static void
-query_class_init (QueryClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_Calendar_Query__epv *epv = &klass->epv;
- GParamSpec *param;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = query_set_property;
- object_class->get_property = query_get_property;
- object_class->finalize = query_finalize;
-
- epv->start = impl_Query_start;
-
- param = g_param_spec_object ("backend", NULL, NULL, CAL_BACKEND_TYPE,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_BACKEND, param);
- param = g_param_spec_pointer ("listener", NULL, NULL,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_LISTENER, param);
- param = g_param_spec_object ("sexp", NULL, NULL, CAL_TYPE_BACKEND_OBJECT_SEXP,
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_SEXP, param);
-}
-
-/* Object initialization function for the live search query */
-static void
-query_init (Query *query, QueryClass *class)
-{
- QueryPrivate *priv;
-
- priv = g_new0 (QueryPrivate, 1);
- query->priv = priv;
-
- priv->backend = NULL;
- priv->listener = NULL;
- priv->component_listener = NULL;
- priv->sexp = NULL;
-}
-
-/* Finalize handler for the live search query */
-static void
-query_finalize (GObject *object)
-{
- Query *query;
- QueryPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_QUERY (object));
-
- query = QUERY (object);
- priv = query->priv;
-
- if (priv->backend)
- g_object_unref (priv->backend);
-
- if (priv->listener != NULL)
- bonobo_object_release_unref (priv->listener, NULL);
-
- if (priv->component_listener != NULL)
- g_object_unref (priv->component_listener);
-
- if (priv->sexp)
- g_object_unref (priv->sexp);
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/**
- * query_new:
- * @backend: Calendar backend that the query object will monitor.
- * @ql: Listener for query results.
- * @sexp: Sexp that defines the query.
- *
- * Creates a new query engine object that monitors a calendar backend.
- *
- * Return value: A newly-created query object, or NULL on failure.
- **/
-Query *
-query_new (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- CalBackendObjectSExp *sexp)
-{
- Query *query;
-
- query = g_object_new (QUERY_TYPE, "backend", backend, "listener", ql,
- "sexp", sexp, NULL);
-
- return query;
-}
-
-/**
- * query_get_sexp
- * @query: A #Query object.
- *
- * Get the expression used for the given query.
- *
- * Returns: the query expression used to search.
- */
-const char *
-query_get_text (Query *query)
-{
- g_return_val_if_fail (IS_QUERY (query), NULL);
-
- return cal_backend_object_sexp_text (query->priv->sexp);
-}
-
-CalBackendObjectSExp *
-query_get_object_sexp (Query *query)
-{
- g_return_val_if_fail (IS_QUERY (query), NULL);
-
- return query->priv->sexp;
-}
-
-gboolean
-query_object_matches (Query *query, const char *object)
-{
- QueryPrivate *priv;
-
- g_return_val_if_fail (query != NULL, FALSE);
- g_return_val_if_fail (IS_QUERY (query), FALSE);
- g_return_val_if_fail (object != NULL, FALSE);
-
- priv = query->priv;
-
- return cal_backend_object_sexp_match_object (priv->sexp, object, priv->backend);
-}
-
-void
-query_notify_objects_added (Query *query, const GList *objects)
-{
- QueryPrivate *priv;
- GNOME_Evolution_Calendar_stringlist obj_list;
- CORBA_Environment ev;
- const GList *l;
- int num_objs, i;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- num_objs = g_list_length ((GList*)objects);
- obj_list._buffer = GNOME_Evolution_Calendar_stringlist_allocbuf (num_objs);
- obj_list._maximum = num_objs;
- obj_list._length = num_objs;
-
- for (l = objects, i = 0; l; l = l->next, i++)
- obj_list._buffer[i] = CORBA_string_dup (l->data);
-
- GNOME_Evolution_Calendar_QueryListener_notifyObjectsAdded (priv->listener, &obj_list, &ev);
-
- CORBA_free (obj_list._buffer);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of object addition");
-
- CORBA_exception_free (&ev);
-}
-
-void
-query_notify_objects_added_1 (Query *query, const char *object)
-{
- QueryPrivate *priv;
- GList objects;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- objects.next = objects.prev = NULL;
- objects.data = (gpointer)object;
-
- query_notify_objects_added (query, &objects);
-}
-
-void
-query_notify_objects_modified (Query *query, const GList *objects)
-{
- QueryPrivate *priv;
- GNOME_Evolution_Calendar_CalObjUIDSeq obj_list;
- CORBA_Environment ev;
- const GList *l;
- int num_objs, i;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- num_objs = g_list_length ((GList*)objects);
- obj_list._buffer = GNOME_Evolution_Calendar_stringlist_allocbuf (num_objs);
- obj_list._maximum = num_objs;
- obj_list._length = num_objs;
-
- for (l = objects, i = 0; l; l = l->next, i++)
- obj_list._buffer[i] = CORBA_string_dup (l->data);
-
- GNOME_Evolution_Calendar_QueryListener_notifyObjectsModified (priv->listener, &obj_list, &ev);
-
- CORBA_free (obj_list._buffer);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of object modification");
-
- CORBA_exception_free (&ev);
-}
-
-void
-query_notify_objects_modified_1 (Query *query, const char *object)
-{
- QueryPrivate *priv;
- GList objects;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- objects.next = objects.prev = NULL;
- objects.data = (gpointer)object;
-
- query_notify_objects_modified (query, &objects);
-}
-
-void
-query_notify_objects_removed (Query *query, const GList *uids)
-{
- QueryPrivate *priv;
- GNOME_Evolution_Calendar_CalObjUIDSeq uid_list;
- CORBA_Environment ev;
- const GList *l;
- int num_uids, i;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- num_uids = g_list_length ((GList*)uids);
- uid_list._buffer = GNOME_Evolution_Calendar_CalObjUIDSeq_allocbuf (num_uids);
- uid_list._maximum = num_uids;
- uid_list._length = num_uids;
-
- for (l = uids, i = 0; l; l = l->next, i ++)
- uid_list._buffer[i] = CORBA_string_dup (l->data);
-
- GNOME_Evolution_Calendar_QueryListener_notifyObjectsRemoved (priv->listener, &uid_list, &ev);
-
- CORBA_free (uid_list._buffer);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of object removal");
-
-
- CORBA_exception_free (&ev);
-}
-
-void
-query_notify_objects_removed_1 (Query *query, const char *uid)
-{
- QueryPrivate *priv;
- GList uids;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- uids.next = uids.prev = NULL;
- uids.data = (gpointer)uid;
-
- query_notify_objects_removed (query, &uids);
-}
-
-void
-query_notify_query_progress (Query *query, const char *message, int percent)
-{
- QueryPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_QueryListener_notifyQueryProgress (priv->listener, message, percent, &ev);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of query progress");
-
- CORBA_exception_free (&ev);
-}
-
-void
-query_notify_query_done (Query *query, GNOME_Evolution_Calendar_CallStatus status)
-{
- QueryPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (IS_QUERY (query));
-
- priv = query->priv;
- g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (priv->listener, status, &ev);
-
- if (BONOBO_EX (&ev))
- g_warning (G_STRLOC ": could not notify the listener of query completion");
-
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/pcs/query.h b/calendar/pcs/query.h
deleted file mode 100644
index 9c03aa2661..0000000000
--- a/calendar/pcs/query.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Evolution calendar - Live search query implementation
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef QUERY_H
-#define QUERY_H
-
-#include <bonobo/bonobo-object.h>
-#include "pcs/cal-common.h"
-#include "pcs/evolution-calendar.h"
-#include "cal-backend-object-sexp.h"
-
-G_BEGIN_DECLS
-
-
-
-#define QUERY_TYPE (query_get_type ())
-#define QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QUERY_TYPE, Query))
-#define QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QUERY_TYPE, QueryClass))
-#define IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QUERY_TYPE))
-#define IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUERY_TYPE))
-
-typedef struct _QueryPrivate QueryPrivate;
-
-struct _Query {
- BonoboObject xobject;
-
- /* Private data */
- QueryPrivate *priv;
-};
-
-struct _QueryClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_Query__epv epv;
-};
-
-GType query_get_type (void);
-Query *query_new (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- CalBackendObjectSExp *sexp);
-const char *query_get_text (Query *query);
-CalBackendObjectSExp *query_get_object_sexp (Query *query);
-gboolean query_object_matches (Query *query, const char *object);
-void query_notify_objects_added (Query *query,
- const GList *objects);
-void query_notify_objects_added_1 (Query *query,
- const char *object);
-void query_notify_objects_modified (Query *query,
- const GList *objects);
-void query_notify_objects_modified_1 (Query *query,
- const char *object);
-void query_notify_objects_removed (Query *query,
- const GList *uids);
-void query_notify_objects_removed_1 (Query *query,
- const char *uid);
-void query_notify_query_progress (Query *query,
- const char *message,
- int percent);
-void query_notify_query_done (Query *query,
- GNOME_Evolution_Calendar_CallStatus status);
-
-G_END_DECLS
-
-#endif