aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@localhost>1998-04-09 08:20:07 +0800
committernobody <nobody@localhost>1998-04-09 08:20:07 +0800
commit05de0b05b77896244ce282b38e23d58d3d7e7dfa (patch)
tree48e2377429e30e946ec87c8f6e9f7f4f7a92b2c7
parent8e5a66e2c304f3cae73838495868941b6f66c7dc (diff)
downloadgsoc2013-evolution-MC_4_1_31.tar
gsoc2013-evolution-MC_4_1_31.tar.gz
gsoc2013-evolution-MC_4_1_31.tar.bz2
gsoc2013-evolution-MC_4_1_31.tar.lz
gsoc2013-evolution-MC_4_1_31.tar.xz
gsoc2013-evolution-MC_4_1_31.tar.zst
gsoc2013-evolution-MC_4_1_31.zip
This commit was manufactured by cvs2svn to create tag 'MC_4_1_31'.MC_4_1_31
svn path=/tags/MC_4_1_31/; revision=119
-rw-r--r--calendar/.cvsignore7
-rw-r--r--calendar/ChangeLog209
-rw-r--r--calendar/Makefile.am68
-rw-r--r--calendar/TODO47
-rw-r--r--calendar/cal-util/calobj.c374
-rw-r--r--calendar/cal-util/calobj.h127
-rw-r--r--calendar/cal_struct.h27
-rw-r--r--calendar/calcs.c253
-rw-r--r--calendar/calcs.h53
-rw-r--r--calendar/calendar.c233
-rw-r--r--calendar/calendar.h32
-rw-r--r--calendar/calobj.c374
-rw-r--r--calendar/calobj.h127
-rw-r--r--calendar/clist.c97
-rw-r--r--calendar/clist.h2
-rw-r--r--calendar/eventedit.c535
-rw-r--r--calendar/eventedit.h56
-rw-r--r--calendar/gncal-day-view.c341
-rw-r--r--calendar/gncal-day-view.h57
-rw-r--r--calendar/gncal-full-day.c1237
-rw-r--r--calendar/gncal-full-day.h58
-rw-r--r--calendar/gncal-week-view.c170
-rw-r--r--calendar/gncal-week-view.h54
-rw-r--r--calendar/gncal.c700
-rw-r--r--calendar/gncal.desktop12
-rw-r--r--calendar/gncal.h6
-rw-r--r--calendar/gnome-cal.c198
-rw-r--r--calendar/gnome-cal.h47
-rw-r--r--calendar/gui/Makefile.am68
-rw-r--r--calendar/gui/cal_struct.h27
-rw-r--r--calendar/gui/calendar.c233
-rw-r--r--calendar/gui/calendar.h32
-rw-r--r--calendar/gui/eventedit.c535
-rw-r--r--calendar/gui/eventedit.h56
-rw-r--r--calendar/gui/gncal-day-view.c341
-rw-r--r--calendar/gui/gncal-day-view.h57
-rw-r--r--calendar/gui/gncal-full-day.c1237
-rw-r--r--calendar/gui/gncal-full-day.h58
-rw-r--r--calendar/gui/gncal-week-view.c170
-rw-r--r--calendar/gui/gncal-week-view.h54
-rw-r--r--calendar/gui/gncal.desktop12
-rw-r--r--calendar/gui/gnome-cal.c198
-rw-r--r--calendar/gui/gnome-cal.h47
-rw-r--r--calendar/gui/icalendar-types39
-rw-r--r--calendar/gui/main.c275
-rw-r--r--calendar/gui/main.h3
-rw-r--r--calendar/gui/test.vcf41
-rw-r--r--calendar/gui/view-utils.c149
-rw-r--r--calendar/gui/view-utils.h28
-rw-r--r--calendar/icalendar-types39
-rw-r--r--calendar/lexer.c441
-rw-r--r--calendar/main.c275
-rw-r--r--calendar/main.h3
-rw-r--r--calendar/menus.c147
-rw-r--r--calendar/menus.h17
-rw-r--r--calendar/objedit.c88
-rw-r--r--calendar/pcs/calobj.c374
-rw-r--r--calendar/pcs/calobj.h127
-rw-r--r--calendar/test.vcf41
-rw-r--r--calendar/timeutil.c119
-rw-r--r--calendar/timeutil.h32
-rw-r--r--calendar/view-utils.c149
-rw-r--r--calendar/view-utils.h28
-rw-r--r--calendar/views.c33
-rw-r--r--calendar/views.h4
-rw-r--r--libversit/.cvsignore3
-rw-r--r--libversit/Makefile.am12
-rw-r--r--libversit/README.TXT951
-rw-r--r--libversit/port.h88
-rw-r--r--libversit/vcaltest.c118
-rw-r--r--libversit/vcaltmp.c337
-rw-r--r--libversit/vcaltmp.h128
-rw-r--r--libversit/vcc.c2071
-rw-r--r--libversit/vcc.h80
-rw-r--r--libversit/vcc.y1217
-rw-r--r--libversit/vctest.c95
-rw-r--r--libversit/vobject.c1428
-rw-r--r--libversit/vobject.h362
78 files changed, 0 insertions, 17968 deletions
diff --git a/calendar/.cvsignore b/calendar/.cvsignore
deleted file mode 100644
index 71e5400a29..0000000000
--- a/calendar/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile.in
-Makefile
-.deps
-_libs
-.libs
-gncal
-gnomecal
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
deleted file mode 100644
index 26f1712396..0000000000
--- a/calendar/ChangeLog
+++ /dev/null
@@ -1,209 +0,0 @@
-1998-04-08 Raja R Harinath <harinath@cs.umn.edu>
-
- * gncal.c (update_calendar): Say `#if 0', not `#ifdef 0'.
-
-1998-04-07 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c: Removed unused global variable parent_class.
-
- * eventedit.h: Renamed gtk_window field to window.
- Made the parent_class field in the EventEditorClass structure be a
- GtkWindowClass, not a gnome property box class.
- Added prototype for event_editor_get_type().
-
-1998-04-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-week-view.c (gncal_week_view_new): Use the new
- gtk_table_set_homogeneous() instead of setting the variable directly.
-
-1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_create_ae): Make it return void.
- (ee_alarm_widgets): Remove some unused variables.
- (ee_store_alarm): Make it return void.
- #include <string.h>
-
- * eventedit.h: #include "gnome-cal.h"
-
- * calobj.c (list_free): Don't use g_free in the g_list_foreach.
-
- * calendar.h: Add prototype for calendar_load().
-
- * timeutil.h: Add prototypes for time_add_*().
-
- * calendar.c:
- * calobj.c:
- * eventedit.c:
- * gnome-cal.c: #include "timeutil.h"
-
- * gncal-day-view.c (gncal_day_view_size_request): Make the minimum
- width equal or larger to the title width.
-
- * main.c: #include "eventedit.h"
- (main): Add a return statement.
- (new_calendar): Show stuff *after* the calendar has been loaded.
-
- * gnome-cal.c (gnome_calendar_load): Update the day view.
- (setup_widgets): Hackish setup of a day view widget - will fix later.
- (gnome_calendar_init): Initialize all fields.
-
- * gnome-cal.h: Added day_view field. Maybe this should be changed
- when the a complete day view panel is complete.
-
- * gncal-day-view.c (gncal_day_view_update): Draw after update, not
- before.
-
-1998-04-06 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
-
- * versit/.cvsignore: New file.
-
-Fri Apr 3 22:31:54 1998 Tom Tromey <tromey@cygnus.com>
-
- * calendar.c: Include <config.h>.
-
-1998-04-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * timeutil.c (time_add_year, time_add_year, time_add_week):
- Routines for time manipulation.
-
- * calobj.c (ical_object_destroy): Full destruction of the object.
-
- * eventedit.c: Finished the main event editor form; It still
- lacks the details and the recurrence bits. It now adds events
- and cancels.
-
-1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * view-utils.c (view_utils_draw_events): The "better" format
- string for strftime() wasn't better, after all :-(
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c: New full-day widget. It is still a work in
- progress. It will be similar to M$ Schedule's nifty full day view
- widget, but with Gtk's elegance :-)
-
- * Makefile.am (gnomecal_SOURCES): Added gncal-full-day.[ch] to the sources.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * eventedit.c: Object editor widget. We dropped ObjEdit.
-
- * timeutil.c (time_from_isodate): Fix.
-
- * view-utils.c (view_utils_draw_events): Changed the display
- formats.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * view-utils.c (view_utils_draw_events): Use better format
- specifier for strftime().
- (view_utils_draw_textured_frame): Ultra-nifty function to draw
- textured "metal" frames, like Netscape's handles.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-day-view.c (gncal_day_view_update): Day events are now
- cached inside the widget. They get initialized at this time.
-
- * view-utils.c (view_utils_draw_events): Use the list of events.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-view.c (gncal_day_view_set_shadow): New customization
- function. We can't decide on a stupid border type :-)
- (gncal_day_view_init): Made GTK_SHADOW_ETCHED_IN be the default
- shadow type. Looks good.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c: New main program that uses our new datatypes and
- objects.
-
- * calendar.c (calendar_load_from_vobject, calendar_load):
- Implement loading of vCalendar objects and vCalendar files.
-
- * calobj.c (ical_object_create_from_vobject): Implement loading of
- vCalendar event and todo objects.
-
- * timeutil.c (isodate_from_time_t): New function.
-
- * gnome-cal.c, gnome-cal.h: Implement a toplevel widget, derived
- from GnomeApp. It holds all of the day views and arbitrates the
- display.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-week-view.[ch]: New week view composite widget. This
- provides a full week view (7 day views plus busy time display --
- the latter is currently unimplemented).
-
-1998-04-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-view.c: New day view widget. It is intended to be a
- child widget of the week view composite widget.
-
- * calendar.c (calendar_get_objects_in_range):
- (calendar_get_events_in_range):
- (calendar_get_journal_in_range):
- (calendar_get_journal_in_range): These functions now take a
- sort_func parameter, which is of type GCompareFunc. If the
- specified value is non-NULL, it will return a sorted list.
- Otherwise, it will return an unordered list.
- (calendar_compare_by_dtstart): Provide a generic sorting routine
- for calendar objects.
-
-Tue Mar 31 23:46:50 1998 Tom Tromey <tromey@cygnus.com>
-
- * timeutil.c (format_simple_hour): `buf' now static.
-
-1998-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal.c: Removed #include "gtkcalendar.h", because it now comes
- from libgnomeui.
-
- * Makefile.am (gncal_SOURCES): Added new source files to the rules.
-
- * timeutil.c (format_simple_hour): New function, formats an
- hour/am_pm pair into a string of the form "3am", "12pm", "05h",
- "19h", etc. It is used by the day view widget for its labels.
-
-1998-03-31 Craig Small <csmall@small.dropbear.id.au>
-
- * Now has (non working) session maangement
- * Uses a clist for the dailylist like gtt
-
-Sat Mar 21 15:43:20 1998 Tom Tromey <tromey@cygnus.com>
-
- * gncal.c: Use gnome_message_box_*, not gnome_messagebox_*.
-
-1998-03-12 Craig Small <csmall@small.dropbear.id.au>
-
- * Now linked (in some horrible way) to the gtkcalendar widget.
-
-Sun Mar 8 16:38:10 1998 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.am (INCLUDES): Added GNOME_INCLUDEDIR.
- (gncal_LDADD): Don't include libsupport.a.
-
- * gncal.c (main): Use new gnome_init.
-
-1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal.c (main): Added app_id "gncal".
-
-1998-02-19 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
-
- * Makefile.am (gncal_LDADD): Added '$(INTLLIBS)'
-
-1998-02-18 Raja R Harinath <harinath@cs.umn.edu>
-
- * Makefile.am (gncal_LDADD): Include `libsupport.a'.
-
- * calcs.c (month_atoi): Replace buggy explicit loop string compare
- with strcasecmp.
- (day_atoi): Likewise.
-
-Sun Jan 25 23:38:30 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * menus.c: Replace "Quit" with "Exit".
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
deleted file mode 100644
index 283e46e1c2..0000000000
--- a/calendar/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-SUBDIRS = versit
-
-INCLUDES = \
- -I$(includedir) \
- $(GNOME_INCLUDEDIR) \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I../../gcalendar
-
-bin_PROGRAMS = gnomecal
-
-gnomecal_SOURCES = \
- calendar.c \
- calendar.h \
- calobj.c \
- calobj.h \
- gncal-day-view.c \
- gncal-day-view.h \
- gncal-full-day.c \
- gncal-full-day.h \
- gncal-week-view.c \
- gncal-week-view.h \
- gnome-cal.c \
- gnome-cal.h \
- main.c \
- timeutil.c \
- timeutil.h \
- view-utils.h \
- view-utils.c \
- views.h \
- views.c \
- eventedit.c \
- eventedit.h
-
-
-#gncal_SOURCES = \
-# gncal.c \
-# gncal.h \
-# calcs.c \
-# calcs.h \
-# clist.c \
-# clist.h \
-# calendar.c \
-# calendar.h \
-# calobj.c \
-# calobj.h \
-# gncal-day-view.c \
-# gncal-day-view.h \
-# timeutil.c \
-# timeutil.h
-
-LINK_FLAGS = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(INTLLIBS) versit/libversit.a
-
-
-#gncal_LDADD = $(LINK_FLAGS)
-#objedit_LDADD = $(LINK_FLAGS)
-
-gnomecal_LDADD = $(LINK_FLAGS)
-
-EXTRA_DIST = \
- gncal.desktop
-
-Productivitydir = $(datadir)/apps/Productivity
-
-Productivity_DATA = gncal.desktop
-
diff --git a/calendar/TODO b/calendar/TODO
deleted file mode 100644
index 23be8e5b32..0000000000
--- a/calendar/TODO
+++ /dev/null
@@ -1,47 +0,0 @@
-Gnome date selection widget:
-
-- Fix the signals.
-
-- The date selected in the popup calendar does not match the displayed
- date in the entry.
-
-- Make the calendar a `real' popup window like in GtkCombo.
-
-- Make the displayed date be localized properly -- use strftime().
-
-Event editor dialog:
-
-- Resize the window and fix whatever is resized in an ugly fashion.
-
-Full day view widget:
-
-- Notify the calendar when a child changes. Look for the FIXMEs in
- the code.
-
-- Select a range in the full day `background' and hit enter to create
- a new appointment in that date.
-
-- Layout the children nicely like M$ Schedule or Netscape Calendar do
- (i.e. make them not overlap each other).
-
-Year view:
-
-- Make use of Arturo's year view code.
-
-Month view:
-
-- Write a month view widget.
-
-Week view:
-
-- Replace the calendar by a `task density' widget like in Solaris cm.
-
-Day view:
-
-- Add a calendar and a to-do list widget.
-
-General:
-
-- Ask the user whether to save the calendar when he quits the program.
-
-- Write online help. Nice help. Lots of help.
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
deleted file mode 100644
index 8c5605c688..0000000000
--- a/calendar/cal-util/calobj.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (federico@gimp.org)
- */
-#include <string.h>
-#include <glib.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "versit/vcc.h"
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->enabled = 0;
- alarm->type = type;
-
- if (type != ALARM_MAIL){
- alarm->count = 15;
- alarm->units = ALARM_MINUTES;
- } else {
- printf ("uno!\n");
- alarm->count = 1;
- alarm->units = ALARM_DAYS;
- }
-
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (def_mail);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- g_free (ico);
-}
-
-GList *
-set_list (char *str, char *sc)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, sc); s; s = strtok (NULL, sc))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo;
- VObjectIterator i;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else
- return 0;
-
- /* uid */
- if (has (o, VCUniqueStringProp))
- ical->uid = g_strdup (str_val (vo));
-
- /* seq */
- if (has (o, VCSequenceProp))
- ical->seq = atoi (str_val (vo));
- else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp))
- ical->dtstart = time_from_isodate (str_val (vo));
- else
- ical->dtstart = 0;
-
- /* dtend */
- if (has (o, VCDTendProp))
- ical->dtend = time_from_isodate (str_val (vo));
- else
- ical->dtend = 0;
-
- /* dcreated */
- if (has (o, VCDCreatedProp))
- ical->created = time_from_isodate (str_val (vo));
-
- /* completed */
- if (has (o, VCCompletedProp))
- ical->completed = time_from_isodate (str_val (vo));
-
- /* last_mod */
- if (has (o, VCLastModifiedProp))
- ical->last_mod = time_from_isodate (str_val (vo));
- else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp))
- ical->exdate = set_list (str_val (vo), ",");
-
- /* description/comment */
- if (has (o, VCDescriptionProp))
- ical->comment = g_strdup (str_val (vo));
-
- /* summary */
- if (has (o, VCSummaryProp))
- ical->summary = g_strdup (str_val (vo));
- else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp))
- ical->status = g_strdup (str_val (vo));
- else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp))
- ical->class = g_strdup (str_val (vo));
- else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp))
- ical->categories = set_list (str_val (vo), ",");
-
- /* resources */
- if (has (o, VCResourcesProp))
- ical->resources = set_list (str_val (vo), ";");
-
- /* priority */
- if (has (o, VCPriorityProp))
- ical->priority = atoi (str_val (vo));
-
- /* tranparency */
- if (has (o, VCTranspProp))
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
-
- /* related */
- if (has (o, VCRelatedToProp))
- ical->related = set_list (str_val (vo), ";");
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0)
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- }
-
- /* url */
- if (has (o, VCURLProp))
- ical->url = g_strdup (str_val (vo));
-
- /* FIXME: dalarm */
- if (has (o, VCDAlarmProp))
- ;
-
- /* FIXME: aalarm */
- if (has (o, VCAAlarmProp))
- ;
-
- /* FIXME: palarm */
- if (has (o, VCPAlarmProp))
- ;
-
- /* FIXME: malarm */
- if (has (o, VCMAlarmProp))
- ;
-
- /* FIXME: rdate */
- if (has (o, VCRDateProp))
- ;
-
- /* FIXME: rrule */
- if (has (o, VCRRuleProp))
- ;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", 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
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
-
- /* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
-
- /* 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/cal-util/calobj.h b/calendar/cal-util/calobj.h
deleted file mode 100644
index 00dbd5c63e..0000000000
--- a/calendar/cal-util/calobj.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org), Federico Mena (federico@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "versit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-} iCalObject;
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/cal_struct.h b/calendar/cal_struct.h
deleted file mode 100644
index 411036c7aa..0000000000
--- a/calendar/cal_struct.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#define MAX_SZ 30
-
-enum RepeatType {
- Single,
- Days,
- Months,
- WeekDays,
- MonthDays
-};
-
-
-struct actionitem {
- char date[MAX_SZ];
- int time; /* Minutes past midnight */
-};
-
-struct event {
- struct actionitem start;
- struct actionitem end;
-
- enum RepeatType repeat;
- int repeatcount;
- char description[MAX_SZ];
- char subtype[MAX_SZ];
- GList *properties;
-};
-
diff --git a/calendar/calcs.c b/calendar/calcs.c
deleted file mode 100644
index d6150f7b35..0000000000
--- a/calendar/calcs.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * calc.c Calculations to work out what day it is etc for the Calendar
- *
- * Most of this stuff was taken from the gcal source by Thomas Esken.
- * <esken@uni-muenster.de>
- * gcal is a text-based calendar program
- */
-
-#include <time.h>
-#include <glib.h>
-#include <ctype.h>
-#include "calcs.h"
-
-#include <config.h>
-
-#ifndef HAVE_STRCASECMP
-int strcasecmp(const char * /*s1*/, const char * /*s2*/);
-#endif
-
-/* Number of days in a month */
-static const int dvec[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-/* Number of past days of a month */
-static const int mvec[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-Greg_struct greg_reform_date[6] = {
-/* {int year, int month, int f_day, int l_day} */
- { 1582, 10, 5, 14 },
- { 1700, 2, 19, 28 },
- { 1752, 9, 3, 13 },
- { 1753, 2, 18, 28 },
-/* must be left with all zeroes */
- { 0,0,0,0 }
-};
-Greg_struct *greg=greg_reform_date;
-
-
-
-/*
- * Computes the number of days in February and returns them,
- */
-int days_of_february(const int year)
-{
- return((year&3) ? 28 : (!(year%100)&&(year%400)) ? 28 : 29);
-}
-
-int is_leap_year(const int year)
-{
- return (days_of_february(year) == 29);
-}
-
-/*
- * Check wether a given date is calid.
- */
-int valid_date(const int day, const int month, const int year)
-{
- if ( day < 1
- || month < MONTH_MIN
- || month > MONTH_MAX
- || ( (month != 2)
- && (day > dvec[month-1]))
- || ( (month == 2)
- && (day > days_of_february (year))))
- return(FALSE);
-
- return(TRUE);
-}
-
-/*
- * Set a date back one day (to yesterday's date)
- */
-void prev_date(int *day, int *month, int *year)
-{
- (*day)--;
- if ( !*day || !valid_date(*day, *month, *year)) {
- (*month)--;
- if (*month < MONTH_MIN) {
- *month = MONTH_MAX;
- (*year)--;
- }
- if (*month ==2)
- *day = days_of_february(*year);
- else
- *day = dvec[*month-1];
- }
-} /* prev_date */
-
-/*
- * Set a date forward one day (to tomorrow's date)
- */
-void next_date(int *day, int *month, int *year)
-{
- (*day)++;
- if (!valid_date(*day, *month, *year)) {
- *day = DAY_MIN;
- if (*month == MONTH_MAX) {
- *month = MONTH_MIN;
- (*year)++;
- } else
- (*month)++;
- }
-} /* next_date */
-
-/*
- * Get date from the system
- */
-void get_system_date(int *day, int *month, int *year)
-{
- auto struct tm *sys_date;
- auto time_t sys_time;
-
-
- sys_time = time((time_t *)NULL);
- sys_date = localtime(&sys_time);
- *day = sys_date->tm_mday;
- *month = sys_date->tm_mon + 1;
- *year = sys_date->tm_year;
- if (*year < CENTURY)
- *year += CENTURY;
-} /* get_system_date */
-
-
-/*
- * Given a string with the name of a month, return 1..12 or 0 if not found
- */
-int month_atoi(const char *string)
-{
- int i;
- for (i = MONTH_MIN; i <= MONTH_MAX; i++)
- if (strcasecmp(string, (char *)get_month_name(i)) == 0)
- return i;
- return 0;
-}
-
-int day_atoi(const char *string)
-{
- int i;
- for (i = DAY_MIN; i <= DAY_MAX; i++)
- if (strcasecmp(string, (char *)get_day_name(i)) == 0)
- return i;
- return 0;
-}
-
-/*
- * Returns ordinal suffix (st, nd, rd, th) for a day
- */
-const char *day_suffix(int day)
-{
- static const char *suffix[]={"th", "st", "nd", "rd"};
- register int i;
-
- i = 0;
-
- if (day > 100)
- day %= 100;
- if (day < 11 || day > 13)
- i = day % 10;
- if (i > 3)
- i = 0;
-
- return(suffix[i]);
-} /* day_suffix */
-
-/*
- * Returns the short name of the day of week, format "%-3s"
- */
-const char *short3_day_name(const int day)
-{
- static const char *name[]={"invalid day", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
-
- return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
-} /* short3_day_name */
-
-/*
- * Returns the short name of day of week
- */
-const char *short_day_name(const int day)
-{
- static const char *name[]={"invalid day", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"};
-
- return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
-} /* short_day_name */
-
-/*
- * Returns the complete name of the day
- */
-const char *get_day_name(const int day)
-{
- static const char *name[]={"invalid day", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
-
- return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
-} /* day_name */
-
-/*
- * Returns the short name of the month
- */
-const char *short_month_name(const int month)
-{
- static const char *name[]={ "invalid month", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
- return(((month<MONTH_MIN)||(month>MONTH_MAX)) ? name[0] : name[month]);
-} /* short_month_name() */
-
-/*
- * Returns the name of the month
- */
-const char *get_month_name(const int month)
-{
- static const char *name[]={ "invalid month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
-
- return(((month<MONTH_MIN)||(month>MONTH_MAX)) ? name[0] : name[month]);
-} /* month_name() */
-
-/*
- * Compute the absolute number of days of the given date since 1 Jan 0001
- * respecting the missing period of the Gregorian Reformation
- * I am glad someone else worked this one out!! - cs
- */
-unsigned long int date2num(const int day, const int month, const int year)
-{
- auto unsigned long int julian_days;
-
- julian_days = (unsigned long int)((year-1)*(unsigned long int)(DAY_LAST)+((year-1)>>2));
-
- if (year > greg->year
- || ( (year == greg->year)
- && ( month > greg->month
- || ( (month == greg->month)
- && (day > greg->last_day)))))
- julian_days -= (unsigned long int)(greg->last_day - greg->first_day + 1);
- if (year > greg->year) {
- julian_days += (((year-1) / 400) - (greg->year / 400));
- julian_days -= (((year-1) / 100) - (greg->year / 100));
- if (!(greg->year % 100) && (greg->year % 400))
- julian_days--;
- }
- julian_days += (unsigned long int)mvec[month-1];
- julian_days += day;
- if ( (days_of_february(year) == 29) && (month > 2))
- julian_days++;
-
- return(julian_days);
-} /* date2num */
-
-/*
- * Computes the weekday of a Gregorian/Julian calendar date
- * (month must be 1..12) returns 1..7 (mo..su)
- */
-int weekday_of_date(const int day, const int month, const int year)
-{
- auto unsigned long int julian_days=date2num(day, month,year)%DAY_MAX;
-
- return((julian_days>2) ? (int)julian_days-2 : (int)julian_days+5);
-} /* weekday_of_date() */
-
diff --git a/calendar/calcs.h b/calendar/calcs.h
deleted file mode 100644
index f331bf7335..0000000000
--- a/calendar/calcs.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * function prototypes
- */
-int days_of_february(const int year);
-int is_leap_year(const int year);
-int valid_date(const int day, const int month, const int year);
-void get_system_date(int *day, int *month, int *year);
-void prev_date(int *day, int *month, int *year);
-void next_date(int *day, int *month, int *year);
-int month_atoi(const char *string);
-int day_atoi(const char *string);
-const char *day_suffix(int day);
-const char *short3_day_name(int day);
-const char *short_day_name(int day);
-const char *get_day_name(int day);
-const char *short_month_name(int month);
-const char *get_month_name(int month);
-unsigned long int date2num(const int day, const int month, const int year);
-int weekday_of_date(const int day, const int month, const int year);
-
-
-/*
- * Important preprocessor symbols for the internal ranges.
- */
-#define DAY_LAST 365 /* Last day in a NON leap year */
-#define DAY_MIN 1 /* Minimum day of week/month/year */
-#define DAY_MAX 7 /* Maximum day/amount of days of week */
-#define WEEK_MAX 52 /* Maximum week number of year */
-#define MONTH_LAST 31 /* Highest day number in a month */
-#define MONTH_MIN 1 /* Minimum month of year */
-#define MONTH_MAX 12 /* Maximum month of year */
-#define YEAR_MIN 1 /* Minimum year able to compute */
-#define YEAR_MAX 9999 /* Maximum year able to compute */
-#define EASTER_MIN 30 /* Minimum year for computing Easter Sunday (29+1) */
-#define EASTER_MAX YEAR_MAX /* Maximum year for computing Easter Sunday */
-#define MONTH_COLS 6 /* Maximum number of columns of a month */
-#define VEC_BLOCK 42 /* Maximum number of elements per month (7*6) */
-#define VEC_ELEMS 504 /* Maximum number of elements per year (42*12) */
-#define CENTURY 1900 /* Operating system standard starting century, DON'T change ! */
-
-/*
-* The Gregorian Reformation date record.
-*/
-typedef
- struct greg_type
- {
- int year; /* Year of Gregorian Reformation */
- int month; /* Month of Gregorian Reformation */
- int first_day; /* First missing day of Reformation period */
- int last_day; /* Last missing day of Reformation period */
- }
- Greg_struct;
-
diff --git a/calendar/calendar.c b/calendar/calendar.c
deleted file mode 100644
index c06414a571..0000000000
--- a/calendar/calendar.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Calendar manager object
- *
- * This keeps track of a given calendar. Eventually this will abtract everything
- * related to getting calendars/saving calendars locally or to a remote Calendar Service
- *
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (federico@gimp.org)
- *
- */
-
-#include <config.h>
-
-#include "calendar.h"
-#include "timeutil.h"
-#include "versit/vcc.h"
-
-Calendar *
-calendar_new (char *title)
-{
- Calendar *cal;
-
- cal = g_new0 (Calendar, 1);
- cal->title = g_strdup (title);
-
- return cal;
-}
-
-void
-calendar_add_object (Calendar *cal, iCalObject *obj)
-{
- printf ("Adding object\n");
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_prepend (cal->events, obj);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_prepend (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_prepend (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-void
-calendar_remove_object (Calendar *cal, iCalObject *obj)
-{
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_remove (cal->events, obj);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_remove (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_remove (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-void
-calendar_destroy (Calendar *cal)
-{
- g_list_foreach (cal->events, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->events);
-
- g_list_foreach (cal->todo, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->todo);
-
- g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->journal);
-
- if (cal->title)
- g_free (cal->title);
- if (cal->filename)
- g_free (cal->filename);
-
- g_free (cal);
-}
-
-char *
-ice (time_t t)
-{
- static char buffer [100];
- struct tm *tm;
-
- tm = localtime (&t);
- sprintf (buffer, "%d/%d/%d", tm->tm_mday, tm->tm_mon, tm->tm_year);
- return buffer;
-}
-
-static GList *
-calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
-{
- GList *new_events = 0;
-
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- if ((start <= object->dtstart) && (object->dtend <= end)){
- if (sort_func)
- new_events = g_list_insert_sorted (new_events, object, sort_func);
- else
- new_events = g_list_prepend (new_events, object);
- }
- }
-
- return new_events;
-}
-
-GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->events, start, end, sort_func);
-}
-
-GList *
-calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->todo, start, end, sort_func);
-}
-GList *
-calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->journal, start, end, sort_func);
-}
-
-gint
-calendar_compare_by_dtstart (gpointer a, gpointer b)
-{
- iCalObject *obj1, *obj2;
- time_t diff;
-
- obj1 = a;
- obj2 = b;
-
- diff = obj1->dtstart - obj2->dtstart;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-#define str_val(obj) (char *) vObjectUStringZValue (obj)
-
-/* Loads our calendar contents from a vObject */
-void
-calendar_load_from_vobject (Calendar *cal, VObject *vcal)
-{
- VObjectIterator i;;
-
- initPropIterator (&i, vcal);
-
- while (moreIteration (&i)){
- VObject *this = nextVObject (&i);
- iCalObject *ical;
- const char *object_name = vObjectName (this);
-
- if (strcmp (object_name, VCDCreatedProp) == 0){
- cal->created = time_from_isodate (str_val (this));
- continue;
- }
-
- if (strcmp (object_name, VCLocationProp) == 0)
- continue; /* FIXME: imlement */
-
- if (strcmp (object_name, VCProdIdProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCVersionProp) == 0)
- continue; /* FIXME: implement */
-
- ical = ical_object_create_from_vobject (this, object_name);
-
- if (ical)
- calendar_add_object (cal, ical);
- }
-}
-
-/* Loads a calendar from a file */
-void
-calendar_load (Calendar *cal, char *fname)
-{
- VObject *vcal;
-
- if (cal->filename){
- g_warning ("Calendar load called again\n");
- return;
- }
-
- cal->filename = g_strdup (fname);
- vcal = Parse_MIME_FromFileName (fname);
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
-void
-calendar_save (Calendar *cal, char *fname)
-{
- VObject *vcal;
- GList *l;
-
- if (fname == NULL)
- fname = cal->filename;
-
- vcal = newVObject (VCCalProp);
- addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
- addPropValue (vcal, VCTimeZoneProp, "NONE");
- addPropValue (vcal, VCVersionProp, VERSION);
- cal->temp = vcal;
-
- for (l = cal->events; l; l = l->next){
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
- writeVObjectToFile (fname, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
diff --git a/calendar/calendar.h b/calendar/calendar.h
deleted file mode 100644
index 8f4e4c1497..0000000000
--- a/calendar/calendar.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef CALENDAR_H
-#define CALENDAR_H
-
-#include "calobj.h"
-
-BEGIN_GNOME_DECLS
-
-typedef struct {
- char *title;
- char *filename;
- GList *events;
- GList *todo;
- GList *journal;
-
- time_t created;
- int modified;
- void *temp;
-} Calendar;
-
-Calendar *calendar_new (char *title);
-void calendar_load (Calendar *cal, char *fname);
-void calendar_add_object (Calendar *cal, iCalObject *obj);
-void calendar_remove_object (Calendar *cal, iCalObject *obj);
-void calendar_destroy (Calendar *cal);
-GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-gint calendar_compare_by_dtstart (gpointer a, gpointer b);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/calobj.c b/calendar/calobj.c
deleted file mode 100644
index 8c5605c688..0000000000
--- a/calendar/calobj.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (federico@gimp.org)
- */
-#include <string.h>
-#include <glib.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "versit/vcc.h"
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->enabled = 0;
- alarm->type = type;
-
- if (type != ALARM_MAIL){
- alarm->count = 15;
- alarm->units = ALARM_MINUTES;
- } else {
- printf ("uno!\n");
- alarm->count = 1;
- alarm->units = ALARM_DAYS;
- }
-
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (def_mail);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- g_free (ico);
-}
-
-GList *
-set_list (char *str, char *sc)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, sc); s; s = strtok (NULL, sc))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo;
- VObjectIterator i;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else
- return 0;
-
- /* uid */
- if (has (o, VCUniqueStringProp))
- ical->uid = g_strdup (str_val (vo));
-
- /* seq */
- if (has (o, VCSequenceProp))
- ical->seq = atoi (str_val (vo));
- else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp))
- ical->dtstart = time_from_isodate (str_val (vo));
- else
- ical->dtstart = 0;
-
- /* dtend */
- if (has (o, VCDTendProp))
- ical->dtend = time_from_isodate (str_val (vo));
- else
- ical->dtend = 0;
-
- /* dcreated */
- if (has (o, VCDCreatedProp))
- ical->created = time_from_isodate (str_val (vo));
-
- /* completed */
- if (has (o, VCCompletedProp))
- ical->completed = time_from_isodate (str_val (vo));
-
- /* last_mod */
- if (has (o, VCLastModifiedProp))
- ical->last_mod = time_from_isodate (str_val (vo));
- else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp))
- ical->exdate = set_list (str_val (vo), ",");
-
- /* description/comment */
- if (has (o, VCDescriptionProp))
- ical->comment = g_strdup (str_val (vo));
-
- /* summary */
- if (has (o, VCSummaryProp))
- ical->summary = g_strdup (str_val (vo));
- else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp))
- ical->status = g_strdup (str_val (vo));
- else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp))
- ical->class = g_strdup (str_val (vo));
- else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp))
- ical->categories = set_list (str_val (vo), ",");
-
- /* resources */
- if (has (o, VCResourcesProp))
- ical->resources = set_list (str_val (vo), ";");
-
- /* priority */
- if (has (o, VCPriorityProp))
- ical->priority = atoi (str_val (vo));
-
- /* tranparency */
- if (has (o, VCTranspProp))
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
-
- /* related */
- if (has (o, VCRelatedToProp))
- ical->related = set_list (str_val (vo), ";");
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0)
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- }
-
- /* url */
- if (has (o, VCURLProp))
- ical->url = g_strdup (str_val (vo));
-
- /* FIXME: dalarm */
- if (has (o, VCDAlarmProp))
- ;
-
- /* FIXME: aalarm */
- if (has (o, VCAAlarmProp))
- ;
-
- /* FIXME: palarm */
- if (has (o, VCPAlarmProp))
- ;
-
- /* FIXME: malarm */
- if (has (o, VCMAlarmProp))
- ;
-
- /* FIXME: rdate */
- if (has (o, VCRDateProp))
- ;
-
- /* FIXME: rrule */
- if (has (o, VCRRuleProp))
- ;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", 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
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
-
- /* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
-
- /* 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/calobj.h b/calendar/calobj.h
deleted file mode 100644
index 00dbd5c63e..0000000000
--- a/calendar/calobj.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org), Federico Mena (federico@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "versit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-} iCalObject;
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/clist.c b/calendar/clist.c
deleted file mode 100644
index 8491d45174..0000000000
--- a/calendar/clist.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * clist.c: All the good stuf to work with the clists that are used for the
- * tasklist.
- *
- * This file is largely based upon GTT code by Eckehard Berns.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <gnome.h>
-
-static void
-select_row(GtkCList *clist, gint row, gint col, GdkEventButton *event)
-{
- if (!event) return;
-
- g_print("select_row, row=%d col=%d button=%d\n", row, col, event->button);
-}
-
-static void
-unselect_row(GtkCList *clist, gint row, gint col, GdkEventButton *event)
-{
- if (!event) return;
-
- g_print("unselect_row, row=%d col=%d button=%d\n", row, col, event->button);
-}
-
-static void
-click_column(GtkCList *clist, gint col)
-{
-
- g_print("click_column, col=%d\n ", col);
-}
-
-
-
-
-GtkWidget * create_clist(void)
-{
- GtkStyle *style;
- GdkGCValues vals;
-
- GtkWidget *clist;
- char *titles[2] = {
- N_("Time"),
- N_("Event")
- };
-
- titles[0] = _(titles[0]);
- titles[1] = _(titles[1]);
- clist = gtk_clist_new_with_titles(2,titles);
- gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_SINGLE);
- gtk_clist_set_column_justification(GTK_CLIST(clist), 0, GTK_JUSTIFY_CENTER);
- style = gtk_widget_get_style(clist);
- g_return_val_if_fail(style != NULL, NULL);
- gdk_gc_get_values(style->fg_gc[0], &vals);
- gtk_clist_set_column_width(GTK_CLIST(clist), 0, gdk_string_width(vals.font, "00:00"));
- gtk_clist_set_policy(GTK_CLIST(clist),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_signal_connect(GTK_OBJECT(clist), "select_row",
- GTK_SIGNAL_FUNC(select_row), NULL);
- gtk_signal_connect(GTK_OBJECT(clist), "click_column",
- GTK_SIGNAL_FUNC(click_column), NULL);
- gtk_signal_connect(GTK_OBJECT(clist), "unselect_row",
- GTK_SIGNAL_FUNC(unselect_row), NULL);
- return clist;
-}
-
-void
-setup_clist(GtkWidget *clist)
-{
- char buf1[10];
- char buf2[1000] = "Programming GNOME";
- char *tmp[2] = { buf1, buf2 };
- int i, row;
-
- gtk_clist_freeze(GTK_CLIST(clist));
- gtk_clist_clear(GTK_CLIST(clist));
- for (i=0; i < 24; i++) {
- sprintf(buf1, "%d:00", i);
- row = gtk_clist_append(GTK_CLIST(clist), tmp);
- }
- gtk_clist_thaw(GTK_CLIST(clist));
-
-}
diff --git a/calendar/clist.h b/calendar/clist.h
deleted file mode 100644
index 061c1b316c..0000000000
--- a/calendar/clist.h
+++ /dev/null
@@ -1,2 +0,0 @@
-GtkWidget *create_clist(void);
-void setup_clist(GtkWidget *clist);
diff --git a/calendar/eventedit.c b/calendar/eventedit.c
deleted file mode 100644
index f2158b50f4..0000000000
--- a/calendar/eventedit.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#include <gnome.h>
-#include <string.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "main.h"
-#include "timeutil.h"
-
-static void event_editor_init (EventEditor *ee);
-
-/* Note: do not i18n these strings, they are part of the vCalendar protocol */
-char *class_names [] = { "PUBLIC", "PRIVATE", "CONFIDENTIAL" };
-
-guint
-event_editor_get_type (void)
-{
- static guint event_editor_type = 0;
-
- if(!event_editor_type) {
- GtkTypeInfo event_editor_info = {
- "EventEditor",
- sizeof(EventEditor),
- sizeof(EventEditorClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) event_editor_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- event_editor_type = gtk_type_unique (gtk_window_get_type (), &event_editor_info);
- }
- return event_editor_type;
-}
-
-/*
- * when the start time is changed, this adjusts the end time.
- */
-static void
-adjust_end_time (GtkWidget *widget, EventEditor *ee)
-{
- struct tm *tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- if (tm->tm_hour < 22)
- tm->tm_hour++;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
-}
-
-GtkWidget *
-adjust (GtkWidget *w, gfloat x, gfloat y, gfloat xs, gfloat ys)
-{
- GtkWidget *a = gtk_alignment_new (x, y, xs, ys);
-
- gtk_container_add (GTK_CONTAINER (a), w);
- return a;
-}
-
-/*
- * Checks if the day range occupies all the day, and if so, check the
- * box accordingly
- */
-static void
-ee_check_all_day (EventEditor *ee)
-{
- time_t ev_start, ev_end;
-
- ev_start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ev_end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (get_time_t_hour (ev_start) <= day_begin && get_time_t_hour (ev_end) >= day_end){
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 1);
- } else{
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 0);
- }
-}
-
-/*
- * Callback: checks if the selected hour range spans all of the day
- */
-static void
-check_times (GtkWidget *widget, EventEditor *ee)
-{
- ee_check_all_day (ee);
-}
-
-/*
- * Callback: all day event box clicked
- */
-static void
-set_all_day (GtkToggleButton *toggle, EventEditor *ee)
-{
- struct tm *tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- tm->tm_hour = day_begin;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (tm));
-
- if (toggle->active)
- tm->tm_hour = day_end;
- else
- tm->tm_hour++;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
-}
-
-static GtkWidget *
-event_editor_setup_time_frame (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *start_time, *end_time;
- GtkTable *t;
-
- frame = gtk_frame_new (_("Time"));
- t = GTK_TABLE (ee->general_time_table = gtk_table_new (1, 1, 0));
- gtk_container_add (GTK_CONTAINER (frame), ee->general_time_table);
-
- /* 1. Start time */
- ee->start_time = start_time = gnome_date_edit_new (ee->ical->dtstart);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (adjust_end_time), ee);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("Start time")), 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (t, start_time, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- /* 2. End time */
- ee->end_time = end_time = gnome_date_edit_new (ee->ical->dtend);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (end_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("End time")), 1, 2, 2, 3, 0, 0, 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- /* 3. All day checkbox */
- ee->general_allday = gtk_check_button_new_with_label (_("All day event"));
- gtk_signal_connect (GTK_OBJECT (ee->general_allday), "toggled",
- GTK_SIGNAL_FUNC (set_all_day), ee);
- gtk_table_attach (t, ee->general_allday, 3, 4, 1, 2, 0, 0, 0, 0);
- ee_check_all_day (ee);
-
- /* 4. Recurring event checkbox */
- ee->general_recur = gtk_check_button_new_with_label (_("Recurring event"));
- gtk_table_attach (t, ee->general_recur, 3, 4, 2, 3, 0, 0, 0, 0);
-
- gtk_container_border_width (GTK_CONTAINER (frame), 5);
- return frame;
-}
-
-static GtkWidget *
-timesel_new (void)
-{
- GtkWidget *menu, *option_menu;
- char *items [] = { N_("Minutes"), N_("Hours"), N_("Days") };
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- for (i = 0; i < 3; i++){
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items [i]));
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- return option_menu;
-}
-
-/*
- * Set the sensitive state depending on whether the alarm enabled flag.
- */
-static void
-ee_alarm_setting (CalendarAlarm *alarm, int sensitive)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_count), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_timesel), sensitive);
-
- if (alarm->type == ALARM_PROGRAM || alarm->type == ALARM_MAIL){
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label), sensitive);
- }
-}
-
-static void
-alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
-{
- ee_alarm_setting (alarm, toggle->active);
-}
-
-#define FX GTK_FILL | GTK_EXPAND
-#define XCOL 6
-static void
-ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type, int y)
-{
- char buffer [40];
-
- alarm->w_enabled = gtk_check_button_new_with_label (str);
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (alarm_toggle), alarm);
- gtk_table_attach (table, alarm->w_enabled, 2, 3, y, y+1, FX, 0, 0, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled), alarm->enabled);
-
- alarm->w_count = gtk_entry_new ();
- gtk_widget_set_usize (alarm->w_count, 40, 0);
- gtk_table_attach (table, alarm->w_count, 3, 4, y, y+1, FX, 0, 5, 0);
- sprintf (buffer, "%d", alarm->count);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_count), buffer);
-
- alarm->w_timesel = timesel_new ();
- gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel), alarm->units);
- gtk_table_attach (table, alarm->w_timesel, 4, 5, y, y+1, 0, 0, 0, 0);
-
- switch (type){
- case ALARM_MAIL:
- alarm->w_label = gtk_label_new (_("Mail to:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, XCOL, XCOL+1, y, y+1, FX, 0, 5, 0);
- alarm->w_entry = gtk_entry_new ();
- gtk_table_attach (table, alarm->w_entry, XCOL+1, XCOL+2, y, y+1, FX, 0, 6, 0);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_entry), alarm->data);
- break;
-
- case ALARM_PROGRAM:
- alarm->w_label = gtk_label_new (_("Run program:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, XCOL, XCOL+1, y, y+1, FX, 0, 5, 0);
- alarm->w_entry = gnome_file_entry_new ("alarm-program", _("Select program to run at alarm time"));
- gtk_table_attach (table, alarm->w_entry, XCOL+1, XCOL+2, y, y+1, 0, 0, 6, 0);
- break;
-
- default:
- /* Nothing */
- }
-
- ee_alarm_setting (alarm, alarm->enabled);
-}
-
-static GtkWidget *
-ee_alarm_widgets (EventEditor *ee)
-{
- GtkWidget *table, *mailto, *mailte, *l;
-
- l = gtk_frame_new (_("Alarms"));
-
- table = gtk_table_new (1, 1, 0);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_container_add (GTK_CONTAINER (l), table);
-
- mailto = gtk_label_new (_("Mail to:"));
- mailte = gtk_entry_new ();
-
- ee_create_ae (GTK_TABLE (table), _("Display"), &ee->ical->dalarm, ALARM_DISPLAY, 1);
- ee_create_ae (GTK_TABLE (table), _("Audio"), &ee->ical->aalarm, ALARM_AUDIO, 2);
- ee_create_ae (GTK_TABLE (table), _("Program"), &ee->ical->palarm, ALARM_PROGRAM, 3);
- ee_create_ae (GTK_TABLE (table), _("Mail"), &ee->ical->malarm, ALARM_MAIL, 4);
-
- return l;
-}
-
-static void
-connect_and_pack (EventEditor *ee, GtkWidget *hbox, GtkWidget *toggle, char *value)
-{
- gtk_box_pack_start_defaults (GTK_BOX (hbox), toggle);
-}
-
-static GtkWidget *
-ee_classification_widgets (EventEditor *ee)
-{
- GtkWidget *rpub, *rpriv, *conf;
- GtkWidget *frame, *hbox;
-
- frame = gtk_frame_new (_("Classification"));
- hbox = gtk_hbox_new (0, 0);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- rpub = gtk_radio_button_new_with_label (NULL, _("Public"));
- rpriv = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Private"));
- conf = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Confidential"));
-
- connect_and_pack (ee, hbox, rpub, class_names [0]);
- connect_and_pack (ee, hbox, rpriv, class_names [1]);
- connect_and_pack (ee, hbox, conf, class_names [2]);
- ee->general_radios = rpub;
-
- return frame;
-}
-
-/*
- * Retrieves the information from the CalendarAlarm widgets and stores them
- * on the CalendarAlarm generic values
- */
-void
-ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
-{
- GtkWidget *item;
- GtkMenu *menu;
- GList *child;
- int idx;
-
- if (alarm->data){
- g_free (alarm->data);
- alarm->data = 0;
- }
-
- alarm->enabled = GTK_TOGGLE_BUTTON (alarm->w_enabled)->active;
-
- if (!alarm->enabled)
- return;
-
- if (type == ALARM_PROGRAM)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
-
- /* Find out the index */
- menu = GTK_MENU (GTK_OPTION_MENU (alarm->w_timesel)->menu);
-
- item = gtk_menu_get_active (menu);
-
- for (idx = 0, child = menu->children; child->data != item; child = child->next)
- idx++;
-
- alarm->units = idx;
- alarm->count = atoi (gtk_entry_get_text (GTK_ENTRY (alarm->w_count)));
-}
-
-/*
- * Retrieves all of the information from the different widgets and updates
- * the iCalObject accordingly.
- */
-static void
-ee_store_dlg_values_to_ical (EventEditor *ee)
-{
- GtkRadioButton *radio = GTK_RADIO_BUTTON (ee->general_radios);
- iCalObject *ical = ee->ical;
- GSList *list = radio->group;
- int idx;
- time_t now;
-
- now = time (NULL);
- ical->dtstart = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ical->dtend = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- ee_store_alarm (&ical->dalarm, ALARM_DISPLAY);
- ee_store_alarm (&ical->aalarm, ALARM_AUDIO);
- ee_store_alarm (&ical->palarm, ALARM_PROGRAM);
- ee_store_alarm (&ical->malarm, ALARM_MAIL);
-
- for (idx = 0; list; list = list->next){
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
- idx++;
- }
- g_free (ical->class);
- ical->class = g_strdup (class_names [idx]);
-
- /* FIXME: This is not entirely correct; we should check if the values actually changed */
- ical->last_mod = now;
-
- if (ee->new_ical)
- ical->created = now;
-
- g_free (ical->summary);
- ical->summary = gtk_editable_get_chars (GTK_EDITABLE (ee->general_summary), 0, -1);
-}
-
-static void
-ee_ok (GtkWidget *widget, EventEditor *ee)
-{
- ee_store_dlg_values_to_ical (ee);
-
- if (ee->new_ical)
- gnome_calendar_add_object (GNOME_CALENDAR (ee->gnome_cal), ee->ical);
-
- gtk_widget_destroy (GTK_WIDGET (ee));
-}
-
-static void
-ee_cancel (GtkWidget *widget, EventEditor *ee)
-{
- if (ee->new_ical)
- ical_object_destroy (ee->ical);
- gtk_widget_destroy (GTK_WIDGET (ee));
-}
-
-static GtkWidget *
-ee_create_buttons (EventEditor *ee)
-{
- GtkWidget *box = gtk_hbox_new (1, 5);
- GtkWidget *ok, *cancel;
-
- ok = gnome_stock_button (GNOME_STOCK_BUTTON_OK);
- cancel = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL);
-
- gtk_box_pack_start (GTK_BOX (box), ok, 0, 0, 5);
- gtk_box_pack_start (GTK_BOX (box), cancel, 0, 0, 5);
-
- gtk_signal_connect (GTK_OBJECT (ok), "clicked", GTK_SIGNAL_FUNC(ee_ok), ee);
- gtk_signal_connect (GTK_OBJECT (cancel), "clicked", GTK_SIGNAL_FUNC(ee_cancel), ee);
-
- return box;
-}
-
-/*
- * Load the contents in a delayed fashion, as the GtkText widget needs it
- */
-static void
-ee_fill_summary (GtkWidget *widget, EventEditor *ee)
-{
- int pos = 0;
-
- gtk_editable_insert_text (GTK_EDITABLE (ee->general_summary), ee->ical->summary,
- strlen (ee->ical->summary), &pos);
- gtk_text_thaw (GTK_TEXT (ee->general_summary));
-}
-
-enum {
- OWNER_LINE,
- DESC_LINE,
- SUMMARY_LINE,
- TIME_LINE = 4,
- ALARM_LINE,
- CLASS_LINE = 8
-};
-
-#define LABEL_SPAN 2
-
-static void
-event_editor_init_widgets (EventEditor *ee)
-{
- GtkWidget *frame, *l;
-
- ee->hbox = gtk_vbox_new (0, 0);
- gtk_container_add (GTK_CONTAINER (ee), ee->hbox);
- gtk_container_border_width (GTK_CONTAINER (ee), 5);
-
- ee->notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (ee->hbox), ee->notebook, 1, 1, 0);
-
- ee->general_table = (GtkTable *) gtk_table_new (1, 1, 0);
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), GTK_WIDGET (ee->general_table),
- gtk_label_new (_("General")));
-
- l = adjust (gtk_label_new (_("Owner:")), 1.0, 0.5, 1.0, 1.0);
- gtk_table_attach (ee->general_table, l,
- 1, LABEL_SPAN, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 6);
-
- ee->general_owner = gtk_label_new (ee->ical->organizer);
- gtk_table_attach (ee->general_table, ee->general_owner,
- LABEL_SPAN, LABEL_SPAN + 1, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
-
- l = gtk_label_new (_("Description:"));
- gtk_table_attach (ee->general_table, l,
- 1, LABEL_SPAN, DESC_LINE, DESC_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
-
- ee->general_summary = gtk_text_new (NULL, NULL);
- gtk_text_freeze (GTK_TEXT (ee->general_summary));
- gtk_signal_connect (GTK_OBJECT (ee->general_summary), "realize",
- GTK_SIGNAL_FUNC (ee_fill_summary), ee);
- gtk_widget_set_usize (ee->general_summary, 0, 60);
- gtk_text_set_editable (GTK_TEXT (ee->general_summary), 1);
- gtk_table_attach (ee->general_table, ee->general_summary,
- 1, 40, SUMMARY_LINE, SUMMARY_LINE+1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 6, 0);
-
- frame = event_editor_setup_time_frame (ee);
- gtk_table_attach (ee->general_table, frame,
- 1, 40, TIME_LINE + 2, TIME_LINE + 3,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
-
- l = ee_alarm_widgets (ee);
- gtk_table_attach (ee->general_table, l,
- 1, 40, ALARM_LINE, ALARM_LINE + 1,
- 0, 0, 0, 0);
-
- l = ee_classification_widgets (ee);
- gtk_table_attach (ee->general_table, l,
- 1, 40, CLASS_LINE, CLASS_LINE + 1,
- 0, 0, 0, 0);
- /* Separator */
- gtk_box_pack_start (GTK_BOX (ee->hbox), gtk_hseparator_new (), 1, 1, 0);
-
- /* Buttons */
- gtk_box_pack_start (GTK_BOX (ee->hbox), ee_create_buttons (ee), 0, 0, 5);
-
- /* We show all of the contained widgets */
- gtk_widget_show_all (GTK_WIDGET (ee));
- /* And we hide the toplevel, to be consistent with the rest of Gtk */
- gtk_widget_hide (GTK_WIDGET (ee));
-}
-
-static void
-event_editor_init (EventEditor *ee)
-{
- ee->ical = 0;
-}
-
-GtkWidget *
-event_editor_new (GnomeCalendar *gcal, iCalObject *ical)
-{
- GtkWidget *retval;
- EventEditor *ee;
-
- retval = gtk_type_new (event_editor_get_type ());
- ee = EVENT_EDITOR (retval);
-
- if (ical == 0){
- ee->new_ical = 1;
- ical = ical_new ("Test Comment", user_name, "Test Summary");
- } else
- ee->new_ical = 0;
-
- ee->ical = ical;
- ee->gnome_cal = gcal;
- event_editor_init_widgets (ee);
-
- return retval;
-}
-
-/*
- * New event: Create iCal, edit, check result: Ok: insert; Cancel: destroy iCal
- * Edit event: fetch iCal, edit, check result: Ok: remove from calendar, add to calendar; Cancel: nothing
- */
diff --git a/calendar/eventedit.h b/calendar/eventedit.h
deleted file mode 100644
index 45e966d034..0000000000
--- a/calendar/eventedit.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef EVENT_EDITOR_H
-#define EVENT_EDITOR_H
-
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define EVENT_EDITOR(obj) GTK_CHECK_CAST(obj, event_editor_get_type(), EventEditor)
-#define EVENT_EDITOR_CLASS(class) GTK_CHECK_CAST_CLASS(class, event_editor_get_type(), EventEditorClass)
-#define IS_EVENT_EDITOR(obj) GTK_CHECK_TYPE(obj, event_editor_get_type())
-
-
-typedef struct {
- GtkWindow window;
- GtkWidget *notebook;
- GtkWidget *hbox;
- GtkWidget *vbox;
-
- GtkWidget *general;
- GtkTable *general_table;
- GtkWidget *general_time_table;
- GtkWidget *general_allday;
- GtkWidget *general_recur;
- GtkWidget *general_owner;
- GtkWidget *general_summary;
- GtkWidget *start_time, *end_time;
- GtkWidget *general_radios;
-
- /* The associated ical object */
- iCalObject *ical;
- int new_ical;
-
- /* The calendar owner of this event */
- GnomeCalendar *gnome_cal;
-} EventEditor;
-
-typedef struct {
- GtkWindowClass parent_class;
-} EventEditorClass;
-
-
-guint event_editor_get_type (void);
-GtkWidget *event_editor_new (GnomeCalendar *owner, iCalObject *);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-day-view.c b/calendar/gncal-day-view.c
deleted file mode 100644
index 951b0eb5ae..0000000000
--- a/calendar/gncal-day-view.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <gtk/gtksignal.h>
-#include "gncal-day-view.h"
-#include "timeutil.h"
-#include "view-utils.h"
-
-
-#define TEXT_BORDER 2
-#define MIN_INFO_WIDTH 50
-
-
-static void gncal_day_view_class_init (GncalDayViewClass *class);
-static void gncal_day_view_init (GncalDayView *dview);
-static void gncal_day_view_destroy (GtkObject *object);
-static void gncal_day_view_realize (GtkWidget *widget);
-static void gncal_day_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gncal_day_view_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-static GtkWidgetClass *parent_class;
-
-
-guint
-gncal_day_view_get_type (void)
-{
- static guint day_view_type = 0;
-
- if (!day_view_type) {
- GtkTypeInfo day_view_info = {
- "GncalDayView",
- sizeof (GncalDayView),
- sizeof (GncalDayViewClass),
- (GtkClassInitFunc) gncal_day_view_class_init,
- (GtkObjectInitFunc) gncal_day_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_view_type = gtk_type_unique (gtk_widget_get_type (), &day_view_info);
- }
-
- return day_view_type;
-}
-
-static void
-gncal_day_view_class_init (GncalDayViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- object_class->destroy = gncal_day_view_destroy;
-
- widget_class->realize = gncal_day_view_realize;
- widget_class->size_request = gncal_day_view_size_request;
- widget_class->expose_event = gncal_day_view_expose;
-}
-
-static void
-gncal_day_view_init (GncalDayView *dview)
-{
- GTK_WIDGET_UNSET_FLAGS (dview, GTK_NO_WINDOW);
-
- dview->calendar = NULL;
-
- dview->lower = 0;
- dview->upper = 0;
-
- dview->shadow_type = GTK_SHADOW_ETCHED_IN;
-}
-
-static void
-gncal_day_view_destroy (GtkObject *object)
-{
- GncalDayView *dview;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (object));
-
- dview = GNCAL_DAY_VIEW (object);
-
- if (dview->day_str)
- g_free (dview->day_str);
- if (dview->events)
- g_list_free (dview->events);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalDayView *dview;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dview = gtk_type_new (gncal_day_view_get_type ());
-
- dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
- dview->events = 0;
-
- gncal_day_view_update (dview);
-
- return GTK_WIDGET (dview);
-}
-
-static void
-gncal_day_view_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-}
-
-static void
-gncal_day_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalDayView *dview;
- int str_width, width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- dview = GNCAL_DAY_VIEW (widget);
-
- /* border and min width */
-
- str_width = gdk_string_width (widget->style->font, dview->day_str);
-
- width = MAX (MIN_INFO_WIDTH, str_width);
-
- requisition->width = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + width;
- requisition->height = 2 * (widget->style->klass->ythickness + TEXT_BORDER);
-
- /* division line */
-
- requisition->height += 2 * TEXT_BORDER + widget->style->klass->ythickness;
-
- /* title and at least one line of text */
-
- requisition->height += 2 * (widget->style->font->ascent + widget->style->font->descent);
-}
-
-static gint
-gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalDayView *dview;
- int x1, y1, width, height;
- GdkRectangle rect, dest;
- GdkFont *font;
- int str_width;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_DAY_VIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- dview = GNCAL_DAY_VIEW (widget);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, dview->shadow_type,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear and paint title */
-
- font = widget->style->font;
-
- rect.x = x1;
- rect.y = y1;
- rect.width = width;
- rect.height = 2 * TEXT_BORDER + font->ascent + font->descent;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest)) {
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- dest = rect;
-
- dest.x += TEXT_BORDER;
- dest.y += TEXT_BORDER;
- dest.width -= 2 * TEXT_BORDER;
- dest.height -= 2 * TEXT_BORDER;
-
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], &dest);
-
- str_width = gdk_string_width (font, dview->day_str);
-
- gdk_draw_string (widget->window,
- font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- dest.x + (dest.width - str_width) / 2,
- dest.y + font->ascent,
- dview->day_str);
-
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], NULL);
- }
-
- /* Division line */
-
- gtk_draw_hline (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- rect.x,
- rect.x + rect.width - 1,
- rect.y + rect.height);
-
- /* Text */
-
- rect.x = x1 + TEXT_BORDER;
- rect.y = y1 + 3 * TEXT_BORDER + font->ascent + font->descent + widget->style->klass->ythickness;
- rect.width = width - 2 * TEXT_BORDER;
- rect.height = height - (rect.y - y1) - TEXT_BORDER;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest))
- view_utils_draw_events (widget,
- widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- &rect,
- VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->events,
- dview->lower,
- dview->upper);
-
- return FALSE;
-}
-
-void
-gncal_day_view_update (GncalDayView *dview)
-{
- struct tm tm;
- char buf[256];
-
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (!dview->calendar->cal)
- return;
-
- if (dview->day_str)
- g_free (dview->day_str);
-
- tm = *localtime (&dview->lower);
- strftime (buf, sizeof (buf)-1, "%A %d", &tm);
- dview->day_str = g_strdup (buf);
-
- if (dview->events)
- g_list_free (dview->events);
-
- dview->events = calendar_get_events_in_range (dview->calendar->cal,
- dview->lower,
- dview->upper,
- calendar_compare_by_dtstart);
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
-}
-
-void
-gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if ((lower != dview->lower) || (upper != dview->upper)) {
- dview->lower = lower;
- dview->upper = upper;
-
- gncal_day_view_update (dview);
- }
-}
-
-void
-gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (shadow_type != dview->shadow_type) {
- dview->shadow_type = shadow_type;
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
- }
-}
diff --git a/calendar/gncal-day-view.h b/calendar/gncal-day-view.h
deleted file mode 100644
index 80e8a6299f..0000000000
--- a/calendar/gncal-day-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNCAL_DAY_VIEW_H
-#define GNCAL_DAY_VIEW_H
-
-
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_VIEW(obj) GTK_CHECK_CAST (obj, gncal_day_view_get_type (), GncalDayView)
-#define GNCAL_DAY_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_view_get_type (), GncalDayViewClass)
-#define GNCAL_IS_DAY_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_day_view_get_type ())
-
-
-typedef struct _GncalDayView GncalDayView;
-typedef struct _GncalDayViewClass GncalDayViewClass;
-
-struct _GncalDayView {
- GtkWidget widget;
-
- GnomeCalendar *calendar;/* the calendar we are associated to */
-
- time_t lower; /* lower and upper times to display */
- time_t upper; /* these include the full day */
-
- char *day_str; /* what day is it? */
- GList *events; /* the events for the this day */
- GtkShadowType shadow_type;
-};
-
-struct _GncalDayViewClass {
- GtkWidgetClass parent_class;
-};
-
-
-guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_day_view_update (GncalDayView *dview);
-void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
-
-void gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c
deleted file mode 100644
index 90a4813947..0000000000
--- a/calendar/gncal-full-day.c
+++ /dev/null
@@ -1,1237 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtktext.h>
-#include "gncal-full-day.h"
-#include "view-utils.h"
-
-
-#define TEXT_BORDER 2
-#define HANDLE_SIZE 3
-#define MIN_WIDTH 200
-#define XOR_RECT_WIDTH 2
-
-
-typedef struct {
- iCalObject *ico;
- GtkWidget *widget;
- GdkWindow *window;
- int lower_row; /* zero is first displayed row */
- int rows_used;
- int x; /* coords of child's window */
- int y;
- int width;
- int height;
-} Child;
-
-struct layout_row {
- int intersections;
- int *slots;
-};
-
-struct drag_info {
- Child *child;
- enum {
- DRAG_MOVE,
- DRAG_SIZE
- } drag_mode;
- int new_y;
- int new_height;
-};
-
-
-static void gncal_full_day_class_init (GncalFullDayClass *class);
-static void gncal_full_day_init (GncalFullDay *fullday);
-static void gncal_full_day_destroy (GtkObject *object);
-static void gncal_full_day_map (GtkWidget *widget);
-static void gncal_full_day_unmap (GtkWidget *widget);
-static void gncal_full_day_realize (GtkWidget *widget);
-static void gncal_full_day_unrealize (GtkWidget *widget);
-static void gncal_full_day_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gncal_full_day_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gncal_full_day_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gncal_full_day_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gncal_full_day_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gncal_full_day_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class;
-
-
-static void
-get_tm_range (GncalFullDay *fullday,
- time_t time_lower, time_t time_upper,
- struct tm *lower, struct tm *upper,
- int *lower_row, int *rows_used)
-{
- struct tm tm_lower, tm_upper;
- int lmin, umin;
- int lrow;
-
- /* Lower */
-
- tm_lower = *localtime (&time_lower);
-
- if ((tm_lower.tm_min % fullday->interval) != 0) {
- tm_lower.tm_min -= tm_lower.tm_min % fullday->interval; /* round down */
- mktime (&tm_lower);
- }
-
- /* Upper */
-
- tm_upper = *localtime (&time_upper);
-
- if ((tm_upper.tm_min % fullday->interval) != 0) {
- tm_upper.tm_min += fullday->interval - (tm_upper.tm_min % fullday->interval); /* round up */
- mktime (&tm_upper);
- }
-
- if (lower)
- *lower = tm_lower;
-
- if (upper)
- *upper = tm_upper;
-
- lmin = 60 * tm_lower.tm_hour + tm_lower.tm_min;
- umin = 60 * tm_upper.tm_hour + tm_upper.tm_min;
-
- if (umin == 0) /* midnight of next day? */
- umin = 60 * 24;
-
- lrow = lmin / fullday->interval;
-
- if (lower_row)
- *lower_row = lrow;
-
- if (rows_used)
- *rows_used = (umin - lmin) / fullday->interval;
-}
-
-static void
-child_map (GncalFullDay *fullday, Child *child)
-{
- gdk_window_show (child->window);
-
- if (!GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
-}
-
-static void
-child_unmap (GncalFullDay *fullday, Child *child)
-{
- gdk_window_hide (child->window);
-
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
-}
-
-static void
-child_set_text_pos (Child *child)
-{
- GtkAllocation allocation;
-
- allocation.x = 0;
- allocation.y = HANDLE_SIZE;
- allocation.width = child->width;
- allocation.height = child->height - 2 * HANDLE_SIZE;
-
- gtk_widget_size_request (child->widget, &child->widget->requisition); /* FIXME: is this needed? */
- gtk_widget_size_allocate (child->widget, &allocation);
-}
-
-static void
-child_realize (GncalFullDay *fullday, Child *child)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (fullday);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = child->x;
- attributes.y = child->y;
- attributes.width = child->width;
- attributes.height = child->height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.cursor = fullday->up_down_cursor;
- attributes.event_mask = (GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR;
-
- child->window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (child->window, widget);
-
- gtk_style_set_background (widget->style, child->window, GTK_STATE_NORMAL);
-
- gtk_widget_set_parent_window (child->widget, child->window);
-
- child_set_text_pos (child);
-}
-
-static void
-child_unrealize (GncalFullDay *fullday, Child *child)
-{
- gdk_window_set_user_data (child->window, NULL);
- gdk_window_destroy (child->window);
- child->window = NULL;
-}
-
-static void
-child_draw (GncalFullDay *fullday, Child *child, GdkRectangle *area, int draw_child)
-{
- GdkRectangle arect, rect, dest;
- gint w, h;
-
- gdk_window_get_size (child->window, &w, &h);
-
- if (!area) {
- arect.x = 0;
- arect.y = 0;
-
- arect.width = w;
- arect.height = h;
-
- area = &arect;
- }
-
- /* Top handle */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = w;
- rect.height = HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- /* Bottom handle */
-
- rect.y = h - HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- if (draw_child) {
- area->y -= HANDLE_SIZE;
- gtk_widget_draw (child->widget, area);
- }
-}
-
-static void
-child_range_changed (GncalFullDay *fullday, Child *child)
-{
- struct tm start, end;
- int lower_row, rows_used;
- int f_lower_row;
-
- /* Calc display range for event */
-
- get_tm_range (fullday, child->ico->dtstart, child->ico->dtend, &start, &end, &lower_row, &rows_used);
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, &f_lower_row, NULL);
-
- child->lower_row = lower_row - f_lower_row;
- child->rows_used = rows_used;
-}
-
-static void
-child_realized_setup (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gdk_window_set_cursor (widget->window, fullday->beam_cursor);
-
- gtk_text_insert (GTK_TEXT (widget), NULL, NULL, NULL,
- child->ico->summary,
- strlen (child->ico->summary));
-}
-
-static gint
-child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- Child *child;
-
- child = data;
-
- if (child->ico->summary)
- g_free (child->ico->summary);
-
- child->ico->summary = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
-
- return FALSE;
-}
-
-static Child *
-child_new (GncalFullDay *fullday, iCalObject *ico)
-{
- Child *child;
-
- child = g_new (Child, 1);
-
- child->ico = ico;
- child->widget = gtk_text_new (NULL, NULL);
- child->window = NULL;
- child->x = 0;
- child->y = 0;
- child->width = 0;
- child->height = 0;
-
- child_range_changed (fullday, child);
-
- /* We set the i-beam cursor and the initial summary text upon realization */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "realize",
- (GtkSignalFunc) child_realized_setup,
- child);
-
- /* Update the iCalObject summary when the text widget loses focus */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "focus_out_event",
- (GtkSignalFunc) child_focus_out,
- child);
-
- /* Finish setup */
-
- gtk_text_set_editable (GTK_TEXT (child->widget), TRUE);
- gtk_text_set_word_wrap (GTK_TEXT (child->widget), TRUE);
-
- gtk_widget_set_parent (child->widget, GTK_WIDGET (fullday));
-
- return child;
-}
-
-static void
-child_destroy (GncalFullDay *fullday, Child *child)
-{
- /* Unparent the child widget manually as we don't have a remove method */
-
- gtk_widget_ref (child->widget);
-
- gtk_widget_unparent (child->widget);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_unmap (fullday, child);
-
- if (GTK_WIDGET_REALIZED (fullday))
- child_unrealize (fullday, child);
-
- gtk_widget_unref (child->widget);
-
- g_free (child);
-}
-
-static void
-child_set_pos (GncalFullDay *fullday, Child *child, int x, int y, int width, int height)
-{
- child->x = x;
- child->y = y;
- child->width = width;
- child->height = height;
-
- if (!child->window) /* realized? */
- return;
-
- child_set_text_pos (child);
- gdk_window_move_resize (child->window, x, y, width, height);
-}
-
-static struct layout_row *
-layout_get_rows (GncalFullDay *fullday)
-{
- struct layout_row *rows;
- int max_i;
- int f_rows;
- GList *children;
- Child *child;
- int i, n;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- rows = g_new0 (struct layout_row, f_rows);
- max_i = 0;
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- rows[n].intersections++;
-
- if (rows[n].intersections > max_i)
- max_i = rows[n].intersections;
- }
- }
-
- for (i = 0; i < f_rows; i++)
- rows[i].slots = g_new0 (int, max_i);
-
- return rows;
-}
-
-static void
-layout_get_child_intersections (Child *child, struct layout_row *rows, int *min, int *max)
-{
- int i, n;
- int imin, imax;
-
- imax = 0;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- if (rows[n].intersections > imax)
- imax = rows[n].intersections;
- }
-
- imin = imax;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- if (rows[n].intersections < imin)
- imin = rows[n].intersections;
- }
-
- if (min)
- *min = imin;
-
- if (max)
- *max = imax;
-}
-
-static int
-calc_labels_width (GncalFullDay *fullday)
-{
- struct tm cur, upper;
- time_t tim, time_upper;
- int width, max_w;
- char buf[256];
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &cur, &upper, NULL, NULL);
-
- max_w = 0;
-
- tim = mktime (&cur);
- time_upper = mktime (&upper);
-
- while (tim < time_upper) {
- strftime (buf, 256, "%X", &cur);
-
- width = gdk_string_width (GTK_WIDGET (fullday)->style->font, buf);
-
- if (width > max_w)
- max_w = width;
-
- cur.tm_min += fullday->interval;
- tim = mktime (&cur);
- }
-
- return max_w;
-}
-
-static void
-layout_child (GncalFullDay *fullday, Child *child, struct layout_row *rows)
-{
- int c_x, c_y, c_width, c_height;
- GtkWidget *widget;
- int labels_width;
- int height, f_rows;
- int row_height;
-
- /* Calculate child position */
-
- widget = GTK_WIDGET (fullday);
-
- labels_width = calc_labels_width (fullday); /* FIXME: this is expensive to do for each child */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- height = widget->allocation.height - 2 * widget->style->klass->ythickness;
- row_height = height / f_rows;
-
- c_x = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + labels_width;
- c_y = widget->style->klass->ythickness;
-
- /* FIXME: for now, the children overlap. Make it layout them nicely. */
-
- c_width = widget->allocation.width - (widget->style->klass->xthickness + c_x);
-
- c_y += child->lower_row * row_height;
- c_height = child->rows_used * row_height;
-
- /* Position child */
-
- child_set_pos (fullday, child, c_x, c_y, c_width, c_height);
-}
-
-static void
-layout_children (GncalFullDay *fullday)
-{
- struct layout_row *rows;
- GList *children;
-
- rows = layout_get_rows (fullday);
-
- for (children = fullday->children; children; children = children->next)
- layout_child (fullday, children->data, rows);
-
- g_free (rows);
-}
-
-guint
-gncal_full_day_get_type (void)
-{
- static guint full_day_type = 0;
-
- if (!full_day_type) {
- GtkTypeInfo full_day_info = {
- "GncalFullDay",
- sizeof (GncalFullDay),
- sizeof (GncalFullDayClass),
- (GtkClassInitFunc) gncal_full_day_class_init,
- (GtkObjectInitFunc) gncal_full_day_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- full_day_type = gtk_type_unique (gtk_container_get_type (), &full_day_info);
- }
-
- return full_day_type;
-}
-
-static void
-gncal_full_day_class_init (GncalFullDayClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- object_class->destroy = gncal_full_day_destroy;
-
- widget_class->map = gncal_full_day_map;
- widget_class->unmap = gncal_full_day_unmap;
- widget_class->realize = gncal_full_day_realize;
- widget_class->unrealize = gncal_full_day_unrealize;
- widget_class->draw = gncal_full_day_draw;
- widget_class->size_request = gncal_full_day_size_request;
- widget_class->size_allocate = gncal_full_day_size_allocate;
- widget_class->button_press_event = gncal_full_day_button_press;
- widget_class->button_release_event = gncal_full_day_button_release;
- widget_class->motion_notify_event = gncal_full_day_motion;
- widget_class->expose_event = gncal_full_day_expose;
-
- container_class->foreach = gncal_full_day_foreach;
-}
-
-static void
-gncal_full_day_init (GncalFullDay *fullday)
-{
- GTK_WIDGET_UNSET_FLAGS (fullday, GTK_NO_WINDOW);
-
- fullday->calendar = NULL;
-
- fullday->lower = 0;
- fullday->upper = 0;
- fullday->interval = 30; /* 30 minutes by default */
-
- fullday->children = NULL;
- fullday->drag_info = g_new (struct drag_info, 1);
-
- fullday->up_down_cursor = NULL;
- fullday->beam_cursor = NULL;
-}
-
-static void
-gncal_full_day_destroy (GtkObject *object)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (object));
-
- fullday = GNCAL_FULL_DAY (object);
-
- /* Unparent the children manually as we don't have a remove method */
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- gtk_widget_unparent (child->widget);
- }
-
- g_list_free (fullday->children);
- g_free (fullday->drag_info);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- fullday = gtk_type_new (gncal_full_day_get_type ());
-
- fullday->calendar = calendar;
-
- gncal_full_day_set_bounds (fullday, lower, upper);
-
- return GTK_WIDGET (fullday);
-}
-
-static void
-gncal_full_day_map (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_show (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_map (fullday, children->data);
-}
-
-static void
-gncal_full_day_unmap (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_hide (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_unmap (fullday, children->data);
-}
-
-static void
-gncal_full_day_realize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-
- fullday->up_down_cursor = gdk_cursor_new (GDK_DOUBLE_ARROW);
- fullday->beam_cursor = gdk_cursor_new (GDK_XTERM);
-
- for (children = fullday->children; children; children = children->next)
- child_realize (fullday, children->data);
-}
-
-static void
-gncal_full_day_unrealize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- fullday = GNCAL_FULL_DAY (widget);
-
- for (children = fullday->children; children; children = children->next)
- child_unrealize (fullday, children->data);
-
- gdk_cursor_destroy (fullday->up_down_cursor);
- fullday->up_down_cursor = NULL;
-
- gdk_cursor_destroy (fullday->beam_cursor);
- fullday->beam_cursor = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gncal_full_day_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* FIXME */
-}
-
-static void
-gncal_full_day_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalFullDay *fullday;
- int labels_width;
- int rows;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (requisition != NULL);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* Border and min width */
-
- labels_width = calc_labels_width (fullday);
-
- requisition->width = 2 * widget->style->klass->xthickness + 4 * TEXT_BORDER + labels_width + MIN_WIDTH;
- requisition->height = 2 * widget->style->klass->ythickness;
-
- /* Rows */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- requisition->height += (rows * (2 * TEXT_BORDER + widget->style->font->ascent + widget->style->font->descent)
- + (rows - 1)); /* division lines */
-}
-
-static void
-gncal_full_day_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- layout_children (fullday);
-}
-
-static Child *
-find_child_by_window (GncalFullDay *fullday, GdkWindow *window)
-{
- GList *children;
- Child *child;
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->window == window)
- return child;
- }
-
- return NULL;
-}
-
-static void
-draw_xor_rect (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int i;
-
- widget = GTK_WIDGET (fullday);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_INVERT);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_INCLUDE_INFERIORS);
-
- di = fullday->drag_info;
-
- for (i = 0; i < XOR_RECT_WIDTH; i++)
- gdk_draw_rectangle (widget->window,
- widget->style->white_gc,
- FALSE,
- di->child->x + i,
- di->new_y + i,
- di->child->width - 2 * i - 1,
- di->new_height - 2 * i - 2);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_COPY);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_CLIP_BY_CHILDREN);
-}
-
-static gint
-gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- Child *child;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- return FALSE; /* FIXME: do range selection thing */
- else {
- child = find_child_by_window (fullday, event->window);
-
- if (!child)
- return FALSE;
-
- di = fullday->drag_info;
-
- di->child = child;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- if (event->y < HANDLE_SIZE)
- di->drag_mode = DRAG_MOVE;
- else
- di->drag_mode = DRAG_SIZE;
-
- di->new_y = child->y;
- di->new_height = child->height;
-
- gdk_pointer_grab (child->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- NULL,
- event->time);
-
- draw_xor_rect (fullday);
- }
-
- return FALSE;
-}
-
-static void
-recompute_motion (GncalFullDay *fullday, int y)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int rows, row_height;
- int ythickness;
-
- widget = GTK_WIDGET (fullday);
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- ythickness = widget->style->klass->ythickness;
-
- row_height = (widget->allocation.height - 2 * ythickness) / rows;
-
- y -= ythickness;
- y = (y + row_height / 2) / row_height; /* round to nearest bound */
- y = y * row_height + ythickness;
-
- di = fullday->drag_info;
-
- switch (di->drag_mode) {
- case DRAG_MOVE:
- if (y < ythickness)
- y = ythickness;
- else if (y >= (ythickness + rows * row_height - di->new_height))
- y = ythickness + rows * row_height - di->new_height;
-
- di->new_y = y;
-
- break;
-
- case DRAG_SIZE:
- if (y <= di->child->y)
- y = di->child->y + row_height;
- else if (y >= (ythickness + rows * row_height))
- y = ythickness + rows * row_height;
-
- di->new_height = y - di->new_y;
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-update_from_drag_info (GncalFullDay *fullday)
-{
- struct drag_info *di;
- GtkWidget *widget;
- struct tm tm;
- int f_rows;
- int row_height;
- int start_row, used_rows;
-
- di = fullday->drag_info;
-
- widget = GTK_WIDGET (fullday);
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, &f_rows);
-
- row_height = (widget->allocation.height - 2 * widget->style->klass->ythickness) / f_rows;
-
- start_row = (di->new_y - widget->style->klass->ythickness) / row_height;
- used_rows = di->new_height / row_height;
-
- tm.tm_min += fullday->interval * start_row;
- di->child->ico->dtstart = mktime (&tm);
-
- tm.tm_min += fullday->interval * used_rows;
- di->child->ico->dtend = mktime (&tm);
-
- child_range_changed (fullday, di->child);
-
- /* FIXME: notify calendar of change */
-
- /* FIXME: re-layout or let notification do it? */
-
- layout_children (fullday);
-}
-
-static gint
-gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- if (!di->child || (event->window != di->child->window))
- return FALSE;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- gdk_pointer_ungrab (event->time);
-
- update_from_drag_info (fullday);
-
- di->child = NULL;
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
- di = fullday->drag_info;
-
- if (!di->child || (event->window != di->child->window))
- return FALSE;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- draw_xor_rect (fullday);
-
- return FALSE;
-}
-
-static void
-paint_back (GncalFullDay *fullday, GdkRectangle *area)
-{
- GtkWidget *widget;
- GdkRectangle rect, dest;
- int x1, y1, width, height;
- int labels_width, division_x;
- int rows, row_height;
- int i, y;
- struct tm tm;
- char buf[256];
-
- widget = GTK_WIDGET (fullday);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear space for labels */
-
- labels_width = calc_labels_width (fullday);
-
- rect.x = x1;
- rect.y = y1;
- rect.width = 2 * TEXT_BORDER + labels_width;
- rect.height = height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Vertical division */
-
- division_x = x1 + 2 * TEXT_BORDER + labels_width;
-
- gtk_draw_vline (widget->style, widget->window,
- GTK_STATE_NORMAL,
- y1,
- y1 + height - 1,
- division_x);
-
- /* Horizontal divisions */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, &rows);
-
- row_height = height / rows; /* includes division line at bottom of row */
-
- y = y1 + row_height - 1;
-
- for (i = 1; i < rows; i++) {
- gdk_draw_line (widget->window,
- widget->style->black_gc,
- x1, y,
- x1 + width - 1, y);
-
- y += row_height;
- }
-
- /* Labels */
-
- y = y1 + ((row_height - 1) - (widget->style->font->ascent + widget->style->font->descent)) / 2;
-
- rect.height = row_height - 1;
-
- for (i = 0; i < rows; i++) {
- mktime (&tm);
-
- if (gdk_rectangle_intersect (&rect, area, &dest)) {
- strftime (buf, 256, "%X", &tm);
-
- gdk_draw_string (widget->window,
- widget->style->font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x1 + TEXT_BORDER,
- y + widget->style->font->ascent,
- buf);
- }
-
- rect.y += row_height;
- y += row_height;
-
- tm.tm_min += fullday->interval;
- }
-}
-
-static gint
-gncal_full_day_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- paint_back (fullday, &event->area);
- else
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (event->window == child->window) {
- child_draw (fullday, child, &event->area, FALSE);
- break;
- }
- }
-
- return FALSE;
-}
-
-static void
-gncal_full_day_foreach (GtkContainer *container, GtkCallback callback, gpointer callback_data)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (container));
- g_return_if_fail (callback != NULL);
-
- fullday = GNCAL_FULL_DAY (container);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- (*callback) (child->widget, callback_data);
- }
-}
-
-void
-gncal_full_day_update (GncalFullDay *fullday)
-{
- GList *children;
- GList *l_events, *events;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if (!fullday->calendar->cal)
- return;
-
- for (children = fullday->children; children; children = children->next)
- child_destroy (fullday, children->data);
-
- g_list_free (fullday->children);
-
- children = NULL;
-
- l_events = calendar_get_events_in_range (fullday->calendar->cal,
- fullday->lower,
- fullday->upper,
- calendar_compare_by_dtstart);
-
- for (events = l_events; events; events = events->next) {
- child = child_new (fullday, events->data);
- children = g_list_append (children, child);
- }
-
- g_list_free (l_events);
-
- fullday->children = g_list_first (children);
-
- layout_children (fullday);
-
- /* Realize and map children */
-
- for (children = fullday->children; children; children = children->next) {
- if (GTK_WIDGET_REALIZED (fullday))
- child_realize (fullday, children->data);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_map (fullday, children->data);
- }
-
- /* FIXME: paint or something */
-
- gtk_widget_draw (GTK_WIDGET (fullday), NULL);
-}
-
-void
-gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper)
-{
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if ((lower != fullday->lower) || (upper != fullday->upper)) {
- fullday->lower = lower;
- fullday->upper = upper;
-
- gncal_full_day_update (fullday);
- }
-}
diff --git a/calendar/gncal-full-day.h b/calendar/gncal-full-day.h
deleted file mode 100644
index 27e60c9326..0000000000
--- a/calendar/gncal-full-day.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNCAL_FULL_DAY_H
-#define GNCAL_FULL_DAY_H
-
-
-#include <gtk/gtkcontainer.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_FULL_DAY(obj) GTK_CHECK_CAST (obj, gncal_full_day_get_type (), GncalFullDay)
-#define GNCAL_FULL_DAY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_full_day_get_type (), GncalFullDayClass)
-#define GNCAL_IS_FULL_DAY(obj) GTK_CHECK_TYPE (obj, gncal_full_day_get_type ())
-
-
-typedef struct _GncalFullDay GncalFullDay;
-typedef struct _GncalFullDayClass GncalFullDayClass;
-
-struct _GncalFullDay {
- GtkContainer container;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t lower; /* lower time to display */
- time_t upper; /* upper time to display */
- int interval; /* interval between rows in minutes */
-
- GList *children; /* container children */
- gpointer drag_info; /* internal drag information */
-
- GdkCursor *up_down_cursor; /* for dragging children */
- GdkCursor *beam_cursor; /* for the text widgets */
-};
-
-struct _GncalFullDayClass {
- GtkContainerClass parent_class;
-};
-
-
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_full_day_update (GncalFullDay *fullday);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-week-view.c b/calendar/gncal-week-view.c
deleted file mode 100644
index 4adf7ba283..0000000000
--- a/calendar/gncal-week-view.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <string.h>
-#include "gncal-week-view.h"
-
-
-static void gncal_week_view_init (GncalWeekView *wview);
-
-
-guint
-gncal_week_view_get_type (void)
-{
- static guint week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "GncalWeekView",
- sizeof (GncalWeekView),
- sizeof (GncalWeekViewClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_week_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gtk_table_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-gncal_week_view_init (GncalWeekView *wview)
-{
- int i;
-
- wview->calendar = NULL;
- memset (&wview->start_of_week, 0, sizeof (wview->start_of_week));
-
- for (i = 0; i < 7; i++)
- wview->days[i] = NULL;
-
- wview->gtk_calendar = NULL;
-}
-
-GtkWidget *
-gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
-{
- GncalWeekView *wview;
- int i;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- wview = gtk_type_new (gncal_week_view_get_type ());
-
- gtk_table_set_homogeneous (GTK_TABLE (wview), TRUE);
-
- wview->calendar = calendar;
-
- for (i = 0; i < 7; i++) {
- wview->days[i] = GNCAL_DAY_VIEW (gncal_day_view_new (calendar, 0, 0));
-
- if (i < 5)
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->days[i]),
- i, i + 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
- else
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->days[i]),
- i - 2, i - 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- gtk_widget_show (GTK_WIDGET (wview->days[i]));
- }
-
- /* FIXME: for now this is a plain calendar (for not having anything better to put
- * there). In the final version it should be a nice days/hours matrix with
- * "event density" display as in Sun's "cm" program.
- */
-
- wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
- gtk_calendar_display_options (wview->gtk_calendar,
- GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->gtk_calendar),
- 0, 3,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 4, 4);
- gtk_widget_show (GTK_WIDGET (wview->gtk_calendar));
-
- gncal_week_view_set (wview, start_of_week);
-
- return GTK_WIDGET (wview);
-}
-
-static void
-update (GncalWeekView *wview, int update_days)
-{
- int i;
-
- if (update_days)
- for (i = 0; i < 7; i++)
- gncal_day_view_update (wview->days[i]);
-
- /* FIXME: update extra widgets */
-}
-
-void
-gncal_week_view_update (GncalWeekView *wview)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- update (wview, TRUE);
-}
-
-void
-gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
-{
- struct tm tm;
- time_t day_start, day_end;
- int i;
-
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- tm = *localtime (&start_of_week);
-
- /* back up to start of week (Monday) */
-
- tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
- /* Start of day */
-
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- day_start = mktime (&tm);
-
- /* Calendar */
-
- gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- /* Day views */
-
- for (i = 0; i < 7; i++) { /* rest of days */
- tm.tm_mday++;
- day_end = mktime (&tm);
-
- printf ("Boundary: ");
- print_time_t (day_start);
- gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
-
- day_start = day_end;
- }
-
- update (wview, FALSE);
-}
diff --git a/calendar/gncal-week-view.h b/calendar/gncal-week-view.h
deleted file mode 100644
index 6bf29e40c4..0000000000
--- a/calendar/gncal-week-view.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gtkcalendar.h>
-#include "gncal-day-view.h"
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_WEEK_VIEW(obj) GTK_CHECK_CAST (obj, gncal_week_view_get_type (), GncalWeekView)
-#define GNCAL_WEEK_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_week_view_get_type (), GncalWeekViewClass)
-#define GNCAL_IS_WEEK_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_week_view_get_type ())
-
-
-typedef struct _GncalWeekView GncalWeekView;
-typedef struct _GncalWeekViewClass GncalWeekViewClass;
-
-struct _GncalWeekView {
- GtkTable table;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- struct tm start_of_week;
-
- GncalDayView *days[7]; /* the day view widgets */
- GtkCalendar *gtk_calendar; /* At least for now; see the FIXME comments in the .c file */
-};
-
-struct _GncalWeekViewClass {
- GtkTableClass parent_class;
-};
-
-
-guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
-
-void gncal_week_view_update (GncalWeekView *wview);
-void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal.c b/calendar/gncal.c
deleted file mode 100644
index 232aa19135..0000000000
--- a/calendar/gncal.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * gnlp.c: LPQ/LPR stuff
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <time.h>
-#include <string.h>
-
-#include <gnome.h>
-#include <config.h>
-
-#include "gncal.h"
-#include "calcs.h"
-#include "clist.h"
-#include "gncal-week-view.h"
-
-void
-prueba (void)
-{
- GtkWidget *window;
- GtkWidget *wview;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
- gtk_container_border_width (GTK_CONTAINER (window), 6);
-
- wview = gncal_week_view_new (NULL, time (NULL));
- gtk_container_add (GTK_CONTAINER (window), wview);
- gtk_widget_show (wview);
-
- gtk_widget_show (window);
-}
-
-/* Function declarations */
-void parse_args(int argc, char *argv[]);
-static int save_state (GnomeClient *client,
- gint phase,
- GnomeRestartStyle save_style,
- gint shutdown,
- GnomeInteractStyle interact_style,
- gint fast,
- gpointer client_data);
-static void connect_client (GnomeClient *client,
- gint was_restarted,
- gpointer client_data);
-
-void discard_session (gchar *id);
-
-static GtkMenuEntry menu_items[] =
-{
- { N_("File/Exit"), N_("<control>Q"), menu_file_quit, NULL},
- { N_("Help/About"), N_("<control>A"), menu_help_about, NULL},
-};
-
-#define DAY_ARRAY_MAX 35
-/* The naughty global variables */
-int curr_day, old_day;
-int curr_month, old_month;
-int curr_year, old_year;
-GtkWidget *month_label;
-GtkWidget *year_label;
-GtkWidget *dailylist;
-GtkWidget *calendar_days[DAY_ARRAY_MAX];
-GtkWidget *calendar_buttons[DAY_ARRAY_MAX];
-GtkWidget *app;
-GtkWidget *calendar;
-
-int restarted = 0;
-/* Stuff we use for session state */
-int os_x = 0,
- os_y = 0,
- os_w = 0,
- os_h = 0;
-
-
-/* True if parsing determined that all the work is already done. */
-int just_exit = 0;
-
-/* These are the arguments that our application supports. */
-static struct argp_option arguments[] =
-{
-#define DISCARD_KEY -1
- { "discard-session", DISCARD_KEY, N_("ID"), 0, N_("Discard session"), 1 },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-/* Forward declaration of the function that gets called when one of
- our arguments is recognized. */
-static error_t parse_an_arg (int key, char *arg, struct argp_state *state);
-
-/* This structure defines our parser. It can be used to specify some
- options for how our parsing function should be called. */
-static struct argp parser =
-{
- arguments, /* Options. */
- parse_an_arg, /* The parser function. */
- NULL, /* Some docs. */
- NULL, /* Some more docs. */
- NULL, /* Child arguments -- gnome_init fills
- this in for us. */
- NULL, /* Help filter. */
- NULL /* Translation domain; for the app it
- can always be NULL. */
-};
-
-#define ELEMENTS(x) (sizeof (x) / sizeof (x [0]))
-
-GtkMenuFactory *
-create_menu ()
-{
- GtkMenuFactory *subfactory;
- int i;
-
- subfactory = gtk_menu_factory_new (GTK_MENU_FACTORY_MENU_BAR);
- gtk_menu_factory_add_entries (subfactory, menu_items, ELEMENTS(menu_items));
-
- return subfactory;
-}
-
-/* place marker until i get get something better */
-void print_error(char *text)
-{
- GtkWidget *msgbox;
- char buf[512];
-
- if (errno == 0)
- sprintf(buf, "%s", text);
- else
- sprintf(buf, "%s (%s)", text, g_strerror(errno));
-
- g_warning("%s\n", buf);
- msgbox = gnome_message_box_new(buf, "error", "OK", NULL, NULL);
-
- gtk_widget_show(msgbox);
-}
-
-
-void menu_file_quit(GtkWidget *widget, gpointer data)
-{
- gtk_main_quit();
-}
-
-void menu_help_about(GtkWidget *widget, gpointer data)
-{
- GtkWidget *about;
- gchar *authors[] = {
- "Craig Small <csmall@small.dropbear.id.au>",
- NULL };
- about = gnome_about_new( _("Gnome Calendar"), VERSION,
- "(C) 1998",
- authors,
- /* Comments */
- _("This program shows a nice pretty "
- "calendar and will do scheduling "
- "real soon now!"),
- NULL);
-
- gtk_widget_show(about);
-}
-
-void dailylist_item_select(GtkWidget *widget, gpointer data)
-{
- int *x = (int*)data;
-
- g_print("Selected %d\n", x);
-}
-
-void update_today_list(void)
-{
- GtkWidget *listitem;
- GtkWidget *list_hbox;
- GtkWidget *hour_label;
- GtkWidget *event_label;
- char buf[50];
- int tmphr, tmpmin,i;
-
-}
-
-/*
- * updates the calendar that appears in the left collumn
- */
-void month_changed(GtkWidget *widget, gpointer data)
-{
- curr_month = GTK_CALENDAR(widget)->month;
- curr_year = GTK_CALENDAR(widget)->year;
-}
-
-void update_calendar()
-{
- int tmpday;
- int i;
- char buf[50];
- int month_changed;
- static int offset;
-
- gtk_calendar_unmark_day(GTK_CALENDAR(calendar),old_day);
- gtk_calendar_mark_day(GTK_CALENDAR(calendar), curr_day);
- printf("Date changed (nothing happens much\n");
-/* gtk_calendar_select_day(GTK_CALENDAR(calendar), curr_day); */
-#if 0
- /* Only update the whole calendar if the year or month has changed */
- tmpday=1;
- month_changed = FALSE;
- if (curr_month != old_month || curr_year != old_year) {
- month_changed = TRUE;
- offset = weekday_of_date(tmpday, curr_month, curr_year) - 1;
- }
-
- for(i=0; i < DAY_ARRAY_MAX; i++) {
- tmpday = i - offset +1;
- if (valid_date(tmpday, curr_month, curr_year)) {
- sprintf(buf, "%2d", tmpday);
- /*if (month_changed) {*/
- gtk_label_set(GTK_LABEL(calendar_days[i]), buf);
- gtk_widget_show(calendar_buttons[i]);
- /*}*/
- if (tmpday == curr_day) {
- gtk_container_border_width(GTK_CONTAINER(calendar_buttons[i]), 2);
- gtk_widget_show(calendar_buttons[i]);
- } else {
- gtk_container_border_width(GTK_CONTAINER(calendar_buttons[i]), 0);
- }
- } else if (month_changed) {
- gtk_label_set(GTK_LABEL(calendar_days[i]), "");
- gtk_widget_hide(calendar_buttons[i]);
- gtk_container_border_width(GTK_CONTAINER(calendar_buttons[i]), 0);
- }
- } /* for i */
-#endif /* 0 */
-}
-
-/*
- * Updates all the main window widgets when the current day of interest is
- * changed
- */
-void update_today(void)
-{
- char buf[50];
-
- /* This needs to be fixed to get the right date order for the country*/
-/* if (curr_month != old_month) {
- gtk_label_set(GTK_LABEL(month_label), month_name(curr_month));
- }
- if (curr_year != old_year) {
- sprintf(buf, "%4d", curr_year);
- gtk_label_set(GTK_LABEL(year_label), buf);
- }*/
- update_today_list();
- update_calendar();
-}
-
-void next_day_but_clicked(GtkWidget *widget, gpointer data)
-{
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- next_date(&curr_day, &curr_month, &curr_year);
- update_today();
-}
-
-void prev_day_but_clicked(GtkWidget *widget, gpointer data)
-{
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- prev_date(&curr_day, &curr_month, &curr_year);
- update_today();
-}
-
-void today_but_clicked(GtkWidget *widget, gpointer data)
-{
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- get_system_date(&curr_day, &curr_month, &curr_year);
- update_today();
-}
-
-void prev_month_but_clicked(GtkWidget *widget, gpointer data)
-{
- if (curr_year == 0 && curr_month == MONTH_MIN)
- return;
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- curr_month--;
- if (curr_month < MONTH_MIN) {
- curr_month = MONTH_MAX;
- curr_year--;
- }
- update_today();
-}
-
-void next_month_but_clicked(GtkWidget *widget, gpointer data)
-{
- if (curr_year == 3000 && curr_month == MONTH_MAX)
- return;
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- curr_month++;
- if (curr_month > MONTH_MAX ) {
- curr_month = MONTH_MIN;
- curr_year++;
- }
- update_today();
-}
-
-void prev_year_but_clicked(GtkWidget *widget, gpointer data)
-{
- if (curr_year == 0)
- return;
-
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- curr_year--;
- update_today();
-}
-
-
-void next_year_but_clicked(GtkWidget *widget, gpointer data)
-{
- if (curr_year == 3000)
- return;
-
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- curr_year++;
- update_today();
-}
-
-
-void calendar_but_clicked(GtkWidget *widget, gpointer data)
-{
- char *ptr;
- int x;
-
- ptr = GTK_LABEL(GTK_BUTTON(widget)->child)->label;
- x = atoi(ptr);
-
- if (valid_date(x, curr_month, curr_year)) {
- old_day = curr_day;
- old_month = curr_month;
- old_year = curr_year;
- curr_day = x;
- update_today();
- }
-}
-
-void test_foreach(GtkWidget *widget, gpointer data)
-{
- char *ptr;
-
- ptr = GTK_LABEL(GTK_BUTTON(widget)->child)->label;
- g_print("%s\n", ptr);
-}
-
-void show_main_window()
-{
- GtkWidget *main_vbox;
- /*GtkWidget *menubar;
- GtkAcceleratorTable *accel;*/
- GtkMenuFactory *menuf;
- GtkWidget *main_hbox;
- GtkWidget *left_vbox;
- GtkWidget *right_vbox;
- GtkWidget *date_hbox;
- GtkWidget *prev_mth_but;
- GtkWidget *next_mth_but;
- GtkWidget *prev_year_but;
- GtkWidget *next_year_but;
- GtkWidget *day_but_hbox;
- GtkWidget *prev_day_but;
- GtkWidget *today_but;
- GtkWidget *next_day_but;
- GtkWidget *separator;
- GtkWidget *cal_table;
- GtkWidget *day_name_label;
- GtkWidget *scrolledwindow;
- GtkWidget *scroll_hbox;
- GtkWidget *hour_list;
- GtkWidget *list_item;
- GtkWidget *dailylist_item;
- GtkWidget *event_label;
- int i,j;
- struct tm tm;
- char buf[50];
-
- bzero((char*)&tm, sizeof(struct tm));
- app = gnome_app_new("gncal", "Gnome Calendar");
- gtk_widget_realize(app);
- gtk_signal_connect(GTK_OBJECT(app), "delete_event",
- GTK_SIGNAL_FUNC(menu_file_quit), NULL);
- if (restarted) {
- gtk_widget_set_uposition(app, os_x, os_y);
- gtk_widget_set_usize(app, os_w, os_h);
- } else {
- gtk_widget_set_usize(app,300,300);
- }
- main_vbox = gtk_vbox_new(FALSE, 1);
- gnome_app_set_contents(GNOME_APP(app), main_vbox);
- gtk_widget_show(main_vbox);
-
- menuf = create_menu();
- gnome_app_set_menus(GNOME_APP(app), GTK_MENU_BAR(menuf->widget));
-
- main_hbox = gtk_hbox_new(FALSE,1);
- gtk_box_pack_start(GTK_BOX(main_vbox), main_hbox, TRUE, TRUE, 0);
- gtk_widget_show(main_hbox);
-
- left_vbox = gtk_vbox_new(FALSE, 1);
- gtk_box_pack_start(GTK_BOX(main_hbox), left_vbox, FALSE, TRUE,0);
- gtk_widget_show(left_vbox);
-
- separator = gtk_vseparator_new();
- gtk_box_pack_start(GTK_BOX(main_hbox), separator, FALSE, TRUE, 0);
- gtk_widget_show(separator);
-
- right_vbox = gtk_vbox_new(FALSE, 1);
- gtk_box_pack_start(GTK_BOX(main_hbox), right_vbox, TRUE, TRUE, 0);
- gtk_widget_show(right_vbox);
-
- date_hbox = gtk_hbox_new(FALSE, 1);
- gtk_box_pack_start(GTK_BOX(left_vbox), date_hbox, FALSE, FALSE, 0);
- gtk_widget_show(date_hbox);
-/*
- prev_mth_but = gtk_button_new_with_label("<");
- gtk_box_pack_start(GTK_BOX(date_hbox), prev_mth_but, FALSE, FALSE, 0);
- gtk_signal_connect(GTK_OBJECT(prev_mth_but), "clicked", GTK_SIGNAL_FUNC(prev_month_but_clicked), NULL);
- gtk_widget_show(prev_mth_but);
-
- month_label = gtk_label_new("Fooary");
- gtk_box_pack_start(GTK_BOX(date_hbox), month_label, TRUE, FALSE, 0);
- gtk_widget_show(month_label);
-
- next_mth_but = gtk_button_new_with_label(">");
- gtk_box_pack_start(GTK_BOX(date_hbox), next_mth_but, FALSE, FALSE, 0);
- gtk_signal_connect(GTK_OBJECT(next_mth_but), "clicked", GTK_SIGNAL_FUNC(next_month_but_clicked), NULL);
- gtk_widget_show(next_mth_but);
-
- prev_year_but = gtk_button_new_with_label("<");
- gtk_box_pack_start(GTK_BOX(date_hbox), prev_year_but, FALSE, FALSE, 0);
- gtk_signal_connect(GTK_OBJECT(prev_year_but), "clicked", GTK_SIGNAL_FUNC(prev_year_but_clicked), NULL);
- gtk_widget_show(prev_year_but);
-
- year_label = gtk_label_new("1971");
- gtk_box_pack_start(GTK_BOX(date_hbox), year_label, TRUE, FALSE, 0);
- gtk_widget_show(year_label);
-
- next_year_but = gtk_button_new_with_label(">");
- gtk_box_pack_start(GTK_BOX(date_hbox), next_year_but, FALSE, FALSE, 0);
- gtk_signal_connect(GTK_OBJECT(next_year_but), "clicked", GTK_SIGNAL_FUNC(next_year_but_clicked), NULL);
- gtk_widget_show(next_year_but);
-*/
- /* Build up the calendar table */
-/* cal_table = gtk_table_new(7,7,TRUE);
- gtk_box_pack_start(GTK_BOX(left_vbox), cal_table, FALSE, FALSE, 0);
- gtk_widget_show(cal_table);
-
- for(i=DAY_MIN; i <= DAY_MAX; i++) {
- day_name_label = gtk_label_new(short3_day_name(i));
- gtk_table_attach_defaults(GTK_TABLE(cal_table), day_name_label, i-1, i, 0, 1);
- gtk_widget_show(day_name_label);
- }
- for(j=0; j < 5; j++) {
- for(i=0; i < 7; i++) {
- calendar_buttons[i+j*7] = gtk_button_new();
- gtk_container_border_width(GTK_CONTAINER(calendar_buttons[i+j*7]), 0);
- gtk_table_attach_defaults(GTK_TABLE(cal_table), calendar_buttons[i+j*7], i, i+1, j+2, j+3);
- gtk_signal_connect(GTK_OBJECT(calendar_buttons[i+j*7]), "clicked", GTK_SIGNAL_FUNC(calendar_but_clicked), NULL);
- gtk_widget_show(calendar_buttons[i+j*7]);
- calendar_days[i+j*7] = gtk_label_new("");
- gtk_container_add(GTK_CONTAINER(calendar_buttons[i+j*7]), calendar_days[i+j*7]);
- gtk_widget_show(calendar_days[i+j*7]);
- }
- }
-*/
- calendar = gtk_calendar_new();
- gtk_calendar_display_options(GTK_CALENDAR(calendar), GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
- gtk_box_pack_start(GTK_BOX(left_vbox), calendar, FALSE, FALSE, 0);
- gtk_signal_connect(GTK_OBJECT(calendar), "month_changed",
- GTK_SIGNAL_FUNC(month_changed), NULL);
- gtk_widget_show(calendar);
-
-
- day_but_hbox = gtk_hbox_new(TRUE, 1);
- gtk_box_pack_start(GTK_BOX(left_vbox), day_but_hbox, FALSE, FALSE, 0);
- gtk_widget_show(day_but_hbox);
-
- prev_day_but = gtk_button_new_with_label("Prev");
- gtk_box_pack_start(GTK_BOX(day_but_hbox), prev_day_but, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(prev_day_but), "clicked", GTK_SIGNAL_FUNC(prev_day_but_clicked), NULL);
- gtk_widget_show(prev_day_but);
-
- today_but = gtk_button_new_with_label("Today");
- gtk_box_pack_start(GTK_BOX(day_but_hbox), today_but, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(today_but), "clicked", GTK_SIGNAL_FUNC(today_but_clicked), NULL);
- gtk_widget_show(today_but);
-
- next_day_but = gtk_button_new_with_label("Next");
- gtk_box_pack_start(GTK_BOX(day_but_hbox), next_day_but, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(next_day_but), "clicked", GTK_SIGNAL_FUNC(next_day_but_clicked), NULL);
- gtk_widget_show(next_day_but);
-
-
- dailylist = create_clist();
- gtk_box_pack_start(GTK_BOX(right_vbox), dailylist, TRUE, TRUE, 0);
- gtk_widget_show(dailylist);
- setup_clist(dailylist);
-
- gtk_widget_show(app);
-
-}
-
-
-int
-main(int argc, char *argv[])
-{
- GnomeClient *client;
-
- argp_program_version = VERSION;
-
-
- /* Initialise the i18n stuff */
- bindtextdomain(PACKAGE, GNOMELOCALEDIR);
- textdomain(PACKAGE);
-
- /* This create a default client and arrages for it to parse some
- command line arguments
- */
- client = gnome_client_new_default();
-
- /* Arrange to be told when something interesting happens. */
- gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
- GTK_SIGNAL_FUNC (save_state), (gpointer) argv[0]);
- gtk_signal_connect (GTK_OBJECT (client), "connect",
- GTK_SIGNAL_FUNC (connect_client), NULL);
-
- gnome_init("gncal", &parser, argc, argv, 0, NULL);
-
- show_main_window();
-
- /* Initialse date to the current day */
- old_day = old_month = old_year = 0;
- get_system_date(&curr_day, &curr_month, &curr_year);
- update_today();
-
- prueba ();
-
- gtk_main();
-
- return 0;
-}
-
-static error_t
-parse_an_arg (int key, char *arg, struct argp_state *state)
-{
- if (key == DISCARD_KEY)
- {
- discard_session (arg);
- just_exit = 1;
- return 0;
- }
-
- /* We didn't recognize it. */
- return ARGP_ERR_UNKNOWN;
-}
-
-
-/* Session Management routines */
-
-
-static int
-save_state (GnomeClient *client,
- gint phase,
- GnomeRestartStyle save_style,
- gint shutdown,
- GnomeInteractStyle interact_style,
- gint fast,
- gpointer client_data)
-{
- gchar *session_id;
- gchar *sess;
- gchar *buf;
- gchar *argv[3];
- gint x, y, w, h;
-
- session_id= gnome_client_get_id (client);
-
- /* The only state that gnome-hello has is the window geometry.
- Get it. */
- gdk_window_get_geometry (app->window, &x, &y, &w, &h, NULL);
-
- /* Save the state using gnome-config stuff. */
- sess = g_copy_strings ("/gncal/Saved-Session-",
- session_id,
- NULL);
-
- buf = g_copy_strings ( sess, "/x", NULL);
- gnome_config_set_int (buf, x);
- g_free(buf);
- buf = g_copy_strings ( sess, "/y", NULL);
- gnome_config_set_int (buf, y);
- g_free(buf);
- buf = g_copy_strings ( sess, "/w", NULL);
- gnome_config_set_int (buf, w);
- g_free(buf);
- buf = g_copy_strings ( sess, "/h", NULL);
- gnome_config_set_int (buf, h);
- g_free(buf);
-
- gnome_config_sync();
- g_free(sess);
-
- /* Here is the real SM code. We set the argv to the parameters needed
- to restart/discard the session that we've just saved and call
- the gnome_session_set_*_command to tell the session manager it. */
- argv[0] = (char*) client_data;
- argv[1] = "--discard-session";
- argv[2] = session_id;
- gnome_client_set_discard_command (client, 3, argv);
-
- /* Set commands to clone and restart this application. Note that we
- use the same values for both -- the session management code will
- automatically add whatever magic option is required to set the
- session id on startup. */
- gnome_client_set_clone_command (client, 1, argv);
- gnome_client_set_restart_command (client, 1, argv);
-
- g_print("save state\n");
- return TRUE;
-}
-
-/* Connected to session manager. If restarted from a former session:
- reads the state of the previous session. Sets os_* (prepare_app
- uses them) */
-void
-connect_client (GnomeClient *client, gint was_restarted, gpointer client_data)
-{
- gchar *session_id;
-
- /* Note that information is stored according to our *old*
- session id. The id can change across sessions. */
- session_id = gnome_client_get_previous_id (client);
-
- if (was_restarted && session_id != NULL)
- {
- gchar *sess;
- gchar *buf;
-
- restarted = 1;
-
- sess = g_copy_strings ("/gncal/Saved-Session-", session_id, NULL);
-
- buf = g_copy_strings ( sess, "/x", NULL);
- os_x = gnome_config_get_int (buf);
- g_free(buf);
- buf = g_copy_strings ( sess, "/y", NULL);
- os_y = gnome_config_get_int (buf);
- g_free(buf);
- buf = g_copy_strings ( sess, "/w", NULL);
- os_w = gnome_config_get_int (buf);
- g_free(buf);
- buf = g_copy_strings ( sess, "/h", NULL);
- os_h = gnome_config_get_int (buf);
- g_free(buf);
- }
-
- /* If we had an old session, we clean up after ourselves. */
- if (session_id != NULL)
- discard_session (session_id);
-
- return;
-}
-
-void
-discard_session (gchar *id)
-{
- gchar *sess;
-
- sess = g_copy_strings ("/gncal/Saved-Session-", id, NULL);
-
- /* we use the gnome_config_get_* to work around a bug in gnome-config
- (it's going under a redesign/rewrite, so i didn't correct it) */
- gnome_config_get_int ("/gncal/Bug/work-around=0");
-
- gnome_config_clean_section (sess);
- gnome_config_sync ();
-
- g_free (sess);
- return;
-}
-
diff --git a/calendar/gncal.desktop b/calendar/gncal.desktop
deleted file mode 100644
index 045553c9de..0000000000
--- a/calendar/gncal.desktop
+++ /dev/null
@@ -1,12 +0,0 @@
-[Desktop Entry]
-Name=Calendar
-Name[es]=Calendario
-Name[fr]=Calendrier
-Name[de]=Kalender
-Comment=Calendar application
-Comment[fr]=Calendrier Gnome
-Comment[de]=Gnome Kalender
-Exec=gncal
-Icon=
-Terminal=0
-Type=Application
diff --git a/calendar/gncal.h b/calendar/gncal.h
deleted file mode 100644
index 8d4790bf07..0000000000
--- a/calendar/gncal.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-void menu_file_quit(GtkWidget *widget, gpointer data);
-#define MIN_DAILY_HOUR 8
-#define MAX_DAILY_HOUR 19
-#define DAILY_MINUTE_STEP 15
-void menu_help_about(GtkWidget *widget, gpointer data); \ No newline at end of file
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
deleted file mode 100644
index b202422e2d..0000000000
--- a/calendar/gnome-cal.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#include <gnome.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "gncal-full-day.h"
-#include "gncal-week-view.h"
-#include "timeutil.h"
-#include "views.h"
-
-static void gnome_calendar_init (GnomeCalendar *gcal);
-
-GnomeApp *parent_class;
-
-guint
-gnome_calendar_get_type (void)
-{
- static guint gnome_calendar_type = 0;
- if(!gnome_calendar_type) {
- GtkTypeInfo gnome_calendar_info = {
- "GnomeCalendar",
- sizeof(GnomeCalendar),
- sizeof(GnomeCalendarClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gnome_calendar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- gnome_calendar_type = gtk_type_unique(gnome_app_get_type(), &gnome_calendar_info);
- parent_class = gtk_type_class (gnome_app_get_type());
- }
- return gnome_calendar_type;
-}
-
-static void
-setup_widgets (GnomeCalendar *gcal)
-{
- time_t now;
- GtkWidget *sw;
-
- now = time (NULL);
-
- gcal->notebook = gtk_notebook_new ();
- gcal->day_view = day_view_create (gcal);
- gcal->week_view = gncal_week_view_new (gcal, now);
- gcal->year_view = year_view_create (gcal);
- gcal->task_view = tasks_create (gcal);
-
- if (1)
- {
- struct tm tm;
- time_t a, b;
-
- tm = *localtime (&now);
-/* tm.tm_mday = 2; */
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- a = mktime (&tm);
-
- tm.tm_mday++;
-
- b = mktime (&tm);
-
- gcal->day_view = gncal_full_day_new (gcal, a, b);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
- gtk_widget_show (gcal->day_view);
- }
-
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), sw, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view, gtk_label_new (_("Year View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->task_view, gtk_label_new (_("Todo")));
-
- gtk_widget_show_all (gcal->notebook);
-
- gnome_app_set_contents (GNOME_APP (gcal), gcal->notebook);
-
-}
-
-static void
-gnome_calendar_init(GnomeCalendar *gcal)
-{
- gcal->cal = 0;
- gcal->day_view = 0;
- gcal->week_view = 0;
- gcal->event_editor = 0;
-
- setup_widgets (gcal);
-}
-
-static GtkWidget *
-get_current_page (GnomeCalendar *gcal)
-{
- return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
-}
-
-void
-gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
-{
- GtkWidget *current = get_current_page (gcal);
- g_assert (new_time != -1);
-
- if (current == gcal->week_view)
- gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
- else if (current == gcal->day_view)
- printf ("updating day view\n");
- else if (current == gcal->year_view)
- printf ("updating year view\n");
- else
- printf ("My penguin is gone!\n");
- gcal->current_display = new_time;
-}
-
-static void
-gnome_calendar_direction (GnomeCalendar *gcal, int direction)
-{
- GtkWidget *cp = get_current_page (gcal);
- time_t new_time;
-
- if (cp == gcal->week_view)
- new_time = time_add_day (gcal->current_display, 7 * direction);
- else if (cp == gcal->day_view)
- new_time = time_add_day (gcal->current_display, 1 * direction);
- else if (cp == gcal->year_view)
- new_time = time_add_year (gcal->current_display, 1 * direction);
- else
- g_warning ("Weee! Where did the penguin go?");
-
- gnome_calendar_goto (gcal, new_time);
-}
-
-void
-gnome_calendar_next (GnomeCalendar *gcal)
-{
- gnome_calendar_direction (gcal, 1);
-}
-
-void
-gnome_calendar_previous (GnomeCalendar *gcal)
-{
- gnome_calendar_direction (gcal, -1);
-}
-
-GtkWidget *
-gnome_calendar_new (char *title)
-{
- GtkWidget *retval;
- GnomeCalendar *gcal;
- GnomeApp *app;
-
- retval = gtk_type_new (gnome_calendar_get_type ());
- app = GNOME_APP (retval);
- gcal = GNOME_CALENDAR (retval);
-
- app->name = g_strdup ("calendar");
- app->prefix = g_copy_strings ("/", app->name, "/", NULL);
-
- gtk_window_set_title(GTK_WINDOW(retval), title);
-
- gcal->current_display = time (NULL);
- gcal->cal = calendar_new (title);
- return retval;
-}
-
-void
-gnome_calendar_update_all (GnomeCalendar *cal)
-{
- gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view));
- gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view));
-}
-
-void
-gnome_calendar_load (GnomeCalendar *gcal, char *file)
-{
- calendar_load (gcal->cal, file);
- gnome_calendar_update_all (gcal);
-}
-
-void
-gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- printf ("Adding object at: ");
- print_time_t (obj->dtstart);
- calendar_add_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal);
-}
diff --git a/calendar/gnome-cal.h b/calendar/gnome-cal.h
deleted file mode 100644
index 053737fd4f..0000000000
--- a/calendar/gnome-cal.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef GNOME_CALENDAR_APP_H
-#define GNOME_CALENDAR_APP_H
-
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gnome-app.h>
-
-BEGIN_GNOME_DECLS
-
-#define GNOME_CALENDAR(obj) GTK_CHECK_CAST(obj, gnome_calendar_get_type(), GnomeCalendar)
-#define GNOME_CALENDAR_CLASS(class) GTK_CHECK_CAST_CLASS(class, gnome_calendar_get_type(), GnomeCalendarClass)
-#define GNOME_IS_CALENDAR(obj) GTK_CHECK_TYPE(obj, gnome_calendar_get_type())
-
-typedef struct {
- GnomeApp gnome_app;
- Calendar *cal;
- time_t current_display;
-
- GtkWidget *notebook;
- GtkWidget *week_view;
- GtkWidget *day_view;
- GtkWidget *year_view;
- GtkWidget *task_view;
- void *event_editor;
-} GnomeCalendar;
-
-typedef struct {
- GnomeAppClass parent_class;
-} GnomeCalendarClass;
-
-guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
-void gnome_calendar_load (GnomeCalendar *gcal, char *file);
-void gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj);
-void gnome_calendar_next (GnomeCalendar *gcal);
-void gnome_calendar_previous (GnomeCalendar *gcal);
-void gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
deleted file mode 100644
index 283e46e1c2..0000000000
--- a/calendar/gui/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-SUBDIRS = versit
-
-INCLUDES = \
- -I$(includedir) \
- $(GNOME_INCLUDEDIR) \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I../../gcalendar
-
-bin_PROGRAMS = gnomecal
-
-gnomecal_SOURCES = \
- calendar.c \
- calendar.h \
- calobj.c \
- calobj.h \
- gncal-day-view.c \
- gncal-day-view.h \
- gncal-full-day.c \
- gncal-full-day.h \
- gncal-week-view.c \
- gncal-week-view.h \
- gnome-cal.c \
- gnome-cal.h \
- main.c \
- timeutil.c \
- timeutil.h \
- view-utils.h \
- view-utils.c \
- views.h \
- views.c \
- eventedit.c \
- eventedit.h
-
-
-#gncal_SOURCES = \
-# gncal.c \
-# gncal.h \
-# calcs.c \
-# calcs.h \
-# clist.c \
-# clist.h \
-# calendar.c \
-# calendar.h \
-# calobj.c \
-# calobj.h \
-# gncal-day-view.c \
-# gncal-day-view.h \
-# timeutil.c \
-# timeutil.h
-
-LINK_FLAGS = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(INTLLIBS) versit/libversit.a
-
-
-#gncal_LDADD = $(LINK_FLAGS)
-#objedit_LDADD = $(LINK_FLAGS)
-
-gnomecal_LDADD = $(LINK_FLAGS)
-
-EXTRA_DIST = \
- gncal.desktop
-
-Productivitydir = $(datadir)/apps/Productivity
-
-Productivity_DATA = gncal.desktop
-
diff --git a/calendar/gui/cal_struct.h b/calendar/gui/cal_struct.h
deleted file mode 100644
index 411036c7aa..0000000000
--- a/calendar/gui/cal_struct.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#define MAX_SZ 30
-
-enum RepeatType {
- Single,
- Days,
- Months,
- WeekDays,
- MonthDays
-};
-
-
-struct actionitem {
- char date[MAX_SZ];
- int time; /* Minutes past midnight */
-};
-
-struct event {
- struct actionitem start;
- struct actionitem end;
-
- enum RepeatType repeat;
- int repeatcount;
- char description[MAX_SZ];
- char subtype[MAX_SZ];
- GList *properties;
-};
-
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
deleted file mode 100644
index c06414a571..0000000000
--- a/calendar/gui/calendar.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Calendar manager object
- *
- * This keeps track of a given calendar. Eventually this will abtract everything
- * related to getting calendars/saving calendars locally or to a remote Calendar Service
- *
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (federico@gimp.org)
- *
- */
-
-#include <config.h>
-
-#include "calendar.h"
-#include "timeutil.h"
-#include "versit/vcc.h"
-
-Calendar *
-calendar_new (char *title)
-{
- Calendar *cal;
-
- cal = g_new0 (Calendar, 1);
- cal->title = g_strdup (title);
-
- return cal;
-}
-
-void
-calendar_add_object (Calendar *cal, iCalObject *obj)
-{
- printf ("Adding object\n");
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_prepend (cal->events, obj);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_prepend (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_prepend (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-void
-calendar_remove_object (Calendar *cal, iCalObject *obj)
-{
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_remove (cal->events, obj);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_remove (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_remove (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-void
-calendar_destroy (Calendar *cal)
-{
- g_list_foreach (cal->events, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->events);
-
- g_list_foreach (cal->todo, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->todo);
-
- g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->journal);
-
- if (cal->title)
- g_free (cal->title);
- if (cal->filename)
- g_free (cal->filename);
-
- g_free (cal);
-}
-
-char *
-ice (time_t t)
-{
- static char buffer [100];
- struct tm *tm;
-
- tm = localtime (&t);
- sprintf (buffer, "%d/%d/%d", tm->tm_mday, tm->tm_mon, tm->tm_year);
- return buffer;
-}
-
-static GList *
-calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
-{
- GList *new_events = 0;
-
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- if ((start <= object->dtstart) && (object->dtend <= end)){
- if (sort_func)
- new_events = g_list_insert_sorted (new_events, object, sort_func);
- else
- new_events = g_list_prepend (new_events, object);
- }
- }
-
- return new_events;
-}
-
-GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->events, start, end, sort_func);
-}
-
-GList *
-calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->todo, start, end, sort_func);
-}
-GList *
-calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->journal, start, end, sort_func);
-}
-
-gint
-calendar_compare_by_dtstart (gpointer a, gpointer b)
-{
- iCalObject *obj1, *obj2;
- time_t diff;
-
- obj1 = a;
- obj2 = b;
-
- diff = obj1->dtstart - obj2->dtstart;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-#define str_val(obj) (char *) vObjectUStringZValue (obj)
-
-/* Loads our calendar contents from a vObject */
-void
-calendar_load_from_vobject (Calendar *cal, VObject *vcal)
-{
- VObjectIterator i;;
-
- initPropIterator (&i, vcal);
-
- while (moreIteration (&i)){
- VObject *this = nextVObject (&i);
- iCalObject *ical;
- const char *object_name = vObjectName (this);
-
- if (strcmp (object_name, VCDCreatedProp) == 0){
- cal->created = time_from_isodate (str_val (this));
- continue;
- }
-
- if (strcmp (object_name, VCLocationProp) == 0)
- continue; /* FIXME: imlement */
-
- if (strcmp (object_name, VCProdIdProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCVersionProp) == 0)
- continue; /* FIXME: implement */
-
- ical = ical_object_create_from_vobject (this, object_name);
-
- if (ical)
- calendar_add_object (cal, ical);
- }
-}
-
-/* Loads a calendar from a file */
-void
-calendar_load (Calendar *cal, char *fname)
-{
- VObject *vcal;
-
- if (cal->filename){
- g_warning ("Calendar load called again\n");
- return;
- }
-
- cal->filename = g_strdup (fname);
- vcal = Parse_MIME_FromFileName (fname);
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
-void
-calendar_save (Calendar *cal, char *fname)
-{
- VObject *vcal;
- GList *l;
-
- if (fname == NULL)
- fname = cal->filename;
-
- vcal = newVObject (VCCalProp);
- addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
- addPropValue (vcal, VCTimeZoneProp, "NONE");
- addPropValue (vcal, VCVersionProp, VERSION);
- cal->temp = vcal;
-
- for (l = cal->events; l; l = l->next){
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
- writeVObjectToFile (fname, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h
deleted file mode 100644
index 8f4e4c1497..0000000000
--- a/calendar/gui/calendar.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef CALENDAR_H
-#define CALENDAR_H
-
-#include "calobj.h"
-
-BEGIN_GNOME_DECLS
-
-typedef struct {
- char *title;
- char *filename;
- GList *events;
- GList *todo;
- GList *journal;
-
- time_t created;
- int modified;
- void *temp;
-} Calendar;
-
-Calendar *calendar_new (char *title);
-void calendar_load (Calendar *cal, char *fname);
-void calendar_add_object (Calendar *cal, iCalObject *obj);
-void calendar_remove_object (Calendar *cal, iCalObject *obj);
-void calendar_destroy (Calendar *cal);
-GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-gint calendar_compare_by_dtstart (gpointer a, gpointer b);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
deleted file mode 100644
index f2158b50f4..0000000000
--- a/calendar/gui/eventedit.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#include <gnome.h>
-#include <string.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "main.h"
-#include "timeutil.h"
-
-static void event_editor_init (EventEditor *ee);
-
-/* Note: do not i18n these strings, they are part of the vCalendar protocol */
-char *class_names [] = { "PUBLIC", "PRIVATE", "CONFIDENTIAL" };
-
-guint
-event_editor_get_type (void)
-{
- static guint event_editor_type = 0;
-
- if(!event_editor_type) {
- GtkTypeInfo event_editor_info = {
- "EventEditor",
- sizeof(EventEditor),
- sizeof(EventEditorClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) event_editor_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- event_editor_type = gtk_type_unique (gtk_window_get_type (), &event_editor_info);
- }
- return event_editor_type;
-}
-
-/*
- * when the start time is changed, this adjusts the end time.
- */
-static void
-adjust_end_time (GtkWidget *widget, EventEditor *ee)
-{
- struct tm *tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- if (tm->tm_hour < 22)
- tm->tm_hour++;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
-}
-
-GtkWidget *
-adjust (GtkWidget *w, gfloat x, gfloat y, gfloat xs, gfloat ys)
-{
- GtkWidget *a = gtk_alignment_new (x, y, xs, ys);
-
- gtk_container_add (GTK_CONTAINER (a), w);
- return a;
-}
-
-/*
- * Checks if the day range occupies all the day, and if so, check the
- * box accordingly
- */
-static void
-ee_check_all_day (EventEditor *ee)
-{
- time_t ev_start, ev_end;
-
- ev_start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ev_end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (get_time_t_hour (ev_start) <= day_begin && get_time_t_hour (ev_end) >= day_end){
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 1);
- } else{
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 0);
- }
-}
-
-/*
- * Callback: checks if the selected hour range spans all of the day
- */
-static void
-check_times (GtkWidget *widget, EventEditor *ee)
-{
- ee_check_all_day (ee);
-}
-
-/*
- * Callback: all day event box clicked
- */
-static void
-set_all_day (GtkToggleButton *toggle, EventEditor *ee)
-{
- struct tm *tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- tm->tm_hour = day_begin;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (tm));
-
- if (toggle->active)
- tm->tm_hour = day_end;
- else
- tm->tm_hour++;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
-}
-
-static GtkWidget *
-event_editor_setup_time_frame (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *start_time, *end_time;
- GtkTable *t;
-
- frame = gtk_frame_new (_("Time"));
- t = GTK_TABLE (ee->general_time_table = gtk_table_new (1, 1, 0));
- gtk_container_add (GTK_CONTAINER (frame), ee->general_time_table);
-
- /* 1. Start time */
- ee->start_time = start_time = gnome_date_edit_new (ee->ical->dtstart);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (adjust_end_time), ee);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("Start time")), 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (t, start_time, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- /* 2. End time */
- ee->end_time = end_time = gnome_date_edit_new (ee->ical->dtend);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (end_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("End time")), 1, 2, 2, 3, 0, 0, 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- /* 3. All day checkbox */
- ee->general_allday = gtk_check_button_new_with_label (_("All day event"));
- gtk_signal_connect (GTK_OBJECT (ee->general_allday), "toggled",
- GTK_SIGNAL_FUNC (set_all_day), ee);
- gtk_table_attach (t, ee->general_allday, 3, 4, 1, 2, 0, 0, 0, 0);
- ee_check_all_day (ee);
-
- /* 4. Recurring event checkbox */
- ee->general_recur = gtk_check_button_new_with_label (_("Recurring event"));
- gtk_table_attach (t, ee->general_recur, 3, 4, 2, 3, 0, 0, 0, 0);
-
- gtk_container_border_width (GTK_CONTAINER (frame), 5);
- return frame;
-}
-
-static GtkWidget *
-timesel_new (void)
-{
- GtkWidget *menu, *option_menu;
- char *items [] = { N_("Minutes"), N_("Hours"), N_("Days") };
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- for (i = 0; i < 3; i++){
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items [i]));
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- return option_menu;
-}
-
-/*
- * Set the sensitive state depending on whether the alarm enabled flag.
- */
-static void
-ee_alarm_setting (CalendarAlarm *alarm, int sensitive)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_count), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_timesel), sensitive);
-
- if (alarm->type == ALARM_PROGRAM || alarm->type == ALARM_MAIL){
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label), sensitive);
- }
-}
-
-static void
-alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
-{
- ee_alarm_setting (alarm, toggle->active);
-}
-
-#define FX GTK_FILL | GTK_EXPAND
-#define XCOL 6
-static void
-ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type, int y)
-{
- char buffer [40];
-
- alarm->w_enabled = gtk_check_button_new_with_label (str);
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (alarm_toggle), alarm);
- gtk_table_attach (table, alarm->w_enabled, 2, 3, y, y+1, FX, 0, 0, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled), alarm->enabled);
-
- alarm->w_count = gtk_entry_new ();
- gtk_widget_set_usize (alarm->w_count, 40, 0);
- gtk_table_attach (table, alarm->w_count, 3, 4, y, y+1, FX, 0, 5, 0);
- sprintf (buffer, "%d", alarm->count);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_count), buffer);
-
- alarm->w_timesel = timesel_new ();
- gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel), alarm->units);
- gtk_table_attach (table, alarm->w_timesel, 4, 5, y, y+1, 0, 0, 0, 0);
-
- switch (type){
- case ALARM_MAIL:
- alarm->w_label = gtk_label_new (_("Mail to:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, XCOL, XCOL+1, y, y+1, FX, 0, 5, 0);
- alarm->w_entry = gtk_entry_new ();
- gtk_table_attach (table, alarm->w_entry, XCOL+1, XCOL+2, y, y+1, FX, 0, 6, 0);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_entry), alarm->data);
- break;
-
- case ALARM_PROGRAM:
- alarm->w_label = gtk_label_new (_("Run program:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, XCOL, XCOL+1, y, y+1, FX, 0, 5, 0);
- alarm->w_entry = gnome_file_entry_new ("alarm-program", _("Select program to run at alarm time"));
- gtk_table_attach (table, alarm->w_entry, XCOL+1, XCOL+2, y, y+1, 0, 0, 6, 0);
- break;
-
- default:
- /* Nothing */
- }
-
- ee_alarm_setting (alarm, alarm->enabled);
-}
-
-static GtkWidget *
-ee_alarm_widgets (EventEditor *ee)
-{
- GtkWidget *table, *mailto, *mailte, *l;
-
- l = gtk_frame_new (_("Alarms"));
-
- table = gtk_table_new (1, 1, 0);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_container_add (GTK_CONTAINER (l), table);
-
- mailto = gtk_label_new (_("Mail to:"));
- mailte = gtk_entry_new ();
-
- ee_create_ae (GTK_TABLE (table), _("Display"), &ee->ical->dalarm, ALARM_DISPLAY, 1);
- ee_create_ae (GTK_TABLE (table), _("Audio"), &ee->ical->aalarm, ALARM_AUDIO, 2);
- ee_create_ae (GTK_TABLE (table), _("Program"), &ee->ical->palarm, ALARM_PROGRAM, 3);
- ee_create_ae (GTK_TABLE (table), _("Mail"), &ee->ical->malarm, ALARM_MAIL, 4);
-
- return l;
-}
-
-static void
-connect_and_pack (EventEditor *ee, GtkWidget *hbox, GtkWidget *toggle, char *value)
-{
- gtk_box_pack_start_defaults (GTK_BOX (hbox), toggle);
-}
-
-static GtkWidget *
-ee_classification_widgets (EventEditor *ee)
-{
- GtkWidget *rpub, *rpriv, *conf;
- GtkWidget *frame, *hbox;
-
- frame = gtk_frame_new (_("Classification"));
- hbox = gtk_hbox_new (0, 0);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- rpub = gtk_radio_button_new_with_label (NULL, _("Public"));
- rpriv = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Private"));
- conf = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Confidential"));
-
- connect_and_pack (ee, hbox, rpub, class_names [0]);
- connect_and_pack (ee, hbox, rpriv, class_names [1]);
- connect_and_pack (ee, hbox, conf, class_names [2]);
- ee->general_radios = rpub;
-
- return frame;
-}
-
-/*
- * Retrieves the information from the CalendarAlarm widgets and stores them
- * on the CalendarAlarm generic values
- */
-void
-ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
-{
- GtkWidget *item;
- GtkMenu *menu;
- GList *child;
- int idx;
-
- if (alarm->data){
- g_free (alarm->data);
- alarm->data = 0;
- }
-
- alarm->enabled = GTK_TOGGLE_BUTTON (alarm->w_enabled)->active;
-
- if (!alarm->enabled)
- return;
-
- if (type == ALARM_PROGRAM)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
-
- /* Find out the index */
- menu = GTK_MENU (GTK_OPTION_MENU (alarm->w_timesel)->menu);
-
- item = gtk_menu_get_active (menu);
-
- for (idx = 0, child = menu->children; child->data != item; child = child->next)
- idx++;
-
- alarm->units = idx;
- alarm->count = atoi (gtk_entry_get_text (GTK_ENTRY (alarm->w_count)));
-}
-
-/*
- * Retrieves all of the information from the different widgets and updates
- * the iCalObject accordingly.
- */
-static void
-ee_store_dlg_values_to_ical (EventEditor *ee)
-{
- GtkRadioButton *radio = GTK_RADIO_BUTTON (ee->general_radios);
- iCalObject *ical = ee->ical;
- GSList *list = radio->group;
- int idx;
- time_t now;
-
- now = time (NULL);
- ical->dtstart = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ical->dtend = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- ee_store_alarm (&ical->dalarm, ALARM_DISPLAY);
- ee_store_alarm (&ical->aalarm, ALARM_AUDIO);
- ee_store_alarm (&ical->palarm, ALARM_PROGRAM);
- ee_store_alarm (&ical->malarm, ALARM_MAIL);
-
- for (idx = 0; list; list = list->next){
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
- idx++;
- }
- g_free (ical->class);
- ical->class = g_strdup (class_names [idx]);
-
- /* FIXME: This is not entirely correct; we should check if the values actually changed */
- ical->last_mod = now;
-
- if (ee->new_ical)
- ical->created = now;
-
- g_free (ical->summary);
- ical->summary = gtk_editable_get_chars (GTK_EDITABLE (ee->general_summary), 0, -1);
-}
-
-static void
-ee_ok (GtkWidget *widget, EventEditor *ee)
-{
- ee_store_dlg_values_to_ical (ee);
-
- if (ee->new_ical)
- gnome_calendar_add_object (GNOME_CALENDAR (ee->gnome_cal), ee->ical);
-
- gtk_widget_destroy (GTK_WIDGET (ee));
-}
-
-static void
-ee_cancel (GtkWidget *widget, EventEditor *ee)
-{
- if (ee->new_ical)
- ical_object_destroy (ee->ical);
- gtk_widget_destroy (GTK_WIDGET (ee));
-}
-
-static GtkWidget *
-ee_create_buttons (EventEditor *ee)
-{
- GtkWidget *box = gtk_hbox_new (1, 5);
- GtkWidget *ok, *cancel;
-
- ok = gnome_stock_button (GNOME_STOCK_BUTTON_OK);
- cancel = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL);
-
- gtk_box_pack_start (GTK_BOX (box), ok, 0, 0, 5);
- gtk_box_pack_start (GTK_BOX (box), cancel, 0, 0, 5);
-
- gtk_signal_connect (GTK_OBJECT (ok), "clicked", GTK_SIGNAL_FUNC(ee_ok), ee);
- gtk_signal_connect (GTK_OBJECT (cancel), "clicked", GTK_SIGNAL_FUNC(ee_cancel), ee);
-
- return box;
-}
-
-/*
- * Load the contents in a delayed fashion, as the GtkText widget needs it
- */
-static void
-ee_fill_summary (GtkWidget *widget, EventEditor *ee)
-{
- int pos = 0;
-
- gtk_editable_insert_text (GTK_EDITABLE (ee->general_summary), ee->ical->summary,
- strlen (ee->ical->summary), &pos);
- gtk_text_thaw (GTK_TEXT (ee->general_summary));
-}
-
-enum {
- OWNER_LINE,
- DESC_LINE,
- SUMMARY_LINE,
- TIME_LINE = 4,
- ALARM_LINE,
- CLASS_LINE = 8
-};
-
-#define LABEL_SPAN 2
-
-static void
-event_editor_init_widgets (EventEditor *ee)
-{
- GtkWidget *frame, *l;
-
- ee->hbox = gtk_vbox_new (0, 0);
- gtk_container_add (GTK_CONTAINER (ee), ee->hbox);
- gtk_container_border_width (GTK_CONTAINER (ee), 5);
-
- ee->notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (ee->hbox), ee->notebook, 1, 1, 0);
-
- ee->general_table = (GtkTable *) gtk_table_new (1, 1, 0);
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), GTK_WIDGET (ee->general_table),
- gtk_label_new (_("General")));
-
- l = adjust (gtk_label_new (_("Owner:")), 1.0, 0.5, 1.0, 1.0);
- gtk_table_attach (ee->general_table, l,
- 1, LABEL_SPAN, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 6);
-
- ee->general_owner = gtk_label_new (ee->ical->organizer);
- gtk_table_attach (ee->general_table, ee->general_owner,
- LABEL_SPAN, LABEL_SPAN + 1, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
-
- l = gtk_label_new (_("Description:"));
- gtk_table_attach (ee->general_table, l,
- 1, LABEL_SPAN, DESC_LINE, DESC_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
-
- ee->general_summary = gtk_text_new (NULL, NULL);
- gtk_text_freeze (GTK_TEXT (ee->general_summary));
- gtk_signal_connect (GTK_OBJECT (ee->general_summary), "realize",
- GTK_SIGNAL_FUNC (ee_fill_summary), ee);
- gtk_widget_set_usize (ee->general_summary, 0, 60);
- gtk_text_set_editable (GTK_TEXT (ee->general_summary), 1);
- gtk_table_attach (ee->general_table, ee->general_summary,
- 1, 40, SUMMARY_LINE, SUMMARY_LINE+1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 6, 0);
-
- frame = event_editor_setup_time_frame (ee);
- gtk_table_attach (ee->general_table, frame,
- 1, 40, TIME_LINE + 2, TIME_LINE + 3,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
-
- l = ee_alarm_widgets (ee);
- gtk_table_attach (ee->general_table, l,
- 1, 40, ALARM_LINE, ALARM_LINE + 1,
- 0, 0, 0, 0);
-
- l = ee_classification_widgets (ee);
- gtk_table_attach (ee->general_table, l,
- 1, 40, CLASS_LINE, CLASS_LINE + 1,
- 0, 0, 0, 0);
- /* Separator */
- gtk_box_pack_start (GTK_BOX (ee->hbox), gtk_hseparator_new (), 1, 1, 0);
-
- /* Buttons */
- gtk_box_pack_start (GTK_BOX (ee->hbox), ee_create_buttons (ee), 0, 0, 5);
-
- /* We show all of the contained widgets */
- gtk_widget_show_all (GTK_WIDGET (ee));
- /* And we hide the toplevel, to be consistent with the rest of Gtk */
- gtk_widget_hide (GTK_WIDGET (ee));
-}
-
-static void
-event_editor_init (EventEditor *ee)
-{
- ee->ical = 0;
-}
-
-GtkWidget *
-event_editor_new (GnomeCalendar *gcal, iCalObject *ical)
-{
- GtkWidget *retval;
- EventEditor *ee;
-
- retval = gtk_type_new (event_editor_get_type ());
- ee = EVENT_EDITOR (retval);
-
- if (ical == 0){
- ee->new_ical = 1;
- ical = ical_new ("Test Comment", user_name, "Test Summary");
- } else
- ee->new_ical = 0;
-
- ee->ical = ical;
- ee->gnome_cal = gcal;
- event_editor_init_widgets (ee);
-
- return retval;
-}
-
-/*
- * New event: Create iCal, edit, check result: Ok: insert; Cancel: destroy iCal
- * Edit event: fetch iCal, edit, check result: Ok: remove from calendar, add to calendar; Cancel: nothing
- */
diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h
deleted file mode 100644
index 45e966d034..0000000000
--- a/calendar/gui/eventedit.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef EVENT_EDITOR_H
-#define EVENT_EDITOR_H
-
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define EVENT_EDITOR(obj) GTK_CHECK_CAST(obj, event_editor_get_type(), EventEditor)
-#define EVENT_EDITOR_CLASS(class) GTK_CHECK_CAST_CLASS(class, event_editor_get_type(), EventEditorClass)
-#define IS_EVENT_EDITOR(obj) GTK_CHECK_TYPE(obj, event_editor_get_type())
-
-
-typedef struct {
- GtkWindow window;
- GtkWidget *notebook;
- GtkWidget *hbox;
- GtkWidget *vbox;
-
- GtkWidget *general;
- GtkTable *general_table;
- GtkWidget *general_time_table;
- GtkWidget *general_allday;
- GtkWidget *general_recur;
- GtkWidget *general_owner;
- GtkWidget *general_summary;
- GtkWidget *start_time, *end_time;
- GtkWidget *general_radios;
-
- /* The associated ical object */
- iCalObject *ical;
- int new_ical;
-
- /* The calendar owner of this event */
- GnomeCalendar *gnome_cal;
-} EventEditor;
-
-typedef struct {
- GtkWindowClass parent_class;
-} EventEditorClass;
-
-
-guint event_editor_get_type (void);
-GtkWidget *event_editor_new (GnomeCalendar *owner, iCalObject *);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c
deleted file mode 100644
index 951b0eb5ae..0000000000
--- a/calendar/gui/gncal-day-view.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <gtk/gtksignal.h>
-#include "gncal-day-view.h"
-#include "timeutil.h"
-#include "view-utils.h"
-
-
-#define TEXT_BORDER 2
-#define MIN_INFO_WIDTH 50
-
-
-static void gncal_day_view_class_init (GncalDayViewClass *class);
-static void gncal_day_view_init (GncalDayView *dview);
-static void gncal_day_view_destroy (GtkObject *object);
-static void gncal_day_view_realize (GtkWidget *widget);
-static void gncal_day_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gncal_day_view_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-static GtkWidgetClass *parent_class;
-
-
-guint
-gncal_day_view_get_type (void)
-{
- static guint day_view_type = 0;
-
- if (!day_view_type) {
- GtkTypeInfo day_view_info = {
- "GncalDayView",
- sizeof (GncalDayView),
- sizeof (GncalDayViewClass),
- (GtkClassInitFunc) gncal_day_view_class_init,
- (GtkObjectInitFunc) gncal_day_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_view_type = gtk_type_unique (gtk_widget_get_type (), &day_view_info);
- }
-
- return day_view_type;
-}
-
-static void
-gncal_day_view_class_init (GncalDayViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- object_class->destroy = gncal_day_view_destroy;
-
- widget_class->realize = gncal_day_view_realize;
- widget_class->size_request = gncal_day_view_size_request;
- widget_class->expose_event = gncal_day_view_expose;
-}
-
-static void
-gncal_day_view_init (GncalDayView *dview)
-{
- GTK_WIDGET_UNSET_FLAGS (dview, GTK_NO_WINDOW);
-
- dview->calendar = NULL;
-
- dview->lower = 0;
- dview->upper = 0;
-
- dview->shadow_type = GTK_SHADOW_ETCHED_IN;
-}
-
-static void
-gncal_day_view_destroy (GtkObject *object)
-{
- GncalDayView *dview;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (object));
-
- dview = GNCAL_DAY_VIEW (object);
-
- if (dview->day_str)
- g_free (dview->day_str);
- if (dview->events)
- g_list_free (dview->events);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalDayView *dview;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dview = gtk_type_new (gncal_day_view_get_type ());
-
- dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
- dview->events = 0;
-
- gncal_day_view_update (dview);
-
- return GTK_WIDGET (dview);
-}
-
-static void
-gncal_day_view_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-}
-
-static void
-gncal_day_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalDayView *dview;
- int str_width, width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- dview = GNCAL_DAY_VIEW (widget);
-
- /* border and min width */
-
- str_width = gdk_string_width (widget->style->font, dview->day_str);
-
- width = MAX (MIN_INFO_WIDTH, str_width);
-
- requisition->width = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + width;
- requisition->height = 2 * (widget->style->klass->ythickness + TEXT_BORDER);
-
- /* division line */
-
- requisition->height += 2 * TEXT_BORDER + widget->style->klass->ythickness;
-
- /* title and at least one line of text */
-
- requisition->height += 2 * (widget->style->font->ascent + widget->style->font->descent);
-}
-
-static gint
-gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalDayView *dview;
- int x1, y1, width, height;
- GdkRectangle rect, dest;
- GdkFont *font;
- int str_width;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_DAY_VIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- dview = GNCAL_DAY_VIEW (widget);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, dview->shadow_type,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear and paint title */
-
- font = widget->style->font;
-
- rect.x = x1;
- rect.y = y1;
- rect.width = width;
- rect.height = 2 * TEXT_BORDER + font->ascent + font->descent;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest)) {
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- dest = rect;
-
- dest.x += TEXT_BORDER;
- dest.y += TEXT_BORDER;
- dest.width -= 2 * TEXT_BORDER;
- dest.height -= 2 * TEXT_BORDER;
-
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], &dest);
-
- str_width = gdk_string_width (font, dview->day_str);
-
- gdk_draw_string (widget->window,
- font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- dest.x + (dest.width - str_width) / 2,
- dest.y + font->ascent,
- dview->day_str);
-
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], NULL);
- }
-
- /* Division line */
-
- gtk_draw_hline (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- rect.x,
- rect.x + rect.width - 1,
- rect.y + rect.height);
-
- /* Text */
-
- rect.x = x1 + TEXT_BORDER;
- rect.y = y1 + 3 * TEXT_BORDER + font->ascent + font->descent + widget->style->klass->ythickness;
- rect.width = width - 2 * TEXT_BORDER;
- rect.height = height - (rect.y - y1) - TEXT_BORDER;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest))
- view_utils_draw_events (widget,
- widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- &rect,
- VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->events,
- dview->lower,
- dview->upper);
-
- return FALSE;
-}
-
-void
-gncal_day_view_update (GncalDayView *dview)
-{
- struct tm tm;
- char buf[256];
-
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (!dview->calendar->cal)
- return;
-
- if (dview->day_str)
- g_free (dview->day_str);
-
- tm = *localtime (&dview->lower);
- strftime (buf, sizeof (buf)-1, "%A %d", &tm);
- dview->day_str = g_strdup (buf);
-
- if (dview->events)
- g_list_free (dview->events);
-
- dview->events = calendar_get_events_in_range (dview->calendar->cal,
- dview->lower,
- dview->upper,
- calendar_compare_by_dtstart);
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
-}
-
-void
-gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if ((lower != dview->lower) || (upper != dview->upper)) {
- dview->lower = lower;
- dview->upper = upper;
-
- gncal_day_view_update (dview);
- }
-}
-
-void
-gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (shadow_type != dview->shadow_type) {
- dview->shadow_type = shadow_type;
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
- }
-}
diff --git a/calendar/gui/gncal-day-view.h b/calendar/gui/gncal-day-view.h
deleted file mode 100644
index 80e8a6299f..0000000000
--- a/calendar/gui/gncal-day-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNCAL_DAY_VIEW_H
-#define GNCAL_DAY_VIEW_H
-
-
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_VIEW(obj) GTK_CHECK_CAST (obj, gncal_day_view_get_type (), GncalDayView)
-#define GNCAL_DAY_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_view_get_type (), GncalDayViewClass)
-#define GNCAL_IS_DAY_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_day_view_get_type ())
-
-
-typedef struct _GncalDayView GncalDayView;
-typedef struct _GncalDayViewClass GncalDayViewClass;
-
-struct _GncalDayView {
- GtkWidget widget;
-
- GnomeCalendar *calendar;/* the calendar we are associated to */
-
- time_t lower; /* lower and upper times to display */
- time_t upper; /* these include the full day */
-
- char *day_str; /* what day is it? */
- GList *events; /* the events for the this day */
- GtkShadowType shadow_type;
-};
-
-struct _GncalDayViewClass {
- GtkWidgetClass parent_class;
-};
-
-
-guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_day_view_update (GncalDayView *dview);
-void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
-
-void gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
deleted file mode 100644
index 90a4813947..0000000000
--- a/calendar/gui/gncal-full-day.c
+++ /dev/null
@@ -1,1237 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtktext.h>
-#include "gncal-full-day.h"
-#include "view-utils.h"
-
-
-#define TEXT_BORDER 2
-#define HANDLE_SIZE 3
-#define MIN_WIDTH 200
-#define XOR_RECT_WIDTH 2
-
-
-typedef struct {
- iCalObject *ico;
- GtkWidget *widget;
- GdkWindow *window;
- int lower_row; /* zero is first displayed row */
- int rows_used;
- int x; /* coords of child's window */
- int y;
- int width;
- int height;
-} Child;
-
-struct layout_row {
- int intersections;
- int *slots;
-};
-
-struct drag_info {
- Child *child;
- enum {
- DRAG_MOVE,
- DRAG_SIZE
- } drag_mode;
- int new_y;
- int new_height;
-};
-
-
-static void gncal_full_day_class_init (GncalFullDayClass *class);
-static void gncal_full_day_init (GncalFullDay *fullday);
-static void gncal_full_day_destroy (GtkObject *object);
-static void gncal_full_day_map (GtkWidget *widget);
-static void gncal_full_day_unmap (GtkWidget *widget);
-static void gncal_full_day_realize (GtkWidget *widget);
-static void gncal_full_day_unrealize (GtkWidget *widget);
-static void gncal_full_day_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gncal_full_day_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gncal_full_day_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gncal_full_day_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gncal_full_day_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gncal_full_day_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class;
-
-
-static void
-get_tm_range (GncalFullDay *fullday,
- time_t time_lower, time_t time_upper,
- struct tm *lower, struct tm *upper,
- int *lower_row, int *rows_used)
-{
- struct tm tm_lower, tm_upper;
- int lmin, umin;
- int lrow;
-
- /* Lower */
-
- tm_lower = *localtime (&time_lower);
-
- if ((tm_lower.tm_min % fullday->interval) != 0) {
- tm_lower.tm_min -= tm_lower.tm_min % fullday->interval; /* round down */
- mktime (&tm_lower);
- }
-
- /* Upper */
-
- tm_upper = *localtime (&time_upper);
-
- if ((tm_upper.tm_min % fullday->interval) != 0) {
- tm_upper.tm_min += fullday->interval - (tm_upper.tm_min % fullday->interval); /* round up */
- mktime (&tm_upper);
- }
-
- if (lower)
- *lower = tm_lower;
-
- if (upper)
- *upper = tm_upper;
-
- lmin = 60 * tm_lower.tm_hour + tm_lower.tm_min;
- umin = 60 * tm_upper.tm_hour + tm_upper.tm_min;
-
- if (umin == 0) /* midnight of next day? */
- umin = 60 * 24;
-
- lrow = lmin / fullday->interval;
-
- if (lower_row)
- *lower_row = lrow;
-
- if (rows_used)
- *rows_used = (umin - lmin) / fullday->interval;
-}
-
-static void
-child_map (GncalFullDay *fullday, Child *child)
-{
- gdk_window_show (child->window);
-
- if (!GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
-}
-
-static void
-child_unmap (GncalFullDay *fullday, Child *child)
-{
- gdk_window_hide (child->window);
-
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
-}
-
-static void
-child_set_text_pos (Child *child)
-{
- GtkAllocation allocation;
-
- allocation.x = 0;
- allocation.y = HANDLE_SIZE;
- allocation.width = child->width;
- allocation.height = child->height - 2 * HANDLE_SIZE;
-
- gtk_widget_size_request (child->widget, &child->widget->requisition); /* FIXME: is this needed? */
- gtk_widget_size_allocate (child->widget, &allocation);
-}
-
-static void
-child_realize (GncalFullDay *fullday, Child *child)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (fullday);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = child->x;
- attributes.y = child->y;
- attributes.width = child->width;
- attributes.height = child->height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.cursor = fullday->up_down_cursor;
- attributes.event_mask = (GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR;
-
- child->window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (child->window, widget);
-
- gtk_style_set_background (widget->style, child->window, GTK_STATE_NORMAL);
-
- gtk_widget_set_parent_window (child->widget, child->window);
-
- child_set_text_pos (child);
-}
-
-static void
-child_unrealize (GncalFullDay *fullday, Child *child)
-{
- gdk_window_set_user_data (child->window, NULL);
- gdk_window_destroy (child->window);
- child->window = NULL;
-}
-
-static void
-child_draw (GncalFullDay *fullday, Child *child, GdkRectangle *area, int draw_child)
-{
- GdkRectangle arect, rect, dest;
- gint w, h;
-
- gdk_window_get_size (child->window, &w, &h);
-
- if (!area) {
- arect.x = 0;
- arect.y = 0;
-
- arect.width = w;
- arect.height = h;
-
- area = &arect;
- }
-
- /* Top handle */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = w;
- rect.height = HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- /* Bottom handle */
-
- rect.y = h - HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- if (draw_child) {
- area->y -= HANDLE_SIZE;
- gtk_widget_draw (child->widget, area);
- }
-}
-
-static void
-child_range_changed (GncalFullDay *fullday, Child *child)
-{
- struct tm start, end;
- int lower_row, rows_used;
- int f_lower_row;
-
- /* Calc display range for event */
-
- get_tm_range (fullday, child->ico->dtstart, child->ico->dtend, &start, &end, &lower_row, &rows_used);
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, &f_lower_row, NULL);
-
- child->lower_row = lower_row - f_lower_row;
- child->rows_used = rows_used;
-}
-
-static void
-child_realized_setup (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gdk_window_set_cursor (widget->window, fullday->beam_cursor);
-
- gtk_text_insert (GTK_TEXT (widget), NULL, NULL, NULL,
- child->ico->summary,
- strlen (child->ico->summary));
-}
-
-static gint
-child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- Child *child;
-
- child = data;
-
- if (child->ico->summary)
- g_free (child->ico->summary);
-
- child->ico->summary = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
-
- return FALSE;
-}
-
-static Child *
-child_new (GncalFullDay *fullday, iCalObject *ico)
-{
- Child *child;
-
- child = g_new (Child, 1);
-
- child->ico = ico;
- child->widget = gtk_text_new (NULL, NULL);
- child->window = NULL;
- child->x = 0;
- child->y = 0;
- child->width = 0;
- child->height = 0;
-
- child_range_changed (fullday, child);
-
- /* We set the i-beam cursor and the initial summary text upon realization */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "realize",
- (GtkSignalFunc) child_realized_setup,
- child);
-
- /* Update the iCalObject summary when the text widget loses focus */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "focus_out_event",
- (GtkSignalFunc) child_focus_out,
- child);
-
- /* Finish setup */
-
- gtk_text_set_editable (GTK_TEXT (child->widget), TRUE);
- gtk_text_set_word_wrap (GTK_TEXT (child->widget), TRUE);
-
- gtk_widget_set_parent (child->widget, GTK_WIDGET (fullday));
-
- return child;
-}
-
-static void
-child_destroy (GncalFullDay *fullday, Child *child)
-{
- /* Unparent the child widget manually as we don't have a remove method */
-
- gtk_widget_ref (child->widget);
-
- gtk_widget_unparent (child->widget);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_unmap (fullday, child);
-
- if (GTK_WIDGET_REALIZED (fullday))
- child_unrealize (fullday, child);
-
- gtk_widget_unref (child->widget);
-
- g_free (child);
-}
-
-static void
-child_set_pos (GncalFullDay *fullday, Child *child, int x, int y, int width, int height)
-{
- child->x = x;
- child->y = y;
- child->width = width;
- child->height = height;
-
- if (!child->window) /* realized? */
- return;
-
- child_set_text_pos (child);
- gdk_window_move_resize (child->window, x, y, width, height);
-}
-
-static struct layout_row *
-layout_get_rows (GncalFullDay *fullday)
-{
- struct layout_row *rows;
- int max_i;
- int f_rows;
- GList *children;
- Child *child;
- int i, n;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- rows = g_new0 (struct layout_row, f_rows);
- max_i = 0;
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- rows[n].intersections++;
-
- if (rows[n].intersections > max_i)
- max_i = rows[n].intersections;
- }
- }
-
- for (i = 0; i < f_rows; i++)
- rows[i].slots = g_new0 (int, max_i);
-
- return rows;
-}
-
-static void
-layout_get_child_intersections (Child *child, struct layout_row *rows, int *min, int *max)
-{
- int i, n;
- int imin, imax;
-
- imax = 0;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- if (rows[n].intersections > imax)
- imax = rows[n].intersections;
- }
-
- imin = imax;
-
- for (i = 0; i < child->rows_used; i++) {
- n = child->lower_row + i;
-
- if (rows[n].intersections < imin)
- imin = rows[n].intersections;
- }
-
- if (min)
- *min = imin;
-
- if (max)
- *max = imax;
-}
-
-static int
-calc_labels_width (GncalFullDay *fullday)
-{
- struct tm cur, upper;
- time_t tim, time_upper;
- int width, max_w;
- char buf[256];
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &cur, &upper, NULL, NULL);
-
- max_w = 0;
-
- tim = mktime (&cur);
- time_upper = mktime (&upper);
-
- while (tim < time_upper) {
- strftime (buf, 256, "%X", &cur);
-
- width = gdk_string_width (GTK_WIDGET (fullday)->style->font, buf);
-
- if (width > max_w)
- max_w = width;
-
- cur.tm_min += fullday->interval;
- tim = mktime (&cur);
- }
-
- return max_w;
-}
-
-static void
-layout_child (GncalFullDay *fullday, Child *child, struct layout_row *rows)
-{
- int c_x, c_y, c_width, c_height;
- GtkWidget *widget;
- int labels_width;
- int height, f_rows;
- int row_height;
-
- /* Calculate child position */
-
- widget = GTK_WIDGET (fullday);
-
- labels_width = calc_labels_width (fullday); /* FIXME: this is expensive to do for each child */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- height = widget->allocation.height - 2 * widget->style->klass->ythickness;
- row_height = height / f_rows;
-
- c_x = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + labels_width;
- c_y = widget->style->klass->ythickness;
-
- /* FIXME: for now, the children overlap. Make it layout them nicely. */
-
- c_width = widget->allocation.width - (widget->style->klass->xthickness + c_x);
-
- c_y += child->lower_row * row_height;
- c_height = child->rows_used * row_height;
-
- /* Position child */
-
- child_set_pos (fullday, child, c_x, c_y, c_width, c_height);
-}
-
-static void
-layout_children (GncalFullDay *fullday)
-{
- struct layout_row *rows;
- GList *children;
-
- rows = layout_get_rows (fullday);
-
- for (children = fullday->children; children; children = children->next)
- layout_child (fullday, children->data, rows);
-
- g_free (rows);
-}
-
-guint
-gncal_full_day_get_type (void)
-{
- static guint full_day_type = 0;
-
- if (!full_day_type) {
- GtkTypeInfo full_day_info = {
- "GncalFullDay",
- sizeof (GncalFullDay),
- sizeof (GncalFullDayClass),
- (GtkClassInitFunc) gncal_full_day_class_init,
- (GtkObjectInitFunc) gncal_full_day_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- full_day_type = gtk_type_unique (gtk_container_get_type (), &full_day_info);
- }
-
- return full_day_type;
-}
-
-static void
-gncal_full_day_class_init (GncalFullDayClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- object_class->destroy = gncal_full_day_destroy;
-
- widget_class->map = gncal_full_day_map;
- widget_class->unmap = gncal_full_day_unmap;
- widget_class->realize = gncal_full_day_realize;
- widget_class->unrealize = gncal_full_day_unrealize;
- widget_class->draw = gncal_full_day_draw;
- widget_class->size_request = gncal_full_day_size_request;
- widget_class->size_allocate = gncal_full_day_size_allocate;
- widget_class->button_press_event = gncal_full_day_button_press;
- widget_class->button_release_event = gncal_full_day_button_release;
- widget_class->motion_notify_event = gncal_full_day_motion;
- widget_class->expose_event = gncal_full_day_expose;
-
- container_class->foreach = gncal_full_day_foreach;
-}
-
-static void
-gncal_full_day_init (GncalFullDay *fullday)
-{
- GTK_WIDGET_UNSET_FLAGS (fullday, GTK_NO_WINDOW);
-
- fullday->calendar = NULL;
-
- fullday->lower = 0;
- fullday->upper = 0;
- fullday->interval = 30; /* 30 minutes by default */
-
- fullday->children = NULL;
- fullday->drag_info = g_new (struct drag_info, 1);
-
- fullday->up_down_cursor = NULL;
- fullday->beam_cursor = NULL;
-}
-
-static void
-gncal_full_day_destroy (GtkObject *object)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (object));
-
- fullday = GNCAL_FULL_DAY (object);
-
- /* Unparent the children manually as we don't have a remove method */
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- gtk_widget_unparent (child->widget);
- }
-
- g_list_free (fullday->children);
- g_free (fullday->drag_info);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- fullday = gtk_type_new (gncal_full_day_get_type ());
-
- fullday->calendar = calendar;
-
- gncal_full_day_set_bounds (fullday, lower, upper);
-
- return GTK_WIDGET (fullday);
-}
-
-static void
-gncal_full_day_map (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_show (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_map (fullday, children->data);
-}
-
-static void
-gncal_full_day_unmap (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_hide (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_unmap (fullday, children->data);
-}
-
-static void
-gncal_full_day_realize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-
- fullday->up_down_cursor = gdk_cursor_new (GDK_DOUBLE_ARROW);
- fullday->beam_cursor = gdk_cursor_new (GDK_XTERM);
-
- for (children = fullday->children; children; children = children->next)
- child_realize (fullday, children->data);
-}
-
-static void
-gncal_full_day_unrealize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- fullday = GNCAL_FULL_DAY (widget);
-
- for (children = fullday->children; children; children = children->next)
- child_unrealize (fullday, children->data);
-
- gdk_cursor_destroy (fullday->up_down_cursor);
- fullday->up_down_cursor = NULL;
-
- gdk_cursor_destroy (fullday->beam_cursor);
- fullday->beam_cursor = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gncal_full_day_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* FIXME */
-}
-
-static void
-gncal_full_day_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalFullDay *fullday;
- int labels_width;
- int rows;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (requisition != NULL);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* Border and min width */
-
- labels_width = calc_labels_width (fullday);
-
- requisition->width = 2 * widget->style->klass->xthickness + 4 * TEXT_BORDER + labels_width + MIN_WIDTH;
- requisition->height = 2 * widget->style->klass->ythickness;
-
- /* Rows */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- requisition->height += (rows * (2 * TEXT_BORDER + widget->style->font->ascent + widget->style->font->descent)
- + (rows - 1)); /* division lines */
-}
-
-static void
-gncal_full_day_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- layout_children (fullday);
-}
-
-static Child *
-find_child_by_window (GncalFullDay *fullday, GdkWindow *window)
-{
- GList *children;
- Child *child;
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->window == window)
- return child;
- }
-
- return NULL;
-}
-
-static void
-draw_xor_rect (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int i;
-
- widget = GTK_WIDGET (fullday);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_INVERT);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_INCLUDE_INFERIORS);
-
- di = fullday->drag_info;
-
- for (i = 0; i < XOR_RECT_WIDTH; i++)
- gdk_draw_rectangle (widget->window,
- widget->style->white_gc,
- FALSE,
- di->child->x + i,
- di->new_y + i,
- di->child->width - 2 * i - 1,
- di->new_height - 2 * i - 2);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_COPY);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_CLIP_BY_CHILDREN);
-}
-
-static gint
-gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- Child *child;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- return FALSE; /* FIXME: do range selection thing */
- else {
- child = find_child_by_window (fullday, event->window);
-
- if (!child)
- return FALSE;
-
- di = fullday->drag_info;
-
- di->child = child;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- if (event->y < HANDLE_SIZE)
- di->drag_mode = DRAG_MOVE;
- else
- di->drag_mode = DRAG_SIZE;
-
- di->new_y = child->y;
- di->new_height = child->height;
-
- gdk_pointer_grab (child->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- NULL,
- event->time);
-
- draw_xor_rect (fullday);
- }
-
- return FALSE;
-}
-
-static void
-recompute_motion (GncalFullDay *fullday, int y)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int rows, row_height;
- int ythickness;
-
- widget = GTK_WIDGET (fullday);
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- ythickness = widget->style->klass->ythickness;
-
- row_height = (widget->allocation.height - 2 * ythickness) / rows;
-
- y -= ythickness;
- y = (y + row_height / 2) / row_height; /* round to nearest bound */
- y = y * row_height + ythickness;
-
- di = fullday->drag_info;
-
- switch (di->drag_mode) {
- case DRAG_MOVE:
- if (y < ythickness)
- y = ythickness;
- else if (y >= (ythickness + rows * row_height - di->new_height))
- y = ythickness + rows * row_height - di->new_height;
-
- di->new_y = y;
-
- break;
-
- case DRAG_SIZE:
- if (y <= di->child->y)
- y = di->child->y + row_height;
- else if (y >= (ythickness + rows * row_height))
- y = ythickness + rows * row_height;
-
- di->new_height = y - di->new_y;
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-update_from_drag_info (GncalFullDay *fullday)
-{
- struct drag_info *di;
- GtkWidget *widget;
- struct tm tm;
- int f_rows;
- int row_height;
- int start_row, used_rows;
-
- di = fullday->drag_info;
-
- widget = GTK_WIDGET (fullday);
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, &f_rows);
-
- row_height = (widget->allocation.height - 2 * widget->style->klass->ythickness) / f_rows;
-
- start_row = (di->new_y - widget->style->klass->ythickness) / row_height;
- used_rows = di->new_height / row_height;
-
- tm.tm_min += fullday->interval * start_row;
- di->child->ico->dtstart = mktime (&tm);
-
- tm.tm_min += fullday->interval * used_rows;
- di->child->ico->dtend = mktime (&tm);
-
- child_range_changed (fullday, di->child);
-
- /* FIXME: notify calendar of change */
-
- /* FIXME: re-layout or let notification do it? */
-
- layout_children (fullday);
-}
-
-static gint
-gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- if (!di->child || (event->window != di->child->window))
- return FALSE;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- gdk_pointer_ungrab (event->time);
-
- update_from_drag_info (fullday);
-
- di->child = NULL;
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
- di = fullday->drag_info;
-
- if (!di->child || (event->window != di->child->window))
- return FALSE;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- draw_xor_rect (fullday);
-
- return FALSE;
-}
-
-static void
-paint_back (GncalFullDay *fullday, GdkRectangle *area)
-{
- GtkWidget *widget;
- GdkRectangle rect, dest;
- int x1, y1, width, height;
- int labels_width, division_x;
- int rows, row_height;
- int i, y;
- struct tm tm;
- char buf[256];
-
- widget = GTK_WIDGET (fullday);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear space for labels */
-
- labels_width = calc_labels_width (fullday);
-
- rect.x = x1;
- rect.y = y1;
- rect.width = 2 * TEXT_BORDER + labels_width;
- rect.height = height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Vertical division */
-
- division_x = x1 + 2 * TEXT_BORDER + labels_width;
-
- gtk_draw_vline (widget->style, widget->window,
- GTK_STATE_NORMAL,
- y1,
- y1 + height - 1,
- division_x);
-
- /* Horizontal divisions */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, &rows);
-
- row_height = height / rows; /* includes division line at bottom of row */
-
- y = y1 + row_height - 1;
-
- for (i = 1; i < rows; i++) {
- gdk_draw_line (widget->window,
- widget->style->black_gc,
- x1, y,
- x1 + width - 1, y);
-
- y += row_height;
- }
-
- /* Labels */
-
- y = y1 + ((row_height - 1) - (widget->style->font->ascent + widget->style->font->descent)) / 2;
-
- rect.height = row_height - 1;
-
- for (i = 0; i < rows; i++) {
- mktime (&tm);
-
- if (gdk_rectangle_intersect (&rect, area, &dest)) {
- strftime (buf, 256, "%X", &tm);
-
- gdk_draw_string (widget->window,
- widget->style->font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x1 + TEXT_BORDER,
- y + widget->style->font->ascent,
- buf);
- }
-
- rect.y += row_height;
- y += row_height;
-
- tm.tm_min += fullday->interval;
- }
-}
-
-static gint
-gncal_full_day_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- paint_back (fullday, &event->area);
- else
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (event->window == child->window) {
- child_draw (fullday, child, &event->area, FALSE);
- break;
- }
- }
-
- return FALSE;
-}
-
-static void
-gncal_full_day_foreach (GtkContainer *container, GtkCallback callback, gpointer callback_data)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (container));
- g_return_if_fail (callback != NULL);
-
- fullday = GNCAL_FULL_DAY (container);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- (*callback) (child->widget, callback_data);
- }
-}
-
-void
-gncal_full_day_update (GncalFullDay *fullday)
-{
- GList *children;
- GList *l_events, *events;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if (!fullday->calendar->cal)
- return;
-
- for (children = fullday->children; children; children = children->next)
- child_destroy (fullday, children->data);
-
- g_list_free (fullday->children);
-
- children = NULL;
-
- l_events = calendar_get_events_in_range (fullday->calendar->cal,
- fullday->lower,
- fullday->upper,
- calendar_compare_by_dtstart);
-
- for (events = l_events; events; events = events->next) {
- child = child_new (fullday, events->data);
- children = g_list_append (children, child);
- }
-
- g_list_free (l_events);
-
- fullday->children = g_list_first (children);
-
- layout_children (fullday);
-
- /* Realize and map children */
-
- for (children = fullday->children; children; children = children->next) {
- if (GTK_WIDGET_REALIZED (fullday))
- child_realize (fullday, children->data);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_map (fullday, children->data);
- }
-
- /* FIXME: paint or something */
-
- gtk_widget_draw (GTK_WIDGET (fullday), NULL);
-}
-
-void
-gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper)
-{
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if ((lower != fullday->lower) || (upper != fullday->upper)) {
- fullday->lower = lower;
- fullday->upper = upper;
-
- gncal_full_day_update (fullday);
- }
-}
diff --git a/calendar/gui/gncal-full-day.h b/calendar/gui/gncal-full-day.h
deleted file mode 100644
index 27e60c9326..0000000000
--- a/calendar/gui/gncal-full-day.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNCAL_FULL_DAY_H
-#define GNCAL_FULL_DAY_H
-
-
-#include <gtk/gtkcontainer.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_FULL_DAY(obj) GTK_CHECK_CAST (obj, gncal_full_day_get_type (), GncalFullDay)
-#define GNCAL_FULL_DAY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_full_day_get_type (), GncalFullDayClass)
-#define GNCAL_IS_FULL_DAY(obj) GTK_CHECK_TYPE (obj, gncal_full_day_get_type ())
-
-
-typedef struct _GncalFullDay GncalFullDay;
-typedef struct _GncalFullDayClass GncalFullDayClass;
-
-struct _GncalFullDay {
- GtkContainer container;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t lower; /* lower time to display */
- time_t upper; /* upper time to display */
- int interval; /* interval between rows in minutes */
-
- GList *children; /* container children */
- gpointer drag_info; /* internal drag information */
-
- GdkCursor *up_down_cursor; /* for dragging children */
- GdkCursor *beam_cursor; /* for the text widgets */
-};
-
-struct _GncalFullDayClass {
- GtkContainerClass parent_class;
-};
-
-
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_full_day_update (GncalFullDay *fullday);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
deleted file mode 100644
index 4adf7ba283..0000000000
--- a/calendar/gui/gncal-week-view.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <string.h>
-#include "gncal-week-view.h"
-
-
-static void gncal_week_view_init (GncalWeekView *wview);
-
-
-guint
-gncal_week_view_get_type (void)
-{
- static guint week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "GncalWeekView",
- sizeof (GncalWeekView),
- sizeof (GncalWeekViewClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_week_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gtk_table_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-gncal_week_view_init (GncalWeekView *wview)
-{
- int i;
-
- wview->calendar = NULL;
- memset (&wview->start_of_week, 0, sizeof (wview->start_of_week));
-
- for (i = 0; i < 7; i++)
- wview->days[i] = NULL;
-
- wview->gtk_calendar = NULL;
-}
-
-GtkWidget *
-gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
-{
- GncalWeekView *wview;
- int i;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- wview = gtk_type_new (gncal_week_view_get_type ());
-
- gtk_table_set_homogeneous (GTK_TABLE (wview), TRUE);
-
- wview->calendar = calendar;
-
- for (i = 0; i < 7; i++) {
- wview->days[i] = GNCAL_DAY_VIEW (gncal_day_view_new (calendar, 0, 0));
-
- if (i < 5)
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->days[i]),
- i, i + 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
- else
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->days[i]),
- i - 2, i - 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- gtk_widget_show (GTK_WIDGET (wview->days[i]));
- }
-
- /* FIXME: for now this is a plain calendar (for not having anything better to put
- * there). In the final version it should be a nice days/hours matrix with
- * "event density" display as in Sun's "cm" program.
- */
-
- wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
- gtk_calendar_display_options (wview->gtk_calendar,
- GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);
- gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->gtk_calendar),
- 0, 3,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 4, 4);
- gtk_widget_show (GTK_WIDGET (wview->gtk_calendar));
-
- gncal_week_view_set (wview, start_of_week);
-
- return GTK_WIDGET (wview);
-}
-
-static void
-update (GncalWeekView *wview, int update_days)
-{
- int i;
-
- if (update_days)
- for (i = 0; i < 7; i++)
- gncal_day_view_update (wview->days[i]);
-
- /* FIXME: update extra widgets */
-}
-
-void
-gncal_week_view_update (GncalWeekView *wview)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- update (wview, TRUE);
-}
-
-void
-gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
-{
- struct tm tm;
- time_t day_start, day_end;
- int i;
-
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- tm = *localtime (&start_of_week);
-
- /* back up to start of week (Monday) */
-
- tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
- /* Start of day */
-
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- day_start = mktime (&tm);
-
- /* Calendar */
-
- gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- /* Day views */
-
- for (i = 0; i < 7; i++) { /* rest of days */
- tm.tm_mday++;
- day_end = mktime (&tm);
-
- printf ("Boundary: ");
- print_time_t (day_start);
- gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
-
- day_start = day_end;
- }
-
- update (wview, FALSE);
-}
diff --git a/calendar/gui/gncal-week-view.h b/calendar/gui/gncal-week-view.h
deleted file mode 100644
index 6bf29e40c4..0000000000
--- a/calendar/gui/gncal-week-view.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gtkcalendar.h>
-#include "gncal-day-view.h"
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_WEEK_VIEW(obj) GTK_CHECK_CAST (obj, gncal_week_view_get_type (), GncalWeekView)
-#define GNCAL_WEEK_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_week_view_get_type (), GncalWeekViewClass)
-#define GNCAL_IS_WEEK_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_week_view_get_type ())
-
-
-typedef struct _GncalWeekView GncalWeekView;
-typedef struct _GncalWeekViewClass GncalWeekViewClass;
-
-struct _GncalWeekView {
- GtkTable table;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- struct tm start_of_week;
-
- GncalDayView *days[7]; /* the day view widgets */
- GtkCalendar *gtk_calendar; /* At least for now; see the FIXME comments in the .c file */
-};
-
-struct _GncalWeekViewClass {
- GtkTableClass parent_class;
-};
-
-
-guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
-
-void gncal_week_view_update (GncalWeekView *wview);
-void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal.desktop b/calendar/gui/gncal.desktop
deleted file mode 100644
index 045553c9de..0000000000
--- a/calendar/gui/gncal.desktop
+++ /dev/null
@@ -1,12 +0,0 @@
-[Desktop Entry]
-Name=Calendar
-Name[es]=Calendario
-Name[fr]=Calendrier
-Name[de]=Kalender
-Comment=Calendar application
-Comment[fr]=Calendrier Gnome
-Comment[de]=Gnome Kalender
-Exec=gncal
-Icon=
-Terminal=0
-Type=Application
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
deleted file mode 100644
index b202422e2d..0000000000
--- a/calendar/gui/gnome-cal.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#include <gnome.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "gncal-full-day.h"
-#include "gncal-week-view.h"
-#include "timeutil.h"
-#include "views.h"
-
-static void gnome_calendar_init (GnomeCalendar *gcal);
-
-GnomeApp *parent_class;
-
-guint
-gnome_calendar_get_type (void)
-{
- static guint gnome_calendar_type = 0;
- if(!gnome_calendar_type) {
- GtkTypeInfo gnome_calendar_info = {
- "GnomeCalendar",
- sizeof(GnomeCalendar),
- sizeof(GnomeCalendarClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gnome_calendar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- gnome_calendar_type = gtk_type_unique(gnome_app_get_type(), &gnome_calendar_info);
- parent_class = gtk_type_class (gnome_app_get_type());
- }
- return gnome_calendar_type;
-}
-
-static void
-setup_widgets (GnomeCalendar *gcal)
-{
- time_t now;
- GtkWidget *sw;
-
- now = time (NULL);
-
- gcal->notebook = gtk_notebook_new ();
- gcal->day_view = day_view_create (gcal);
- gcal->week_view = gncal_week_view_new (gcal, now);
- gcal->year_view = year_view_create (gcal);
- gcal->task_view = tasks_create (gcal);
-
- if (1)
- {
- struct tm tm;
- time_t a, b;
-
- tm = *localtime (&now);
-/* tm.tm_mday = 2; */
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- a = mktime (&tm);
-
- tm.tm_mday++;
-
- b = mktime (&tm);
-
- gcal->day_view = gncal_full_day_new (gcal, a, b);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
- gtk_widget_show (gcal->day_view);
- }
-
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), sw, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view, gtk_label_new (_("Year View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->task_view, gtk_label_new (_("Todo")));
-
- gtk_widget_show_all (gcal->notebook);
-
- gnome_app_set_contents (GNOME_APP (gcal), gcal->notebook);
-
-}
-
-static void
-gnome_calendar_init(GnomeCalendar *gcal)
-{
- gcal->cal = 0;
- gcal->day_view = 0;
- gcal->week_view = 0;
- gcal->event_editor = 0;
-
- setup_widgets (gcal);
-}
-
-static GtkWidget *
-get_current_page (GnomeCalendar *gcal)
-{
- return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
-}
-
-void
-gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
-{
- GtkWidget *current = get_current_page (gcal);
- g_assert (new_time != -1);
-
- if (current == gcal->week_view)
- gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
- else if (current == gcal->day_view)
- printf ("updating day view\n");
- else if (current == gcal->year_view)
- printf ("updating year view\n");
- else
- printf ("My penguin is gone!\n");
- gcal->current_display = new_time;
-}
-
-static void
-gnome_calendar_direction (GnomeCalendar *gcal, int direction)
-{
- GtkWidget *cp = get_current_page (gcal);
- time_t new_time;
-
- if (cp == gcal->week_view)
- new_time = time_add_day (gcal->current_display, 7 * direction);
- else if (cp == gcal->day_view)
- new_time = time_add_day (gcal->current_display, 1 * direction);
- else if (cp == gcal->year_view)
- new_time = time_add_year (gcal->current_display, 1 * direction);
- else
- g_warning ("Weee! Where did the penguin go?");
-
- gnome_calendar_goto (gcal, new_time);
-}
-
-void
-gnome_calendar_next (GnomeCalendar *gcal)
-{
- gnome_calendar_direction (gcal, 1);
-}
-
-void
-gnome_calendar_previous (GnomeCalendar *gcal)
-{
- gnome_calendar_direction (gcal, -1);
-}
-
-GtkWidget *
-gnome_calendar_new (char *title)
-{
- GtkWidget *retval;
- GnomeCalendar *gcal;
- GnomeApp *app;
-
- retval = gtk_type_new (gnome_calendar_get_type ());
- app = GNOME_APP (retval);
- gcal = GNOME_CALENDAR (retval);
-
- app->name = g_strdup ("calendar");
- app->prefix = g_copy_strings ("/", app->name, "/", NULL);
-
- gtk_window_set_title(GTK_WINDOW(retval), title);
-
- gcal->current_display = time (NULL);
- gcal->cal = calendar_new (title);
- return retval;
-}
-
-void
-gnome_calendar_update_all (GnomeCalendar *cal)
-{
- gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view));
- gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view));
-}
-
-void
-gnome_calendar_load (GnomeCalendar *gcal, char *file)
-{
- calendar_load (gcal->cal, file);
- gnome_calendar_update_all (gcal);
-}
-
-void
-gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- printf ("Adding object at: ");
- print_time_t (obj->dtstart);
- calendar_add_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal);
-}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
deleted file mode 100644
index 053737fd4f..0000000000
--- a/calendar/gui/gnome-cal.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef GNOME_CALENDAR_APP_H
-#define GNOME_CALENDAR_APP_H
-
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gnome-app.h>
-
-BEGIN_GNOME_DECLS
-
-#define GNOME_CALENDAR(obj) GTK_CHECK_CAST(obj, gnome_calendar_get_type(), GnomeCalendar)
-#define GNOME_CALENDAR_CLASS(class) GTK_CHECK_CAST_CLASS(class, gnome_calendar_get_type(), GnomeCalendarClass)
-#define GNOME_IS_CALENDAR(obj) GTK_CHECK_TYPE(obj, gnome_calendar_get_type())
-
-typedef struct {
- GnomeApp gnome_app;
- Calendar *cal;
- time_t current_display;
-
- GtkWidget *notebook;
- GtkWidget *week_view;
- GtkWidget *day_view;
- GtkWidget *year_view;
- GtkWidget *task_view;
- void *event_editor;
-} GnomeCalendar;
-
-typedef struct {
- GnomeAppClass parent_class;
-} GnomeCalendarClass;
-
-guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
-void gnome_calendar_load (GnomeCalendar *gcal, char *file);
-void gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj);
-void gnome_calendar_next (GnomeCalendar *gcal);
-void gnome_calendar_previous (GnomeCalendar *gcal);
-void gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/icalendar-types b/calendar/gui/icalendar-types
deleted file mode 100644
index e11f4c1789..0000000000
--- a/calendar/gui/icalendar-types
+++ /dev/null
@@ -1,39 +0,0 @@
-evento todo journal fbrequest fbreply busytime timezone
- attach attach attach
- attendee attendee attendee attendee attendee attendee
- categories categories categories
- class class class
- comment comment comment comment comment comment comment
- completed
- contact contact contact
- created created created created
- description description description
- dtstamp dtstamp
- dtend/duration due->dtend dtend [duration] dtend dtend
- dtstart dtstart dtstart dtstart dtstart dtstart dtstart
- exdate exdate exdate
- exrule exrule exrule
- geo geo
- last-mod last-mod last-mod last-mod last-mod
- location location
- organizer organizer organizer
- percent
- priority priority
- rstatus rstatus rstatus rstatus
- related related related
- resources resources
- rdate rdate rdate [rdate/rrule]
- rrule rrule rrule
- dtstamp dtstamp dtstamp dtstamp
- seq seq seq seq seq
- status status
- summary summary summary
- transp
- uid uid uid uid uid
- url url url url url
- recurid recurid recurid
- freebusy freebusy
- tzname
- tzoffset-to
- tzoffset-from
-
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
deleted file mode 100644
index cd4d107421..0000000000
--- a/calendar/gui/main.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "gnome-cal.h"
-#include "main.h"
-
-/* The username, used to set the `owner' field of the event */
-char *user_name;
-
-/* The full user name from the Gecos field */
-char *full_name;
-
-/* The user's default calendar file */
-char *user_calendar_file;
-
-/* a gnome-config string prefix that can be used to access the calendar config info */
-char *calendar_settings;
-
-/* Day begin, day end parameters */
-int day_begin, day_end;
-
-/* Number of calendars active */
-int active_calendars = 0;
-
-void
-init_username (void)
-{
- char *p;
- struct passwd *passwd;
-
- passwd = getpwuid (getuid ());
- if ((p = passwd->pw_name)){
- user_name = g_strdup (p);
- full_name = g_strdup (passwd->pw_gecos);
- } else {
- if ((p = getenv ("USER"))){
- user_name = g_strdup (p);
- full_name = g_strdup (p);
- return;
- } else {
- user_name = g_strdup ("unknown");
- full_name = g_strdup ("unknown");
- }
- }
- endpwent ();
-}
-
-int
-range_check_hour (int hour)
-{
- struct tm tm;
-
- if (hour < 0)
- hour = 0;
- if (hour > 24)
- hour = 23;
-
- return hour;
-}
-
-/*
- * Initializes the calendar internal variables, loads defaults
- */
-void
-init_calendar (void)
-{
- init_username ();
- user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
- calendar_settings = g_copy_strings ("=", gnome_util_user_home (), ".gnome/calendar=", NULL);
-
- gnome_config_push_prefix (calendar_settings);
- day_begin = range_check_hour (gnome_config_get_int ("/Calendar/Day start=8"));
- day_end = range_check_hour (gnome_config_get_int ("/Calendar/Day end=17"));
-
- if (day_end < day_begin){
- day_begin = 8;
- day_end = 17;
- }
- gnome_config_pop_prefix ();
-}
-
-void
-new_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-open_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-save_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-about_calendar_cmd (GtkWidget *widget, void *data)
-{
-
- GtkWidget *about;
- gchar *authors[] = {
- "Miguel de Icaza (miguel@kernel.org)",
- "Federico Mena (federico@gimp.org)",
- NULL
- };
-
- about = gnome_about_new (_("Gnome Calendar"), VERSION,
- "(C) 1998 the Free Software Fundation",
- authors,
- _("The GNOME personal calendar and schedule manager."),
- NULL);
- gtk_widget_show (about);
-}
-
-void
-display_objedit (GtkWidget *widget, GnomeCalendar *gcal)
-{
- event_editor_new (gcal, NULL);
-}
-
-void
-quit_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- /* FIXME: check all of the calendars for their state (modified) */
-
- gtk_main_quit ();
-}
-
-void
-close_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- if (gcal->cal->modified){
- gnome_message_box_new (_("The calendar has unsaved changes, Save them?"),
- GNOME_MESSAGE_BOX_WARNING,
- "Yes", "No");
- }
- gtk_widget_destroy (widget);
- active_calendars--;
-
- if (active_calendars == 0)
- gtk_main_quit ();
-}
-
-void
-previous_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_previous (gcal);
-}
-
-void
-next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_next (gcal);
-}
-
-void
-today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_goto (gcal, time (NULL));
-}
-
-GnomeUIInfo gnome_cal_file_menu [] = {
- { GNOME_APP_UI_ITEM, N_("New calendar"), NULL, new_calendar_cmd },
-
- { GNOME_APP_UI_ITEM, N_("Open calendar"), NULL, open_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN },
-
- { GNOME_APP_UI_ITEM, N_("Save calendar"), NULL, save_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
-
- { GNOME_APP_UI_SEPARATOR },
- { GNOME_APP_UI_ITEM, N_("Close"), NULL, close_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
-
- { GNOME_APP_UI_ITEM, N_("Exit"), NULL, quit_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
-
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_about_menu [] = {
- { GNOME_APP_UI_ITEM, N_("About"), NULL, about_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT },
- GNOMEUIINFO_HELP ("cal"),
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_edit_menu [] = {
- { GNOME_APP_UI_ITEM, N_("New appointment"), NULL, display_objedit },
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_menu [] = {
- { GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gnome_cal_file_menu },
- { GNOME_APP_UI_SUBTREE, N_("Edit"), NULL, &gnome_cal_edit_menu },
- { GNOME_APP_UI_SUBTREE, N_("Help"), NULL, &gnome_cal_about_menu },
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_toolbar [] = {
- { 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"), NULL, today_clicked, 0, 0,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK },
-
- { GNOME_APP_UI_ITEM, N_("Next"), NULL, next_clicked, 0, 0,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD },
-
- GNOMEUIINFO_END
-};
-
-static void
-setup_menu (GtkWidget *gcal)
-{
- gnome_app_create_menus_with_data (GNOME_APP (gcal), gnome_cal_menu, gcal);
- gnome_app_create_toolbar_with_data (GNOME_APP (gcal), gnome_toolbar, gcal);
-
-}
-
-static void
-new_calendar (char *full_name, char *calendar_file)
-{
- GtkWidget *toplevel;
- char *title;
-
- title = g_copy_strings (full_name, "'s calendar", NULL);
-
- toplevel = gnome_calendar_new (title);
- setup_menu (toplevel);
-
- if (g_file_exists (calendar_file)){
- printf ("Trying to load %s\n", calendar_file);
- gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
- } else {
- printf ("tring: ./test.vcf\n");
- gnome_calendar_load (GNOME_CALENDAR (toplevel), "./test.vcf");
- }
- active_calendars++;
-
- gtk_widget_show (toplevel);
-}
-
-int
-main(int argc, char *argv[])
-{
- GnomeClient *client;
-
- argp_program_version = VERSION;
-
- /* Initialise the i18n stuff */
- bindtextdomain(PACKAGE, GNOMELOCALEDIR);
- textdomain(PACKAGE);
-
- gnome_init ("gncal", NULL, argc, argv, 0, NULL);
-
- init_calendar ();
-
- new_calendar (full_name, user_calendar_file);
- gtk_main ();
- return 0;
-}
-
-
diff --git a/calendar/gui/main.h b/calendar/gui/main.h
deleted file mode 100644
index 91ba1e403a..0000000000
--- a/calendar/gui/main.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-extern int day_begin, day_end;
-extern char *user_name;
diff --git a/calendar/gui/test.vcf b/calendar/gui/test.vcf
deleted file mode 100644
index 7cd47a9cbf..0000000000
--- a/calendar/gui/test.vcf
+++ /dev/null
@@ -1,41 +0,0 @@
-BEGIN:VCALENDAR
-
-PRODID:-//K Desktop Environment//NONSGML KOrganizer//EN
-TZ:-05
-VERSION:1.0
-BEGIN:VEVENT
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980408T003000
-DTEND:19980408T010000
-SUMMARY:asdfasdfasfasdfasdf
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
-
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
-SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980408T140000
-DTEND:19980408T160000
-SUMMARY:asdfasfdasfasdfasfd
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
-
-END:VCALENDAR
-
diff --git a/calendar/gui/view-utils.c b/calendar/gui/view-utils.c
deleted file mode 100644
index f5a3b41928..0000000000
--- a/calendar/gui/view-utils.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <string.h>
-#include "view-utils.h"
-
-
-/* FIXME: remove this function later */
-
-#if 0
-static GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- static iCalObject objs[24];
- static int ready = 0;
- int i;
- GList *list;
-
- if (!ready) {
- struct tm tm;
- time_t tim;
-
- ready = 1;
-
- for (i = 0; i < 24; i++) {
- tim = time (NULL);
- tm = *localtime (&tim);
-
- tm.tm_hour = i;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- objs[i].dtstart = mktime (&tm);
-
- tm.tm_hour = i;
- tm.tm_min = 30;
- tm.tm_sec = 0;
- objs[i].dtend = mktime (&tm);
-
- objs[i].summary = "Ir a chingar a tu madre";
- }
- }
-
- list = NULL;
-
- for (i = 0; i < 8; i++)
- list = g_list_append (list, &objs[i]);
-
- return list;
-}
-#endif
-void
-view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end)
-{
- int font_height;
- int x, y, max_y;
- char buf[512];
- int len;
- struct tm tm_start, tm_end;
- char *str;
- iCalObject *ico;
- GList *list;
-
- gdk_gc_set_clip_rectangle (gc, area);
-
- font_height = widget->style->font->ascent + widget->style->font->descent;
-
- max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
-
- for (y = area->y, list = events; (y < max_y) && list; y += font_height, list = list->next) {
- ico = list->data;
-
- tm_start = *localtime (&ico->dtstart);
- tm_end = *localtime (&ico->dtend);
- str = ico->summary;
-
- if (flags & VIEW_UTILS_DRAW_END) {
- strftime (buf, 512, "%X-", &tm_start);
- len = strlen (buf);
- strftime (buf + len, 512 - len, "%X ", &tm_end);
- } else
- strftime (buf, 512, "%X ", &tm_start);
-
- gdk_draw_string (window,
- widget->style->font,
- gc,
- area->x,
- y + widget->style->font->ascent,
- buf);
-
- if (flags & VIEW_UTILS_DRAW_SPLIT) {
- y += font_height;
- x = widget->style->font->ascent; /* some indentation */
- } else
- x = gdk_string_width (widget->style->font, buf);
-
- gdk_draw_string (window,
- widget->style->font,
- gc,
- x,
- y + widget->style->font->ascent,
- str);
- }
- gdk_gc_set_clip_rectangle (gc, NULL);
-}
-
-void
-view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow)
-{
- int x, y;
- int xthick, ythick;
- GdkGC *light_gc, *dark_gc;
-
- gdk_draw_rectangle (window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- rect->x, rect->y,
- rect->width, rect->height);
-
- light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
- dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
-
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
-
- gdk_gc_set_clip_rectangle (light_gc, rect);
- gdk_gc_set_clip_rectangle (dark_gc, rect);
-
- for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
- for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6) {
- gdk_draw_point (window, light_gc, x, y);
- gdk_draw_point (window, dark_gc, x + 1, y + 1);
-
- gdk_draw_point (window, light_gc, x + 3, y + 1);
- gdk_draw_point (window, dark_gc, x + 4, y + 2);
- }
-
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
-
- gtk_draw_shadow (widget->style, window,
- GTK_STATE_NORMAL, shadow,
- rect->x, rect->y,
- rect->width, rect->height);
-}
diff --git a/calendar/gui/view-utils.h b/calendar/gui/view-utils.h
deleted file mode 100644
index 6e934c0407..0000000000
--- a/calendar/gui/view-utils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef VIEW_UTILS_H
-#define VIEW_UTILS_H
-
-
-#include <gtk/gtk.h>
-#include "calendar.h"
-
-
-enum {
- VIEW_UTILS_DRAW_END = 1 << 0,
- VIEW_UTILS_DRAW_SPLIT = 1 << 1
-};
-
-
-void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end);
-
-void view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow);
-
-
-#endif
diff --git a/calendar/icalendar-types b/calendar/icalendar-types
deleted file mode 100644
index e11f4c1789..0000000000
--- a/calendar/icalendar-types
+++ /dev/null
@@ -1,39 +0,0 @@
-evento todo journal fbrequest fbreply busytime timezone
- attach attach attach
- attendee attendee attendee attendee attendee attendee
- categories categories categories
- class class class
- comment comment comment comment comment comment comment
- completed
- contact contact contact
- created created created created
- description description description
- dtstamp dtstamp
- dtend/duration due->dtend dtend [duration] dtend dtend
- dtstart dtstart dtstart dtstart dtstart dtstart dtstart
- exdate exdate exdate
- exrule exrule exrule
- geo geo
- last-mod last-mod last-mod last-mod last-mod
- location location
- organizer organizer organizer
- percent
- priority priority
- rstatus rstatus rstatus rstatus
- related related related
- resources resources
- rdate rdate rdate [rdate/rrule]
- rrule rrule rrule
- dtstamp dtstamp dtstamp dtstamp
- seq seq seq seq seq
- status status
- summary summary summary
- transp
- uid uid uid uid uid
- url url url url url
- recurid recurid recurid
- freebusy freebusy
- tzname
- tzoffset-to
- tzoffset-from
-
diff --git a/calendar/lexer.c b/calendar/lexer.c
deleted file mode 100644
index e03cb666fb..0000000000
--- a/calendar/lexer.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * lexer.c: Reads in the .calendar files
- */
-#include <stdio.h>
-#include <glib.h>
-#include "cal_struct.h"
-
-
-#define opener "["
-#define closer "]"
-#define VersionMajor 2
-
-GSList *eventlist;
-
-void print_glist(gpointer data, gpointer user_data)
-{
- struct event *myevent = (struct event*)data;
-
- if (data == NULL)
- return;
- printf ("===============================================\nNew event\n");
- printf ("Start: %s %02d:%02d End: %s %02d:%02d\n", myevent->start.date, myevent->start.time / 60, myevent->start.time % 60, myevent->end.date, myevent->end.time / 60, myevent->end.time % 60);
- printf ("Contents: %s\n", myevent->description);
- printf ("Repeat = %d (%d)", (int)(myevent->repeat), myevent->repeatcount);
-}
-
-
-int skip_chars(FILE *fp, char *terminator)
-{
- int c;
- int cnt;
-
- cnt = 0;
- while( (c = fgetc(fp)) != EOF) {
- if (c == terminator[cnt]) {
- cnt++;
- if (terminator[cnt] == '\0')
- return TRUE;
- } else
- cnt = 0;
- }
- return FALSE;
-}
-
-int peek_char(FILE *fp, char *c)
-{
- if ( ((*c) = fgetc(fp)) != EOF) {
- ungetc((*c), fp);
- return TRUE;
- } else
- return FALSE;
-}
-
-int skip_whitespace(FILE *fp)
-{
- int c;
-
- while( (c = fgetc(fp)) != EOF)
- if (!isspace(c)) {
- ungetc(c, fp);
- return TRUE;
- }
- return FALSE;
-}
-
-int get_until(FILE *fp, char terminator, char *buf)
-{
- int c;
-
- while( (c = fgetc(fp)) != EOF) {
- if (c == terminator) {
- *buf = '\0';
- return TRUE;
- }
- *buf = (char)c;
- buf++;
- }
- *buf = '\0';
- return FALSE;
-}
-
-int get_number(FILE *fp, int *x)
-{
- char buf[50];
- int c;
- int cnt;
-
- cnt = 0;
- buf[cnt] = '\0';
- while( (c= fgetc(fp)) != EOF) {
- if (!isdigit(c)) {
- ungetc(c, fp);
- *x = atoi(buf);
- return TRUE;
- }
- buf[cnt++] = (char)c;
- buf[cnt] = '\0';
- }
- *x = atoi(buf);
- return FALSE;
-}
-
-/* Get string until EOF or closer_char */
-int get_string(FILE *fp, char *string)
-{
- int c;
- int cnt;
-
- cnt = 0;
- while ( (c = fgetc(fp)) != EOF) {
- if (c == closer[0]) {
- string[cnt] = '\0';
- ungetc((char)c, fp);
- return TRUE;
- }
- string[cnt++] = (char)c;
- }
- return FALSE;
-}
-
-int get_dates(FILE *fp, char *keyword, struct event *ptr)
-{
- char *c;
- int x;
-
- if (strncmp("Single", keyword, 6) == 0) {
- ptr->repeat = Single;
- /* It's a single date */
- if (! skip_whitespace(fp) || !get_until(fp, ' ', ptr->start.date))
- return FALSE;
- if (! skip_chars(fp, "End"))
- return FALSE;
- return TRUE;
- } else if (strncmp("Days", keyword, 4) == 0) {
- ptr->repeat = Days;
- if (! skip_whitespace(fp) || !get_until(fp, ' ', ptr->start.date))
- return FALSE;
- if (! skip_whitespace(fp) || !get_number(fp, &(ptr->repeatcount)))
- return FALSE;
- if (! skip_chars(fp, "End"))
- return FALSE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-int getid(FILE *fp, char *string)
-{
- int c;
- int cnt;
-
- cnt = 0;
- while( (c =fgetc(fp)) != EOF) {
- if (isalnum(c))
- string[cnt++] = (char)c;
- else {
- string[cnt] = '\0';
- return TRUE;
- }
- }
- string[cnt] = '\0';
- return FALSE;
-}
-
-int parse_appointment(FILE *fp, struct event *ptr, char keyword[])
-{
- char buf[50];
- int x,y,c;
-
- if (strcmp(keyword, "Start") == 0) {
- if ( ! skip_whitespace(fp) || ! get_number(fp, &x) ) {
- g_error("Unable to get start time");
- return FALSE;
- }
- g_print ("Appointment start = %02d:%02d\n", x/60, x % 60);
- ptr->start.time = x;
- return TRUE;
- }
-
- if (strcmp(keyword, "Length") == 0) {
- if ( ! skip_whitespace(fp) || ! get_number(fp, &x) ) {
- g_error("Unable to get length");
- return FALSE;
- }
- g_print ("Appointment length = %d\n", x);
- ptr->end.time = ptr->start.time + x;
- return TRUE;
- }
-
- if (strcmp(keyword, "Alarms") == 0) {
- while(TRUE) {
- skip_whitespace(fp);
- if (!peek_char(fp, (char*)&c)) {
- g_error("Cannot read alarm list");
- return FALSE;
- }
- if (!isdigit(c))
- break;
-
- if (! get_number(fp, &x))
- return FALSE;
-
- g_print("New alarm %d\n", x);
- }
- return TRUE;
- }
-
- g_print("Unknown keyword %s\n", keyword);
- return FALSE;
-}
-
-int parse_item(FILE *fp, struct event *ptr, char keyword[])
-{
- char buf[50];
- int x, y, c;
-
- if (strcmp(keyword, "Remind") == 0) {
- if (! skip_whitespace(fp) || ! get_number(fp, &x)) {
- g_error("Cannot get remind level");
- return FALSE;
- }
- g_print("Remind level = %d\n", x);
- return TRUE;
- }
-
- if (strcmp(keyword, "Owner") == 0) {
- if (!get_string(fp, buf)) {
- g_error("Cannot get owner information");
- return FALSE;
- }
- g_print("Owner = %s\n", buf);
- return TRUE;
- }
-
- if (strcmp(keyword, "Uid") == 0) {
- if (!skip_whitespace(fp) || !get_until(fp, *closer, buf)) {
- g_error("Cannot get unique ID");
- return FALSE;
- }
- g_print("UID = %s\n", buf);
- return TRUE;
- }
-
- if (strcmp(keyword, "Contents") == 0) {
- if (!get_string(fp, buf)) {
- g_error("Cannot get item text");
- return FALSE;
- }
- g_print("Contents = %s\n", buf);
- strcpy(ptr->description,buf);
- return TRUE;
- }
-
- if (strcmp(keyword, "Text") == 0) {
- if (! skip_whitespace(fp) || ! get_number(fp, &x) ||
- (x < 0) || ! skip_whitespace(fp) || ! skip_chars(fp, opener) ) {
- g_error("Cannot get item text");
- return FALSE;
- }
- y = 0;
- while(y < x) {
- if ( (c = fgetc(fp)) == EOF) {
- g_error("Short item text");
- return FALSE;
- }
- buf[y++] = (char)c;
- }
- buf[y] = '\0';
- g_print("Text = %s\n", buf);
- return TRUE;
- }
-
- if (strcmp(keyword, "Dates") == 0) {
- if ( ! getid(fp, buf)) {
- g_error("Cannot get date");
- return FALSE;
- }
- return get_dates(fp, buf,ptr);
- }
-
- if (strcmp(keyword, "Deleted") == 0) {
- if (! skip_whitespace(fp) || ! get_number(fp, &x)) {
- g_error("Cannot get deleted day");
- return FALSE;
- }
- g_print("%d/", x);
- if (! skip_whitespace(fp) || ! get_number(fp, &x)) {
- g_error("Cannot get deleted month");
- return FALSE;
- }
- g_print("%d/", x);
- if (! skip_whitespace(fp) || ! get_number(fp, &x)) {
- g_error("Cannot get deleted year");
- return FALSE;
- }
- g_print("%d\n", x);
- return TRUE;
- }
-
- if (strcmp(keyword, "Hilite") == 0) {
- if (! get_string(fp, buf) ) {
- g_error("Cannot get hilite data");
- return FALSE;
- }
- g_print("Hilite = %s\n", buf);
- return TRUE;
- }
-
- if (strcmp(keyword, "Todo") == 0) {
- g_print("Todo\n");
- return TRUE;
- }
-
-
- if (strcmp(keyword, "Done") == 0) {
- g_print("Done\n");
- return TRUE;
- }
-
- return FALSE;
-}
-
-void parse_ical_file(char const *file)
-{
- FILE *fp;
- int finished;
- char keyword[50];
- int file_major, file_minor;
- char c;
- int item_type;
- int incomplete_item;
- struct event *myevent;
-
- if ( (fp = fopen(file, "r")) == NULL) {
- g_error("couldn't open file");
- return;
- }
-
- finished = FALSE;
-
- if (!skip_whitespace(fp))
- return;
-
- if (! skip_chars(fp, "Calendar") || ! skip_whitespace(fp) ) {
- g_error("unable to find calendar file");
- fclose(fp);
- return;
- }
-
- if (! skip_chars(fp, opener) || ! skip_chars(fp, "v") ) {
- g_error("Unable to get version line");
- fclose(fp);
- return;
- }
- if (! get_number(fp, &file_major) || ! (file_major >=0) || (file_major > VersionMajor)) {
- g_error("Missing/bad major version");
- fclose(fp);
- return;
- }
-
- if (! skip_chars(fp, ".") || ! get_number(fp, &file_minor) ||
- ! skip_chars(fp, "]") || ! skip_whitespace(fp) ) {
- g_error("Missing minor version");
- fclose(fp);
- return;
- }
- if (file_minor > 0) {
- g_error("Bad minor version");
- fclose(fp);
- return;
- }
-
- while(TRUE) {
- g_print("----------------------------------------\n");
- item_type= 0;
- skip_whitespace(fp);
- if (! getid(fp,keyword) || ! skip_whitespace(fp) ||
- ! skip_chars(fp, opener) || ! skip_whitespace(fp) ) {
- fclose(fp);
- return;
- }
-
- if (strcmp(keyword, "Appt") == 0) {
- g_print("New Appointment\n");
- item_type = 1;
-
- } else if (strcmp(keyword, "Note") == 0) {
- g_print("New Note\n");
- item_type = 2;
- } else
- g_print("New ??? (%s)\n", keyword);
-
- incomplete_item = TRUE;
- myevent = g_malloc0(sizeof(struct event));
- while(incomplete_item) {
- if (! skip_whitespace(fp) || ! peek_char(fp, &c)) {
- g_warning("Incomplete item\n");
- fclose(fp);
- return;
- }
- if (c == closer[0]) {
- (void)fgetc(fp);
- g_print("done!\n");
- incomplete_item = FALSE;
- g_slist_append(eventlist, myevent);
- break;
- }
-
- if (! getid(fp,keyword) || ! skip_whitespace(fp) ||
- ! skip_chars(fp, opener) ) {
- g_error("Error reading item property name");
- fclose(fp);
- return;
- }
- if ( ! parse_item(fp, myevent, keyword) && ! parse_appointment(fp, myevent, keyword) ) {
- g_warning("Unable to parse line\n");
- fclose(fp);
- return;
- }
- if ( ! skip_whitespace(fp) || ! skip_chars(fp, closer)) {
- g_error("Error reading item property");
- fclose(fp);
- return;
- }
- } /* while */
- } /* while */
-}
-
-
-
-
-int main(int argc, char *argv[])
-{
-
- eventlist = g_slist_alloc();
- parse_ical_file("/home/csmall/.calendar");
- g_slist_foreach(eventlist, print_glist, NULL);
- return 0;
-}
-
diff --git a/calendar/main.c b/calendar/main.c
deleted file mode 100644
index cd4d107421..0000000000
--- a/calendar/main.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "gnome-cal.h"
-#include "main.h"
-
-/* The username, used to set the `owner' field of the event */
-char *user_name;
-
-/* The full user name from the Gecos field */
-char *full_name;
-
-/* The user's default calendar file */
-char *user_calendar_file;
-
-/* a gnome-config string prefix that can be used to access the calendar config info */
-char *calendar_settings;
-
-/* Day begin, day end parameters */
-int day_begin, day_end;
-
-/* Number of calendars active */
-int active_calendars = 0;
-
-void
-init_username (void)
-{
- char *p;
- struct passwd *passwd;
-
- passwd = getpwuid (getuid ());
- if ((p = passwd->pw_name)){
- user_name = g_strdup (p);
- full_name = g_strdup (passwd->pw_gecos);
- } else {
- if ((p = getenv ("USER"))){
- user_name = g_strdup (p);
- full_name = g_strdup (p);
- return;
- } else {
- user_name = g_strdup ("unknown");
- full_name = g_strdup ("unknown");
- }
- }
- endpwent ();
-}
-
-int
-range_check_hour (int hour)
-{
- struct tm tm;
-
- if (hour < 0)
- hour = 0;
- if (hour > 24)
- hour = 23;
-
- return hour;
-}
-
-/*
- * Initializes the calendar internal variables, loads defaults
- */
-void
-init_calendar (void)
-{
- init_username ();
- user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
- calendar_settings = g_copy_strings ("=", gnome_util_user_home (), ".gnome/calendar=", NULL);
-
- gnome_config_push_prefix (calendar_settings);
- day_begin = range_check_hour (gnome_config_get_int ("/Calendar/Day start=8"));
- day_end = range_check_hour (gnome_config_get_int ("/Calendar/Day end=17"));
-
- if (day_end < day_begin){
- day_begin = 8;
- day_end = 17;
- }
- gnome_config_pop_prefix ();
-}
-
-void
-new_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-open_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-save_calendar_cmd (GtkWidget *widget, void *data)
-{
-}
-
-void
-about_calendar_cmd (GtkWidget *widget, void *data)
-{
-
- GtkWidget *about;
- gchar *authors[] = {
- "Miguel de Icaza (miguel@kernel.org)",
- "Federico Mena (federico@gimp.org)",
- NULL
- };
-
- about = gnome_about_new (_("Gnome Calendar"), VERSION,
- "(C) 1998 the Free Software Fundation",
- authors,
- _("The GNOME personal calendar and schedule manager."),
- NULL);
- gtk_widget_show (about);
-}
-
-void
-display_objedit (GtkWidget *widget, GnomeCalendar *gcal)
-{
- event_editor_new (gcal, NULL);
-}
-
-void
-quit_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- /* FIXME: check all of the calendars for their state (modified) */
-
- gtk_main_quit ();
-}
-
-void
-close_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- if (gcal->cal->modified){
- gnome_message_box_new (_("The calendar has unsaved changes, Save them?"),
- GNOME_MESSAGE_BOX_WARNING,
- "Yes", "No");
- }
- gtk_widget_destroy (widget);
- active_calendars--;
-
- if (active_calendars == 0)
- gtk_main_quit ();
-}
-
-void
-previous_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_previous (gcal);
-}
-
-void
-next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_next (gcal);
-}
-
-void
-today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- gnome_calendar_goto (gcal, time (NULL));
-}
-
-GnomeUIInfo gnome_cal_file_menu [] = {
- { GNOME_APP_UI_ITEM, N_("New calendar"), NULL, new_calendar_cmd },
-
- { GNOME_APP_UI_ITEM, N_("Open calendar"), NULL, open_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN },
-
- { GNOME_APP_UI_ITEM, N_("Save calendar"), NULL, save_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
-
- { GNOME_APP_UI_SEPARATOR },
- { GNOME_APP_UI_ITEM, N_("Close"), NULL, close_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
-
- { GNOME_APP_UI_ITEM, N_("Exit"), NULL, quit_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
-
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_about_menu [] = {
- { GNOME_APP_UI_ITEM, N_("About"), NULL, about_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT },
- GNOMEUIINFO_HELP ("cal"),
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_edit_menu [] = {
- { GNOME_APP_UI_ITEM, N_("New appointment"), NULL, display_objedit },
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_cal_menu [] = {
- { GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gnome_cal_file_menu },
- { GNOME_APP_UI_SUBTREE, N_("Edit"), NULL, &gnome_cal_edit_menu },
- { GNOME_APP_UI_SUBTREE, N_("Help"), NULL, &gnome_cal_about_menu },
- GNOMEUIINFO_END
-};
-
-GnomeUIInfo gnome_toolbar [] = {
- { 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"), NULL, today_clicked, 0, 0,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK },
-
- { GNOME_APP_UI_ITEM, N_("Next"), NULL, next_clicked, 0, 0,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD },
-
- GNOMEUIINFO_END
-};
-
-static void
-setup_menu (GtkWidget *gcal)
-{
- gnome_app_create_menus_with_data (GNOME_APP (gcal), gnome_cal_menu, gcal);
- gnome_app_create_toolbar_with_data (GNOME_APP (gcal), gnome_toolbar, gcal);
-
-}
-
-static void
-new_calendar (char *full_name, char *calendar_file)
-{
- GtkWidget *toplevel;
- char *title;
-
- title = g_copy_strings (full_name, "'s calendar", NULL);
-
- toplevel = gnome_calendar_new (title);
- setup_menu (toplevel);
-
- if (g_file_exists (calendar_file)){
- printf ("Trying to load %s\n", calendar_file);
- gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
- } else {
- printf ("tring: ./test.vcf\n");
- gnome_calendar_load (GNOME_CALENDAR (toplevel), "./test.vcf");
- }
- active_calendars++;
-
- gtk_widget_show (toplevel);
-}
-
-int
-main(int argc, char *argv[])
-{
- GnomeClient *client;
-
- argp_program_version = VERSION;
-
- /* Initialise the i18n stuff */
- bindtextdomain(PACKAGE, GNOMELOCALEDIR);
- textdomain(PACKAGE);
-
- gnome_init ("gncal", NULL, argc, argv, 0, NULL);
-
- init_calendar ();
-
- new_calendar (full_name, user_calendar_file);
- gtk_main ();
- return 0;
-}
-
-
diff --git a/calendar/main.h b/calendar/main.h
deleted file mode 100644
index 91ba1e403a..0000000000
--- a/calendar/main.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-extern int day_begin, day_end;
-extern char *user_name;
diff --git a/calendar/menus.c b/calendar/menus.c
deleted file mode 100644
index c42a52a981..0000000000
--- a/calendar/menus.c
+++ /dev/null
@@ -1,147 +0,0 @@
-#include <gtk/gtk.h>
-#include <strings.h>
-
-#include "gncal.h"
-
-
-static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar *
- path);
-static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar
-key, gchar modifiers, gchar * path);
-void menus_init(void);
-void menus_create(GtkMenuEntry * entries, int nmenu_entries);
-
-
-/* this is the GtkMenuEntry structure used to create new menus. The
- * first member is the menu definition string. The second, the
- * default accelerator key used to access this menu function with
- * the keyboard. The third is the callback function to call when
- * this menu item is selected (by the accelerator key, or with the
- * mouse.) The member is the data to pass to your callback function.
- */
-
-static GtkMenuEntry menu_items[] =
-{
- {"<Main>/File/Exit", "<control>Q", menu_file_quit, NULL},
- {"<Main>/Help/About", NULL, menu_help_about, NULL},
-
-};
-
-static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
-
-static int initialize = TRUE;
-static GtkMenuFactory *factory = NULL;
-static GtkMenuFactory *subfactory[1];
-static GHashTable *entry_ht = NULL;
-
-void get_main_menu(GtkWidget ** menubar, GtkAcceleratorTable ** table)
-{
- if (initialize)
- menus_init();
-
- if (menubar)
- *menubar = subfactory[0]->widget;
- if (table)
- *table = subfactory[0]->table;
-}
-
-void menus_init(void)
-{
- if (initialize) {
- initialize = FALSE;
-
- factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
- subfactory[0] = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
-
- gtk_menu_factory_add_subfactory(factory, subfactory[0], "<Main>");
- menus_create(menu_items, nmenu_items);
- }
-}
-
-void menus_create(GtkMenuEntry * entries, int nmenu_entries)
-{
- char *accelerator;
- int i;
-
- if (initialize)
- menus_init();
-
- if (entry_ht)
- for (i = 0; i < nmenu_entries; i++) {
- accelerator = g_hash_table_lookup(entry_ht, entries[i].path);
- if (accelerator) {
- if (accelerator[0] == '\0')
- entries[i].accelerator = NULL;
- else
- entries[i].accelerator = accelerator;
- }
- }
- gtk_menu_factory_add_entries(factory, entries, nmenu_entries);
-
-
- for (i = 0; i < nmenu_entries; i++)
- if (entries[i].widget) {
- gtk_signal_connect(GTK_OBJECT(entries[i].widget), "install_accelerator",
- (GtkSignalFunc) menus_install_accel,
- entries[i].path);
- gtk_signal_connect(GTK_OBJECT(entries[i].widget), "remove_accelerator",
- (GtkSignalFunc) menus_remove_accel,
- entries[i].path);
- }
-}
-
-static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar
-key, gchar modifiers, gchar * path)
-{
- char accel[64];
- char *t1, t2[2];
-
- accel[0] = '\0';
- if (modifiers & GDK_CONTROL_MASK)
- strcat(accel, "<control>");
- if (modifiers & GDK_SHIFT_MASK)
- strcat(accel, "<shift>");
- if (modifiers & GDK_MOD1_MASK)
- strcat(accel, "<alt>");
-
- t2[0] = key;
- t2[1] = '\0';
- strcat(accel, t2);
-
- if (entry_ht) {
- t1 = g_hash_table_lookup(entry_ht, path);
- g_free(t1);
- } else
- entry_ht = g_hash_table_new(g_string_hash, g_string_equal);
-
- g_hash_table_insert(entry_ht, path, g_strdup(accel));
-
- return TRUE;
-}
-
-static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar *
- path)
-{
- char *t;
-
- if (entry_ht) {
- t = g_hash_table_lookup(entry_ht, path);
- g_free(t);
-
- g_hash_table_insert(entry_ht, path, g_strdup(""));
- }
-}
-
-void menus_set_sensitive(char *path, int sensitive)
-{
- GtkMenuPath *menu_path;
-
- if (initialize)
- menus_init();
-
- menu_path = gtk_menu_factory_find(factory, path);
- if (menu_path)
- gtk_widget_set_sensitive(menu_path->widget, sensitive);
- else
- g_warning("Unable to set sensitivity for menu which doesn't exist: %s", path);
-}
diff --git a/calendar/menus.h b/calendar/menus.h
deleted file mode 100644
index 2cf5ab08e2..0000000000
--- a/calendar/menus.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __MENUS_H__
-#define __MENUS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gtk/gtk.h>
-
-void get_main_menu (GtkWidget **menubar, GtkAcceleratorTable **table);
-void menus_create(GtkMenuEntry *entries, int nmenu_entries);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __MENUS_H__ */
diff --git a/calendar/objedit.c b/calendar/objedit.c
deleted file mode 100644
index 3a15e76f82..0000000000
--- a/calendar/objedit.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Calendar Object editor.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#include <gnome.h>
-
-/* Day start and day end in hours */
-int day_start, day_end;
-
-typedef struct {
- GtkWidget *property_box;
-
- GtkWidget *general;
-
- GtkTable *general_table;
- GtkWidget *general_time_table;
-} ObjEditor;
-
-GtkWidget *
-calendar_object_editor_setup_time_frame (ObjEditor *oe)
-{
- GtkWidget *frame;
- GtkWidget *start_time, *end_time;
- GtkTable *t;
-
- frame = gtk_frame_new (_("Time"));
- t = GTK_TABLE (oe->general_time_table = gtk_table_new (1, 1, 0));
- gtk_container_add (GTK_CONTAINER (frame), oe->general_time_table);
-
- start_time = gnome_date_edit_new (0);
- end_time = gnome_date_edit_new (0);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_start, day_end);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_start, day_end);
-
- gtk_table_attach (t, gtk_label_new (_("Start time")), 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (t, gtk_label_new (_("End time")), 1, 2, 2, 3, 0, 0, 0, 0);
-
- gtk_table_attach (t, start_time, 2, 3, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3, 0, 0, 0, 0);
- return frame;
-}
-
-void
-calendar_general_editor_new (ObjEditor *oe)
-{
- GtkWidget *frame;
-
- oe->general = gtk_hbox_new (0, 0);
- oe->general_table = (GtkTable *) gtk_table_new (1, 1, 0);
-
- gtk_box_pack_start (GTK_BOX (oe->general), (GtkWidget *) oe->general_table, 1, 1, 0);
-
- frame = calendar_object_editor_setup_time_frame (oe);
- gtk_table_attach (oe->general_table, frame,
- 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-
- gnome_property_box_append_page (oe->property_box, oe->general, gtk_label_new (_("General")));
-}
-
-ObjEditor *
-calendar_object_editor_new (void)
-{
- ObjEditor *oe;
-
- oe = g_new0 (ObjEditor, 1);
-
- oe->property_box = gnome_property_box_new ();
- calendar_general_editor_new (oe);
-
- return oe;
-}
-
-main (int argc, char *argv [])
-{
- ObjEditor *oe;
-
- day_start = 7;
- day_end = 19;
- gnome_init ("myapp", NULL, argc, argv, 0, NULL);
-
- oe = calendar_object_editor_new ();
- gtk_widget_show_all (oe->property_box);
- gtk_main ();
-}
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
deleted file mode 100644
index 8c5605c688..0000000000
--- a/calendar/pcs/calobj.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (federico@gimp.org)
- */
-#include <string.h>
-#include <glib.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "versit/vcc.h"
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->enabled = 0;
- alarm->type = type;
-
- if (type != ALARM_MAIL){
- alarm->count = 15;
- alarm->units = ALARM_MINUTES;
- } else {
- printf ("uno!\n");
- alarm->count = 1;
- alarm->units = ALARM_DAYS;
- }
-
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (def_mail);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- g_free (ico);
-}
-
-GList *
-set_list (char *str, char *sc)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, sc); s; s = strtok (NULL, sc))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo;
- VObjectIterator i;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else
- return 0;
-
- /* uid */
- if (has (o, VCUniqueStringProp))
- ical->uid = g_strdup (str_val (vo));
-
- /* seq */
- if (has (o, VCSequenceProp))
- ical->seq = atoi (str_val (vo));
- else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp))
- ical->dtstart = time_from_isodate (str_val (vo));
- else
- ical->dtstart = 0;
-
- /* dtend */
- if (has (o, VCDTendProp))
- ical->dtend = time_from_isodate (str_val (vo));
- else
- ical->dtend = 0;
-
- /* dcreated */
- if (has (o, VCDCreatedProp))
- ical->created = time_from_isodate (str_val (vo));
-
- /* completed */
- if (has (o, VCCompletedProp))
- ical->completed = time_from_isodate (str_val (vo));
-
- /* last_mod */
- if (has (o, VCLastModifiedProp))
- ical->last_mod = time_from_isodate (str_val (vo));
- else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp))
- ical->exdate = set_list (str_val (vo), ",");
-
- /* description/comment */
- if (has (o, VCDescriptionProp))
- ical->comment = g_strdup (str_val (vo));
-
- /* summary */
- if (has (o, VCSummaryProp))
- ical->summary = g_strdup (str_val (vo));
- else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp))
- ical->status = g_strdup (str_val (vo));
- else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp))
- ical->class = g_strdup (str_val (vo));
- else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp))
- ical->categories = set_list (str_val (vo), ",");
-
- /* resources */
- if (has (o, VCResourcesProp))
- ical->resources = set_list (str_val (vo), ";");
-
- /* priority */
- if (has (o, VCPriorityProp))
- ical->priority = atoi (str_val (vo));
-
- /* tranparency */
- if (has (o, VCTranspProp))
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
-
- /* related */
- if (has (o, VCRelatedToProp))
- ical->related = set_list (str_val (vo), ";");
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0)
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- }
-
- /* url */
- if (has (o, VCURLProp))
- ical->url = g_strdup (str_val (vo));
-
- /* FIXME: dalarm */
- if (has (o, VCDAlarmProp))
- ;
-
- /* FIXME: aalarm */
- if (has (o, VCAAlarmProp))
- ;
-
- /* FIXME: palarm */
- if (has (o, VCPAlarmProp))
- ;
-
- /* FIXME: malarm */
- if (has (o, VCMAlarmProp))
- ;
-
- /* FIXME: rdate */
- if (has (o, VCRDateProp))
- ;
-
- /* FIXME: rrule */
- if (has (o, VCRRuleProp))
- ;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", 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
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
-
- /* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
-
- /* 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/pcs/calobj.h b/calendar/pcs/calobj.h
deleted file mode 100644
index 00dbd5c63e..0000000000
--- a/calendar/pcs/calobj.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org), Federico Mena (federico@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "versit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-} iCalObject;
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/test.vcf b/calendar/test.vcf
deleted file mode 100644
index 7cd47a9cbf..0000000000
--- a/calendar/test.vcf
+++ /dev/null
@@ -1,41 +0,0 @@
-BEGIN:VCALENDAR
-
-PRODID:-//K Desktop Environment//NONSGML KOrganizer//EN
-TZ:-05
-VERSION:1.0
-BEGIN:VEVENT
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980408T003000
-DTEND:19980408T010000
-SUMMARY:asdfasdfasfasdfasdf
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
-
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
-SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980408T140000
-DTEND:19980408T160000
-SUMMARY:asdfasfdasfasdfasfd
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
-
-END:VCALENDAR
-
diff --git a/calendar/timeutil.c b/calendar/timeutil.c
deleted file mode 100644
index acd2b33ee7..0000000000
--- a/calendar/timeutil.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <federico@nuclecu.unam.mx>
- * Miguel de Icaza <miguel@nuclecu.unam.mx>
- */
-
-#include <libgnome/libgnome.h>
-#include "timeutil.h"
-
-#define digit_at(x,y) (x [y] - '0')
-
-time_t
-time_from_isodate (char *str)
-{
- struct tm my_tm;
- time_t t;
-
- my_tm.tm_year = (digit_at (str, 0) * 1000 + digit_at (str, 1) * 100 +
- digit_at (str, 2) * 10 + digit_at (str, 3)) - 1900;
-
- my_tm.tm_mon = digit_at (str, 4) * 10 + digit_at (str, 5) - 1;
- my_tm.tm_mday = digit_at (str, 6) * 10 + digit_at (str, 7);
- my_tm.tm_hour = digit_at (str, 9) * 10 + digit_at (str, 10);
- my_tm.tm_min = digit_at (str, 11) * 10 + digit_at (str, 12);
- my_tm.tm_sec = digit_at (str, 13) * 10 + digit_at (str, 14);
- my_tm.tm_isdst = -1;
-
- t = mktime (&my_tm);
- return t;
-}
-
-void
-print_time_t (time_t t)
-{
- struct tm *tm = localtime (&t);
-
- printf ("TIEMPO: %d/%d/%d %d:%d:%d\n",
- tm->tm_mon+1, tm->tm_mday, tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
-int
-get_time_t_hour (time_t t)
-{
- struct tm *tm;
-
- tm = localtime (&t);
- return tm->tm_hour;
-}
-
-char *
-isodate_from_time_t (time_t t)
-{
- struct tm *tm;
- static char isotime [40];
-
- tm = localtime (&t);
- strftime (isotime, sizeof (isotime)-1, "%Y%m%dT%H%M%sZ", tm);
- return isotime;
-}
-
-time_t
-time_from_start_duration (time_t start, char *duration)
-{
- printf ("Not yet implemented\n");
- return 0;
-}
-
-char *
-format_simple_hour (int hour, int use_am_pm)
-{
- static char buf[256];
-
- /* I don't know whether this is the best way to internationalize it.
- * Does any language use different conventions? - Federico
- */
-
- if (use_am_pm)
- sprintf (buf, "%d%s",
- (hour == 0) ? 12 : (hour > 12) ? (hour - 12) : hour,
- (hour < 12) ? _("am") : _("pm"));
- else
- sprintf (buf, "%02d%s", hour, _("h"));
-
- return buf;
-
-}
-
-time_t
-time_add_day (time_t time, int days)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
-
- tm->tm_mday += days;
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a day with\n");
- print_time_t (time);
- return time;
- }
- return new_time;
-}
-
-time_t
-time_add_year (time_t time, int years)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
-
- tm->tm_year += years;
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a year with\n");
- print_time_t (time);
- return time;
- }
- return new_time;
-}
diff --git a/calendar/timeutil.h b/calendar/timeutil.h
deleted file mode 100644
index 8f9157351c..0000000000
--- a/calendar/timeutil.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <federico@nuclecu.unam.mx>
- * Miguel de Icaza <miguel@nuclecu.unam.mx>
- */
-
-#ifndef TIMEUTIL_H
-#define TIMEUTIL_H
-
-
-#include <time.h>
-
-
-time_t time_from_isodate (char *str);
-time_t time_from_start_duration (time_t start, char *duration);
-char *isodate_from_time_t (time_t t);
-int get_time_t_hour (time_t t);
-
-time_t time_add_week (time_t time, int weeks);
-time_t time_add_day (time_t time, int weeks);
-time_t time_add_year (time_t time, int years);
-
-/* Returns pointer to a statically-allocated buffer with a string of the form
- * 3am, 4am, 12pm, 08h, 17h, etc.
- * The string is internationalized, hopefully correctly.
- */
-char *format_simple_hour (int hour, int use_am_pm);
-
-
-#endif
diff --git a/calendar/view-utils.c b/calendar/view-utils.c
deleted file mode 100644
index f5a3b41928..0000000000
--- a/calendar/view-utils.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <string.h>
-#include "view-utils.h"
-
-
-/* FIXME: remove this function later */
-
-#if 0
-static GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- static iCalObject objs[24];
- static int ready = 0;
- int i;
- GList *list;
-
- if (!ready) {
- struct tm tm;
- time_t tim;
-
- ready = 1;
-
- for (i = 0; i < 24; i++) {
- tim = time (NULL);
- tm = *localtime (&tim);
-
- tm.tm_hour = i;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- objs[i].dtstart = mktime (&tm);
-
- tm.tm_hour = i;
- tm.tm_min = 30;
- tm.tm_sec = 0;
- objs[i].dtend = mktime (&tm);
-
- objs[i].summary = "Ir a chingar a tu madre";
- }
- }
-
- list = NULL;
-
- for (i = 0; i < 8; i++)
- list = g_list_append (list, &objs[i]);
-
- return list;
-}
-#endif
-void
-view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end)
-{
- int font_height;
- int x, y, max_y;
- char buf[512];
- int len;
- struct tm tm_start, tm_end;
- char *str;
- iCalObject *ico;
- GList *list;
-
- gdk_gc_set_clip_rectangle (gc, area);
-
- font_height = widget->style->font->ascent + widget->style->font->descent;
-
- max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
-
- for (y = area->y, list = events; (y < max_y) && list; y += font_height, list = list->next) {
- ico = list->data;
-
- tm_start = *localtime (&ico->dtstart);
- tm_end = *localtime (&ico->dtend);
- str = ico->summary;
-
- if (flags & VIEW_UTILS_DRAW_END) {
- strftime (buf, 512, "%X-", &tm_start);
- len = strlen (buf);
- strftime (buf + len, 512 - len, "%X ", &tm_end);
- } else
- strftime (buf, 512, "%X ", &tm_start);
-
- gdk_draw_string (window,
- widget->style->font,
- gc,
- area->x,
- y + widget->style->font->ascent,
- buf);
-
- if (flags & VIEW_UTILS_DRAW_SPLIT) {
- y += font_height;
- x = widget->style->font->ascent; /* some indentation */
- } else
- x = gdk_string_width (widget->style->font, buf);
-
- gdk_draw_string (window,
- widget->style->font,
- gc,
- x,
- y + widget->style->font->ascent,
- str);
- }
- gdk_gc_set_clip_rectangle (gc, NULL);
-}
-
-void
-view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow)
-{
- int x, y;
- int xthick, ythick;
- GdkGC *light_gc, *dark_gc;
-
- gdk_draw_rectangle (window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- rect->x, rect->y,
- rect->width, rect->height);
-
- light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
- dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
-
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
-
- gdk_gc_set_clip_rectangle (light_gc, rect);
- gdk_gc_set_clip_rectangle (dark_gc, rect);
-
- for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
- for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6) {
- gdk_draw_point (window, light_gc, x, y);
- gdk_draw_point (window, dark_gc, x + 1, y + 1);
-
- gdk_draw_point (window, light_gc, x + 3, y + 1);
- gdk_draw_point (window, dark_gc, x + 4, y + 2);
- }
-
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
-
- gtk_draw_shadow (widget->style, window,
- GTK_STATE_NORMAL, shadow,
- rect->x, rect->y,
- rect->width, rect->height);
-}
diff --git a/calendar/view-utils.h b/calendar/view-utils.h
deleted file mode 100644
index 6e934c0407..0000000000
--- a/calendar/view-utils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef VIEW_UTILS_H
-#define VIEW_UTILS_H
-
-
-#include <gtk/gtk.h>
-#include "calendar.h"
-
-
-enum {
- VIEW_UTILS_DRAW_END = 1 << 0,
- VIEW_UTILS_DRAW_SPLIT = 1 << 1
-};
-
-
-void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end);
-
-void view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow);
-
-
-#endif
diff --git a/calendar/views.c b/calendar/views.c
deleted file mode 100644
index a066d789e8..0000000000
--- a/calendar/views.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Calendar views.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <gnome.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-GtkWidget *
-day_view_create (GnomeCalendar *gcal)
-{
- return gtk_button_new_with_label ("This is supposed to be the Day View");
-}
-
-GtkWidget *
-week_view_create (GnomeCalendar *gcal)
-{
- return gtk_button_new_with_label ("This is supposed to be the Week View");
-}
-
-GtkWidget *
-year_view_create (GnomeCalendar *gcal)
-{
- return gtk_button_new_with_label ("This is supposed to be the Year View");
-}
-
-GtkWidget *
-tasks_create (GnomeCalendar *gcal)
-{
- return gtk_button_new_with_label ("This is supposed to be the Tasks View");
-}
diff --git a/calendar/views.h b/calendar/views.h
deleted file mode 100644
index d7162cfcbd..0000000000
--- a/calendar/views.h
+++ /dev/null
@@ -1,4 +0,0 @@
-GtkWidget *day_view_create (GnomeCalendar *gcal);
-GtkWidget *week_view_create (GnomeCalendar *gcal);
-GtkWidget *year_view_create (GnomeCalendar *gcal);
-GtkWidget *tasks_create (GnomeCalendar *gcal);
diff --git a/libversit/.cvsignore b/libversit/.cvsignore
deleted file mode 100644
index e995588475..0000000000
--- a/libversit/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.deps
-Makefile
-Makefile.in
diff --git a/libversit/Makefile.am b/libversit/Makefile.am
deleted file mode 100644
index 57c733bbb1..0000000000
--- a/libversit/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-lib_LIBRARIES = libversit.a
-
-libversit_a_SOURCES = \
- vcc.y \
- vobject.c \
- vobject.h \
- port.h \
- vcaltmp.c \
- vcaltmp.h
-
-EXTRA_DIST = README.TXT vcaltest.c vctest.c
diff --git a/libversit/README.TXT b/libversit/README.TXT
deleted file mode 100644
index c8ce8b0979..0000000000
--- a/libversit/README.TXT
+++ /dev/null
@@ -1,951 +0,0 @@
-NOTE: If you used the earlier APIs released by Versit
-then you will want to look at the document "migrate.doc"
-included with this package. It contains a discussion of
-the differences between the old API and this one.
-
-----------------------------------------------------------------
-
-The vCard/vCalendar C interface is implemented in the set
-of files as follows:
-
-vcc.y, yacc source, and vcc.c, the yacc output you will use
-implements the core parser
-
-vobject.c implements an API that insulates the caller from
-the parser and changes in the vCard/vCalendar BNF
-
-port.h defines compilation environment dependent stuff
-
-vcc.h and vobject.h are header files for their .c counterparts
-
-vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
-which you may find useful.
-
-test.c is a standalone test driver that exercises some of
-the features of the APIs provided. Invoke test.exe on a
-VCARD/VCALENDAR input text file and you will see the pretty
-print output of the internal representation (this pretty print
-output should give you a good idea of how the internal
-representation looks like -- there is one such output in the
-following too). Also, a file with the .out suffix is generated
-to show that the internal representation can be written back
-in the original text format.
-
------------------------------------------------------------------
-
-
- VObject for VCard/VCalendar
-
-Table of Contents
-=================
-1. VObject
-2. Internal Representations of VCard/VCalendar
-3. Iterating Through VObject's Properties or Values
-4. Pretty Printing a VObject Tree
-5. Building A VObject Representation of A VCard/VCalendar
-6. Converting A VObject Representation Into Its Textual Representation
-7. Miscellaneous Notes On VObject APIs usages
-8. Brief descriptions of each APIs
-9. Additional Programming Notes.
-
-This document is mainly about the VObject and its APIs. The main
-use of a VObject is to represent a VCard or a VCalendar inside
-a program. However, its use is not limited to aforemention as it
-can represent an arbitrary information that makes up of a tree or
-forest of properties/values.
-
-1. VObject
- =======
-A VObject can have a name (id) and a list of associated properties and
-a value. Each property is itself a VObject.
-
-2. Internal Representations of VCard/VCalendar
- ===========================================
-A list of VCard or a VCalendar is represented by a list of VObjects.
-The name (id) of the VObjects in the list is either VCCardProp or
-VCCalProp. Each of these VObjects can have a list of properties.
-Since a property is represented as a VObject, each of these properties
-can have a name, a list of properties, and a value.
-
-For example, the input file "vobject.vcf":
-
-BEGIN:VCARD
-N:Alden;Roland
-FN:Roland H. Alden
-ORG:AT&T;Versit Project Office
-TITLE:Consultant
-EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com
-EMAIL;INTERNET:ralden@sfgate.com
-EMAIL;MCIMail:242-2200
-LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-Suite 2208=0A=
-One Pine Street=0A=
-San Francisco, CA 94111
-LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-Suite 2208=0A=
-One Pine Street=0A=
-San Francisco, CA 94111=0A=
-U.S.A.
-TEL;WORK;PREF;MSG:+1 415 296 9106
-TEL;WORK;FAX:+1 415 296 9016
-TEL;MSG;CELL:+1 415 608 5981
-ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A.
-SOUND:ROW-LAND H ALL-DIN
-LOGO;GIF;BASE64:
- R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC
- QjExMSEhIRAQEO///87v9973/73n95zW71K13jGl1nvG50Kt3iGc1gCMzq3e94zO
- 7xCU1nO952O15wAAACwAAAAApgBOAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv
- /8CgcEj8QTaeywWTyWCUno2kSK0KI5tLc8vtNi+WiHVMlj0mFK96nalsxOW4fPSw
- cNj4tQc+7xcjGh4WExJTJYUTFkp3eU0eEH6RkpOUlTARhRoWm5ydFpCWoS0QEqAu
- ARKaHRcVjV0borEoFl0cSre4Sq67FA+yvwAeTU8XHZ7HmxS6u2wVfMCVpAE3pJoW
- ylrMptDcOqSF4OHg3eQ5pInInb7lcc86mNbLzBXsZbRfUOn6ucyNHvVWJHCpQFDf
- MWwEEzLqx2YCQCqF3OnItClJNmYcJD7cSAKTuI/gtnEcOQKkyVIk6/+ds5CkFcMM
- 61LiENikwi1jBnNyuvUSjwWZOS5uIZarqNFcNl32XMMB6I06GgoJ+bZp1ZKeDl8E
- +MC1K1cBIhZ4HUu2LAsCZdOWRQDt20lxIlccSHsgrNq7Xc/ixcsWmNu34WKyYJCW
- gQjCe9XqTZy2L4pv04gg2sSKSc8OLgTcBSuWsdkVaD2TdXyiQxebFyjo1Gnx6tJm
- LuaqrdtZtNfFtruSNmF5IKujwIsmJbjwtRqNJhrcNVw79wcRAgogmE4ArIjQzj/s
- JvHAGCFDQR4UqigPK4sBe62XwO51OwADiMcqUG+iOdcFAL+hW20BfAoEexlwAnu6
- mZDAXQ1EVh//WfhxJB5gIbHgwFgOTOiVAgOuVQKAfKFg3weGwSBYFZMp4hpDGKyA
- 3lgJKECWgiMQyBVpW+0V4oJjNfhCNkR1IgWEb21QlRK9GdfFCgeOZYBsXgm4noYj
- GEBhAQHYh0J8XenoQnFGdrkUciJY6FUAK15ogozakcBhliKsyZWHDMZQ0wWC/Aim
- DB6h01KRr/lXQgFxAqDcWDACgCZpUnrVQJtjwTnWjS6MWAYqqfDnSaEkJOlVXQBo
- 2pWTMUJ53WgAuPncCR9q6VQMAYjZlXWJmknCoSUM2p4BC+SaKwG88hoZlvfFMM4f
- hQh5TXkv+RklWYtC91mopJIAKFkJlDAW/wF25ShnLbeo5gmQ+1FGkJdrKCuCi2OR
- BuwHBcwqKgABrMtVAgpem61XkLbAJ7n8uiIpvGVhO4KpH1QLbbpqLheZvQCkGoNL
- thSzSTg2UGVBBzbtaxwKsYrmgLvRAlCmWgwMAADD66rKAgR3XlGspcdkZYK8ibU7
- asgEl+XAyB8I7PCqMWiWncGGimpfAgO4ypXSPpOVLwsRCDJxRD2AoyeRRv5kApO5
- fXwzwvfOKLKtaTWtbQxccmGLTZy8xYlVSvXbhbk0M2YzrYfJJ0K8m+V9NgxpyC04
- UycI/aiuiH9Y8NftDUwWp1Wm5UABnAUKwwRsPFGBt4Oc9PZvGvNLwf8JOZt8Arpe
- eY23yDovwIDiBX74NAsPVLDJj3Hh4JEExsKcjrlKf9DsCVx3ZfLqAKBuG1s/A90C
- z2KjYHjjyPOdG1spz6BBUr+BcUxUb1nDCTa/VZD2Uv+YkLPAKJC9dNEh7628WgqI
- ybzlaA+ufxMa6bxC6ciLUQLcx5UGIAAsAkDA6wQkOxrcY39yo4cQMNWCAPTKV1R4
- wPkgaBxzOc8FtMiF1NoGoXBRJjgoPApmPsjCFlbMdzCM4TFy50IXxI2DPcHAv2rY
- gghsEIeu8CAPW6ABIPYEFkOsAeaMyIz0JfGJUExBBGRIRX0IMYovWCIT1eBELNpA
- i1vcgta8iANPCIQOghzQABl30J0tXqBla4wjFLFQxZzAUY42CIAd5OYBCuKxB2c4
- I0b28EcrQKADgmSKB9RYyDhA4BqCxIBqrtjIMTwoFeCjYSU3KZMQAAA7
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-PRODID:-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-START:19960523T120000
-END:19960523T130000
-SUBTYPE:PHONE CALL
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-DESCRIPTION:VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland
-END:VEVENT
-BEGIN:VEVENT
-START:19960523T113000
-END:19960523T115500
-SUBTYPE:LUNCH
-SUMMARY:Eat in the cafeteria today
-END:VEVENT
-END:VCALENDAR
-
-END:VCARD
-
-
-will conceptually be be represented as
- vcard
- VCNameProp
- VCFamilyNameProp=Alden
- VCGivenNameProp=Roland
- VCFullNameProp=Roland H.Alden
- ....
-
-note that
- EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com
-will be represented as:
- VCEmailAddress=sf!rincon!ralden@alden.attmail.com
- VCWork
- VCPreferred
- VCInternet
-where the lower level properties are properties of the property
-VCEmailAddress.
-
-Groupings are flattened out in the VObject representation such
-that:
- a.b:blah
- a.c:blahblah
-are represented as:
- b=blah
- VCGrouping=a
- c=blahblah
- VCGrouping=a
-i.e. one can read the above as:
- the property "b" has value "blah" and property "VCGrouping"
- with the value "a".
- the property "c" has value "blahblah" and property "VCGrouping"
- with the value "a".
-likewise, multi-level groupings are flatten similarly. e.g.
- a.b.c:blah
- a.b.e:blahblah
--->
- c=blah
- VCGrouping=b
- VCGrouping=a
- e=blahblah
- VCGrouping=b
- VCGrouping=a
-which read:
- the property "c" has value "blah" and property "VCGrouping"
- with the value "b" which has property "VCGrouping"
- with value "a".
- the property "e" has value "blahblah" and property "VCGrouping"
- with the value "b" which has property "VCGrouping"
- with value "a".
-
-3. Iterating Through VObject's Properties or Values
- ================================================
-The following is a skeletal form of iterating through
-all properties of a vobject, o:
-
- // assume the object of interest, o, is of type VObject
- VObjectIterator i;
- initPropIterator(&i,o);
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- // ... do something with "each" property
- }
-
-Use the API vObjectName() to access a VObject's name.
-Use the API vObjectValueType() to determine if a VObject has
- a value. For VCard/VCalendar application, you
- should not need this function as practically
- all values are either of type VCVT_USTRINGZ or
- VCVT_RAW (i.e set by setVObjectUStringZValue and
- setVObjectAnyValue APIs respectively), and the
- value returned by calls to vObjectUStringZValue
- and vObjectAnyValue are 0 if a VObject has no
- value. (There is a minor exception where VObject with
- VCDataSizeProp has value that is set by
- setVObjectLongValue).
-Use the APIs vObject???Value() to access a VObject's value.
- where ??? is the expected type.
-Use the APIs setvObject???Value() to set or modify a VObject's value.
- where ??? is the expected type.
-Use the API isAPropertyOf() to query if a name match the name of
- a property of a VObject. Since isAPropertyOf() return
- the matching property, we can use that to retrieve
- a property and subsequently the value of the property.
-
-4. Pretty Printing a VObject Tree
- ==============================
-VObject tree can be pretty printed with the printVObject() function.
-The output of pretty printing a VObject representation of the input
-test file "vobject.vcf" is shown below. Note that the indentation
-indicates the tree hirerarchy where the immediate children nodes
-of a parent node is all at the same indentation level and the
-immediate children nodes are the immediate properties of the
-associated parent nodes. In the following, {N,FN,ORG,TITLE,...}
-are immediate properties of VCARD. {F and G} are properties of N
-with value {"Alden" and "Roland"} respectively; FN has no property
-but has the value "Roland H. Alden"; EMAIL has value and
-the properties WORK, PREF, and INTERNET.
-
-
-VCARD
- N
- F="Alden"
- G="Roland"
- FN="Roland H. Alden"
- ORG
- ORGNAME="AT&T"
- OUN="Versit Project Office"
- TITLE="Consultant"
- EMAIL="sf!rincon!ralden@alden.attmail.com"
- WORK
- PREF
- INTERNET
- EMAIL="ralden@sfgate.com"
- INTERNET
- EMAIL="242-2200"
- MCIMail
- LABEL="Roland H. Alden
- Suite 2208
- One Pine Street
- San Francisco, CA 94111"
- DOM
- POSTAL
- PARCEL
- HOME
- WORK
- QP
- LABEL="Roland H. Alden
- Suite 2208
- One Pine Street
- San Francisco, CA 94111
- U.S.A."
- POSTAL
- PARCEL
- HOME
- WORK
- QP
- TEL="+1 415 296 9106"
- WORK
- PREF
- MSG
- TEL="+1 415 296 9016"
- WORK
- FAX
- TEL="+1 415 608 5981"
- MSG
- CELL
- ADR
- EXT ADD="Suite 2208"
- STREET="One Pine Street"
- L="San Francisco"
- R="CA"
- PC="94111"
- C="U.S.A."
- SOUND="ROW-LAND H ALL-DIN"
- LOGO=[raw data]
- GIF
- BASE64
- DataSize=1482
-VCALENDAR
- DCREATED="19960523T100522"
- PRODID="-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN"
- VERSION="0.3"
- VEVENT
- START="19960523T120000"
- END="19960523T130000"
- SUBTYPE="PHONE CALL"
- SUMMARY="VERSIT PDI PR Teleconference/Interview"
- DESCRIPTION="VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland"
- VEVENT
- START="19960523T113000"
- END="19960523T115500"
- SUBTYPE="LUNCH"
- SUMMARY="Eat in the cafeteria today"
-
-5. Building A VObject Representation of A VCard/VCalendar
- ======================================================
-The parser in vcc.y converts an input file with one or more
-VCard/VCalendar that is in their textual representation
-into their corresponding VObject representation.
-
-VObject representation of a VCard/VCalendar can also be built
-directly with calls to the VObject building APIs. e.g.
-
- VObject *prop;
- VObject *vcard = newVObject(VCCardProp);
- prop = addProp(vcard,VCNameProp);
- addPropValue(prop,VCFamilyNameProp,"Alden");
- addPropValue(prop,VCGivenNameProp,"Roland");
- addPropValue(vcard,VCFullNameProp,"Roland H. Alden");
- ....
-
-6. Converting A VObject Representation Into Its Textual Representation
- ===================================================================
-The VObject representation can be converted back to its textual
-representation via the call to writeVObject() or writeMemVObject()
-API. e.g.
- a. to write to a file:
- // assume vcard is of type VObject
- FILE *fp = fopen("alden.vcf","w");
- writeVObject(fp,vcard);
- a. to write to memory, and let the API allocate the required memory.
- char* clipboard = writeVObject(0,0,vcard);
- ... do something to clipboard
- free(clipboard);
- b. to write to a user allocated buffer:
- char clipboard[16384];
- int len = 16384;
- char *buf = writeVObject(clipboard,&len,vcard);
- ... buf will be equal to clipboard if the write
- is successful otherwise 0.
-
-In the case of writing to memory, the memory buffer can be either
-allocated by the API or the user. If the user allocate the
-memory for the buffer, then the length of the buffer needs to be
-communicated to the API via a variable. The variable passed as
-the length argument will be overwritten with the actual size
-of the text output. A 0 return value from writeMemVObject()
-indicates an error which could be caused by overflowing the
-size of the buffer or lack of heap memory.
-
-7. Miscellaneous Notes On VObject APIs usages
- ==========================================
-a. vcc.h -- contains basic interfaces to the parser:
- VObject* Parse_MIME(const char *input, unsigned long len);
- VObject* Parse_MIME_FromFile(FILE *file);
- -- both of this return a null-terminated list of
- VObject that is either a VCARD or VCALENDAR.
- To iterate through this list, do
- VObject *t, *v;
- v = Parse_Mime_FromFile(fp);
- while (v) {
- // ... do something to v.
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
- note that call to cleanVObject will release
- resource used to represent the VObject.
-
-b. vobject.h -- contains basic interfaces to the VObject APIs.
- see the header for more details.
- The structure of VObject is purposely (hiddened) not exposed
- to the user. Every access has to be done via
- the APIs. This way, if we need to change the
- structure or implementation, the client need not
- recompile as long as the interfaces remain the
- same.
-
-c. values of a property is determined by the property definition
- itself. The vobject APIs does not attempt to enforce
- any of such definition. It is the consumer responsibility
- to know what value is expected from a property. e.g
- most properties have unicode string value, so to access
- the value of these type of properties, you will use
- the vObjectUStringZValue() to read the value and
- setVObjectUStringZValue() to set or modify the value.
- Refer to the VCard and VCalendar specifications for
- the definition of each property.
-
-d. properties name (id) are case incensitive.
-
-8. Brief descriptions of each APIs
- ===============================
- * the predefined properties' names (id) are listed under vobject.h
- each is of the form VC*Prop. e.g.
- #define VC7bitProp "7BIT"
- #define VCAAlarmProp "AALARM"
- ....
-
- * consumer of a VObject can only define pointers to VObject.
-
- * a variable of type VObjectIterator, say "i", can be used to iterate
- through a VObject's properties, say "o". The APIs related to
- VObjectIterator are:
- void initPropIterator(VObjectIterator *i, VObject *o);
- -- e.g. usage
- initPropIterator(&i,o);
- int moreIteration(VObjectIterator *i);
- -- e.g. usage
- while (moreIteration(&i)) { ... }
- VObject* nextVObject(VObjectIterator *i);
- -- e.g. usage
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- }
-
- * VObject can be chained together to form a list. e.g. of such
- use is in the parser where the return value of the parser is
- a link list of VObject. A link list of VObject can be
- built by:
- void addList(VObject **o, VObject *p);
- and iterated by
- VObject* nextVObjectInList(VObject *o);
- -- next VObjectInList return 0 if the list
- is exhausted.
-
- * the following APIs are mainly used to construct a VObject tree:
- VObject* newVObject(const char *id);
- -- used extensively internally by VObject APIs but when
- used externally, its use is mainly limited to the
- construction of top level object (e.g. an object
- with VCCardProp or VCCalendarProp id).
-
- void deleteVObject(VObject *p);
- -- to deallocate single VObject, for most user, use
- cleanVObject(VObject *o) instead for freeing all
- resources associated with the VObject.
-
- char* dupStr(const char *s, unsigned int size);
- -- duplicate a string s. If size is 0, the string is
- assume to be a null-terminated.
-
- void deleteStr(const char *p);
- -- used to deallocate a string allocated by dupStr();
-
- void setVObjectName(VObject *o, const char* id);
- -- set the id of VObject o. This function is not
- normally used by the user. The setting of id
- is normally done as part of other APIs (e.g.
- addProp()).
-
- void setVObjectStringZValue(VObject *o, const char *s);
- -- set a string value of a VObject.
-
- void setVObjectUStringZValue(VObject *o, const wchar_t *s);
- -- set a Unicode string value of a VObject.
-
- void setVObjectIntegerValue(VObject *o, unsigned int i);
- -- set an integer value of a VObject.
-
- void setVObjectLongValue(VObject *o, unsigned long l);
- -- set an long integer value of a VObject.
-
- void setVObjectAnyValue(VObject *o, void *t);
- -- set any value of a VObject. The value type is
- unspecified.
-
- VObject* setValueWithSize(VObject *prop, void *val, unsigned int size);
- -- set a raw data (stream of bytes) value of a VObject
- whose size is size. The internal VObject representation
- is
- this object = val
- VCDataSizeProp=size
- i.e. the value val will be attached to the VObject prop
- and a property of VCDataSize whose value is size
- is also added to the object.
-
- void setVObjectVObjectValue(VObject *o, VObject *p);
- -- set a VObject as the value of another VObject.
-
- const char* vObjectName(VObject *o);
- -- retrieve the VObject's Name (i.e. id).
-
- const char* vObjectStringZValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- null-terminated string.
-
- const wchar_t* vObjectUStringZValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- null-terminated unicode string.
-
- unsigned int vObjectIntegerValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- integer.
-
- unsigned long vObjectLongValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- long integer.
-
- void* vObjectAnyValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- any value.
-
- VObject* vObjectVObjectValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- a VObject.
-
- VObject* addVObjectProp(VObject *o, VObject *p);
- -- add a VObject p as a property of VObject o.
- (not normally used externally for building a
- VObject).
-
- VObject* addProp(VObject *o, const char *id);
- -- add a property whose name is id to VObject o.
-
- VObject* addPropValue(VObject *o, const char *id, const char *v);
- -- add a property whose name is id and whose value
- is a null-terminated string to VObject o.
-
- VObject* addPropSizedValue(VObject *o, const char *id,
- const char *v, unsigned int size);
- -- add a property whose name is id and whose value
- is a stream of bytes of size size, to VObject o.
-
- VObject* addGroup(VObject *o, const char *g);
- -- add a group g to VObject o.
- e.g. if g is a.b.c, you will have
- o
- c
- VCGroupingProp=b
- VCGroupingProp=a
- and the object c is returned.
-
- VObject* isAPropertyOf(VObject *o, const char *id);
- -- query if a property by the name id is in o and
- return the VObject that represent that property.
-
- void printVObject(VObject *o);
- -- pretty print VObject o to stdout (for debugging use).
-
- void writeVObject(FILE *fp, VObject *o);
- -- convert VObject o to its textual representation and
- write it to file.
-
- char* writeMemVObject(char *s, int *len, VObject *o);
- -- convert VObject o to its textual representation and
- write it to memory. If s is 0, then memory required
- to hold the textual representation will be allocated
- by this API. If a variable len is passed, len will
- be overwriten with the byte size of the textual
- representation. If s is non-zero, then s has to
- be a user allocated buffer whose size has be passed
- in len as a variable. Memory allocated by the API
- has to be freed with call to free. The return value
- of this API is either the user supplied buffer,
- the memory allocated by the API, or 0 (in case of
- failure).
-
- void cleanStrTbl();
- -- this function has to be called when all
- VObject has been destroyed.
-
- void cleanVObject(VObject *o);
- -- release all resources used by VObject o.
-
- wchar_t* fakeUnicode(const char *ps, int *bytes);
- -- convert char* to wchar_t*.
-
- extern int uStrLen(const wchar_t *u);
- -- length of unicode u.
-
- char *fakeCString(const wchar_t *u);
- -- convert wchar_t to CString (blindly assumes that
- this could be done).
-
-9. Additional Programming Notes
- ============================
-In the following notes, please refers to the listing
-of Example.vcf and its VObject Representation
-(shown at the end of this section).
-
-* Handling the Return Value of the VCard/VCalendar Parser
- The example input text file contains two root VObjects
- (a VCalendar and a VCard). The output of the VCard/VCalendar
- parser is a null-terminated list of VObjects. For this
- particular input file, the list will have two VObjects.
- The following shows a template for iterating through the
- output of the Parser:
-
- VObject *t, *v;
- v = Parse_Mime_fromFileName("example.vcf");
- while (v) {
- // currently, v will either be a VCard or a VCalendar
- // do whatever your application need to do to
- // v here ...
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
-
-* Iterating Through a VCard/VCalendar VObject
- From the VObject APIs point of view, a VCard VObject
- is the same as a VCalendar VObject. However, the application
- needs to know what are in a VCard or a VCalendar.
- For example, A VCalendar VObject can have VCDCreatedProp,
- a VCGEOLocationProp, etc, and one or more VCEventProp and
- or VCTodoProp. The VCEventProp and VCTodoProp can have
- many properties of their own, which in turn could have
- more properties (e.g. VCDAlarmProp can be a VCEventProp
- VObject's property, and VCRunTimeProp can be a
- VCDAlarmProp VObject's property. Because a VObject tree
- can be arbitrarily complex, in general, to process all
- properties and values of a VObject tree, a recursive walk
- is desirable. An example recursive VObject tree walk
- can be found in the vobject.c source lines for printVObject*
- and writeVObject* APIs. Depending on what the application need
- to do with a VCard or a VCalendar, a recursive walk
- of the VObject tree may or may not be desirable. An example
- template of a non-recursive walk is shown below:
-
- void processVCardVCalendar(char *inputFile)
- {
- VObject *t, *v;
- v = Parse_Mime_fromFileName(inputFile);
- while (v) {
- char *n = vObjectName(v);
- if (strcmp(n,VCCardProp) == 0) {
- do_VCard(v);
- }
- else if (strcmp(n,VCCalendarProp) == 0) {
- do_VCalendar(v);
- }
- else {
- // don't know how to handle anything else!
- }
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
- }
-
- void do_VCard(VObject *vcard)
- {
- VObjectIterator t;
- initPropIterator(&t,vcard);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- // The primarly purpose of this example is to
- // show how to iterate through a VCard VObject,
- // it is not meant to be efficient at all.
- char *n = vObjectName(eachProp);
- if (strcmp(n,VCNameProp)==0) {
- do_name(eachProp);
- }
- else if (strcmp(n,VCEmailProp)==0) {
- do_email(eachProp);
- }
- else if (strcmp(n,VCLabelProp)==0) {
- do_label(eachProp);
- }
- else if ....
- }
- }
-
- void do_VCalendar(VObject *vcal)
- {
- VObjectIterator t;
- initPropIterator(&t,vcard);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- // The primarly purpose of this example is to
- // show how to iterate through a VCalendar VObject,
- // it is not meant to be efficient at all.
- char *n = vObjectName(eachProp);
- if (strcmp(n,VCDCreatedProp)==0) {
- do_DCreated(eachProp);
- }
- else if (strcmp(n,VCVersionProp)==0) {
- do_Version(eachProp);
- }
- else if (strcmp(n,VCTodoProp)==0) {
- do_Todo(eachProp);
- }
- else if (strcmp(n,VCEventProp)==0) {
- do_Event(eachProp);
- }
- else if ....
- }
- }
-
- void do_Todo(VObject *vtodo) { ... }
-
- void do_Event(VObject *vevent) { ... }
-
- ...
-
-* Property's Values and Properties
- The VObject APIs do not attempt to check for the
- correctness of the values of a property. Nor do they
- will prevent the user from attaching a non-VCard/VCalendar
- standard property to a VCard/VCalendar property. Take
- the example of line [11] of the example, "O.K" is not
- a valid value of VCStatusProp. It is up to the application
- to accept or reject the value of a property.
-
-* Output of printVObject
- PrintVObject pretty prints a VObject tree in human
- readable form. See the listing at the end of the file
- for an example output of printVObject on the example
- input file "Example.vcf".
-
- Note that binary data are not shown in the output of
- printVObject. Instead, a note is made ([raw data]) to
- indicate that there exists such a binary data.
-
-* Note on Binary Data
- When the value of a property is a binary data, it is only
- useful to know the size of the binary data.
-
- In the case of the VCard/VCalendar parser, it chooses
- to represent the size information as a separate property
- called VCDataSizeProp whose value is the size of the binary
- data. The APIs sequence to construct the VObject subtree
- of line [44] of Example.vcf is
-
- // VObject *vcard;
- VObject *p1 = addProp(vcard,VCLogoProp);
- (void) addProp(p1,VCGIFProp);
- (void) addProp(p1,VCBASE64Prop);
- VObject *p2 = addProp(p1,VCDataSizeProp);
- (void) setVObjectLongValue(p2,1482);
- setVObjectAnyValue(vcard,...pointer to binary data);
-
- Note the presence of VCBase64Prop will cause the
- writeVObject API to output the binary data as BASE64 text.
- For VCard/VCalendar application, having the VCBase64Prop
- property is pratically always neccessary for property with
- binary data as its value.
-
-* Note on Quoted-Printable String
- String value with embedded newline are written out as
- quoted-prinatable string. It is therefore important
- to mark a property with a string value that has
- one or more embedded newlines, with the VCQutedPrintableProp
- property. e.g.
-
- // VObject *root;
- char *msg="To be\nor\nnot to be";
- VObject *p = addPropValue(root,VCDescriptionProp,msg);
- // the following is how you mark a property with
- // a property. In this case, the marker is
- // VCQuotedPrintableProp
- addProp(p,VCQuotedPrintableProp);
-
-* Note on Unicode
- Although, the current parser takes ASCII text file only,
- string values are all stored as Unicode in the VObject tree.
- For now, when using the VObject APIs to construct a
- VObject tree, one should always convert ASCII string value
- to a Unicode string value:
-
- // VObject *root;
- VObject *p = addProp(root,VCSomeProp);
- setVObjectUStringZValue(p,fakeUnicode(someASCIIStringZvalue));
-
- An API is provided to simplify the above process:
-
- addPropValue(root,VCSomeProp,someASCIIStringZValue);
-
- Note that someASCIISTringZValue is automatically converted to
- Unicode by addPropValue API, where as, the former code
- sequence do an explicit call to fakeUnicode.
-
- To read back the value, one should use the vObjectUStringZValue
- API not vObjectStringZValue API. The value returned by the
- vObjectUStringZValue API is a Unicode string. If the application
- do not know how to handle Unicode string, it can use the
- fakeCString API to convert it back to ASCII string (as long
- as the conversion is meaningful).
-
- Note that fakeCString return a heap allocated memory. It is
- important to call deleteStr on fakeCString return value if
- it is not longer required (or there will be memory leak).
-
- NOTE: Unfortunately, at the point when this document is written,
- there is still no consensus on how Unicode is to be handled
- in the textual representation of VCard/VCalendar. So, there
- is no version of writeVObject and the parser to output and
- input Unicode textual representation of VCard/VCalendar.
-
-
-Example.vcf
------------
-line
-number Input Text (example.vcf)
------- ----------
-1 BEGIN:VCALENDAR
-2 DCREATED:19961102T100522
-3 GEO:0,0
-4 VERSION:1.0
-5 BEGIN:VEVENT
-6 DTSTART:19961103T000000
-7 DTEND:20000101T000000
-8 DESCRIPTION;QUOTED-PRINTABLE:To be =0A=
-9 or =0A=
-10 not to be
-11 STATUS:O.K.
-12 X-ACTION:No action required
-13 DALARM:19961103T114500;5;3;Enjoy
-14 MALARM:19970101T120000;;;johny@nowhere.com;Call Mom.
-15 END:VEVENT
-16
-17 BEGIN:VTODO
-18 DUE:19960614T0173000
-19 DESCRIPTION:Relex.
-20 END:VTODO
-21
-22 END:VCALENDAR
-23
-24 BEGIN:VCARD
-25 N:Alden;Roland
-26 FN:Roland H. Alden
-27 ORG:AT&T;Versit Project Office
-28 TITLE:Consultant
-29 EMAIL;WORK;PREF;INTERNET:ralden@ralden.com
-30 LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-31 Suite 2208=0A=
-32 One Pine Street=0A=
-33 San Francisco, CA 94111
-34 LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-35 Suite 2208=0A=
-36 One Pine Street=0A=
-37 San Francisco, CA 94111=0A=
-38 U.S.A.
-39 TEL;WORK;PREF;MSG:+1 415 296 9106
-40 TEL;WORK;FAX:+1 415 296 9016
-41 TEL;MSG;CELL:+1 415 608 5981
-42 ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A.
-43 SOUND:ROW-LAND H ALL-DIN
-44 LOGO;GIF;BASE64:
-45 R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC
- ... 30 lines of BASE64 data not shown here.
-76 END:VCARD
-
-
-VObject Representation of Example.vcf:
--------------------------------------
-line
-in
-text
-file VObject Tree as Printed by printVObject API
----- -------------------------------------------
-1 VCALENDAR
-2 DCREATED="19961102T100522"
-3 GEO="0,0"
-4 VERSION="1.0"
-5 VEVENT
-6 DTSTART="19961103T000000"
-7 DTEND="20000101T000000"
-8 DESCRIPTION="To be
-9 or
-10 not to be"
-8 QUOTED-PRINTABLE
-11 STATUS="O.K."
-12 X-ACTION="No action required"
-13 DALARM
-13 RUNTIME="19961103T114500"
-13 SNOOZETIME="5"
-13 REPEATCOUNT="3"
-13 DISPLAYSTRING="Enjoy"
-14 MALARM
-14 RUNTIME="19970101T120000"
-14 EMAIL="johny@nowhere.com"
-14 NOTE="Call Mom"
-17 VTODO
-18 DUE="19960614T0173000"
-19 DESCRIPTION="Relex."
-24 VCARD
-25 N
-25 F="Alden"
-25 G="Roland"
-26 FN="Roland H. Alden"
-27 ORG
-27 ORGNAME="AT&T"
-27 OUN="Versit Project Office"
-28 TITLE="Consultant"
-29 EMAIL="ralden@alden.com"
-29 WORK
-29 PREF
-29 INTERNET
-30 LABEL="Roland H. Alden
-31 Suite 2208
-32 One Pine Street
-33 San Francisco, CA 94111"
-30 DOM
-30 POSTAL
-30 PARCEL
-30 HOME
-30 WORK
-30 QUOTED-PRINTABLE
-34 LABEL="Roland H. Alden
-35 Suite 2208
-36 One Pine Street
-37 San Francisco, CA 94111
-38 U.S.A."
-34 POSTAL
-34 PARCEL
-34 HOME
-34 WORK
-34 QUOTED-PRINTABLE
-39 TEL="+1 415 296 9106"
-39 WORK
-39 PREF
-39 MSG
-40 TEL="+1 415 296 9016"
-40 WORK
-40 FAX
-41 TEL="+1 415 608 5981"
-41 MSG
-41 CELL
-42 ADR
-42 EXT ADD="Suite 2208"
-42 STREET="One Pine Street"
-42 L="San Francisco"
-42 R="CA"
-42 PC="94111"
-42 C="U.S.A."
-43 SOUND="ROW-LAND H ALL-DIN"
-44 LOGO=[raw data]
-44 GIF
-44 BASE64
-44 DATASIZE=1482
-
diff --git a/libversit/port.h b/libversit/port.h
deleted file mode 100644
index 6dba3567fe..0000000000
--- a/libversit/port.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#ifndef __PORT_H__
-#define __PORT_H__ 1
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-// some of these #defines are commented out because
-// Visual C++ sets them on the compiler command line instead
-
-//#define _DEBUG
-//#define WIN32
-//#define WIN16
-//#define _WINDOWS
-//#define __MWERKS__
-//#define INCLUDEMFC
-
-#define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
-#define vCalendarClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCalendar"
-
-/* The above strings vCardClipboardFormat and vCalendarClipboardFormat
-are globally unique IDs which can be used to generate clipboard format
-ID's as per the requirements of a specific platform. For example, in
-Windows they are used as the parameter in a call to RegisterClipboardFormat.
-For example:
-
- CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
-
-*/
-
-#define vCardMimeType "text/x-vCard"
-#define vCalendarMimeType "text/x-vCalendar"
-
-#define DLLEXPORT(t) t
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#define stricmp strcasecmp
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif // __PORT_H__
diff --git a/libversit/vcaltest.c b/libversit/vcaltest.c
deleted file mode 100644
index 5528aab1d1..0000000000
--- a/libversit/vcaltest.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "vcaltmp.h"
-
-#if 0
-This testcase would generate a file call "frankcal.vcf" with
-the following content:
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-GEO:37.24,-17.87
-PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-DTSTART:19960523T120000
-DTEND:19960523T130000
-DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
-With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
-activities with European Press representatives.
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-SUBTYPE:PHONE CALL
-STATUS:CONFIRMED
-TRANSP:19960523T100522-4000F100582713-009251
-UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
-DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
-MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
-PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
-X-LDC-OR2-OLE:c:\temp\agenda.doc
-END:VEVENT
-
-BEGIN:VTODO
-DUE:19960614T0173000
-DESCRIPTION:Review VCalendar helper API.
-END:VTODO
-
-END:VCALENDAR
-
-#endif
-
-FILE *cfp;
-
-void testVcalAPIs() {
- FILE *fp;
- VObject *vcal, *vevent;
-#if _CONSOLE
- cfp = stdout;
-#else
- cfp = fopen("vcaltest.out","w");
-#endif
- if (cfp == 0) return;
- vcal = vcsCreateVCal(
- "19960523T100522",
- "37.24,-17.87",
- "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
- 0,
- "0.3"
- );
-
- vevent = vcsAddEvent(
- vcal,
- "19960523T120000",
- "19960523T130000",
- "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
- "VERSIT PDI PR Teleconference/Interview",
- "PHONE CALL",
- 0,
- "CONFIRMED",
- "19960523T100522-4000F100582713-009251",
- "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
- 0
- );
-
- vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
- "Your Telecon Starts At Noon!!!");
- vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
- "Remember 05/23 Noon Telecon!!!");
- vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
- "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
-
- addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
-
- vcsAddTodo(
- vcal,
- 0,
- "19960614T0173000",
- 0,
- "Review VCalendar helper API.",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- );
-
- /* now do something to the resulting VObject */
- /* pretty print on stdout for fun */
- printVObject(cfp,vcal);
- /* open the output text file */
-
-#define OUTFILE "frankcal.vcf"
-
- fp = fopen(OUTFILE, "w");
- if (fp) {
- /* write it in text form */
- writeVObject(fp,vcal);
- fclose(fp);
- }
- else {
- fprintf(cfp,"open output file '%s' failed\n", OUTFILE);
- }
- if (cfp != stdout) fclose(cfp);
- }
-
-void main() {
- testVcalAPIs();
- }
-
diff --git a/libversit/vcaltmp.c b/libversit/vcaltmp.c
deleted file mode 100644
index bd79e27975..0000000000
--- a/libversit/vcaltmp.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
-This module provides some helper APIs for creating
-a VCalendar object.
-
-Note on APIs:
- 1. The APIs does not attempt to verify if the arguments
- passed are correct.
- 2. Where the argument to an API is not applicable, pass
- the value 0.
- 3. See the test program at the bottom of this file as an
- example of usage.
- 4. This code calls APIs in vobject.c.
-
-*/
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-
-#include <stdio.h>
-#include <string.h>
-#include "vcaltmp.h"
-
-
-DLLEXPORT(VObject*) vcsCreateVCal(
- char *date_created,
- char *location,
- char *product_id,
- char *time_zone,
- char *version
- )
- {
- VObject *vcal = newVObject(VCCalProp);
-#define Z(p,v) if (v) addPropValue(vcal,p,v);
- Z(VCDCreatedProp, date_created);
- Z(VCLocationProp, location)
- Z(VCProdIdProp, product_id)
- Z(VCTimeZoneProp, time_zone)
- Z(VCVersionProp, version)
-#undef Z
- return vcal;
- }
-
-
-DLLEXPORT(VObject*) vcsAddEvent(
- VObject *vcal,
- char *start_date_time,
- char *end_date_time,
- char *description,
- char *summary,
- char *categories,
- char *classification,
- char *status,
- char *transparency,
- char *uid,
- char *url
- )
- {
- VObject *vevent = addProp(vcal,VCEventProp);
-#define Z(p,v) if (v) addPropValue(vevent,p,v);
- Z(VCDTstartProp,start_date_time);
- Z(VCDTendProp,end_date_time);
- if (description) {
- VObject *p = addPropValue(vevent,VCDescriptionProp,description);
- if (strchr(description,'\n'))
- addProp(p,VCQuotedPrintableProp);
- }
- Z(VCSummaryProp,summary);
- Z(VCCategoriesProp,categories);
- Z(VCClassProp,classification);
- Z(VCStatusProp,status);
- Z(VCTranspProp,transparency);
- Z(VCUniqueStringProp,uid);
- Z(VCURLProp,url);
-#undef Z
- return vevent;
- }
-
-
-DLLEXPORT(VObject*) vcsAddTodo(
- VObject *vcal,
- char *start_date_time,
- char *due_date_time,
- char *date_time_complete,
- char *description,
- char *summary,
- char *priority,
- char *classification,
- char *status,
- char *uid,
- char *url
- )
- {
- VObject *vtodo = addProp(vcal,VCTodoProp);
-#define Z(p,v) if (v) addPropValue(vtodo,p,v);
- Z(VCDTstartProp,start_date_time);
- Z(VCDueProp,due_date_time);
- Z(VCCompletedProp,date_time_complete);
- if (description) {
- VObject *p = addPropValue(vtodo,VCDescriptionProp,description);
- if (strchr(description,'\n'))
- addProp(p,VCQuotedPrintableProp);
- }
- Z(VCSummaryProp,summary);
- Z(VCPriorityProp,priority);
- Z(VCClassProp,classification);
- Z(VCStatusProp,status);
- Z(VCUniqueStringProp,uid);
- Z(VCURLProp,url);
-#undef Z
- return vtodo;
- }
-
-
-DLLEXPORT(VObject*) vcsAddAAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *audio_content
- )
- {
- VObject *aalarm= addProp(vevent,VCAAlarmProp);
-#define Z(p,v) if (v) addPropValue(aalarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCAudioContentProp,audio_content);
-#undef Z
- return aalarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddMAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *email_address,
- char *note
- )
- {
- VObject *malarm= addProp(vevent,VCMAlarmProp);
-#define Z(p,v) if (v) addPropValue(malarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCEmailAddressProp,email_address);
- Z(VCNoteProp,note);
-#undef Z
- return malarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddDAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *display_string
- )
- {
- VObject *dalarm= addProp(vevent,VCDAlarmProp);
-#define Z(p,v) if (v) addPropValue(dalarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCDisplayStringProp,display_string);
-#undef Z
- return dalarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddPAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *procedure_name
- )
- {
- VObject *palarm= addProp(vevent,VCPAlarmProp);
-#define Z(p,v) if (v) addPropValue(palarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCProcedureNameProp,procedure_name);
-#undef Z
- return palarm;
- }
-
-
-#ifdef _TEST
-
-#if 0
-This testcase would generate a file call "frankcal.vcf" with
-the following content:
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-GEO:37.24,-17.87
-PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-DTSTART:19960523T120000
-DTEND:19960523T130000
-DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
-With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
-activities with European Press representatives.
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-CATEGORIES:PHONE CALL
-STATUS:CONFIRMED
-TRANSP:19960523T100522-4000F100582713-009251
-UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
-DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
-MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
-PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
-X-LDC-OR2-OLE:c:\temp\agenda.doc
-END:VEVENT
-
-BEGIN:VTODO
-DUE:19960614T0173000
-DESCRIPTION:Review VCalendar helper API.
-END:VTODO
-
-END:VCALENDAR
-
-#endif
-
-void testVcalAPIs() {
- FILE *fp;
- VObject *vcal = vcsCreateVCal(
- "19960523T100522",
- "37.24,-17.87",
- "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
- 0,
- "0.3"
- );
-
- VObject *vevent = vcsAddEvent(
- vcal,
- "19960523T120000",
- "19960523T130000",
- "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
- "VERSIT PDI PR Teleconference/Interview",
- "PHONE CALL",
- 0,
- "CONFIRMED",
- "19960523T100522-4000F100582713-009251",
- "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
- 0
- );
-
- vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
- "Your Telecon Starts At Noon!!!");
- vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
- "Remember 05/23 Noon Telecon!!!");
- vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
- "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
-
- addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
-
- vcsAddTodo(
- vcal,
- 0,
- "19960614T0173000",
- 0,
- "Review VCalendar helper API.",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- );
-
- /* now do something to the resulting VObject */
- /* pretty print on stdout for fun */
- printVObject(vcal);
- /* open the output text file */
-
-#define OUTFILE "frankcal.vcf"
-
- fp = fopen(OUTFILE, "w");
- if (fp) {
- /* write it in text form */
- writeVObject(fp,vcal);
- fclose(fp);
- }
- else {
- printf("open output file '%s' failed\n", OUTFILE);
- }
- }
-
-void main() {
- testVcalAPIs();
- }
-
-#endif
-
-
-// end of source file vcaltmp.c
diff --git a/libversit/vcaltmp.h b/libversit/vcaltmp.h
deleted file mode 100644
index 4c4afde963..0000000000
--- a/libversit/vcaltmp.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#include "vcc.h"
-
-#ifndef __VCALTMP_H__
-#define __VCALTMP_H__
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-extern DLLEXPORT(VObject*) vcsCreateVCal(
- char *date_created,
- char *location,
- char *product_id,
- char *time_zone,
- char *version
- );
-
-extern DLLEXPORT(VObject*) vcsAddEvent(
- VObject *vcal,
- char *start_date_time,
- char *end_date_time,
- char *description,
- char *summary,
- char *categories,
- char *classification,
- char *status,
- char *transparency,
- char *uid,
- char *url
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddTodo(
- VObject *vcal,
- char *start_date_time,
- char *due_date_time,
- char *date_time_complete,
- char *description,
- char *summary,
- char *priority,
- char *classification,
- char *status,
- char *uid,
- char *url
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddAAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *audio_content
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddMAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *email_address,
- char *note
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddDAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *display_string
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddPAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *procedure_name
- );
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VCALTMP_H__ */
-
-
diff --git a/libversit/vcc.c b/libversit/vcc.c
deleted file mode 100644
index 02ab47cb8e..0000000000
--- a/libversit/vcc.c
+++ /dev/null
@@ -1,2071 +0,0 @@
-
-/* A Bison parser, made from vcc.y
- by GNU Bison version 1.25
- */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#define EQ 258
-#define COLON 259
-#define DOT 260
-#define SEMICOLON 261
-#define SPACE 262
-#define HTAB 263
-#define LINESEP 264
-#define NEWLINE 265
-#define BEGIN_VCARD 266
-#define END_VCARD 267
-#define BEGIN_VCAL 268
-#define END_VCAL 269
-#define BEGIN_VEVENT 270
-#define END_VEVENT 271
-#define BEGIN_VTODO 272
-#define END_VTODO 273
-#define ID 274
-#define STRING 275
-
-#line 1 "vcc.y"
-
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vcc.c
- * doc: Parser for vCard and vCalendar. Note that this code is
- * generated by a yacc parser generator. Generally it should not
- * be edited by hand. The real source is vcc.y. The #line directives
- * can be commented out here to make it easier to trace through
- * in a debugger. However, if a bug is found it should
- * be fixed in vcc.y and this file regenerated.
- */
-
-
-/* debugging utilities */
-#if __DEBUG
-#define DBG_(x) printf x
-#else
-#define DBG_(x)
-#endif
-
-/**** External Functions ****/
-
-/* assign local name to parser variables and functions so that
- we can use more than one yacc based parser.
-*/
-
-#define yyparse mime_parse
-#define yylex mime_lex
-#define yyerror mime_error
-#define yychar mime_char
-/* #define p_yyval p_mime_val */
-#undef yyval
-#define yyval mime_yyval
-/* #define p_yylval p_mime_lval */
-#undef yylval
-#define yylval mime_yylval
-#define yydebug mime_debug
-#define yynerrs mime_nerrs
-#define yyerrflag mime_errflag
-#define yyss mime_ss
-#define yyssp mime_ssp
-#define yyvs mime_vs
-#define yyvsp mime_vsp
-#define yylhs mime_lhs
-#define yylen mime_len
-#define yydefred mime_defred
-#define yydgoto mime_dgoto
-#define yysindex mime_sindex
-#define yyrindex mime_rindex
-#define yygindex mime_gindex
-#define yytable mime_table
-#define yycheck mime_check
-#define yyname mime_name
-#define yyrule mime_rule
-#define YYPREFIX "mime_"
-
-
-#ifndef _NO_LINE_FOLDING
-#define _SUPPORT_LINE_FOLDING 1
-#endif
-
-/* undef below if compile with MFC */
-/* #define INCLUDEMFC 1 */
-
-#if defined(WIN32) || defined(_WIN32)
-#ifdef INCLUDEMFC
-#include <afx.h>
-#endif
-#endif
-
-#include <string.h>
-#ifndef __MWERKS__
-#include <malloc.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vcc.h"
-
-/**** Types, Constants ****/
-
-#define YYDEBUG 0 /* 1 to compile in some debugging code */
-#define MAXTOKEN 256 /* maximum token (line) length */
-#define YYSTACKSIZE 50 // ~unref ?
-#define MAXLEVEL 10 /* max # of nested objects parseable */
- /* (includes outermost) */
-
-
-/**** Global Variables ****/
-int mime_lineNum, mime_numErrors; /* yyerror() can use these */
-static VObject* vObjList;
-static VObject *curProp;
-static VObject *curObj;
-static VObject* ObjStack[MAXLEVEL];
-static int ObjStackTop;
-
-
-/* A helpful utility for the rest of the app. */
-#if __CPLUSPLUS__
-extern "C" {
-#endif
-
- extern void Parse_Debug(const char *s);
- extern void yyerror(char *s);
-
-#if __CPLUSPLUS__
- };
-#endif
-
-int yyparse();
-
-enum LexMode {
- L_NORMAL,
- L_VCARD,
- L_VCAL,
- L_VEVENT,
- L_VTODO,
- L_VALUES,
- L_BASE64,
- L_QUOTED_PRINTABLE
- };
-
-/**** Private Forward Declarations ****/
-static int pushVObject(const char *prop);
-static VObject* popVObject();
-static char* lexDataFromBase64();
-static void lexPopMode(int top);
-static int lexWithinMode(enum LexMode mode);
-static void lexPushMode(enum LexMode mode);
-static void enterProps(const char *s);
-static void enterAttr(const char *s1, const char *s2);
-static void enterValues(const char *value);
-static void mime_error_(char *s);
-
-
-#line 179 "vcc.y"
-typedef union {
- char *str;
- VObject *vobj;
- } YYSTYPE;
-#include <stdio.h>
-
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
-#endif
-#endif
-
-
-
-#define YYFINAL 62
-#define YYFLAG -32768
-#define YYNTBASE 21
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 51)
-
-static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20
-};
-
-#if YYDEBUG != 0
-static const short yyprhs[] = { 0,
- 0, 2, 3, 7, 9, 11, 13, 14, 19, 20,
- 24, 27, 29, 30, 36, 38, 39, 43, 45, 48,
- 50, 53, 55, 59, 61, 62, 67, 69, 71, 72,
- 73, 78, 79, 83, 86, 88, 90, 92, 94, 95,
- 100, 101, 105, 106, 111, 112
-};
-
-static const short yyrhs[] = { 22,
- 0, 0, 24, 23, 22, 0, 24, 0, 25, 0,
- 40, 0, 0, 11, 26, 28, 12, 0, 0, 11,
- 27, 12, 0, 29, 28, 0, 29, 0, 0, 31,
- 4, 30, 37, 9, 0, 1, 0, 0, 36, 32,
- 33, 0, 36, 0, 34, 33, 0, 34, 0, 6,
- 35, 0, 36, 0, 36, 3, 36, 0, 19, 0,
- 0, 39, 6, 38, 37, 0, 39, 0, 20, 0,
- 0, 0, 13, 41, 43, 14, 0, 0, 13, 42,
- 14, 0, 44, 43, 0, 44, 0, 45, 0, 48,
- 0, 28, 0, 0, 15, 46, 28, 16, 0, 0,
- 15, 47, 16, 0, 0, 17, 49, 28, 18, 0,
- 0, 17, 50, 18, 0
-};
-
-#endif
-
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
- 207, 210, 213, 213, 217, 218, 221, 227, 232, 238,
- 244, 245, 248, 252, 258, 261, 266, 266, 272, 273,
- 276, 279, 283, 290, 293, 294, 294, 298, 299, 303,
- 307, 309, 312, 315, 316, 319, 321, 322, 325, 332,
- 337, 343, 349, 356, 361, 367
-};
-#endif
-
-
-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
-
-static const char * const yytname[] = { "$","error","$undefined.","EQ","COLON",
-"DOT","SEMICOLON","SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD",
-"BEGIN_VCAL","END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO",
-"ID","STRING","mime","vobjects","@1","vobject","vcard","@2","@3","items","item",
-"@4","prop","@5","attr_params","attr_param","attr","name","values","@6","value",
-"vcal","@7","@8","calitems","calitem","eventitem","@9","@10","todoitem","@11",
-"@12", NULL
-};
-#endif
-
-static const short yyr1[] = { 0,
- 21, 23, 22, 22, 24, 24, 26, 25, 27, 25,
- 28, 28, 30, 29, 29, 32, 31, 31, 33, 33,
- 34, 35, 35, 36, 38, 37, 37, 39, 39, 41,
- 40, 42, 40, 43, 43, 44, 44, 44, 46, 45,
- 47, 45, 49, 48, 50, 48
-};
-
-static const short yyr2[] = { 0,
- 1, 0, 3, 1, 1, 1, 0, 4, 0, 3,
- 2, 1, 0, 5, 1, 0, 3, 1, 2, 1,
- 2, 1, 3, 1, 0, 4, 1, 1, 0, 0,
- 4, 0, 3, 2, 1, 1, 1, 1, 0, 4,
- 0, 3, 0, 4, 0, 3
-};
-
-static const short yydefact[] = { 0,
- 7, 30, 1, 2, 5, 6, 0, 0, 0, 0,
- 0, 15, 24, 0, 0, 0, 16, 10, 39, 43,
- 38, 0, 0, 36, 37, 33, 3, 8, 11, 13,
- 0, 0, 0, 0, 0, 31, 34, 29, 0, 17,
- 20, 0, 42, 0, 46, 28, 0, 27, 21, 22,
- 19, 40, 44, 14, 25, 0, 29, 23, 26, 0,
- 0, 0
-};
-
-static const short yydefgoto[] = { 60,
- 3, 11, 4, 5, 7, 8, 21, 15, 38, 16,
- 31, 40, 41, 49, 17, 47, 57, 48, 6, 9,
- 10, 22, 23, 24, 32, 33, 25, 34, 35
-};
-
-static const short yypact[] = { -9,
- -6, -5,-32768, 7,-32768,-32768, 2, -1, 19, 15,
- -9,-32768,-32768, 1, 0, 26, 27,-32768, 16, 17,
--32768, 23, 9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 33, 2, 24, 2, 25,-32768,-32768, 13, 22,-32768,
- 33, 28,-32768, 29,-32768,-32768, 36, 40,-32768, 39,
--32768,-32768,-32768,-32768,-32768, 22, 13,-32768,-32768, 48,
- 49,-32768
-};
-
-static const short yypgoto[] = {-32768,
- 41,-32768,-32768,-32768,-32768,-32768, -7,-32768,-32768,-32768,
--32768, 10,-32768,-32768, -34, -4,-32768,-32768,-32768,-32768,
--32768, 31,-32768,-32768,-32768,-32768,-32768,-32768,-32768
-};
-
-
-#define YYLAST 54
-
-
-static const short yytable[] = { 14,
- 12, 1, 12, 2, 50, -9, -4, 29, -32, 12,
- 18, -12, 28, -12, -12, -12, -12, -12, 13, 12,
- 13, 58, -35, 19, 42, 20, 44, 13, 26, 30,
- -18, -41, 46, 19, -45, 20, 36, 13, 39, 43,
- 13, 56, 45, 52, 54, 55, 53, 61, 62, 0,
- 51, 27, 59, 37
-};
-
-static const short yycheck[] = { 7,
- 1, 11, 1, 13, 39, 12, 0, 15, 14, 1,
- 12, 12, 12, 14, 15, 16, 17, 18, 19, 1,
- 19, 56, 14, 15, 32, 17, 34, 19, 14, 4,
- 4, 16, 20, 15, 18, 17, 14, 19, 6, 16,
- 19, 3, 18, 16, 9, 6, 18, 0, 0, -1,
- 41, 11, 57, 23
-};
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/lib/bison.simple"
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT return(0)
-#define YYABORT return(1)
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval)
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-int yyparse (void);
-#endif
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, int count)
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-
-#line 196 "/usr/lib/bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-
- switch (yyn) {
-
-case 2:
-#line 211 "vcc.y"
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
- break;}
-case 4:
-#line 214 "vcc.y"
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
- break;}
-case 7:
-#line 223 "vcc.y"
-{
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- ;
- break;}
-case 8:
-#line 228 "vcc.y"
-{
- lexPopMode(0);
- yyval.vobj = popVObject();
- ;
- break;}
-case 9:
-#line 233 "vcc.y"
-{
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- ;
- break;}
-case 10:
-#line 238 "vcc.y"
-{
- lexPopMode(0);
- yyval.vobj = popVObject();
- ;
- break;}
-case 13:
-#line 249 "vcc.y"
-{
- lexPushMode(L_VALUES);
- ;
- break;}
-case 14:
-#line 253 "vcc.y"
-{
- if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
- lexPopMode(0);
- lexPopMode(0);
- ;
- break;}
-case 16:
-#line 262 "vcc.y"
-{
- enterProps(yyvsp[0].str);
- ;
- break;}
-case 18:
-#line 267 "vcc.y"
-{
- enterProps(yyvsp[0].str);
- ;
- break;}
-case 22:
-#line 280 "vcc.y"
-{
- enterAttr(yyvsp[0].str,0);
- ;
- break;}
-case 23:
-#line 284 "vcc.y"
-{
- enterAttr(yyvsp[-2].str,yyvsp[0].str);
-
- ;
- break;}
-case 25:
-#line 293 "vcc.y"
-{ enterValues(yyvsp[-1].str); ;
- break;}
-case 27:
-#line 295 "vcc.y"
-{ enterValues(yyvsp[0].str); ;
- break;}
-case 29:
-#line 300 "vcc.y"
-{ yyval.str = 0; ;
- break;}
-case 30:
-#line 305 "vcc.y"
-{ if (!pushVObject(VCCalProp)) YYERROR; ;
- break;}
-case 31:
-#line 308 "vcc.y"
-{ yyval.vobj = popVObject(); ;
- break;}
-case 32:
-#line 310 "vcc.y"
-{ if (!pushVObject(VCCalProp)) YYERROR; ;
- break;}
-case 33:
-#line 312 "vcc.y"
-{ yyval.vobj = popVObject(); ;
- break;}
-case 39:
-#line 327 "vcc.y"
-{
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- ;
- break;}
-case 40:
-#line 333 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 41:
-#line 338 "vcc.y"
-{
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- ;
- break;}
-case 42:
-#line 343 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 43:
-#line 351 "vcc.y"
-{
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- ;
- break;}
-case 44:
-#line 357 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 45:
-#line 362 "vcc.y"
-{
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- ;
- break;}
-case 46:
-#line 367 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-}
- /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/lib/bison.simple"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-}
-#line 373 "vcc.y"
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static int pushVObject(const char *prop)
- {
- VObject *newObj;
- if (ObjStackTop == MAXLEVEL)
- return FALSE;
-
- ObjStack[++ObjStackTop] = curObj;
-
- if (curObj) {
- newObj = addProp(curObj,prop);
- curObj = newObj;
- }
- else
- curObj = newVObject(prop);
-
- return TRUE;
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This pops the recently built vCard off the stack and returns it. */
-static VObject* popVObject()
- {
- VObject *oldObj;
- if (ObjStackTop < 0) {
- yyerror("pop on empty Object Stack\n");
- return 0;
- }
- oldObj = curObj;
- curObj = ObjStack[ObjStackTop--];
-
- return oldObj;
- }
-
-
-static void enterValues(const char *value)
- {
- if (fieldedProp && *fieldedProp) {
- if (value) {
- addPropValue(curProp,*fieldedProp,value);
- }
- /* else this field is empty, advance to next field */
- fieldedProp++;
- }
- else {
- if (value) {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
- }
- }
- deleteStr(value);
- }
-
-static void enterProps(const char *s)
- {
- curProp = addGroup(curObj,s);
- deleteStr(s);
- }
-
-static void enterAttr(const char *s1, const char *s2)
- {
- const char *p1, *p2;
- p1 = lookupProp_(s1);
- if (s2) {
- VObject *a;
- p2 = lookupProp_(s2);
- a = addProp(curProp,p1);
- setVObjectStringZValue(a,p2);
- }
- else
- addProp(curProp,p1);
- if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
- lexPushMode(L_BASE64);
- else if (stricmp(p1,VCQuotedPrintableProp) == 0
- || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
- lexPushMode(L_QUOTED_PRINTABLE);
- deleteStr(s1); deleteStr(s2);
- }
-
-
-#define MAX_LEX_LOOKAHEAD_0 32
-#define MAX_LEX_LOOKAHEAD 64
-#define MAX_LEX_MODE_STACK_SIZE 10
-#define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop])
-
-struct LexBuf {
- /* input */
-#ifdef INCLUDEMFC
- CFile *inputFile;
-#else
- FILE *inputFile;
-#endif
- char *inputString;
- unsigned long curPos;
- unsigned long inputLen;
- /* lookahead buffer */
- /* -- lookahead buffer is short instead of char so that EOF
- / can be represented correctly.
- */
- unsigned long len;
- short buf[MAX_LEX_LOOKAHEAD];
- unsigned long getPtr;
- /* context stack */
- unsigned long lexModeStackTop;
- enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE];
- /* token buffer */
- unsigned long maxToken;
- char *strs;
- unsigned long strsLen;
- } lexBuf;
-
-static void lexPushMode(enum LexMode mode)
- {
- if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1))
- yyerror("lexical context stack overflow");
- else {
- lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode;
- }
- }
-
-static void lexPopMode(int top)
- {
- /* special case of pop for ease of error recovery -- this
- version will never underflow */
- if (top)
- lexBuf.lexModeStackTop = 0;
- else
- if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--;
- }
-
-static int lexWithinMode(enum LexMode mode) {
- unsigned long i;
- for (i=0;i<lexBuf.lexModeStackTop;i++)
- if (mode == lexBuf.lexModeStack[i]) return 1;
- return 0;
- }
-
-static char lexGetc_()
- {
- /* get next char from input, no buffering. */
- if (lexBuf.curPos == lexBuf.inputLen)
- return EOF;
- else if (lexBuf.inputString)
- return *(lexBuf.inputString + lexBuf.curPos++);
- else {
-#ifdef INCLUDEMFC
- char result;
- return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
-#else
- return fgetc(lexBuf.inputFile);
-#endif
- }
- }
-
-static int lexGeta()
- {
- ++lexBuf.len;
- return (lexBuf.buf[lexBuf.getPtr] = lexGetc_());
- }
-
-static int lexGeta_(int i)
- {
- ++lexBuf.len;
- return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_());
- }
-
-static void lexSkipLookahead() {
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* don't skip EOF. */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- }
-
-static int lexLookahead() {
- int c = (lexBuf.len)?
- lexBuf.buf[lexBuf.getPtr]:
- lexGeta();
- /* do the \r\n -> \n or \r -> \n translation here */
- if (c == '\r') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]:
- lexGeta_(1);
- if (a == '\n') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = c = '\n';
- }
- else if (c == '\n') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[lexBuf.getPtr+1]:
- lexGeta_(1);
- if (a == '\r') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = '\n';
- }
- return c;
- }
-
-static int lexGetc() {
- int c = lexLookahead();
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* EOF will remain in lookahead buffer */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- return c;
- }
-
-static void lexSkipLookaheadWord() {
- if (lexBuf.strsLen <= lexBuf.len) {
- lexBuf.len -= lexBuf.strsLen;
- lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD;
- }
- }
-
-static void lexClearToken()
- {
- lexBuf.strsLen = 0;
- }
-
-static void lexAppendc(int c)
- {
- lexBuf.strs[lexBuf.strsLen] = c;
- /* append up to zero termination */
- if (c == 0) return;
- lexBuf.strsLen++;
- if (lexBuf.strsLen > lexBuf.maxToken) {
- /* double the token string size */
- lexBuf.maxToken <<= 1;
- lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken);
- }
- }
-
-static char* lexStr() {
- return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1);
- }
-
-static void lexSkipWhite() {
- int c = lexLookahead();
- while (c == ' ' || c == '\t') {
- lexSkipLookahead();
- c = lexLookahead();
- }
- }
-
-static char* lexGetWord() {
- int c;
- lexSkipWhite();
- lexClearToken();
- c = lexLookahead();
- while (c != EOF && !strchr("\t\n ;:=",c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return lexStr();
- }
-
-static void lexPushLookahead(char *s, int len) {
- int putptr;
- if (len == 0) len = strlen(s);
- putptr = (int)lexBuf.getPtr - len;
- /* this function assumes that length of word to push back
- / is not greater than MAX_LEX_LOOKAHEAD.
- */
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- while (*s) {
- lexBuf.buf[putptr] = *s++;
- putptr = (putptr + 1) % MAX_LEX_LOOKAHEAD;
- }
- lexBuf.len += len;
- }
-
-static void lexPushLookaheadc(int c) {
- int putptr;
- /* can't putback EOF, because it never leaves lookahead buffer */
- if (c == EOF) return;
- putptr = (int)lexBuf.getPtr - 1;
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- lexBuf.buf[putptr] = c;
- lexBuf.len += 1;
- }
-
-static char* lexLookaheadWord() {
- /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0
- / and thing bigger than that will stop the lookahead and return 0;
- / leading white spaces are not recoverable.
- */
- int c;
- int len = 0;
- int curgetptr = 0;
- lexSkipWhite();
- lexClearToken();
- curgetptr = (int)lexBuf.getPtr; // remember!
- while (len < (MAX_LEX_LOOKAHEAD_0)) {
- c = lexGetc();
- len++;
- if (c == EOF || strchr("\t\n ;:=", c)) {
- lexAppendc(0);
- /* restore lookahead buf. */
- lexBuf.len += len;
- lexBuf.getPtr = curgetptr;
- return lexStr();
- }
- else
- lexAppendc(c);
- }
- lexBuf.len += len; /* char that has been moved to lookahead buffer */
- lexBuf.getPtr = curgetptr;
- return 0;
- }
-
-#ifdef _SUPPORT_LINE_FOLDING
-static void handleMoreRFC822LineBreak(int c) {
- /* suport RFC 822 line break in cases like
- * ADR: foo;
- * morefoo;
- * more foo;
- */
- if (c == ';') {
- int a;
- lexSkipLookahead();
- /* skip white spaces */
- a = lexLookahead();
- while (a == ' ' || a == '\t') {
- lexSkipLookahead();
- a = lexLookahead();
- }
- if (a == '\n') {
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- /* continuation, throw away all the \n and spaces read so
- * far
- */
- lexSkipWhite();
- lexPushLookaheadc(';');
- }
- else {
- lexPushLookaheadc('\n');
- lexPushLookaheadc(';');
- }
- }
- else {
- lexPushLookaheadc(';');
- }
- }
- }
-
-static char* lexGet1Value() {
- int size = 0;
- int c;
- lexSkipWhite();
- c = lexLookahead();
- lexClearToken();
- while (c != EOF && c != ';') {
- if (c == '\n') {
- int a;
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- lexAppendc(' ');
- lexSkipLookahead();
- }
- else {
- lexPushLookaheadc('\n');
- break;
- }
- }
- else {
- lexAppendc(c);
- lexSkipLookahead();
- }
- c = lexLookahead();
- }
- lexAppendc(0);
- handleMoreRFC822LineBreak(c);
- return c==EOF?0:lexStr();
- }
-#endif
-
-static char* lexGetStrUntil(char *termset) {
- int size = 0;
- int c = lexLookahead();
- lexClearToken();
- while (c != EOF && !strchr(termset,c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return c==EOF?0:lexStr();
- }
-
-static int match_begin_name(int end) {
- char *n = lexLookaheadWord();
- int token = ID;
- if (n) {
- if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
- else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
- else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
- else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
- deleteStr(n);
- return token;
- }
- return 0;
- }
-
-
-#ifdef INCLUDEMFC
-void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
-#else
-void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
-#endif
- {
- // initialize lex mode stack
- lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL;
-
- // iniatialize lex buffer.
- lexBuf.inputString = (char*) inputstring;
- lexBuf.inputLen = inputlen;
- lexBuf.curPos = 0;
- lexBuf.inputFile = inputfile;
-
- lexBuf.len = 0;
- lexBuf.getPtr = 0;
-
- lexBuf.maxToken = MAXTOKEN;
- lexBuf.strs = (char*)malloc(MAXTOKEN);
- lexBuf.strsLen = 0;
-
- }
-
-static void finiLex() {
- free(lexBuf.strs);
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This parses and converts the base64 format for binary encoding into
- * a decoded buffer (allocated with new). See RFC 1521.
- */
-static char * lexGetDataFromBase64()
- {
- unsigned long bytesLen = 0, bytesMax = 0;
- int quadIx = 0, pad = 0;
- unsigned long trip = 0;
- unsigned char b;
- int c;
- unsigned char *bytes = NULL;
- unsigned char *oldBytes = NULL;
-
- DBG_(("db: lexGetDataFromBase64\n"));
- while (1) {
- c = lexGetc();
- if (c == '\n') {
- ++mime_lineNum;
- if (lexLookahead() == '\n') {
- /* a '\n' character by itself means end of data */
- break;
- }
- else continue; /* ignore '\n' */
- }
- else {
- if ((c >= 'A') && (c <= 'Z'))
- b = (unsigned char)(c - 'A');
- else if ((c >= 'a') && (c <= 'z'))
- b = (unsigned char)(c - 'a') + 26;
- else if ((c >= '0') && (c <= '9'))
- b = (unsigned char)(c - '0') + 52;
- else if (c == '+')
- b = 62;
- else if (c == '/')
- b = 63;
- else if (c == '=') {
- b = 0;
- pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
- } else { /* error condition */
- if (bytes) free(bytes);
- else if (oldBytes) free(oldBytes);
- // error recovery: skip until 2 adjacent newlines.
- DBG_(("db: invalid character 0x%x '%c'\n", c,c));
- if (c != EOF) {
- c = lexGetc();
- while (c != EOF) {
- if (c == '\n' && lexLookahead() == '\n') {
- ++mime_lineNum;
- break;
- }
- c = lexGetc();
- }
- }
- return NULL;
- }
- trip = (trip << 6) | b;
- if (++quadIx == 4) {
- unsigned char outBytes[3];
- int numOut;
- int i;
- for (i = 0; i < 3; i++) {
- outBytes[2-i] = (unsigned char)(trip & 0xFF);
- trip >>= 8;
- }
- numOut = 3 - pad;
- if (bytesLen + numOut > bytesMax) {
- if (!bytes) {
- bytesMax = 1024;
- bytes = (unsigned char*)malloc((size_t)bytesMax);
- }
- else {
- bytesMax <<= 2;
- oldBytes = bytes;
- bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax);
- }
- if (bytes == 0) {
- mime_error("out of memory while processing BASE64 data\n");
- }
- }
- if (bytes) {
- memcpy(bytes + bytesLen, outBytes, numOut);
- bytesLen += numOut;
- }
- trip = 0;
- quadIx = 0;
- }
- }
- } /* while */
- DBG_(("db: bytesLen = %d\n", bytesLen));
- /* kludge: all this won't be necessary if we have tree form
- representation */
- if (bytes) {
- setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
- free(bytes);
- }
- else if (oldBytes) {
- setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
- free(oldBytes);
- }
- return 0;
- }
-
-static int match_begin_end_name(int end) {
- int token;
- lexSkipWhite();
- if (lexLookahead() != ':') return ID;
- lexSkipLookahead();
- lexSkipWhite();
- token = match_begin_name(end);
- if (token == ID) {
- lexPushLookaheadc(':');
- DBG_(("db: ID '%s'\n", yylval.str));
- return ID;
- }
- else if (token != 0) {
- lexSkipLookaheadWord();
- deleteStr(yylval.str);
- DBG_(("db: begin/end %d\n", token));
- return token;
- }
- return 0;
- }
-
-static char* lexGetQuotedPrintable()
- {
- char cur;
- unsigned long len = 0;
-
- lexClearToken();
- do {
- cur = lexGetc();
- switch (cur) {
- case '=': {
- int c = 0;
- int next[2];
- int i;
- for (i = 0; i < 2; i++) {
- next[i] = lexGetc();
- if (next[i] >= '0' && next[i] <= '9')
- c = c * 16 + next[i] - '0';
- else if (next[i] >= 'A' && next[i] <= 'F')
- c = c * 16 + next[i] - 'A' + 10;
- else
- break;
- }
- if (i == 0) {
- /* single '=' follow by LINESEP is continuation sign? */
- if (next[0] == '\n') {
- ++mime_lineNum;
- }
- else {
- lexPushLookaheadc('=');
- goto EndString;
- }
- }
- else if (i == 1) {
- lexPushLookaheadc(next[1]);
- lexPushLookaheadc(next[0]);
- lexAppendc('=');
- } else {
- lexAppendc(c);
- }
- break;
- } /* '=' */
- case '\n': {
- lexPushLookaheadc('\n');
- goto EndString;
- }
- case (char)EOF:
- break;
- default:
- lexAppendc(cur);
- break;
- } /* switch */
- } while (cur != (char)EOF);
-
-EndString:
- lexAppendc(0);
- return lexStr();
- } /* LexQuotedPrintable */
-
-static int yylex() {
- int token = 0;
-
- int lexmode = LEXMODE();
- if (lexmode == L_VALUES) {
- int c = lexGetc();
- if (c == ';') {
- DBG_(("db: SEMICOLON\n"));
- lexPushLookaheadc(c);
- handleMoreRFC822LineBreak(c);
- lexSkipLookahead();
- return SEMICOLON;
- }
- else if (strchr("\n",c)) {
- ++mime_lineNum;
- /* consume all line separator(s) adjacent to each other */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: LINESEP\n"));
- return LINESEP;
- }
- else {
- char *p = 0;
- lexPushLookaheadc(c);
- if (lexWithinMode(L_BASE64)) {
- /* get each char and convert to bin on the fly... */
- p = lexGetDataFromBase64();
- yylval.str = p;
- return STRING;
- }
- else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
- p = lexGetQuotedPrintable();
- }
- else {
-#ifdef _SUPPORT_LINE_FOLDING
- p = lexGet1Value();
-#else
- p = lexGetStrUntil(";\n");
-#endif
- }
- if (p) {
- DBG_(("db: STRING: '%s'\n", p));
- yylval.str = p;
- return STRING;
- }
- else return 0;
- }
- }
- else {
- /* normal mode */
- while (1) {
- int c = lexGetc();
- switch(c) {
- case ':': {
- /* consume all line separator(s) adjacent to each other */
- /* ignoring linesep immediately after colon. */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: COLON\n"));
- return COLON;
- }
- case ';':
- DBG_(("db: SEMICOLON\n"));
- return SEMICOLON;
- case '=':
- DBG_(("db: EQ\n"));
- return EQ;
- /* ignore whitespace in this mode */
- case '\t':
- case ' ': continue;
- case '\n': {
- ++mime_lineNum;
- continue;
- }
- case EOF: return 0;
- break;
- default: {
- lexPushLookaheadc(c);
- if (isalpha(c)) {
- char *t = lexGetWord();
- yylval.str = t;
- if (!stricmp(t, "begin")) {
- return match_begin_end_name(0);
- }
- else if (!stricmp(t,"end")) {
- return match_begin_end_name(1);
- }
- else {
- DBG_(("db: ID '%s'\n", t));
- return ID;
- }
- }
- else {
- /* unknow token */
- return 0;
- }
- break;
- }
- }
- }
- }
- return 0;
- }
-
-
-/***************************************************************************/
-/*** Public Functions ****/
-/***************************************************************************/
-
-static VObject* Parse_MIMEHelper()
- {
- ObjStackTop = -1;
- mime_numErrors = 0;
- mime_lineNum = 1;
- vObjList = 0;
- curObj = 0;
-
- if (yyparse() != 0)
- return 0;
-
- finiLex();
- return vObjList;
- }
-
-/*/////////////////////////////////////////////////////////////////////////*/
-DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
- {
- initLex(input, len, 0);
- return Parse_MIMEHelper();
- }
-
-
-#if INCLUDEMFC
-
-DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
- {
- unsigned long startPos;
- VObject *result;
-
- initLex(0,-1,file);
- startPos = file->GetPosition();
- if (!(result = Parse_MIMEHelper()))
- file->Seek(startPos, CFile::begin);
- return result;
- }
-
-#else
-
-VObject* Parse_MIME_FromFile(FILE *file)
- {
- VObject *result;
- long startPos;
-
- initLex(0,(unsigned long)-1,file);
- startPos = ftell(file);
- if (!(result = Parse_MIMEHelper())) {
- fseek(file,startPos,SEEK_SET);
- }
- return result;
- }
-
-DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
- {
- FILE *fp = fopen(fname,"r");
- if (fp) {
- VObject* o = Parse_MIME_FromFile(fp);
- fclose(fp);
- return o;
- }
- else {
- char msg[80];
- sprintf(msg, "can't open file '%s' for reading\n", fname);
- mime_error_(msg);
- return 0;
- }
- }
-
-#endif
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static void YYDebug(const char *s)
-{
-/* Parse_Debug(s); */
-}
-
-
-static MimeErrorHandler mimeErrorHandler;
-
-DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
- {
- mimeErrorHandler = me;
- }
-
-static void mime_error(char *s)
- {
- char msg[256];
- if (mimeErrorHandler) {
- sprintf(msg,"%s at line %d", s, mime_lineNum);
- mimeErrorHandler(msg);
- }
- }
-
-static void mime_error_(char *s)
- {
- if (mimeErrorHandler) {
- mimeErrorHandler(s);
- }
- }
-
diff --git a/libversit/vcc.h b/libversit/vcc.h
deleted file mode 100644
index 0e52034710..0000000000
--- a/libversit/vcc.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#ifndef __VCC_H__
-#define __VCC_H__ 1
-
-#include "vobject.h"
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-typedef void (*MimeErrorHandler)(char *);
-
-extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
-
-extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
-extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
-
-
-/* NOTE regarding Parse_MIME_FromFile
-The function above, Parse_MIME_FromFile, comes in two flavors,
-neither of which is exported from the DLL. Each version takes
-a CFile or FILE* as a parameter, neither of which can be
-passed across a DLL interface (at least that is my experience).
-If you are linking this code into your build directly then
-you may find them a more convenient API that the other flavors
-that take a file name. If you use them with the DLL LIB you
-will get a link error.
-*/
-
-
-#if INCLUDEMFC
-extern VObject* Parse_MIME_FromFile(CFile *file);
-#else
-extern VObject* Parse_MIME_FromFile(FILE *file);
-#endif
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VCC_H__ */
-
diff --git a/libversit/vcc.y b/libversit/vcc.y
deleted file mode 100644
index b8b9933f2c..0000000000
--- a/libversit/vcc.y
+++ /dev/null
@@ -1,1217 +0,0 @@
-%{
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vcc.c
- * doc: Parser for vCard and vCalendar. Note that this code is
- * generated by a yacc parser generator. Generally it should not
- * be edited by hand. The real source is vcc.y. The #line directives
- * can be commented out here to make it easier to trace through
- * in a debugger. However, if a bug is found it should
- * be fixed in vcc.y and this file regenerated.
- */
-
-
-/* debugging utilities */
-#if __DEBUG
-#define DBG_(x) printf x
-#else
-#define DBG_(x)
-#endif
-
-/**** External Functions ****/
-
-/* assign local name to parser variables and functions so that
- we can use more than one yacc based parser.
-*/
-
-#define yyparse mime_parse
-#define yylex mime_lex
-#define yyerror mime_error
-#define yychar mime_char
-/* #define p_yyval p_mime_val */
-#undef yyval
-#define yyval mime_yyval
-/* #define p_yylval p_mime_lval */
-#undef yylval
-#define yylval mime_yylval
-#define yydebug mime_debug
-#define yynerrs mime_nerrs
-#define yyerrflag mime_errflag
-#define yyss mime_ss
-#define yyssp mime_ssp
-#define yyvs mime_vs
-#define yyvsp mime_vsp
-#define yylhs mime_lhs
-#define yylen mime_len
-#define yydefred mime_defred
-#define yydgoto mime_dgoto
-#define yysindex mime_sindex
-#define yyrindex mime_rindex
-#define yygindex mime_gindex
-#define yytable mime_table
-#define yycheck mime_check
-#define yyname mime_name
-#define yyrule mime_rule
-#define YYPREFIX "mime_"
-
-
-#ifndef _NO_LINE_FOLDING
-#define _SUPPORT_LINE_FOLDING 1
-#endif
-
-/* undef below if compile with MFC */
-/* #define INCLUDEMFC 1 */
-
-#if defined(WIN32) || defined(_WIN32)
-#ifdef INCLUDEMFC
-#include <afx.h>
-#endif
-#endif
-
-#include <string.h>
-#ifndef __MWERKS__
-#include <malloc.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vcc.h"
-
-/**** Types, Constants ****/
-
-#define YYDEBUG 0 /* 1 to compile in some debugging code */
-#define MAXTOKEN 256 /* maximum token (line) length */
-#define YYSTACKSIZE 50 // ~unref ?
-#define MAXLEVEL 10 /* max # of nested objects parseable */
- /* (includes outermost) */
-
-
-/**** Global Variables ****/
-int mime_lineNum, mime_numErrors; /* yyerror() can use these */
-static VObject* vObjList;
-static VObject *curProp;
-static VObject *curObj;
-static VObject* ObjStack[MAXLEVEL];
-static int ObjStackTop;
-
-
-/* A helpful utility for the rest of the app. */
-#if __CPLUSPLUS__
-extern "C" {
-#endif
-
- extern void Parse_Debug(const char *s);
- extern void yyerror(char *s);
-
-#if __CPLUSPLUS__
- };
-#endif
-
-int yyparse();
-
-enum LexMode {
- L_NORMAL,
- L_VCARD,
- L_VCAL,
- L_VEVENT,
- L_VTODO,
- L_VALUES,
- L_BASE64,
- L_QUOTED_PRINTABLE
- };
-
-/**** Private Forward Declarations ****/
-static int pushVObject(const char *prop);
-static VObject* popVObject();
-static char* lexDataFromBase64();
-static void lexPopMode(int top);
-static int lexWithinMode(enum LexMode mode);
-static void lexPushMode(enum LexMode mode);
-static void enterProps(const char *s);
-static void enterAttr(const char *s1, const char *s2);
-static void enterValues(const char *value);
-static void mime_error_(char *s);
-
-%}
-
-/***************************************************************************/
-/*** The grammar ****/
-/***************************************************************************/
-
-%union {
- char *str;
- VObject *vobj;
- }
-
-%token
- EQ COLON DOT SEMICOLON SPACE HTAB LINESEP NEWLINE
- BEGIN_VCARD END_VCARD BEGIN_VCAL END_VCAL
- BEGIN_VEVENT END_VEVENT BEGIN_VTODO END_VTODO
- ID
-
-/*
- * NEWLINE is the token that would occur outside a vCard,
- * while LINESEP is the token that would occur inside a vCard.
- */
-
-%token <str>
- STRING ID
-
-%type <str> name value
-
-%type <vobj> vcard vcal vobject
-
-%start mime
-
-%%
-
-
-mime: vobjects
- ;
-
-vobjects: vobject
- { addList(&vObjList, $1); curObj = 0; }
- vobjects
- | vobject
- { addList(&vObjList, $1); curObj = 0; }
- ;
-
-vobject: vcard
- | vcal
- ;
-
-vcard:
- BEGIN_VCARD
- {
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- }
- items END_VCARD
- {
- lexPopMode(0);
- $$ = popVObject();
- }
- | BEGIN_VCARD
- {
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- }
- END_VCARD
- {
- lexPopMode(0);
- $$ = popVObject();
- }
- ;
-
-items: item items
- | item
- ;
-
-item: prop COLON
- {
- lexPushMode(L_VALUES);
- }
- values LINESEP
- {
- if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
- lexPopMode(0);
- lexPopMode(0);
- }
- | error
- ;
-
-prop: name
- {
- enterProps($1);
- }
- attr_params
- | name
- {
- enterProps($1);
- }
- ;
-
-attr_params: attr_param attr_params
- | attr_param
- ;
-
-attr_param: SEMICOLON attr
- ;
-
-attr: name
- {
- enterAttr($1,0);
- }
- | name EQ name
- {
- enterAttr($1,$3);
-
- }
- ;
-
-name: ID
- ;
-
-values: value SEMICOLON { enterValues($1); } values
- | value
- { enterValues($1); }
- ;
-
-value: STRING
- |
- { $$ = 0; }
- ;
-
-vcal:
- BEGIN_VCAL
- { if (!pushVObject(VCCalProp)) YYERROR; }
- calitems
- END_VCAL
- { $$ = popVObject(); }
- | BEGIN_VCAL
- { if (!pushVObject(VCCalProp)) YYERROR; }
- END_VCAL
- { $$ = popVObject(); }
- ;
-
-calitems: calitem calitems
- | calitem
- ;
-
-calitem:
- eventitem
- | todoitem
- | items
- ;
-
-eventitem:
- BEGIN_VEVENT
- {
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- }
- items
- END_VEVENT
- {
- lexPopMode(0);
- popVObject();
- }
- | BEGIN_VEVENT
- {
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- }
- END_VEVENT
- {
- lexPopMode(0);
- popVObject();
- }
- ;
-
-todoitem:
- BEGIN_VTODO
- {
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- }
- items
- END_VTODO
- {
- lexPopMode(0);
- popVObject();
- }
- | BEGIN_VTODO
- {
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- }
- END_VTODO
- {
- lexPopMode(0);
- popVObject();
- }
- ;
-
-%%
-/*/////////////////////////////////////////////////////////////////////////*/
-static int pushVObject(const char *prop)
- {
- VObject *newObj;
- if (ObjStackTop == MAXLEVEL)
- return FALSE;
-
- ObjStack[++ObjStackTop] = curObj;
-
- if (curObj) {
- newObj = addProp(curObj,prop);
- curObj = newObj;
- }
- else
- curObj = newVObject(prop);
-
- return TRUE;
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This pops the recently built vCard off the stack and returns it. */
-static VObject* popVObject()
- {
- VObject *oldObj;
- if (ObjStackTop < 0) {
- yyerror("pop on empty Object Stack\n");
- return 0;
- }
- oldObj = curObj;
- curObj = ObjStack[ObjStackTop--];
-
- return oldObj;
- }
-
-
-static void enterValues(const char *value)
- {
- if (fieldedProp && *fieldedProp) {
- if (value) {
- addPropValue(curProp,*fieldedProp,value);
- }
- /* else this field is empty, advance to next field */
- fieldedProp++;
- }
- else {
- if (value) {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
- }
- }
- deleteStr(value);
- }
-
-static void enterProps(const char *s)
- {
- curProp = addGroup(curObj,s);
- deleteStr(s);
- }
-
-static void enterAttr(const char *s1, const char *s2)
- {
- const char *p1, *p2;
- p1 = lookupProp_(s1);
- if (s2) {
- VObject *a;
- p2 = lookupProp_(s2);
- a = addProp(curProp,p1);
- setVObjectStringZValue(a,p2);
- }
- else
- addProp(curProp,p1);
- if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
- lexPushMode(L_BASE64);
- else if (stricmp(p1,VCQuotedPrintableProp) == 0
- || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
- lexPushMode(L_QUOTED_PRINTABLE);
- deleteStr(s1); deleteStr(s2);
- }
-
-
-#define MAX_LEX_LOOKAHEAD_0 32
-#define MAX_LEX_LOOKAHEAD 64
-#define MAX_LEX_MODE_STACK_SIZE 10
-#define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop])
-
-struct LexBuf {
- /* input */
-#ifdef INCLUDEMFC
- CFile *inputFile;
-#else
- FILE *inputFile;
-#endif
- char *inputString;
- unsigned long curPos;
- unsigned long inputLen;
- /* lookahead buffer */
- /* -- lookahead buffer is short instead of char so that EOF
- / can be represented correctly.
- */
- unsigned long len;
- short buf[MAX_LEX_LOOKAHEAD];
- unsigned long getPtr;
- /* context stack */
- unsigned long lexModeStackTop;
- enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE];
- /* token buffer */
- unsigned long maxToken;
- char *strs;
- unsigned long strsLen;
- } lexBuf;
-
-static void lexPushMode(enum LexMode mode)
- {
- if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1))
- yyerror("lexical context stack overflow");
- else {
- lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode;
- }
- }
-
-static void lexPopMode(int top)
- {
- /* special case of pop for ease of error recovery -- this
- version will never underflow */
- if (top)
- lexBuf.lexModeStackTop = 0;
- else
- if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--;
- }
-
-static int lexWithinMode(enum LexMode mode) {
- unsigned long i;
- for (i=0;i<lexBuf.lexModeStackTop;i++)
- if (mode == lexBuf.lexModeStack[i]) return 1;
- return 0;
- }
-
-static char lexGetc_()
- {
- /* get next char from input, no buffering. */
- if (lexBuf.curPos == lexBuf.inputLen)
- return EOF;
- else if (lexBuf.inputString)
- return *(lexBuf.inputString + lexBuf.curPos++);
- else {
-#ifdef INCLUDEMFC
- char result;
- return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
-#else
- return fgetc(lexBuf.inputFile);
-#endif
- }
- }
-
-static int lexGeta()
- {
- ++lexBuf.len;
- return (lexBuf.buf[lexBuf.getPtr] = lexGetc_());
- }
-
-static int lexGeta_(int i)
- {
- ++lexBuf.len;
- return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_());
- }
-
-static void lexSkipLookahead() {
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* don't skip EOF. */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- }
-
-static int lexLookahead() {
- int c = (lexBuf.len)?
- lexBuf.buf[lexBuf.getPtr]:
- lexGeta();
- /* do the \r\n -> \n or \r -> \n translation here */
- if (c == '\r') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]:
- lexGeta_(1);
- if (a == '\n') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = c = '\n';
- }
- else if (c == '\n') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[lexBuf.getPtr+1]:
- lexGeta_(1);
- if (a == '\r') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = '\n';
- }
- return c;
- }
-
-static int lexGetc() {
- int c = lexLookahead();
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* EOF will remain in lookahead buffer */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- return c;
- }
-
-static void lexSkipLookaheadWord() {
- if (lexBuf.strsLen <= lexBuf.len) {
- lexBuf.len -= lexBuf.strsLen;
- lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD;
- }
- }
-
-static void lexClearToken()
- {
- lexBuf.strsLen = 0;
- }
-
-static void lexAppendc(int c)
- {
- lexBuf.strs[lexBuf.strsLen] = c;
- /* append up to zero termination */
- if (c == 0) return;
- lexBuf.strsLen++;
- if (lexBuf.strsLen > lexBuf.maxToken) {
- /* double the token string size */
- lexBuf.maxToken <<= 1;
- lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken);
- }
- }
-
-static char* lexStr() {
- return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1);
- }
-
-static void lexSkipWhite() {
- int c = lexLookahead();
- while (c == ' ' || c == '\t') {
- lexSkipLookahead();
- c = lexLookahead();
- }
- }
-
-static char* lexGetWord() {
- int c;
- lexSkipWhite();
- lexClearToken();
- c = lexLookahead();
- while (c != EOF && !strchr("\t\n ;:=",c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return lexStr();
- }
-
-static void lexPushLookahead(char *s, int len) {
- int putptr;
- if (len == 0) len = strlen(s);
- putptr = (int)lexBuf.getPtr - len;
- /* this function assumes that length of word to push back
- / is not greater than MAX_LEX_LOOKAHEAD.
- */
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- while (*s) {
- lexBuf.buf[putptr] = *s++;
- putptr = (putptr + 1) % MAX_LEX_LOOKAHEAD;
- }
- lexBuf.len += len;
- }
-
-static void lexPushLookaheadc(int c) {
- int putptr;
- /* can't putback EOF, because it never leaves lookahead buffer */
- if (c == EOF) return;
- putptr = (int)lexBuf.getPtr - 1;
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- lexBuf.buf[putptr] = c;
- lexBuf.len += 1;
- }
-
-static char* lexLookaheadWord() {
- /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0
- / and thing bigger than that will stop the lookahead and return 0;
- / leading white spaces are not recoverable.
- */
- int c;
- int len = 0;
- int curgetptr = 0;
- lexSkipWhite();
- lexClearToken();
- curgetptr = (int)lexBuf.getPtr; // remember!
- while (len < (MAX_LEX_LOOKAHEAD_0)) {
- c = lexGetc();
- len++;
- if (c == EOF || strchr("\t\n ;:=", c)) {
- lexAppendc(0);
- /* restore lookahead buf. */
- lexBuf.len += len;
- lexBuf.getPtr = curgetptr;
- return lexStr();
- }
- else
- lexAppendc(c);
- }
- lexBuf.len += len; /* char that has been moved to lookahead buffer */
- lexBuf.getPtr = curgetptr;
- return 0;
- }
-
-#ifdef _SUPPORT_LINE_FOLDING
-static void handleMoreRFC822LineBreak(int c) {
- /* suport RFC 822 line break in cases like
- * ADR: foo;
- * morefoo;
- * more foo;
- */
- if (c == ';') {
- int a;
- lexSkipLookahead();
- /* skip white spaces */
- a = lexLookahead();
- while (a == ' ' || a == '\t') {
- lexSkipLookahead();
- a = lexLookahead();
- }
- if (a == '\n') {
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- /* continuation, throw away all the \n and spaces read so
- * far
- */
- lexSkipWhite();
- lexPushLookaheadc(';');
- }
- else {
- lexPushLookaheadc('\n');
- lexPushLookaheadc(';');
- }
- }
- else {
- lexPushLookaheadc(';');
- }
- }
- }
-
-static char* lexGet1Value() {
- int size = 0;
- int c;
- lexSkipWhite();
- c = lexLookahead();
- lexClearToken();
- while (c != EOF && c != ';') {
- if (c == '\n') {
- int a;
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- lexAppendc(' ');
- lexSkipLookahead();
- }
- else {
- lexPushLookaheadc('\n');
- break;
- }
- }
- else {
- lexAppendc(c);
- lexSkipLookahead();
- }
- c = lexLookahead();
- }
- lexAppendc(0);
- handleMoreRFC822LineBreak(c);
- return c==EOF?0:lexStr();
- }
-#endif
-
-static char* lexGetStrUntil(char *termset) {
- int size = 0;
- int c = lexLookahead();
- lexClearToken();
- while (c != EOF && !strchr(termset,c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return c==EOF?0:lexStr();
- }
-
-static int match_begin_name(int end) {
- char *n = lexLookaheadWord();
- int token = ID;
- if (n) {
- if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
- else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
- else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
- else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
- deleteStr(n);
- return token;
- }
- return 0;
- }
-
-
-#ifdef INCLUDEMFC
-void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
-#else
-void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
-#endif
- {
- // initialize lex mode stack
- lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL;
-
- // iniatialize lex buffer.
- lexBuf.inputString = (char*) inputstring;
- lexBuf.inputLen = inputlen;
- lexBuf.curPos = 0;
- lexBuf.inputFile = inputfile;
-
- lexBuf.len = 0;
- lexBuf.getPtr = 0;
-
- lexBuf.maxToken = MAXTOKEN;
- lexBuf.strs = (char*)malloc(MAXTOKEN);
- lexBuf.strsLen = 0;
-
- }
-
-static void finiLex() {
- free(lexBuf.strs);
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This parses and converts the base64 format for binary encoding into
- * a decoded buffer (allocated with new). See RFC 1521.
- */
-static char * lexGetDataFromBase64()
- {
- unsigned long bytesLen = 0, bytesMax = 0;
- int quadIx = 0, pad = 0;
- unsigned long trip = 0;
- unsigned char b;
- int c;
- unsigned char *bytes = NULL;
- unsigned char *oldBytes = NULL;
-
- DBG_(("db: lexGetDataFromBase64\n"));
- while (1) {
- c = lexGetc();
- if (c == '\n') {
- ++mime_lineNum;
- if (lexLookahead() == '\n') {
- /* a '\n' character by itself means end of data */
- break;
- }
- else continue; /* ignore '\n' */
- }
- else {
- if ((c >= 'A') && (c <= 'Z'))
- b = (unsigned char)(c - 'A');
- else if ((c >= 'a') && (c <= 'z'))
- b = (unsigned char)(c - 'a') + 26;
- else if ((c >= '0') && (c <= '9'))
- b = (unsigned char)(c - '0') + 52;
- else if (c == '+')
- b = 62;
- else if (c == '/')
- b = 63;
- else if (c == '=') {
- b = 0;
- pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
- } else { /* error condition */
- if (bytes) free(bytes);
- else if (oldBytes) free(oldBytes);
- // error recovery: skip until 2 adjacent newlines.
- DBG_(("db: invalid character 0x%x '%c'\n", c,c));
- if (c != EOF) {
- c = lexGetc();
- while (c != EOF) {
- if (c == '\n' && lexLookahead() == '\n') {
- ++mime_lineNum;
- break;
- }
- c = lexGetc();
- }
- }
- return NULL;
- }
- trip = (trip << 6) | b;
- if (++quadIx == 4) {
- unsigned char outBytes[3];
- int numOut;
- int i;
- for (i = 0; i < 3; i++) {
- outBytes[2-i] = (unsigned char)(trip & 0xFF);
- trip >>= 8;
- }
- numOut = 3 - pad;
- if (bytesLen + numOut > bytesMax) {
- if (!bytes) {
- bytesMax = 1024;
- bytes = (unsigned char*)malloc((size_t)bytesMax);
- }
- else {
- bytesMax <<= 2;
- oldBytes = bytes;
- bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax);
- }
- if (bytes == 0) {
- mime_error("out of memory while processing BASE64 data\n");
- }
- }
- if (bytes) {
- memcpy(bytes + bytesLen, outBytes, numOut);
- bytesLen += numOut;
- }
- trip = 0;
- quadIx = 0;
- }
- }
- } /* while */
- DBG_(("db: bytesLen = %d\n", bytesLen));
- /* kludge: all this won't be necessary if we have tree form
- representation */
- if (bytes) {
- setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
- free(bytes);
- }
- else if (oldBytes) {
- setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
- free(oldBytes);
- }
- return 0;
- }
-
-static int match_begin_end_name(int end) {
- int token;
- lexSkipWhite();
- if (lexLookahead() != ':') return ID;
- lexSkipLookahead();
- lexSkipWhite();
- token = match_begin_name(end);
- if (token == ID) {
- lexPushLookaheadc(':');
- DBG_(("db: ID '%s'\n", yylval.str));
- return ID;
- }
- else if (token != 0) {
- lexSkipLookaheadWord();
- deleteStr(yylval.str);
- DBG_(("db: begin/end %d\n", token));
- return token;
- }
- return 0;
- }
-
-static char* lexGetQuotedPrintable()
- {
- char cur;
- unsigned long len = 0;
-
- lexClearToken();
- do {
- cur = lexGetc();
- switch (cur) {
- case '=': {
- int c = 0;
- int next[2];
- int i;
- for (i = 0; i < 2; i++) {
- next[i] = lexGetc();
- if (next[i] >= '0' && next[i] <= '9')
- c = c * 16 + next[i] - '0';
- else if (next[i] >= 'A' && next[i] <= 'F')
- c = c * 16 + next[i] - 'A' + 10;
- else
- break;
- }
- if (i == 0) {
- /* single '=' follow by LINESEP is continuation sign? */
- if (next[0] == '\n') {
- ++mime_lineNum;
- }
- else {
- lexPushLookaheadc('=');
- goto EndString;
- }
- }
- else if (i == 1) {
- lexPushLookaheadc(next[1]);
- lexPushLookaheadc(next[0]);
- lexAppendc('=');
- } else {
- lexAppendc(c);
- }
- break;
- } /* '=' */
- case '\n': {
- lexPushLookaheadc('\n');
- goto EndString;
- }
- case (char)EOF:
- break;
- default:
- lexAppendc(cur);
- break;
- } /* switch */
- } while (cur != (char)EOF);
-
-EndString:
- lexAppendc(0);
- return lexStr();
- } /* LexQuotedPrintable */
-
-static int yylex() {
- int token = 0;
-
- int lexmode = LEXMODE();
- if (lexmode == L_VALUES) {
- int c = lexGetc();
- if (c == ';') {
- DBG_(("db: SEMICOLON\n"));
- lexPushLookaheadc(c);
- handleMoreRFC822LineBreak(c);
- lexSkipLookahead();
- return SEMICOLON;
- }
- else if (strchr("\n",c)) {
- ++mime_lineNum;
- /* consume all line separator(s) adjacent to each other */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: LINESEP\n"));
- return LINESEP;
- }
- else {
- char *p = 0;
- lexPushLookaheadc(c);
- if (lexWithinMode(L_BASE64)) {
- /* get each char and convert to bin on the fly... */
- p = lexGetDataFromBase64();
- yylval.str = p;
- return STRING;
- }
- else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
- p = lexGetQuotedPrintable();
- }
- else {
-#ifdef _SUPPORT_LINE_FOLDING
- p = lexGet1Value();
-#else
- p = lexGetStrUntil(";\n");
-#endif
- }
- if (p) {
- DBG_(("db: STRING: '%s'\n", p));
- yylval.str = p;
- return STRING;
- }
- else return 0;
- }
- }
- else {
- /* normal mode */
- while (1) {
- int c = lexGetc();
- switch(c) {
- case ':': {
- /* consume all line separator(s) adjacent to each other */
- /* ignoring linesep immediately after colon. */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: COLON\n"));
- return COLON;
- }
- case ';':
- DBG_(("db: SEMICOLON\n"));
- return SEMICOLON;
- case '=':
- DBG_(("db: EQ\n"));
- return EQ;
- /* ignore whitespace in this mode */
- case '\t':
- case ' ': continue;
- case '\n': {
- ++mime_lineNum;
- continue;
- }
- case EOF: return 0;
- break;
- default: {
- lexPushLookaheadc(c);
- if (isalpha(c)) {
- char *t = lexGetWord();
- yylval.str = t;
- if (!stricmp(t, "begin")) {
- return match_begin_end_name(0);
- }
- else if (!stricmp(t,"end")) {
- return match_begin_end_name(1);
- }
- else {
- DBG_(("db: ID '%s'\n", t));
- return ID;
- }
- }
- else {
- /* unknow token */
- return 0;
- }
- break;
- }
- }
- }
- }
- return 0;
- }
-
-
-/***************************************************************************/
-/*** Public Functions ****/
-/***************************************************************************/
-
-static VObject* Parse_MIMEHelper()
- {
- ObjStackTop = -1;
- mime_numErrors = 0;
- mime_lineNum = 1;
- vObjList = 0;
- curObj = 0;
-
- if (yyparse() != 0)
- return 0;
-
- finiLex();
- return vObjList;
- }
-
-/*/////////////////////////////////////////////////////////////////////////*/
-DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
- {
- initLex(input, len, 0);
- return Parse_MIMEHelper();
- }
-
-
-#if INCLUDEMFC
-
-DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
- {
- unsigned long startPos;
- VObject *result;
-
- initLex(0,-1,file);
- startPos = file->GetPosition();
- if (!(result = Parse_MIMEHelper()))
- file->Seek(startPos, CFile::begin);
- return result;
- }
-
-#else
-
-VObject* Parse_MIME_FromFile(FILE *file)
- {
- VObject *result;
- long startPos;
-
- initLex(0,(unsigned long)-1,file);
- startPos = ftell(file);
- if (!(result = Parse_MIMEHelper())) {
- fseek(file,startPos,SEEK_SET);
- }
- return result;
- }
-
-DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
- {
- FILE *fp = fopen(fname,"r");
- if (fp) {
- VObject* o = Parse_MIME_FromFile(fp);
- fclose(fp);
- return o;
- }
- else {
- char msg[80];
- sprintf(msg, "can't open file '%s' for reading\n", fname);
- mime_error_(msg);
- return 0;
- }
- }
-
-#endif
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static void YYDebug(const char *s)
-{
-/* Parse_Debug(s); */
-}
-
-
-static MimeErrorHandler mimeErrorHandler;
-
-DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
- {
- mimeErrorHandler = me;
- }
-
-static void mime_error(char *s)
- {
- char msg[256];
- if (mimeErrorHandler) {
- sprintf(msg,"%s at line %d", s, mime_lineNum);
- mimeErrorHandler(msg);
- }
- }
-
-static void mime_error_(char *s)
- {
- if (mimeErrorHandler) {
- mimeErrorHandler(s);
- }
- }
-
diff --git a/libversit/vctest.c b/libversit/vctest.c
deleted file mode 100644
index b14e6c1b4e..0000000000
--- a/libversit/vctest.c
+++ /dev/null
@@ -1,95 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include "vcc.h"
-
-FILE *cfp;
-
-void myMimeErrorHandler(char *s)
-{
- printf("%s\n", s);
-}
-
-void main(int argc, char **argv)
-{
- int testmem = 0;
-
- char * foo[2] = {"foo","alden.vcf"};
-
-argc = 2;
-argv = foo;
-
-#ifdef _CONSOLE
- cfp = stdout;
- registerMimeErrorHandler(myMimeErrorHandler);
-#else
- cfp = fopen("vctest.out", "w");
- if (!cfp) return;
-#endif
- ++argv;
- while (--argc) {
- FILE *fp;
- if (strcmp(*argv,"-testmem") == 0) {
- testmem = 1;
- argv++;
- continue;
- }
- fprintf(cfp,"processing %s\n",*argv);
- fp = fopen(*argv,"r");
- if (!fp) {
- fprintf(cfp,"error opening file\n");
- }
- else {
- VObject *v, *t;
- FILE *ofp;
- char buf[256];
- char *p;
- strcpy(buf,*argv);
- p = strchr(buf,'.');
- if (p) *p = 0;
- strcat(buf,".out");
- fprintf(cfp,"reading text input from '%s'...\n", *argv);
- //v = Parse_MIME_FromFile(fp);
- v = Parse_MIME_FromFileName(*argv);
- writeVObjectToFile(buf,v);
- cleanVObject(v);
-
- /*
- fprintf(cfp,"pretty print internal format of '%s'...\n", *argv);
- ofp = fopen(buf,"w");
- while (v) {
- printVObject(cfp,v);
- if (testmem) {
- char *s, *p;
- fprintf(cfp,"test writing to mem...\n");
- p = s = writeMemVObject(0,0,v);
- if (s) {
- while (*s) {
- fputc(*s,ofp);
- s++;
- }
- free(p);
- }
- }
- else {
- writeVObject(ofp,v);
- }
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
-
- fclose(ofp);
- fclose(fp);
- */
- }
-
- cleanStrTbl();
- argv++;
-
- }
-
- if (cfp != stdout) fclose(cfp);
-
-}
-
diff --git a/libversit/vobject.c b/libversit/vobject.c
deleted file mode 100644
index 74ac4fadfb..0000000000
--- a/libversit/vobject.c
+++ /dev/null
@@ -1,1428 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vobject.c
- * doc: vobject and APIs to construct vobject, APIs pretty print
- * vobject, and convert a vobject into its textual representation.
- */
-
-#ifndef MWERKS
-#include <malloc.h>
-#endif
-
-#include "vobject.h"
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-
-#define NAME_OF(o) o->id
-#define VALUE_TYPE(o) o->valType
-#define STRINGZ_VALUE_OF(o) o->val.strs
-#define USTRINGZ_VALUE_OF(o) o->val.ustrs
-#define INTEGER_VALUE_OF(o) o->val.i
-#define LONG_VALUE_OF(o) o->val.l
-#define ANY_VALUE_OF(o) o->val.any
-#define VOBJECT_VALUE_OF(o) o->val.vobj
-
-typedef union ValueItem {
- const char *strs;
- const wchar_t *ustrs;
- unsigned int i;
- unsigned long l;
- void *any;
- VObject *vobj;
- } ValueItem;
-
-struct VObject {
- VObject *next;
- const char *id;
- VObject *prop;
- unsigned short valType;
- ValueItem val;
- };
-
-typedef struct StrItem StrItem;
-
-struct StrItem {
- StrItem *next;
- const char *s;
- unsigned int refCnt;
- };
-
-const char** fieldedProp;
-
-
-
-/*----------------------------------------------------------------------
- The following functions involve with memory allocation:
- newVObject
- deleteVObject
- dupStr
- deleteStr
- newStrItem
- deleteStrItem
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(VObject*) newVObject_(const char *id)
-{
- VObject *p = (VObject*)malloc(sizeof(VObject));
- p->next = 0;
- p->id = id;
- p->prop = 0;
- VALUE_TYPE(p) = 0;
- ANY_VALUE_OF(p) = 0;
- return p;
-}
-
-DLLEXPORT(VObject*) newVObject(const char *id)
-{
- return newVObject_(lookupStr(id));
-}
-
-DLLEXPORT(void) deleteVObject(VObject *p)
-{
- unUseStr(p->id);
- free(p);
-}
-
-DLLEXPORT(char*) dupStr(const char *s, unsigned int size)
-{
- char *t;
- if (size == 0) {
- size = strlen(s);
- }
- t = (char*)malloc(size+1);
- if (t) {
- memcpy(t,s,size);
- t[size] = 0;
- return t;
- }
- else {
- return (char*)0;
- }
-}
-
-DLLEXPORT(void) deleteStr(const char *p)
-{
- if (p) free((void*)p);
-}
-
-
-static StrItem* newStrItem(const char *s, StrItem *next)
-{
- StrItem *p = (StrItem*)malloc(sizeof(StrItem));
- p->next = next;
- p->s = s;
- p->refCnt = 1;
- return p;
-}
-
-static void deleteStrItem(StrItem *p)
-{
- free((void*)p);
-}
-
-
-/*----------------------------------------------------------------------
- The following function provide accesses to VObject's value.
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(const char*) vObjectName(VObject *o)
-{
- return NAME_OF(o);
-}
-
-DLLEXPORT(void) setVObjectName(VObject *o, const char* id)
-{
- NAME_OF(o) = id;
-}
-
-DLLEXPORT(const char*) vObjectStringZValue(VObject *o)
-{
- return STRINGZ_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s)
-{
- STRINGZ_VALUE_OF(o) = dupStr(s,0);
- VALUE_TYPE(o) = VCVT_STRINGZ;
-}
-
-DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s)
-{
- STRINGZ_VALUE_OF(o) = s;
- VALUE_TYPE(o) = VCVT_STRINGZ;
-}
-
-DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o)
-{
- return USTRINGZ_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s)
-{
- USTRINGZ_VALUE_OF(o) = (wchar_t*) dupStr((char*)s,(uStrLen(s)+1)*2);
- VALUE_TYPE(o) = VCVT_USTRINGZ;
-}
-
-DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s)
-{
- USTRINGZ_VALUE_OF(o) = s;
- VALUE_TYPE(o) = VCVT_USTRINGZ;
-}
-
-DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o)
-{
- return INTEGER_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i)
-{
- INTEGER_VALUE_OF(o) = i;
- VALUE_TYPE(o) = VCVT_UINT;
-}
-
-DLLEXPORT(unsigned long) vObjectLongValue(VObject *o)
-{
- return LONG_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l)
-{
- LONG_VALUE_OF(o) = l;
- VALUE_TYPE(o) = VCVT_ULONG;
-}
-
-DLLEXPORT(void*) vObjectAnyValue(VObject *o)
-{
- return ANY_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t)
-{
- ANY_VALUE_OF(o) = t;
- VALUE_TYPE(o) = VCVT_RAW;
-}
-
-DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o)
-{
- return VOBJECT_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p)
-{
- VOBJECT_VALUE_OF(o) = p;
- VALUE_TYPE(o) = VCVT_VOBJECT;
-}
-
-DLLEXPORT(int) vObjectValueType(VObject *o)
-{
- return VALUE_TYPE(o);
-}
-
-
-/*----------------------------------------------------------------------
- The following functions can be used to build VObject.
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p)
-{
- /* circular link list pointed to tail */
- /*
- o {next,id,prop,val}
- V
- pn {next,id,prop,val}
- V
- ...
- p1 {next,id,prop,val}
- V
- pn
- -->
- o {next,id,prop,val}
- V
- pn {next,id,prop,val}
- V
- p {next,id,prop,val}
- ...
- p1 {next,id,prop,val}
- V
- pn
- */
-
- VObject *tail = o->prop;
- if (tail) {
- p->next = tail->next;
- o->prop = tail->next = p;
- }
- else {
- o->prop = p->next = p;
- }
- return p;
-}
-
-DLLEXPORT(VObject*) addProp(VObject *o, const char *id)
-{
- return addVObjectProp(o,newVObject(id));
-}
-
-DLLEXPORT(VObject*) addProp_(VObject *o, const char *id)
-{
- return addVObjectProp(o,newVObject_(id));
-}
-
-DLLEXPORT(void) addList(VObject **o, VObject *p)
-{
- p->next = 0;
- if (*o == 0) {
- *o = p;
- }
- else {
- VObject *t = *o;
- while (t->next) {
- t = t->next;
- }
- t->next = p;
- }
-}
-
-DLLEXPORT(VObject*) nextVObjectInList(VObject *o)
-{
- return o->next;
-}
-
-DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size)
-{
- VObject *sizeProp;
- setVObjectAnyValue(prop, val);
- sizeProp = addProp(prop,VCDataSizeProp);
- setVObjectLongValue(sizeProp, size);
- return prop;
-}
-
-DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size)
-{
- void *p = dupStr((const char *)val,size);
- return setValueWithSize_(prop,p,p?size:0);
-}
-
-DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o)
-{
- i->start = o->prop;
- i->next = 0;
-}
-
-DLLEXPORT(void) initVObjectIterator(VObjectIterator *i, VObject *o)
-{
- i->start = o->next;
- i->next = 0;
-}
-
-DLLEXPORT(int) moreIteration(VObjectIterator *i)
-{
- return (i->start && (i->next==0 || i->next!=i->start));
-}
-
-DLLEXPORT(VObject*) nextVObject(VObjectIterator *i)
-{
- if (i->start && i->next != i->start) {
- if (i->next == 0) {
- i->next = i->start->next;
- return i->next;
- }
- else {
- i->next = i->next->next;
- return i->next;
- }
- }
- else return (VObject*)0;
-}
-
-DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id)
-{
- VObjectIterator i;
- initPropIterator(&i,o);
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- if (!stricmp(id,each->id))
- return each;
- }
- return (VObject*)0;
-}
-
-DLLEXPORT(VObject*) addGroup(VObject *o, const char *g)
-{
- /*
- a.b.c
- -->
- prop(c)
- prop(VCGrouping=b)
- prop(VCGrouping=a)
- */
- char *dot = strrchr(g,'.');
- if (dot) {
- VObject *p, *t;
- char *gs, *n = dot+1;
- gs = dupStr(g,0); /* so we can write to it. */
- /* used to be
- * t = p = addProp_(o,lookupProp_(n));
- */
- t = p = addProp_(o,lookupProp(n));
- dot = strrchr(gs,'.');
- *dot = 0;
- do {
- dot = strrchr(gs,'.');
- if (dot) {
- n = dot+1;
- *dot=0;
- }
- else
- n = gs;
- /* property(VCGroupingProp=n);
- * and the value may have VCGrouping property
- */
- t = addProp(t,VCGroupingProp);
- setVObjectStringZValue(t,lookupProp_(n));
- } while (n != gs);
- deleteStr(gs);
- return p;
- }
- else
- return addProp_(o,lookupProp(g));
-}
-
-DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v)
-{
- VObject *prop;
- prop = addProp(o,p);
- setVObjectUStringZValue_(prop, fakeUnicode(v,0));
- return prop;
-}
-
-DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v,
- unsigned int size)
-{
- VObject *prop;
- prop = addProp(o,p);
- setValueWithSize_(prop, (void*)v, size);
- return prop;
-}
-
-DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v,
- unsigned int size)
-{
- return addPropSizedValue_(o,p,dupStr(v,size),size);
-}
-
-
-
-/*----------------------------------------------------------------------
- The following pretty print a VObject
- ----------------------------------------------------------------------*/
-
-static void printVObject_(FILE *fp, VObject *o, int level);
-
-static void indent(FILE *fp, int level)
-{
- int i;
- for (i=0;i<level*4;i++) {
- fputc(' ', fp);
- }
-}
-
-static void printValue(FILE *fp, VObject *o, int level)
-{
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ: {
- char c;
- char *t,*s;
- s = t = fakeCString(USTRINGZ_VALUE_OF(o));
- fputc('"',fp);
- while (c=*t,c) {
- fputc(c,fp);
- if (c == '\n') indent(fp,level+2);
- t++;
- }
- fputc('"',fp);
- deleteStr(s);
- break;
- }
- case VCVT_STRINGZ: {
- char c;
- const char *s = STRINGZ_VALUE_OF(o);
- fputc('"',fp);
- while (c=*s,c) {
- fputc(c,fp);
- if (c == '\n') indent(fp,level+2);
- s++;
- }
- fputc('"',fp);
- break;
- }
- case VCVT_UINT:
- fprintf(fp,"%d", INTEGER_VALUE_OF(o)); break;
- case VCVT_ULONG:
- fprintf(fp,"%ld", LONG_VALUE_OF(o)); break;
- case VCVT_RAW:
- fprintf(fp,"[raw data]"); break;
- case VCVT_VOBJECT:
- fprintf(fp,"[vobject]\n");
- printVObject_(fp,VOBJECT_VALUE_OF(o),level+1);
- break;
- case 0:
- fprintf(fp,"[none]"); break;
- default:
- fprintf(fp,"[unknown]"); break;
- }
-}
-
-static void printNameValue(FILE *fp,VObject *o, int level)
-{
- indent(fp,level);
- if (NAME_OF(o)) {
- fprintf(fp,"%s", NAME_OF(o));
- }
- if (VALUE_TYPE(o)) {
- fputc('=',fp);
- printValue(fp,o, level);
- }
- fprintf(fp,"\n");
-}
-
-static void printVObject_(FILE *fp, VObject *o, int level)
- {
- VObjectIterator t;
- if (o == 0) {
- fprintf(fp,"[NULL]\n");
- return;
- }
- printNameValue(fp,o,level);
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- printVObject_(fp,eachProp,level+1);
- }
- }
-
-void printVObject(FILE *fp,VObject *o)
-{
- printVObject_(fp,o,0);
-}
-
-DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- printVObject(fp,o);
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- while (list) {
- printVObject(fp,list);
- list = nextVObjectInList(list);
- }
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) cleanVObject(VObject *o)
-{
- if (o == 0) return;
- if (o->prop) {
- /* destroy time: cannot use the iterator here.
- Have to break the cycle in the circular link
- list and turns it into regular NULL-terminated
- list -- since at some point of destruction,
- the reference entry for the iterator to work
- will not longer be valid.
- */
- VObject *p;
- p = o->prop->next;
- o->prop->next = 0;
- do {
- VObject *t = p->next;
- cleanVObject(p);
- p = t;
- } while (p);
- }
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ:
- case VCVT_STRINGZ:
- case VCVT_RAW:
- // assume they are all allocated by malloc.
- free((char*)STRINGZ_VALUE_OF(o));
- break;
- case VCVT_VOBJECT:
- cleanVObject(VOBJECT_VALUE_OF(o));
- break;
- }
- deleteVObject(o);
-}
-
-DLLEXPORT(void) cleanVObjects(VObject *list)
-{
- while (list) {
- VObject *t = list;
- list = nextVObjectInList(list);
- cleanVObject(t);
- }
-}
-
-/*----------------------------------------------------------------------
- The following is a String Table Facilities.
- ----------------------------------------------------------------------*/
-
-#define STRTBLSIZE 255
-
-static StrItem *strTbl[STRTBLSIZE];
-
-static unsigned int hashStr(const char *s)
-{
- unsigned int h = 0;
- int i;
- for (i=0;s[i];i++) {
- h += s[i]*i;
- }
- return h % STRTBLSIZE;
-}
-
-DLLEXPORT(const char*) lookupStr(const char *s)
-{
- StrItem *t;
- unsigned int h = hashStr(s);
- if ((t = strTbl[h]) != 0) {
- do {
- if (stricmp(t->s,s) == 0) {
- t->refCnt++;
- return t->s;
- }
- t = t->next;
- } while (t);
- }
- s = dupStr(s,0);
- strTbl[h] = newStrItem(s,strTbl[h]);
- return s;
-}
-
-DLLEXPORT(void) unUseStr(const char *s)
-{
- StrItem *t, *p;
- unsigned int h = hashStr(s);
- if ((t = strTbl[h]) != 0) {
- p = t;
- do {
- if (stricmp(t->s,s) == 0) {
- t->refCnt--;
- if (t->refCnt == 0) {
- if (p == strTbl[h]) {
- strTbl[h] = t->next;
- }
- else {
- p->next = t->next;
- }
- deleteStr(t->s);
- deleteStrItem(t);
- return;
- }
- }
- p = t;
- t = t->next;
- } while (t);
- }
-}
-
-DLLEXPORT(void) cleanStrTbl()
-{
- int i;
- for (i=0; i<STRTBLSIZE;i++) {
- StrItem *t = strTbl[i];
- while (t) {
- StrItem *p;
- deleteStr(t->s);
- p = t;
- t = t->next;
- deleteStrItem(p);
- } while (t);
- strTbl[i] = 0;
- }
-}
-
-
-struct PreDefProp {
- const char *name;
- const char *alias;
- const char** fields;
- unsigned int flags;
- };
-
-/* flags in PreDefProp */
-#define PD_BEGIN 0x1
-#define PD_INTERNAL 0x2
-
-static const char *adrFields[] = {
- VCPostalBoxProp,
- VCExtAddressProp,
- VCStreetAddressProp,
- VCCityProp,
- VCRegionProp,
- VCPostalCodeProp,
- VCCountryNameProp,
- 0
-};
-
-static const char *nameFields[] = {
- VCFamilyNameProp,
- VCGivenNameProp,
- VCAdditionalNamesProp,
- VCNamePrefixesProp,
- VCNameSuffixesProp,
- NULL
- };
-
-static const char *orgFields[] = {
- VCOrgNameProp,
- VCOrgUnitProp,
- VCOrgUnit2Prop,
- VCOrgUnit3Prop,
- VCOrgUnit4Prop,
- NULL
- };
-
-static const char *AAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCAudioContentProp,
- 0
- };
-
-/* ExDate -- has unamed fields */
-/* RDate -- has unamed fields */
-
-static const char *DAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCDisplayStringProp,
- 0
- };
-
-static const char *MAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCEmailAddressProp,
- VCNoteProp,
- 0
- };
-
-static const char *PAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCProcedureNameProp,
- 0
- };
-
-static struct PreDefProp propNames[] = {
- { VC7bitProp, 0, 0, 0 },
- { VC8bitProp, 0, 0, 0 },
- { VCAAlarmProp, 0, AAlarmFields, 0 },
- { VCAdditionalNamesProp, 0, 0, 0 },
- { VCAdrProp, 0, adrFields, 0 },
- { VCAgentProp, 0, 0, 0 },
- { VCAIFFProp, 0, 0, 0 },
- { VCAOLProp, 0, 0, 0 },
- { VCAppleLinkProp, 0, 0, 0 },
- { VCAttachProp, 0, 0, 0 },
- { VCAttendeeProp, 0, 0, 0 },
- { VCATTMailProp, 0, 0, 0 },
- { VCAudioContentProp, 0, 0, 0 },
- { VCAVIProp, 0, 0, 0 },
- { VCBase64Prop, 0, 0, 0 },
- { VCBBSProp, 0, 0, 0 },
- { VCBirthDateProp, 0, 0, 0 },
- { VCBMPProp, 0, 0, 0 },
- { VCBodyProp, 0, 0, 0 },
- { VCBusinessRoleProp, 0, 0, 0 },
- { VCCalProp, 0, 0, PD_BEGIN },
- { VCCaptionProp, 0, 0, 0 },
- { VCCardProp, 0, 0, PD_BEGIN },
- { VCCarProp, 0, 0, 0 },
- { VCCategoriesProp, 0, 0, 0 },
- { VCCellularProp, 0, 0, 0 },
- { VCCGMProp, 0, 0, 0 },
- { VCCharSetProp, 0, 0, 0 },
- { VCCIDProp, VCContentIDProp, 0, 0 },
- { VCCISProp, 0, 0, 0 },
- { VCCityProp, 0, 0, 0 },
- { VCClassProp, 0, 0, 0 },
- { VCCommentProp, 0, 0, 0 },
- { VCCompletedProp, 0, 0, 0 },
- { VCContentIDProp, 0, 0, 0 },
- { VCCountryNameProp, 0, 0, 0 },
- { VCDAlarmProp, 0, DAlarmFields, 0 },
- { VCDataSizeProp, 0, 0, PD_INTERNAL },
- { VCDayLightProp, 0, 0, 0 },
- { VCDCreatedProp, 0, 0, 0 },
- { VCDeliveryLabelProp, 0, 0, 0 },
- { VCDescriptionProp, 0, 0, 0 },
- { VCDIBProp, 0, 0, 0 },
- { VCDisplayStringProp, 0, 0, 0 },
- { VCDomesticProp, 0, 0, 0 },
- { VCDTendProp, 0, 0, 0 },
- { VCDTstartProp, 0, 0, 0 },
- { VCDueProp, 0, 0, 0 },
- { VCEmailAddressProp, 0, 0, 0 },
- { VCEncodingProp, 0, 0, 0 },
- { VCEndProp, 0, 0, 0 },
- { VCEventProp, 0, 0, PD_BEGIN },
- { VCEWorldProp, 0, 0, 0 },
- { VCExNumProp, 0, 0, 0 },
- { VCExpDateProp, 0, 0, 0 },
- { VCExpectProp, 0, 0, 0 },
- { VCExtAddressProp, 0, 0, 0 },
- { VCFamilyNameProp, 0, 0, 0 },
- { VCFaxProp, 0, 0, 0 },
- { VCFullNameProp, 0, 0, 0 },
- { VCGeoLocationProp, 0, 0, 0 },
- { VCGeoProp, 0, 0, 0 },
- { VCGIFProp, 0, 0, 0 },
- { VCGivenNameProp, 0, 0, 0 },
- { VCGroupingProp, 0, 0, 0 },
- { VCHomeProp, 0, 0, 0 },
- { VCIBMMailProp, 0, 0, 0 },
- { VCInlineProp, 0, 0, 0 },
- { VCInternationalProp, 0, 0, 0 },
- { VCInternetProp, 0, 0, 0 },
- { VCISDNProp, 0, 0, 0 },
- { VCJPEGProp, 0, 0, 0 },
- { VCLanguageProp, 0, 0, 0 },
- { VCLastModifiedProp, 0, 0, 0 },
- { VCLastRevisedProp, 0, 0, 0 },
- { VCLocationProp, 0, 0, 0 },
- { VCLogoProp, 0, 0, 0 },
- { VCMailerProp, 0, 0, 0 },
- { VCMAlarmProp, 0, MAlarmFields, 0 },
- { VCMCIMailProp, 0, 0, 0 },
- { VCMessageProp, 0, 0, 0 },
- { VCMETProp, 0, 0, 0 },
- { VCModemProp, 0, 0, 0 },
- { VCMPEG2Prop, 0, 0, 0 },
- { VCMPEGProp, 0, 0, 0 },
- { VCMSNProp, 0, 0, 0 },
- { VCNamePrefixesProp, 0, 0, 0 },
- { VCNameProp, 0, nameFields, 0 },
- { VCNameSuffixesProp, 0, 0, 0 },
- { VCNoteProp, 0, 0, 0 },
- { VCOrgNameProp, 0, 0, 0 },
- { VCOrgProp, 0, orgFields, 0 },
- { VCOrgUnit2Prop, 0, 0, 0 },
- { VCOrgUnit3Prop, 0, 0, 0 },
- { VCOrgUnit4Prop, 0, 0, 0 },
- { VCOrgUnitProp, 0, 0, 0 },
- { VCPagerProp, 0, 0, 0 },
- { VCPAlarmProp, 0, PAlarmFields, 0 },
- { VCParcelProp, 0, 0, 0 },
- { VCPartProp, 0, 0, 0 },
- { VCPCMProp, 0, 0, 0 },
- { VCPDFProp, 0, 0, 0 },
- { VCPGPProp, 0, 0, 0 },
- { VCPhotoProp, 0, 0, 0 },
- { VCPICTProp, 0, 0, 0 },
- { VCPMBProp, 0, 0, 0 },
- { VCPostalBoxProp, 0, 0, 0 },
- { VCPostalCodeProp, 0, 0, 0 },
- { VCPostalProp, 0, 0, 0 },
- { VCPowerShareProp, 0, 0, 0 },
- { VCPreferredProp, 0, 0, 0 },
- { VCPriorityProp, 0, 0, 0 },
- { VCProcedureNameProp, 0, 0, 0 },
- { VCProdIdProp, 0, 0, 0 },
- { VCProdigyProp, 0, 0, 0 },
- { VCPronunciationProp, 0, 0, 0 },
- { VCPSProp, 0, 0, 0 },
- { VCPublicKeyProp, 0, 0, 0 },
- { VCQPProp, VCQuotedPrintableProp, 0, 0 },
- { VCQuickTimeProp, 0, 0, 0 },
- { VCQuotedPrintableProp, 0, 0, 0 },
- { VCRDateProp, 0, 0, 0 },
- { VCRegionProp, 0, 0, 0 },
- { VCRelatedToProp, 0, 0, 0 },
- { VCRepeatCountProp, 0, 0, 0 },
- { VCResourcesProp, 0, 0, 0 },
- { VCRNumProp, 0, 0, 0 },
- { VCRoleProp, 0, 0, 0 },
- { VCRRuleProp, 0, 0, 0 },
- { VCRSVPProp, 0, 0, 0 },
- { VCRunTimeProp, 0, 0, 0 },
- { VCSequenceProp, 0, 0, 0 },
- { VCSnoozeTimeProp, 0, 0, 0 },
- { VCStartProp, 0, 0, 0 },
- { VCStatusProp, 0, 0, 0 },
- { VCStreetAddressProp, 0, 0, 0 },
- { VCSubTypeProp, 0, 0, 0 },
- { VCSummaryProp, 0, 0, 0 },
- { VCTelephoneProp, 0, 0, 0 },
- { VCTIFFProp, 0, 0, 0 },
- { VCTimeZoneProp, 0, 0, 0 },
- { VCTitleProp, 0, 0, 0 },
- { VCTLXProp, 0, 0, 0 },
- { VCTodoProp, 0, 0, PD_BEGIN },
- { VCTranspProp, 0, 0, 0 },
- { VCUniqueStringProp, 0, 0, 0 },
- { VCURLProp, 0, 0, 0 },
- { VCURLValueProp, 0, 0, 0 },
- { VCValueProp, 0, 0, 0 },
- { VCVersionProp, 0, 0, 0 },
- { VCVideoProp, 0, 0, 0 },
- { VCVoiceProp, 0, 0, 0 },
- { VCWAVEProp, 0, 0, 0 },
- { VCWMFProp, 0, 0, 0 },
- { VCWorkProp, 0, 0, 0 },
- { VCX400Prop, 0, 0, 0 },
- { VCX509Prop, 0, 0, 0 },
- { VCXRuleProp, 0, 0, 0 },
- { 0,0,0,0 }
- };
-
-
-static struct PreDefProp* lookupPropInfo(const char* str)
-{
- /* brute force for now, could use a hash table here. */
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- return &propNames[i];
- }
-
- return 0;
-}
-
-
-DLLEXPORT(const char*) lookupProp_(const char* str)
-{
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- const char* s;
- s = propNames[i].alias?propNames[i].alias:propNames[i].name;
- return lookupStr(s);
- }
- return lookupStr(str);
-}
-
-
-DLLEXPORT(const char*) lookupProp(const char* str)
-{
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- const char *s;
- fieldedProp = propNames[i].fields;
- s = propNames[i].alias?propNames[i].alias:propNames[i].name;
- return lookupStr(s);
- }
- fieldedProp = 0;
- return lookupStr(str);
-}
-
-
-/*----------------------------------------------------------------------
- APIs to Output text form.
- ----------------------------------------------------------------------*/
-#define OFILE_REALLOC_SIZE 256
-typedef struct OFile {
- FILE *fp;
- char *s;
- int len;
- int limit;
- int alloc:1;
- int fail:1;
- } OFile;
-
-#if 0
-static void appendsOFile(OFile *fp, const char *s)
-{
- int slen;
- if (fp->fail) return;
- slen = strlen(s);
- if (fp->fp) {
- fwrite(s,1,slen,fp->fp);
- }
- else {
-stuff:
- if (fp->len + slen < fp->limit) {
- memcpy(fp->s+fp->len,s,slen);
- fp->len += slen;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- if (OFILE_REALLOC_SIZE <= slen) fp->limit += slen;
- fp->s = (char *) realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-
-static void appendcOFile(OFile *fp, char c)
-{
- if (fp->fail) return;
- if (fp->fp) {
- fputc(c,fp->fp);
- }
- else {
-stuff:
- if (fp->len+1 < fp->limit) {
- fp->s[fp->len] = c;
- fp->len++;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- fp->s = (char *) realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-#else
-static void appendcOFile_(OFile *fp, char c)
-{
- if (fp->fail) return;
- if (fp->fp) {
- fputc(c,fp->fp);
- }
- else {
-stuff:
- if (fp->len+1 < fp->limit) {
- fp->s[fp->len] = c;
- fp->len++;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- fp->s = realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-
-static void appendcOFile(OFile *fp, char c)
-{
- if (c == '\n') {
- /* write out as <CR><LF> */
- appendcOFile_(fp,0xd);
- appendcOFile_(fp,0xa);
- }
- else
- appendcOFile_(fp,c);
-}
-
-static void appendsOFile(OFile *fp, const char *s)
-{
- int i, slen;
- slen = strlen(s);
- for (i=0; i<slen; i++) {
- appendcOFile(fp,s[i]);
- }
-}
-
-#endif
-
-static void initOFile(OFile *fp, FILE *ofp)
-{
- fp->fp = ofp;
- fp->s = 0;
- fp->len = 0;
- fp->limit = 0;
- fp->alloc = 0;
- fp->fail = 0;
-}
-
-static void initMemOFile(OFile *fp, char *s, int len)
-{
- fp->fp = 0;
- fp->s = s;
- fp->len = 0;
- fp->limit = s?len:0;
- fp->alloc = s?0:1;
- fp->fail = 0;
-}
-
-
-static int writeBase64(OFile *fp, unsigned char *s, long len)
-{
- long cur = 0;
- int i, numQuads = 0;
- unsigned long trip;
- unsigned char b;
- char quad[5];
-#define MAXQUADS 16
-
- quad[4] = 0;
-
- while (cur < len) {
- // collect the triplet of bytes into 'trip'
- trip = 0;
- for (i = 0; i < 3; i++) {
- b = (cur < len) ? *(s + cur) : 0;
- cur++;
- trip = trip << 8 | b;
- }
- // fill in 'quad' with the appropriate four characters
- for (i = 3; i >= 0; i--) {
- b = (unsigned char)(trip & 0x3F);
- trip = trip >> 6;
- if ((3 - i) < (cur - len))
- quad[i] = '='; // pad char
- else if (b < 26) quad[i] = (char)b + 'A';
- else if (b < 52) quad[i] = (char)(b - 26) + 'a';
- else if (b < 62) quad[i] = (char)(b - 52) + '0';
- else if (b == 62) quad[i] = '+';
- else quad[i] = '/';
- }
- // now output 'quad' with appropriate whitespace and line ending
- appendsOFile(fp, (numQuads == 0 ? " " : ""));
- appendsOFile(fp, quad);
- appendsOFile(fp, ((cur >= len)?"\n" :(numQuads==MAXQUADS-1?"\n" : "")));
- numQuads = (numQuads + 1) % MAXQUADS;
- }
- appendcOFile(fp,'\n');
-
- return 1;
-}
-
-static void writeQPString(OFile *fp, const char *s)
-{
- const char *p = s;
- while (*p) {
- if (*p == '\n') {
- if (p[1]) appendsOFile(fp,"=0A=");
- }
- appendcOFile(fp,*p);
- p++;
- }
-}
-
-
-
-static void writeVObject_(OFile *fp, VObject *o);
-
-static void writeValue(OFile *fp, VObject *o, unsigned long size)
-{
- if (o == 0) return;
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ: {
- char *s = fakeCString(USTRINGZ_VALUE_OF(o));
- writeQPString(fp, s);
- deleteStr(s);
- break;
- }
- case VCVT_STRINGZ: {
- writeQPString(fp, STRINGZ_VALUE_OF(o));
- break;
- }
- case VCVT_UINT: {
- char buf[16];
- sprintf(buf,"%u", INTEGER_VALUE_OF(o));
- appendsOFile(fp,buf);
- break;
- }
- case VCVT_ULONG: {
- char buf[16];
- sprintf(buf,"%lu", LONG_VALUE_OF(o));
- appendsOFile(fp,buf);
- break;
- }
- case VCVT_RAW: {
- appendcOFile(fp,'\n');
- writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size);
- break;
- }
- case VCVT_VOBJECT:
- appendcOFile(fp,'\n');
- writeVObject_(fp,VOBJECT_VALUE_OF(o));
- break;
- }
-}
-
-static void writeAttrValue(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- pi = lookupPropInfo(NAME_OF(o));
- if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
- appendcOFile(fp,';');
- appendsOFile(fp,NAME_OF(o));
- }
- else
- appendcOFile(fp,';');
- if (VALUE_TYPE(o)) {
- appendcOFile(fp,'=');
- writeValue(fp,o,0);
- }
-}
-
-static void writeGroup(OFile *fp, VObject *o)
-{
- char buf1[256];
- char buf2[256];
- strcpy(buf1,NAME_OF(o));
- while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) {
- strcpy(buf2,STRINGZ_VALUE_OF(o));
- strcat(buf2,".");
- strcat(buf2,buf1);
- strcpy(buf1,buf2);
- }
- appendsOFile(fp,buf1);
-}
-
-static int inList(const char **list, const char *s)
-{
- if (list == 0) return 0;
- while (*list) {
- if (stricmp(*list,s) == 0) return 1;
- list++;
- }
- return 0;
-}
-
-static void writeProp(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- VObjectIterator t;
- const char **fields_ = 0;
- pi = lookupPropInfo(NAME_OF(o));
- if (pi && ((pi->flags & PD_BEGIN) != 0)) {
- writeVObject_(fp,o);
- return;
- }
- if (isAPropertyOf(o,VCGroupingProp))
- writeGroup(fp,o);
- else
- appendsOFile(fp,NAME_OF(o));
- if (pi) fields_ = pi->fields;
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- const char *s;
- VObject *eachProp = nextVObject(&t);
- s = NAME_OF(eachProp);
- if (stricmp(VCGroupingProp,s) && !inList(fields_,s))
- writeAttrValue(fp,eachProp);
- }
- if (fields_) {
- int i = 0, n = 0;
- const char** fields = fields_;
- /* output prop as fields */
- appendcOFile(fp,':');
- while (*fields) {
- VObject *t = isAPropertyOf(o,*fields);
- i++;
- if (t) n = i;
- fields++;
- }
- fields = fields_;
- for (i=0;i<n;i++) {
- writeValue(fp,isAPropertyOf(o,*fields),0);
- fields++;
- if (i<(n-1)) appendcOFile(fp,';');
- }
- }
- }
-
- if (VALUE_TYPE(o)) {
- unsigned long size = 0;
- VObject *p = isAPropertyOf(o,VCDataSizeProp);
- if (p) size = LONG_VALUE_OF(p);
- appendcOFile(fp,':');
- writeValue(fp,o,size);
- }
-
- appendcOFile(fp,'\n');
-}
-
-static void writeVObject_(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- pi = lookupPropInfo(NAME_OF(o));
-
- if (pi && ((pi->flags & PD_BEGIN) != 0)) {
- VObjectIterator t;
- const char *begin = NAME_OF(o);
- appendsOFile(fp,"BEGIN:");
- appendsOFile(fp,begin);
- appendcOFile(fp,'\n');
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- writeProp(fp, eachProp);
- }
- appendsOFile(fp,"END:");
- appendsOFile(fp,begin);
- appendsOFile(fp,"\n\n");
- }
- }
-}
-
-void writeVObject(FILE *fp, VObject *o)
-{
- OFile ofp;
- initOFile(&ofp,fp);
- writeVObject_(&ofp,o);
-}
-
-DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- writeVObject(fp,o);
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- while (list) {
- writeVObject(fp,list);
- list = nextVObjectInList(list);
- }
- fclose(fp);
- }
-}
-
-DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o)
-{
- OFile ofp;
- initMemOFile(&ofp,s,len?*len:0);
- writeVObject_(&ofp,o);
- if (len) *len = ofp.len;
- appendcOFile(&ofp,0);
- return ofp.s;
-}
-
-DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list)
-{
- OFile ofp;
- initMemOFile(&ofp,s,len?*len:0);
- while (list) {
- writeVObject_(&ofp,list);
- list = nextVObjectInList(list);
- }
- if (len) *len = ofp.len;
- appendcOFile(&ofp,0);
- return ofp.s;
-}
-
-/*----------------------------------------------------------------------
- APIs to do fake Unicode stuff.
- ----------------------------------------------------------------------*/
-DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes)
-{
- wchar_t *r, *pw;
- int len = strlen(ps)+1;
-
- pw = r = (wchar_t*)malloc(sizeof(wchar_t)*len);
- if (bytes)
- *bytes = len * sizeof(wchar_t);
-
- while (*ps) {
- if (*ps == '\n')
- *pw = (wchar_t)0x2028;
- else if (*ps == '\r')
- *pw = (wchar_t)0x2029;
- else
- *pw = (wchar_t)(unsigned char)*ps;
- ps++; pw++;
- }
- *pw = (wchar_t)0;
-
- return r;
-}
-
-DLLEXPORT(int) uStrLen(const wchar_t *u)
-{
- int i = 0;
- while (*u != (wchar_t)0) { u++; i++; }
- return i;
-}
-
-DLLEXPORT(char*) fakeCString(const wchar_t *u)
-{
- char *s, *t;
- int len = uStrLen(u) + 1;
- t = s = (char*)malloc(len);
- while (*u) {
- if (*u == (wchar_t)0x2028)
- *t = '\n';
- else if (*u == (wchar_t)0x2029)
- *t = '\r';
- else
- *t = (char)*u;
- u++; t++;
- }
- *t = 0;
- return s;
-}
-
-// end of source file vobject.c
diff --git a/libversit/vobject.h b/libversit/vobject.h
deleted file mode 100644
index d5f1fa291f..0000000000
--- a/libversit/vobject.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
-
-The vCard/vCalendar C interface is implemented in the set
-of files as follows:
-
-vcc.y, yacc source, and vcc.c, the yacc output you will use
-implements the core parser
-
-vobject.c implements an API that insulates the caller from
-the parser and changes in the vCard/vCalendar BNF
-
-port.h defines compilation environment dependent stuff
-
-vcc.h and vobject.h are header files for their .c counterparts
-
-vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
-which you may find useful.
-
-test.c is a standalone test driver that exercises some of
-the features of the APIs provided. Invoke test.exe on a
-VCARD/VCALENDAR input text file and you will see the pretty
-print output of the internal representation (this pretty print
-output should give you a good idea of how the internal
-representation looks like -- there is one such output in the
-following too). Also, a file with the .out suffix is generated
-to show that the internal representation can be written back
-in the original text format.
-
-For more information on this API see the readme.txt file
-which accompanied this distribution.
-
- Also visit:
-
- http://www.versit.com
- http://www.ralden.com
-
-*/
-
-
-#ifndef __VOBJECT_H__
-#define __VOBJECT_H__ 1
-
-
-#include "port.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-#define VC7bitProp "7BIT"
-#define VC8bitProp "8BIT"
-#define VCAAlarmProp "AALARM"
-#define VCAdditionalNamesProp "ADDN"
-#define VCAdrProp "ADR"
-#define VCAgentProp "AGENT"
-#define VCAIFFProp "AIFF"
-#define VCAOLProp "AOL"
-#define VCAppleLinkProp "APPLELINK"
-#define VCAttachProp "ATTACH"
-#define VCAttendeeProp "ATTENDEE"
-#define VCATTMailProp "ATTMAIL"
-#define VCAudioContentProp "AUDIOCONTENT"
-#define VCAVIProp "AVI"
-#define VCBase64Prop "BASE64"
-#define VCBBSProp "BBS"
-#define VCBirthDateProp "BDAY"
-#define VCBMPProp "BMP"
-#define VCBodyProp "BODY"
-#define VCBusinessRoleProp "ROLE"
-#define VCCalProp "VCALENDAR"
-#define VCCaptionProp "CAP"
-#define VCCardProp "VCARD"
-#define VCCarProp "CAR"
-#define VCCategoriesProp "CATEGORIES"
-#define VCCellularProp "CELL"
-#define VCCGMProp "CGM"
-#define VCCharSetProp "CS"
-#define VCCIDProp "CID"
-#define VCCISProp "CIS"
-#define VCCityProp "L"
-#define VCClassProp "CLASS"
-#define VCCommentProp "NOTE"
-#define VCCompletedProp "COMPLETED"
-#define VCContentIDProp "CONTENT-ID"
-#define VCCountryNameProp "C"
-#define VCDAlarmProp "DALARM"
-#define VCDataSizeProp "DATASIZE"
-#define VCDayLightProp "DAYLIGHT"
-#define VCDCreatedProp "DCREATED"
-#define VCDeliveryLabelProp "LABEL"
-#define VCDescriptionProp "DESCRIPTION"
-#define VCDIBProp "DIB"
-#define VCDisplayStringProp "DISPLAYSTRING"
-#define VCDomesticProp "DOM"
-#define VCDTendProp "DTEND"
-#define VCDTstartProp "DTSTART"
-#define VCDueProp "DUE"
-#define VCEmailAddressProp "EMAIL"
-#define VCEncodingProp "ENCODING"
-#define VCEndProp "END"
-#define VCEventProp "VEVENT"
-#define VCEWorldProp "EWORLD"
-#define VCExNumProp "EXNUM"
-#define VCExpDateProp "EXDATE"
-#define VCExpectProp "EXPECT"
-#define VCExtAddressProp "EXT ADD"
-#define VCFamilyNameProp "F"
-#define VCFaxProp "FAX"
-#define VCFullNameProp "FN"
-#define VCGeoProp "GEO"
-#define VCGeoLocationProp "GEO"
-#define VCGIFProp "GIF"
-#define VCGivenNameProp "G"
-#define VCGroupingProp "Grouping"
-#define VCHomeProp "HOME"
-#define VCIBMMailProp "IBMMail"
-#define VCInlineProp "INLINE"
-#define VCInternationalProp "INTL"
-#define VCInternetProp "INTERNET"
-#define VCISDNProp "ISDN"
-#define VCJPEGProp "JPEG"
-#define VCLanguageProp "LANG"
-#define VCLastModifiedProp "LAST-MODIFIED"
-#define VCLastRevisedProp "REV"
-#define VCLocationProp "LOCATION"
-#define VCLogoProp "LOGO"
-#define VCMailerProp "MAILER"
-#define VCMAlarmProp "MALARM"
-#define VCMCIMailProp "MCIMAIL"
-#define VCMessageProp "MSG"
-#define VCMETProp "MET"
-#define VCModemProp "MODEM"
-#define VCMPEG2Prop "MPEG2"
-#define VCMPEGProp "MPEG"
-#define VCMSNProp "MSN"
-#define VCNamePrefixesProp "NPRE"
-#define VCNameProp "N"
-#define VCNameSuffixesProp "NSUF"
-#define VCNoteProp "NOTE"
-#define VCOrgNameProp "ORGNAME"
-#define VCOrgProp "ORG"
-#define VCOrgUnit2Prop "OUN2"
-#define VCOrgUnit3Prop "OUN3"
-#define VCOrgUnit4Prop "OUN4"
-#define VCOrgUnitProp "OUN"
-#define VCPagerProp "PAGER"
-#define VCPAlarmProp "PALARM"
-#define VCParcelProp "PARCEL"
-#define VCPartProp "PART"
-#define VCPCMProp "PCM"
-#define VCPDFProp "PDF"
-#define VCPGPProp "PGP"
-#define VCPhotoProp "PHOTO"
-#define VCPICTProp "PICT"
-#define VCPMBProp "PMB"
-#define VCPostalBoxProp "BOX"
-#define VCPostalCodeProp "PC"
-#define VCPostalProp "POSTAL"
-#define VCPowerShareProp "POWERSHARE"
-#define VCPreferredProp "PREF"
-#define VCPriorityProp "PRIORITY"
-#define VCProcedureNameProp "PROCEDURENAME"
-#define VCProdIdProp "PRODID"
-#define VCProdigyProp "PRODIGY"
-#define VCPronunciationProp "SOUND"
-#define VCPSProp "PS"
-#define VCPublicKeyProp "KEY"
-#define VCQPProp "QP"
-#define VCQuickTimeProp "QTIME"
-#define VCQuotedPrintableProp "QUOTED-PRINTABLE"
-#define VCRDateProp "RDATE"
-#define VCRegionProp "R"
-#define VCRelatedToProp "RELATED-TO"
-#define VCRepeatCountProp "REPEATCOUNT"
-#define VCResourcesProp "RESOURCES"
-#define VCRNumProp "RNUM"
-#define VCRoleProp "ROLE"
-#define VCRRuleProp "RRULE"
-#define VCRSVPProp "RSVP"
-#define VCRunTimeProp "RUNTIME"
-#define VCSequenceProp "SEQUENCE"
-#define VCSnoozeTimeProp "SNOOZETIME"
-#define VCStartProp "START"
-#define VCStatusProp "STATUS"
-#define VCStreetAddressProp "STREET"
-#define VCSubTypeProp "SUBTYPE"
-#define VCSummaryProp "SUMMARY"
-#define VCTelephoneProp "TEL"
-#define VCTIFFProp "TIFF"
-#define VCTimeZoneProp "TZ"
-#define VCTitleProp "TITLE"
-#define VCTLXProp "TLX"
-#define VCTodoProp "VTODO"
-#define VCTranspProp "TRANSP"
-#define VCUniqueStringProp "UID"
-#define VCURLProp "URL"
-#define VCURLValueProp "URLVAL"
-#define VCValueProp "VALUE"
-#define VCVersionProp "VERSION"
-#define VCVideoProp "VIDEO"
-#define VCVoiceProp "VOICE"
-#define VCWAVEProp "WAVE"
-#define VCWMFProp "WMF"
-#define VCWorkProp "WORK"
-#define VCX400Prop "X400"
-#define VCX509Prop "X509"
-#define VCXRuleProp "XRULE"
-
-
-typedef struct VObject VObject;
-
-typedef struct VObjectIterator {
- VObject* start;
- VObject* next;
- } VObjectIterator;
-
-extern DLLEXPORT(VObject*) newVObject(const char *id);
-extern DLLEXPORT(void) deleteVObject(VObject *p);
-extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
-extern DLLEXPORT(void) deleteStr(const char *p);
-extern DLLEXPORT(void) unUseStr(const char *s);
-
-extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
-extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
-extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
-extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s);
-extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s);
-extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
-extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
-extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
-extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
-extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
-
-extern DLLEXPORT(const char*) vObjectName(VObject *o);
-extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
-extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o);
-extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
-extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
-extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
-extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
-extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
-
-extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
-extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
-extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
-extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
-extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
-extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
-extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
-extern DLLEXPORT(void) addList(VObject **o, VObject *p);
-
-extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
-
-extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
-extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
-extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
-extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
-
-extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o);
-extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list);
-
-extern DLLEXPORT(const char*) lookupStr(const char *s);
-extern DLLEXPORT(void) cleanStrTbl();
-
-extern DLLEXPORT(void) cleanVObject(VObject *o);
-extern DLLEXPORT(void) cleanVObjects(VObject *list);
-
-extern DLLEXPORT(const char*) lookupProp(const char* str);
-extern DLLEXPORT(const char*) lookupProp_(const char* str);
-
-extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes);
-extern DLLEXPORT(int) uStrLen(const wchar_t *u);
-extern DLLEXPORT(char*) fakeCString(const wchar_t *u);
-
-extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o);
-extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list);
-extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
-extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
-
-extern DLLEXPORT(int) vObjectValueType(VObject *o);
-
-/* return type of vObjectValueType: */
-#define VCVT_NOVALUE 0
- /* if the VObject has no value associated with it. */
-#define VCVT_STRINGZ 1
- /* if the VObject has value set by setVObjectStringZValue. */
-#define VCVT_USTRINGZ 2
- /* if the VObject has value set by setVObjectUStringZValue. */
-#define VCVT_UINT 3
- /* if the VObject has value set by setVObjectIntegerValue. */
-#define VCVT_ULONG 4
- /* if the VObject has value set by setVObjectLongValue. */
-#define VCVT_RAW 5
- /* if the VObject has value set by setVObjectAnyValue. */
-#define VCVT_VOBJECT 6
- /* if the VObject has value set by setVObjectVObjectValue. */
-
-extern const char** fieldedProp;
-
-/* NOTE regarding printVObject and writeVObject
-
-The functions below are not exported from the DLL because they
-take a FILE* as a parameter, which cannot be passed across a DLL
-interface (at least that is my experience). Instead you can use
-their companion functions which take file names or pointers
-to memory. However, if you are linking this code into
-your build directly then you may find them a more convenient API
-and you can go ahead and use them. If you try to use them with
-the DLL LIB you will get a link error.
-*/
-extern void printVObject(FILE *fp,VObject *o);
-extern void writeVObject(FILE *fp, VObject *o);
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VOBJECT_H__ */
-
-