diff options
author | Seth Alves <alves@src.gnome.org> | 2000-02-18 05:30:09 +0800 |
---|---|---|
committer | Seth Alves <alves@src.gnome.org> | 2000-02-18 05:30:09 +0800 |
commit | 4cd07c4e96046f0151528ba585de8d4472e0fbe5 (patch) | |
tree | 099951cfea95af02f479cd8d5cb3dcec923ef05f /calendar/icalendar.c | |
parent | c975d4ef24b4db28b19faf6d2b1e5d1956fe836c (diff) | |
download | gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar.gz gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar.bz2 gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar.lz gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar.xz gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.tar.zst gsoc2013-evolution-4cd07c4e96046f0151528ba585de8d4472e0fbe5.zip |
moved CalendarFormat type def here
* cal-backend.h: moved CalendarFormat type def here
* cal-backend.c (cal_backend_load): if extension suggests
an ical file, attempt to load an iCal file.
(cal_get_type_from_filename): returns CAL_ICAL if file
extension is 'ics' or 'ifb', else returns CAL_VCAL
(icalendar_calendar_load): moved this here from
icalendar.c because it needs to call the static function
add_object.
svn path=/trunk/; revision=1831
Diffstat (limited to 'calendar/icalendar.c')
-rw-r--r-- | calendar/icalendar.c | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/calendar/icalendar.c b/calendar/icalendar.c index 43c1b46016..30d91f6858 100644 --- a/calendar/icalendar.c +++ b/calendar/icalendar.c @@ -13,12 +13,9 @@ #include <gnome.h> #include <unistd.h> #include <sys/stat.h> -#include "ical.h" -#include "calobj.h" -#include "calendar.h" +#include "icalendar.h" +#include "cal-backend.h" -void icalendar_calendar_load (Calendar* cal, char* fname); -static icalcomponent* icalendar_parse_file (char* fname); static time_t icaltime_to_timet (struct icaltimetype* i); static CalendarAlarm* parse_alarm (icalproperty *prop); static iCalPerson* parse_person (icalproperty *prop, gchar *value); @@ -39,14 +36,8 @@ copy_to_list (GList** store, gchar* src) return *store; } -/* eh? - static icalcomponent* - ical_object_to_icalcomponent (iCalObject* ical) - { - icalcomponent *comp; -*/ -static iCalObject * +iCalObject * ical_object_create_from_icalcomponent (icalcomponent* comp) { iCalObject *ical = NULL; @@ -372,61 +363,6 @@ this may not be correct */ return ical; } -void -icalendar_calendar_load (Calendar* cal, char* fname) -{ - icalcomponent *comp; - icalcomponent *subcomp; - iCalObject *ical; - - comp = icalendar_parse_file (fname); - subcomp = icalcomponent_get_first_component (comp, - ICAL_ANY_COMPONENT); - while (subcomp) { - ical = ical_object_create_from_icalcomponent (subcomp); - if (ical->type != ICAL_EVENT && - ical->type != ICAL_TODO && - ical->type != ICAL_JOURNAL) { - g_warning ("Skipping unsupported iCalendar component."); - } else - calendar_add_object (cal, ical); - subcomp = icalcomponent_get_next_component (comp, - ICAL_ANY_COMPONENT); - } -} - -static icalcomponent* -icalendar_parse_file (char* fname) -{ - FILE* fp; - icalcomponent* comp = NULL; - gchar* str; - struct stat st; - int n; - - fp = fopen (fname, "r"); - if (!fp) { - g_warning ("Cannot open open calendar file."); - return NULL; - } - - stat (fname, &st); - - str = g_malloc (st.st_size + 2); - - n = fread ((gchar*) str, 1, st.st_size, fp); - if (n != st.st_size) { - g_warning ("Read error."); - } - str[n] = '\0'; - - fclose (fp); - - comp = icalparser_parse_string (str); - g_free (str); - - return comp; -} static time_t icaltime_to_timet (struct icaltimetype* i) { |