diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-05 05:06:49 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-05 05:06:49 +0800 |
commit | 45ebcc48ee83de3c5a991ffd4095280770cb22b1 (patch) | |
tree | e07956a3a64e67cbc59f12405a71230a7f9756de /calendar | |
parent | 524de5fe838f5d8d6569d81ac1484fd771d025d6 (diff) | |
download | gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar.gz gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar.bz2 gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar.lz gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar.xz gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.tar.zst gsoc2013-evolution-45ebcc48ee83de3c5a991ffd4095280770cb22b1.zip |
vCalendar gets fully saved -mig
svn path=/trunk/; revision=107
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/cal-util/calobj.c | 86 | ||||
-rw-r--r-- | calendar/calendar.c | 2 | ||||
-rw-r--r-- | calendar/calobj.c | 86 | ||||
-rw-r--r-- | calendar/gui/calendar.c | 2 | ||||
-rw-r--r-- | calendar/gui/main.c | 6 | ||||
-rw-r--r-- | calendar/main.c | 6 | ||||
-rw-r--r-- | calendar/pcs/calobj.c | 86 |
7 files changed, 259 insertions, 15 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 6dd7fa98db..8c5605c688 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -9,6 +9,7 @@ #include <string.h> #include <glib.h> #include "calobj.h" +#include "timeutil.h" #include "versit/vcc.h" iCalObject * @@ -66,9 +67,15 @@ ical_new (char *comment, char *organizer, char *summary) } static void +my_free (gpointer data, gpointer user_dat_ignored) +{ + g_free (data); +} + +static void list_free (GList *list) { - g_list_foreach (list, g_free, 0); + g_list_foreach (list, my_free, 0); g_list_free (list); } @@ -259,11 +266,37 @@ to_str (int num) return buf; } +/* + * stores a GList in the property, using SEP as the value separator + */ +static void +store_list (VObject *o, char *prop, GList *values, char sep) +{ + GList *l; + int len; + char *result, *p; + + for (len = 0, l = values; l; l = l->next) + len += strlen (l->data) + 1; + + result = g_malloc (len); + for (p = result, l = values; l; l = l->next){ + int len = strlen (l->data); + + strcpy (p, l->data); + p [len] = sep; + p += len+1; + } + addPropValue (o, prop, result); + g_free (p); +} + VObject * ical_object_to_vobject (iCalObject *ical) { VObject *o; - + GList *l; + if (ical->type == ICAL_EVENT) o = newVObject (VCEventProp); else @@ -288,7 +321,54 @@ ical_object_to_vobject (iCalObject *ical) /* completed */ if (ical->completed) addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed)); - + + /* last_mod */ + addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod)); + + /* exdate */ + if (ical->exdate) + store_list (o, VCExpDateProp, ical->exdate, ','); + + /* description/comment */ + if (ical->comment) + addPropValue (o, VCDescriptionProp, ical->comment); + + /* summary */ + if (ical->summary) + addPropValue (o, VCSummaryProp, ical->summary); + + /* status */ + addPropValue (o, VCStatusProp, ical->status); + + /* class */ + addPropValue (o, VCClassProp, ical->class); + + /* categories */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->categories, ','); + + /* resources */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->resources, ";"); + + /* priority */ + addPropValue (o, VCPriorityProp, to_str (ical->priority)); + + /* transparency */ + addPropValue (o, VCTranspProp, to_str (ical->transp)); + + /* related */ + store_list (o, VCRelatedToProp, ical->related, ";"); + + /* attach */ + for (l = ical->attach; l; l = l->next) + addPropValue (o, VCAttachProp, l->data); + + /* url */ + if (ical->url) + addPropValue (o, VCURLProp, ical->url); + + /* FIXME: alarms */ return o; } diff --git a/calendar/calendar.c b/calendar/calendar.c index d2f164a49c..581a75ee2f 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -201,6 +201,7 @@ calendar_load (Calendar *cal, char *fname) vcal = Parse_MIME_FromFileName (fname); calendar_load_from_vobject (cal, vcal); cleanVObject (vcal); + cleanStrTbl (); } void @@ -226,5 +227,6 @@ calendar_save (Calendar *cal, char *fname) } writeVObjectToFile (fname, vcal); cleanVObject (vcal); + cleanStrTbl (); } diff --git a/calendar/calobj.c b/calendar/calobj.c index 6dd7fa98db..8c5605c688 100644 --- a/calendar/calobj.c +++ b/calendar/calobj.c @@ -9,6 +9,7 @@ #include <string.h> #include <glib.h> #include "calobj.h" +#include "timeutil.h" #include "versit/vcc.h" iCalObject * @@ -66,9 +67,15 @@ ical_new (char *comment, char *organizer, char *summary) } static void +my_free (gpointer data, gpointer user_dat_ignored) +{ + g_free (data); +} + +static void list_free (GList *list) { - g_list_foreach (list, g_free, 0); + g_list_foreach (list, my_free, 0); g_list_free (list); } @@ -259,11 +266,37 @@ to_str (int num) return buf; } +/* + * stores a GList in the property, using SEP as the value separator + */ +static void +store_list (VObject *o, char *prop, GList *values, char sep) +{ + GList *l; + int len; + char *result, *p; + + for (len = 0, l = values; l; l = l->next) + len += strlen (l->data) + 1; + + result = g_malloc (len); + for (p = result, l = values; l; l = l->next){ + int len = strlen (l->data); + + strcpy (p, l->data); + p [len] = sep; + p += len+1; + } + addPropValue (o, prop, result); + g_free (p); +} + VObject * ical_object_to_vobject (iCalObject *ical) { VObject *o; - + GList *l; + if (ical->type == ICAL_EVENT) o = newVObject (VCEventProp); else @@ -288,7 +321,54 @@ ical_object_to_vobject (iCalObject *ical) /* completed */ if (ical->completed) addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed)); - + + /* last_mod */ + addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod)); + + /* exdate */ + if (ical->exdate) + store_list (o, VCExpDateProp, ical->exdate, ','); + + /* description/comment */ + if (ical->comment) + addPropValue (o, VCDescriptionProp, ical->comment); + + /* summary */ + if (ical->summary) + addPropValue (o, VCSummaryProp, ical->summary); + + /* status */ + addPropValue (o, VCStatusProp, ical->status); + + /* class */ + addPropValue (o, VCClassProp, ical->class); + + /* categories */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->categories, ','); + + /* resources */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->resources, ";"); + + /* priority */ + addPropValue (o, VCPriorityProp, to_str (ical->priority)); + + /* transparency */ + addPropValue (o, VCTranspProp, to_str (ical->transp)); + + /* related */ + store_list (o, VCRelatedToProp, ical->related, ";"); + + /* attach */ + for (l = ical->attach; l; l = l->next) + addPropValue (o, VCAttachProp, l->data); + + /* url */ + if (ical->url) + addPropValue (o, VCURLProp, ical->url); + + /* FIXME: alarms */ return o; } diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index d2f164a49c..581a75ee2f 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -201,6 +201,7 @@ calendar_load (Calendar *cal, char *fname) vcal = Parse_MIME_FromFileName (fname); calendar_load_from_vobject (cal, vcal); cleanVObject (vcal); + cleanStrTbl (); } void @@ -226,5 +227,6 @@ calendar_save (Calendar *cal, char *fname) } writeVObjectToFile (fname, vcal); cleanVObject (vcal); + cleanStrTbl (); } diff --git a/calendar/gui/main.c b/calendar/gui/main.c index b8e3f2fb9e..d499992b1c 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -208,13 +208,13 @@ GnomeUIInfo gnome_cal_menu [] = { }; GnomeUIInfo gnome_toolbar [] = { - { GNOME_APP_UI_ITEM, N_("Prev"), N_("Previous"), previous_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Prev"), NULL, previous_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK }, - { GNOME_APP_UI_ITEM, N_("Today"), N_("Today"), today_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Today"), NULL, today_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK }, - { GNOME_APP_UI_ITEM, N_("Next"), N_("Next"), next_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Next"), NULL, next_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, GNOMEUIINFO_END diff --git a/calendar/main.c b/calendar/main.c index b8e3f2fb9e..d499992b1c 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -208,13 +208,13 @@ GnomeUIInfo gnome_cal_menu [] = { }; GnomeUIInfo gnome_toolbar [] = { - { GNOME_APP_UI_ITEM, N_("Prev"), N_("Previous"), previous_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Prev"), NULL, previous_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK }, - { GNOME_APP_UI_ITEM, N_("Today"), N_("Today"), today_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Today"), NULL, today_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK }, - { GNOME_APP_UI_ITEM, N_("Next"), N_("Next"), next_clicked, 0, 0, + { GNOME_APP_UI_ITEM, N_("Next"), NULL, next_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, GNOMEUIINFO_END diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c index 6dd7fa98db..8c5605c688 100644 --- a/calendar/pcs/calobj.c +++ b/calendar/pcs/calobj.c @@ -9,6 +9,7 @@ #include <string.h> #include <glib.h> #include "calobj.h" +#include "timeutil.h" #include "versit/vcc.h" iCalObject * @@ -66,9 +67,15 @@ ical_new (char *comment, char *organizer, char *summary) } static void +my_free (gpointer data, gpointer user_dat_ignored) +{ + g_free (data); +} + +static void list_free (GList *list) { - g_list_foreach (list, g_free, 0); + g_list_foreach (list, my_free, 0); g_list_free (list); } @@ -259,11 +266,37 @@ to_str (int num) return buf; } +/* + * stores a GList in the property, using SEP as the value separator + */ +static void +store_list (VObject *o, char *prop, GList *values, char sep) +{ + GList *l; + int len; + char *result, *p; + + for (len = 0, l = values; l; l = l->next) + len += strlen (l->data) + 1; + + result = g_malloc (len); + for (p = result, l = values; l; l = l->next){ + int len = strlen (l->data); + + strcpy (p, l->data); + p [len] = sep; + p += len+1; + } + addPropValue (o, prop, result); + g_free (p); +} + VObject * ical_object_to_vobject (iCalObject *ical) { VObject *o; - + GList *l; + if (ical->type == ICAL_EVENT) o = newVObject (VCEventProp); else @@ -288,7 +321,54 @@ ical_object_to_vobject (iCalObject *ical) /* completed */ if (ical->completed) addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed)); - + + /* last_mod */ + addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod)); + + /* exdate */ + if (ical->exdate) + store_list (o, VCExpDateProp, ical->exdate, ','); + + /* description/comment */ + if (ical->comment) + addPropValue (o, VCDescriptionProp, ical->comment); + + /* summary */ + if (ical->summary) + addPropValue (o, VCSummaryProp, ical->summary); + + /* status */ + addPropValue (o, VCStatusProp, ical->status); + + /* class */ + addPropValue (o, VCClassProp, ical->class); + + /* categories */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->categories, ','); + + /* resources */ + if (ical->categories) + store_list (o, VCCategoriesProp, ical->resources, ";"); + + /* priority */ + addPropValue (o, VCPriorityProp, to_str (ical->priority)); + + /* transparency */ + addPropValue (o, VCTranspProp, to_str (ical->transp)); + + /* related */ + store_list (o, VCRelatedToProp, ical->related, ";"); + + /* attach */ + for (l = ical->attach; l; l = l->next) + addPropValue (o, VCAttachProp, l->data); + + /* url */ + if (ical->url) + addPropValue (o, VCURLProp, ical->url); + + /* FIXME: alarms */ return o; } |