2003-12-21 JP Rosevear <jpr@ximian.com>
+ * libecal/e-cal.h: update protos
+
+ * libecal/e-cal.c: use ECalSourceType
+ (convert_type): convert and ECalSourceType to a corba equivalent
+ (fetch_corba_cal): use ECalSourceType
+ (e_cal_new): ditto
+ (e_cal_new_from_uri): ditto
+ (e_cal_generate_instances): does not need a type arg
+
+ * libecal/e-cal-util.h: remove CalObjType
+
+ * libecal/client-test.c (create_client): use ECalSourceType
+ (main): ditto
+
+2003-12-21 JP Rosevear <jpr@ximian.com>
+
* backends/file/e-cal-backend-file.c (open_cal): set the uri
before scanning the vcalendar because we may have to fix duplicate
UIDs (and hence save the calendar)
/* Creates a calendar client and tries to load the specified URI into it */
static void
-create_client (ECal **client, const gchar *uri, CalObjType type, gboolean only_if_exists)
+create_client (ECal **client, const gchar *uri, ECalSourceType type, gboolean only_if_exists)
{
ECalView *query;
GError *error = NULL;
#if 0
source = e_source_new ("test-source", "file:///home/gnome24-evolution-new-calendar/evolution/local/Calendar");
#endif
- create_client (&client1, "file:///home/hpj/.evolution/calendar/local/OnThisComputer/Pakk", CALOBJ_TYPE_EVENT, FALSE);
+ create_client (&client1, "file:///home/hpj/.evolution/calendar/local/OnThisComputer/Pakk", E_CAL_SOURCE_TYPE_EVENT, FALSE);
// create_client (&client2, "file:///tmp/tasks", TRUE);
bonobo_main ();
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,
*/
ESource *source;
char *uri;
- CalObjType type;
+ ECalSourceType type;
ECalendarOp *current_op;
return cal_mode_enum_type;
}
+static GNOME_Evolution_Calendar_CalObjType
+convert_type (ECalSourceType type)
+{
+ switch (type){
+ case E_CAL_SOURCE_TYPE_EVENT:
+ return GNOME_Evolution_Calendar_TYPE_EVENT;
+ case E_CAL_SOURCE_TYPE_TODO:
+ return GNOME_Evolution_Calendar_TYPE_TODO;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ return GNOME_Evolution_Calendar_TYPE_JOURNAL;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return GNOME_Evolution_Calendar_TYPE_ANY;
+}
+
/* EBookOp calls */
static ECalendarOp*
static gboolean
-fetch_corba_cal (ECal *ecal, ESource *source, CalObjType type)
+fetch_corba_cal (ECal *ecal, ESource *source, ECalSourceType type)
{
ECalPrivate *priv;
GList *f;
CORBA_exception_init (&ev);
- cal = GNOME_Evolution_Calendar_CalFactory_getCal (f->data, source_xml, priv->type,
+ cal = GNOME_Evolution_Calendar_CalFactory_getCal (f->data, source_xml, convert_type (priv->type),
BONOBO_OBJREF (priv->listener), &ev);
if (BONOBO_EX (&ev))
continue;
* not be constructed because it could not contact the calendar server.
**/
ECal *
-e_cal_new (ESource *source, CalObjType type)
+e_cal_new (ESource *source, ECalSourceType type)
{
ECal *ecal;
* not be constructed because it could not contact the calendar server.
**/
ECal *
-e_cal_new_from_uri (const gchar *uri, CalObjType type)
+e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
{
ESourceGroup *group;
ESource *source;
* it gets passed if it intends to keep it around.
**/
void
-e_cal_generate_instances (ECal *ecal, CalObjType type,
- time_t start, time_t end,
+e_cal_generate_instances (ECal *ecal, time_t start, time_t end,
ECalRecurInstanceFn cb, gpointer cb_data)
{
ECalPrivate *priv;
typedef struct _ECalClass ECalClass;
typedef struct _ECalPrivate ECalPrivate;
+typedef enum {
+ E_CAL_SOURCE_TYPE_EVENT,
+ E_CAL_SOURCE_TYPE_TODO,
+ E_CAL_SOURCE_TYPE_JOURNAL,
+ E_CAL_SOURCE_TYPE_LAST
+} ECalSourceType;
+
/* Set mode status for the e_cal_set_mode function */
typedef enum {
E_CAL_SET_MODE_SUCCESS,
GType e_cal_set_mode_status_enum_get_type (void);
GType cal_mode_enum_get_type (void);
-ECal *e_cal_new (ESource *source, CalObjType type);
-ECal *e_cal_new_from_uri (const gchar *uri, CalObjType type);
+ECal *e_cal_new (ESource *source, ECalSourceType type);
+ECal *e_cal_new_from_uri (const gchar *uri, ECalSourceType type);
void e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data);
gboolean e_cal_get_free_busy (ECal *ecal, GList *users, time_t start, time_t end,
GList **freebusy, GError **error);
-void e_cal_generate_instances (ECal *ecal, CalObjType type,
- time_t start, time_t end,
+void e_cal_generate_instances (ECal *ecal, time_t start, time_t end,
ECalRecurInstanceFn cb, gpointer cb_data);
GSList *e_cal_get_alarms_in_range (ECal *ecal, time_t start, time_t end);