update protos
authorJP Rosevear <jpr@ximian.com>
Sun, 21 Dec 2003 17:04:54 +0000 (17:04 +0000)
committerJP Rosevear <jpr@src.gnome.org>
Sun, 21 Dec 2003 17:04:54 +0000 (17:04 +0000)
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

calendar/ChangeLog
calendar/libecal/client-test.c
calendar/libecal/e-cal-util.h
calendar/libecal/e-cal.c
calendar/libecal/e-cal.h

index 122a90a..a669454 100644 (file)
@@ -1,5 +1,21 @@
 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)
index ef3019f..4c8775f 100644 (file)
@@ -138,7 +138,7 @@ client_destroy_cb (gpointer data, GObject *object)
 
 /* 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;
@@ -196,7 +196,7 @@ main (int argc, char **argv)
 #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 ();
index cf2d00e..ab55094 100644 (file)
@@ -43,14 +43,6 @@ typedef struct {
 
 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,
index 0b86cf1..17fba8c 100644 (file)
@@ -63,7 +63,7 @@ struct _ECalPrivate {
         */
        ESource *source;
        char *uri;
-       CalObjType type;
+       ECalSourceType type;
        
        ECalendarOp *current_op;
 
@@ -182,6 +182,23 @@ cal_mode_enum_get_type (void)
        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*
@@ -1188,7 +1205,7 @@ e_cal_get_type (void)
 
 
 static gboolean
-fetch_corba_cal (ECal *ecal, ESource *source, CalObjType type)
+fetch_corba_cal (ECal *ecal, ESource *source, ECalSourceType type)
 {
        ECalPrivate *priv;
        GList *f;
@@ -1224,7 +1241,7 @@ fetch_corba_cal (ECal *ecal, ESource *source, CalObjType type)
 
                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;
@@ -1252,7 +1269,7 @@ fetch_corba_cal (ECal *ecal, ESource *source, CalObjType type)
  * 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;
 
@@ -1279,7 +1296,7 @@ e_cal_new (ESource *source, CalObjType type)
  * 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;
@@ -2581,8 +2598,7 @@ compare_comp_instance (gconstpointer a, gconstpointer b)
  * 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;
index 6614e38..77ba351 100644 (file)
@@ -45,6 +45,13 @@ typedef struct _ECal ECal;
 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,
@@ -93,8 +100,8 @@ GType e_cal_open_status_enum_get_type (void);
 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);
 
@@ -140,8 +147,7 @@ void e_cal_free_object_list (GList *objects);
 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);