[Commits] Makefile.am NONE 1.1.2.1 Makefile.in NONE 1.1.2.1 common-views.c NONE 1.1.2.1 common-views.h NONE 1.1.2.1 day-view.c NONE 1.1.2.1 icaltime_as_local.c NONE 1.1.2.1 icaltime_as_local.h NONE 1.1.2.1 month-view.c NONE 1.1.2.1 placeholder.txt 1.1.2.1 NONE plugin.c NONE 1.1.2.1 vcal_dbus.c NONE 1.1.2.1 vcal_dbus.h NONE 1.1.2.1 vcal_folder.c NONE 1.1.2.1 vcal_folder.h NONE 1.1.2.1 vcal_interface.h NONE 1.1.2.1 vcal_manager.c NONE 1.1.2.1 vcal_manager.h NONE 1.1.2.1 vcal_meeting_gtk.c NONE 1.1.2.1 vcal_meeting_gtk.h NONE 1.1.2.1 vcal_prefs.c NONE 1.1.2.1 vcal_prefs.h NONE 1.1.2.1 vcalendar.c NONE 1.1.2.1 vcalendar.h NONE 1.1.2.1 version.rc NONE 1.1.2.1

colin at claws-mail.org colin at claws-mail.org
Wed Feb 13 21:50:31 CET 2013


Update of /home/claws-mail/claws/src/plugins/vcalendar
In directory srv:/tmp/cvs-serv22674/src/plugins/vcalendar

Added Files:
      Tag: gtk2
	Makefile.am Makefile.in common-views.c common-views.h 
	day-view.c icaltime_as_local.c icaltime_as_local.h 
	month-view.c plugin.c vcal_dbus.c vcal_dbus.h vcal_folder.c 
	vcal_folder.h vcal_interface.h vcal_manager.c vcal_manager.h 
	vcal_meeting_gtk.c vcal_meeting_gtk.h vcal_prefs.c 
	vcal_prefs.h vcalendar.c vcalendar.h version.rc 
Removed Files:
      Tag: gtk2
	placeholder.txt 
Log Message:
2013-02-13 [colin]	3.9.0cvs65

	* src/plugins/address_dup_finder/placeholder.txt
	* src/plugins/synce/placeholder.txt
		Removed, deprecated plugins
	* src/plugins/Makefile.am
	* src/plugins/vcalendar/Makefile.am
	* src/plugins/vcalendar/Makefile.in
	* src/plugins/vcalendar/common-views.c
	* src/plugins/vcalendar/common-views.h
	* src/plugins/vcalendar/day-view.c
	* src/plugins/vcalendar/icaltime_as_local.c
	* src/plugins/vcalendar/icaltime_as_local.h
	* src/plugins/vcalendar/month-view.c
	* src/plugins/vcalendar/placeholder.txt
	* src/plugins/vcalendar/plugin.c
	* src/plugins/vcalendar/vcal_dbus.c
	* src/plugins/vcalendar/vcal_dbus.h
	* src/plugins/vcalendar/vcal_folder.c
	* src/plugins/vcalendar/vcal_folder.h
	* src/plugins/vcalendar/vcal_interface.h
	* src/plugins/vcalendar/vcal_manager.c
	* src/plugins/vcalendar/vcal_manager.h
	* src/plugins/vcalendar/vcal_meeting_gtk.c
	* src/plugins/vcalendar/vcal_meeting_gtk.h
	* src/plugins/vcalendar/vcal_prefs.c
	* src/plugins/vcalendar/vcal_prefs.h
	* src/plugins/vcalendar/vcalendar.c
	* src/plugins/vcalendar/vcalendar.h
	* src/plugins/vcalendar/version.rc
	* src/plugins/vcalendar/libical/.cvsignore
	* src/plugins/vcalendar/libical/Makefile.am
	* src/plugins/vcalendar/libical/Makefile.in
	* src/plugins/vcalendar/libical/design-data/.cvsignore
	* src/plugins/vcalendar/libical/design-data/Makefile.am
	* src/plugins/vcalendar/libical/design-data/Makefile.in
	* src/plugins/vcalendar/libical/design-data/parameters.csv
	* src/plugins/vcalendar/libical/design-data/properties.csv
	* src/plugins/vcalendar/libical/design-data/restrictions.csv
	* src/plugins/vcalendar/libical/design-data/status.txt
	* src/plugins/vcalendar/libical/design-data/value-types.csv
	* src/plugins/vcalendar/libical/libical/.cvsignore
	* src/plugins/vcalendar/libical/libical/Makefile.am
	* src/plugins/vcalendar/libical/libical/Makefile.in
	* src/plugins/vcalendar/libical/libical/icalattendee.c
	* src/plugins/vcalendar/libical/libical/icalattendee.h
	* src/plugins/vcalendar/libical/libical/icalcomponent.c
	* src/plugins/vcalendar/libical/libical/icalcomponent.h
	* src/plugins/vcalendar/libical/libical/icalderivedparameter.c.in
	* src/plugins/vcalendar/libical/libical/icalderivedparameter.h.in
	* src/plugins/vcalendar/libical/libical/icalderivedproperty.c.in
	* src/plugins/vcalendar/libical/libical/icalderivedproperty.h.in
	* src/plugins/vcalendar/libical/libical/icalderivedvalue.c.in
	* src/plugins/vcalendar/libical/libical/icalderivedvalue.h.in
	* src/plugins/vcalendar/libical/libical/icalduration.c
	* src/plugins/vcalendar/libical/libical/icalduration.h
	* src/plugins/vcalendar/libical/libical/icalenums.c
	* src/plugins/vcalendar/libical/libical/icalenums.h
	* src/plugins/vcalendar/libical/libical/icalerror.c
	* src/plugins/vcalendar/libical/libical/icalerror.h
	* src/plugins/vcalendar/libical/libical/icallangbind.c
	* src/plugins/vcalendar/libical/libical/icallangbind.h
	* src/plugins/vcalendar/libical/libical/icallexer.l
	* src/plugins/vcalendar/libical/libical/icalmemory.c
	* src/plugins/vcalendar/libical/libical/icalmemory.h
	* src/plugins/vcalendar/libical/libical/icalmime.c
	* src/plugins/vcalendar/libical/libical/icalmime.h
	* src/plugins/vcalendar/libical/libical/icalparameter.c
	* src/plugins/vcalendar/libical/libical/icalparameter.h
	* src/plugins/vcalendar/libical/libical/icalparameterimpl.h
	* src/plugins/vcalendar/libical/libical/icalparser.c
	* src/plugins/vcalendar/libical/libical/icalparser.h
	* src/plugins/vcalendar/libical/libical/icalperiod.c
	* src/plugins/vcalendar/libical/libical/icalperiod.h
	* src/plugins/vcalendar/libical/libical/icalproperty.c
	* src/plugins/vcalendar/libical/libical/icalproperty.h
	* src/plugins/vcalendar/libical/libical/icalrecur.c
	* src/plugins/vcalendar/libical/libical/icalrecur.h
	* src/plugins/vcalendar/libical/libical/icalrestriction.c.in
	* src/plugins/vcalendar/libical/libical/icalrestriction.h
	* src/plugins/vcalendar/libical/libical/icaltime.c
	* src/plugins/vcalendar/libical/libical/icaltime.h
	* src/plugins/vcalendar/libical/libical/icaltypes.c
	* src/plugins/vcalendar/libical/libical/icaltypes.h
	* src/plugins/vcalendar/libical/libical/icalvalue.c
	* src/plugins/vcalendar/libical/libical/icalvalue.h
	* src/plugins/vcalendar/libical/libical/icalvalueimpl.h
	* src/plugins/vcalendar/libical/libical/icalversion.h
	* src/plugins/vcalendar/libical/libical/icalversion.h.in
	* src/plugins/vcalendar/libical/libical/icalyacc.output
	* src/plugins/vcalendar/libical/libical/icalyacc.y
	* src/plugins/vcalendar/libical/libical/pvl.c
	* src/plugins/vcalendar/libical/libical/pvl.h
	* src/plugins/vcalendar/libical/libical/sspm.c
	* src/plugins/vcalendar/libical/libical/sspm.h
	* src/plugins/vcalendar/libical/libical/vsnprintf.c
	* src/plugins/vcalendar/libical/scripts/.cvsignore
	* src/plugins/vcalendar/libical/scripts/Makefile.am
	* src/plugins/vcalendar/libical/scripts/Makefile.in
	* src/plugins/vcalendar/libical/scripts/mkderivedcomponents.pl
	* src/plugins/vcalendar/libical/scripts/mkderivedparameters.pl
	* src/plugins/vcalendar/libical/scripts/mkderivedproperties.pl
	* src/plugins/vcalendar/libical/scripts/mkderivedvalues.pl
	* src/plugins/vcalendar/libical/scripts/mkparameterrestrictions.pl
	* src/plugins/vcalendar/libical/scripts/mkrestrictionrecords.pl
	* src/plugins/vcalendar/libical/scripts/mkrestrictiontable.pl
	* src/plugins/vcalendar/libical/scripts/readvaluesfile.pl
		Add vcalendar.

--- NEW FILE: common-views.h ---
/* Copyright (c) 2007-2008 Juha Kautto (juha at xfce.org)
 * Copyright (c) 2008 Colin Leroy (colin at colino.net)
 *
 * 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 3 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.
 */

#ifndef __COMMON_VIEWS_H__
#define __COMMON_VIEWS_H__

#include <string.h>
#include <time.h>

#include <glib.h>
#include <glib/gprintf.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

#include "summaryview.h"
#include "vcalendar.h"
#include "vcal_folder.h"
#include "vcal_prefs.h"
#include "vcal_manager.h"
#include "vcal_meeting_gtk.h"

GtkWidget *build_line(gint start_x, gint start_y
        , gint width, gint height, GtkWidget *hour_line, GdkColor *line_color);
void orage_move_day(struct tm *t, int day);
gint orage_days_between(struct tm *t1, struct tm *t2);
gint vcal_view_set_calendar_page(GtkWidget *to_show, GCallback cb, gpointer data);
void vcal_view_set_summary_page(GtkWidget *to_remove, guint selsig);
void vcal_view_select_event (const gchar *uid, FolderItem *item, gboolean edit,
		    	    GCallback block_cb, gpointer block_data);
void vcal_view_create_popup_menus(gpointer data, 
				GtkWidget **view_menu,
				GtkWidget **event_menu, GtkActionGroup **event_group,
				GtkUIManager **ui_manager);

#endif

--- NEW FILE: Makefile.in ---
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@


VPATH = @srcdir@
am__make_dryrun = \
  { \
    am__dry=no; \
    case $$MAKEFLAGS in \
      *\\[\ \	]*) \
        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
      *) \
        for am__flg in $$MAKEFLAGS; do \
          case $$am__flg in \
            *=*|--*) ;; \
            *n*) am__dry=yes; break;; \
          esac; \
        done;; \
    esac; \
    test $$am__dry = yes; \
  }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/plugins/vcalendar
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
	$(vcalendarinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/check-type.m4 \
	$(top_srcdir)/m4/gnupg-check-typedef.m4 \
	$(top_srcdir)/m4/gnupg.m4 $(top_srcdir)/m4/gpgme.m4 \
	$(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/libtool.m4 \
	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
	$(top_srcdir)/m4/spamassassin.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h \
	$(top_builddir)/claws-features.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    if (++n[$$2] == $(am__install_max)) \
      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    END { for (dir in files) print dir, files[dir] }'
am__base_list = \
  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
  test -z "$$files" \
    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
         $(am__cd) "$$dir" && rm -f $$files; }; \
  }
am__installdirs = "$(DESTDIR)$(plugindir)" \
	"$(DESTDIR)$(vcalendarincludedir)"
LTLIBRARIES = $(plugin_LTLIBRARIES)
am__DEPENDENCIES_1 =
am_vcalendar_la_OBJECTS = plugin.lo vcalendar.lo vcal_manager.lo \
	vcal_folder.lo vcal_meeting_gtk.lo vcal_prefs.lo vcal_dbus.lo \
	icaltime_as_local.lo common-views.lo day-view.lo month-view.lo
vcalendar_la_OBJECTS = $(am_vcalendar_la_OBJECTS)
vcalendar_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(vcalendar_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
	$(LDFLAGS) -o $@
SOURCES = $(vcalendar_la_SOURCES)
DIST_SOURCES = $(vcalendar_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
	html-recursive info-recursive install-data-recursive \
	install-dvi-recursive install-exec-recursive \
	install-html-recursive install-info-recursive \
	install-pdf-recursive install-ps-recursive install-recursive \
	installcheck-recursive installdirs-recursive pdf-recursive \
	ps-recursive uninstall-recursive
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac
HEADERS = $(vcalendarinclude_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
  distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
	distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
  sed_rest='s,^[^/]*/*,,'; \
  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
  sed_butlast='s,/*[^/]*$$,,'; \
  while test -n "$$dir1"; do \
    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
    if test "$$first" != "."; then \
      if test "$$first" = ".."; then \
        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
      else \
        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
        if test "$$first2" = "$$first"; then \
          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
        else \
          dir2="../$$dir2"; \
        fi; \
        dir0="$$dir0"/"$$first"; \
      fi; \
    fi; \
    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
  done; \
  reldir="$$dir2"
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPFACE_LIBS = @COMPFACE_LIBS@
CONIC_CFLAGS = @CONIC_CFLAGS@
CONIC_LIBS = @CONIC_LIBS@
CONTACTS_CFLAGS = @CONTACTS_CFLAGS@
CONTACTS_LIBS = @CONTACTS_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPT_LIBS = @CRYPT_LIBS@
CURL_CFLAGS = @CURL_CFLAGS@
CURL_LIBS = @CURL_LIBS@
CYGPATH_W = @CYGPATH_W@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOCBOOK2HTML = @DOCBOOK2HTML@
DOCBOOK2PDF = @DOCBOOK2PDF@
DOCBOOK2PS = @DOCBOOK2PS@
DOCBOOK2TXT = @DOCBOOK2TXT@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENCHANT_CFLAGS = @ENCHANT_CFLAGS@
ENCHANT_LIBS = @ENCHANT_LIBS@
EXEEXT = @EXEEXT@
EXTRA_VERSION = @EXTRA_VERSION@
FGREP = @FGREP@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNOME2_CFLAGS = @GNOME2_CFLAGS@
GNOME2_LIBS = @GNOME2_LIBS@
GNOME_CONFIG = @GNOME_CONFIG@
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
GNUTLS_LIBS = @GNUTLS_LIBS@
GPGME_CFLAGS = @GPGME_CFLAGS@
GPGME_CONFIG = @GPGME_CONFIG@
GPGME_LIBS = @GPGME_LIBS@
GREP = @GREP@
GTKPRINTUNIX_CFLAGS = @GTKPRINTUNIX_CFLAGS@
GTKPRINTUNIX_LIBS = @GTKPRINTUNIX_LIBS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
JPILOT_LIBS = @JPILOT_LIBS@
LD = @LD@
LDAP_LIBS = @LDAP_LIBS@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBETPAN_FLAGS = @LIBETPAN_FLAGS@
LIBETPAN_LIBS = @LIBETPAN_LIBS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@
LIBSOUP_GNOME_CFLAGS = @LIBSOUP_GNOME_CFLAGS@
LIBSOUP_GNOME_LIBS = @LIBSOUP_GNOME_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
MAEMO_CFLAGS = @MAEMO_CFLAGS@
MAEMO_LIBS = @MAEMO_LIBS@
MAINT = @MAINT@
MAJOR_VERSION = @MAJOR_VERSION@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MICRO_VERSION = @MICRO_VERSION@
MINOR_VERSION = @MINOR_VERSION@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
NETWORKMANAGER_SUPPORT_CFLAGS = @NETWORKMANAGER_SUPPORT_CFLAGS@
NETWORKMANAGER_SUPPORT_LIBS = @NETWORKMANAGER_SUPPORT_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PASSCRYPT_KEY = @PASSCRYPT_KEY@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSUB = @POSUB@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SM_LIBS = @SM_LIBS@
STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@
STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
VALGRIND_LIBS = @VALGRIND_LIBS@
VERSION = @VERSION@
WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
WEBKIT_LIBS = @WEBKIT_LIBS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_cv_enable_crash_dialog = @ac_cv_enable_crash_dialog@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gnomedatadir = @gnomedatadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libetpanconfig = @libetpanconfig@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
manualdir = @manualdir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = libical
EXTRA_DIST = claws.def plugin.def version.rc
@OS_WIN32_TRUE at LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RC) \
@OS_WIN32_TRUE@     `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
@OS_WIN32_TRUE@     sed -e 's/-I/--include-dir /g;s/-D/--define /g'`

@OS_WIN32_FALSE at plugin_res = 
@OS_WIN32_TRUE at plugin_res = version.lo
@OS_WIN32_FALSE at plugin_res_ldflag = 
@OS_WIN32_TRUE at plugin_res_ldflag = -Wl,.libs/version.o
@OS_WIN32_FALSE at export_symbols = 
@OS_WIN32_TRUE at export_symbols = -export-symbols $(srcdir)/plugin.def
@OS_WIN32_FALSE at plugin_deps = 
@OS_WIN32_TRUE at plugin_deps = libclaws.a $(plugin_res) plugin.def
@OS_WIN32_FALSE at plugin_ldadd = 
@OS_WIN32_TRUE at plugin_ldadd = -L. -lclaws
@PLATFORM_WIN32_FALSE at no_undefined = 
@PLATFORM_WIN32_TRUE at no_undefined = -no-undefined
@CYGWIN_FALSE at cygwin_export_lib = 
@CYGWIN_TRUE at cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = vcalendar.la
INCLUDES = \
	-I$(top_srcdir)/src \
	-I$(top_srcdir)/src/common \
	-I$(top_builddir)/src/common \
	-I$(top_srcdir)/src/gtk \
	-I$(top_srcdir)/src/plugins/vcalendar/libical/libical

vcalendar_la_SOURCES = \
	plugin.c \
	vcalendar.c vcalendar.h \
	vcal_manager.c vcal_manager.h \
	vcal_folder.c vcal_folder.h \
	vcal_meeting_gtk.c vcal_meeting_gtk.h \
	vcal_prefs.c vcal_prefs.h \
	vcal_dbus.c vcal_dbus.h \
	icaltime_as_local.c icaltime_as_local.h \
	common-views.c common-views.h \
	day-view.c month-view.c

vcalendarincludedir = $(includedir)/claws-mail/plugins/vcalendar
vcalendarinclude_HEADERS = \
	vcal_interface.h

vcalendar_la_LDFLAGS = \
	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
	-avoid-version -module \
	$(GTK_LIBS)

vcalendar_la_DEPENDENCIES = $(plugin_deps)
vcalendar_la_LIBADD = $(plugin_ldadd) $(cygwin_export_lib) \
	$(GTK_LIBS) \
        $(top_builddir)/src/plugins/vcalendar/libical/libical/libical.la

AM_CPPFLAGS = \
	$(CLAWS_MAIL_CFLAGS) \
	$(GLIB_CFLAGS) \
	$(GTK_CFLAGS) \
	-DLOCALEDIR=\""$(localedir)"\"

all: all-recursive

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
	        && { if test -f $@; then exit 0; else break; fi; }; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/plugins/vcalendar/Makefile'; \
	$(am__cd) $(top_srcdir) && \
	  $(AUTOMAKE) --foreign src/plugins/vcalendar/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
	@$(NORMAL_INSTALL)
	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
	list2=; for p in $$list; do \
	  if test -f $$p; then \
	    list2="$$list2 $$p"; \
	  else :; fi; \
	done; \
	test -z "$$list2" || { \
	  echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
	}

uninstall-pluginLTLIBRARIES:
	@$(NORMAL_UNINSTALL)
	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
	done

clean-pluginLTLIBRARIES:
	-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
	@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
	  test "$$dir" != "$$p" || dir=.; \
	  echo "rm -f \"$${dir}/so_locations\""; \
	  rm -f "$${dir}/so_locations"; \
	done
vcalendar.la: $(vcalendar_la_OBJECTS) $(vcalendar_la_DEPENDENCIES) $(EXTRA_vcalendar_la_DEPENDENCIES) 
	$(vcalendar_la_LINK) -rpath $(plugindir) $(vcalendar_la_OBJECTS) $(vcalendar_la_LIBADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/common-views.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/day-view.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/icaltime_as_local.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/month-view.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/plugin.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcal_dbus.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcal_folder.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcal_manager.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcal_meeting_gtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcal_prefs.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vcalendar.Plo at am__quote@

.c.o:
@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c $<

.c.obj:
@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`

.c.lo:
@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs
install-vcalendarincludeHEADERS: $(vcalendarinclude_HEADERS)
	@$(NORMAL_INSTALL)
	@list='$(vcalendarinclude_HEADERS)'; test -n "$(vcalendarincludedir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(vcalendarincludedir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(vcalendarincludedir)" || exit 1; \
	fi; \
	for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(vcalendarincludedir)'"; \
	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(vcalendarincludedir)" || exit $$?; \
	done

uninstall-vcalendarincludeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(vcalendarinclude_HEADERS)'; test -n "$(vcalendarincludedir)" || list=; \
	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
	dir='$(DESTDIR)$(vcalendarincludedir)'; $(am__uninstall_files_from_dir)

# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
#     (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
	@fail= failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"

$(RECURSIVE_CLEAN_TARGETS):
	@fail= failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	case "$@" in \
	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	  *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; for subdir in $$list; do \
	  if test "$$subdir" = "."; then :; else \
	    rev="$$subdir $$rev"; \
	  fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done && test -z "$$fail"
tags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
	done
ctags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
	done

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	mkid -fID $$unique
tags: TAGS

TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	set x; \
	here=`pwd`; \
	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
	  include_option=--etags-include; \
	  empty_fix=.; \
	else \
	  include_option=--include; \
	  empty_fix=; \
	fi; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test ! -f $$subdir/TAGS || \
	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
	  fi; \
	done; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	shift; \
	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  if test $$# -gt 0; then \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      "$$@" $$unique; \
	  else \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      $$unique; \
	  fi; \
	fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	test -z "$(CTAGS_ARGS)$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && $(am__cd) $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) "$$here"

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
	  dist_files=`for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
	case $$dist_files in \
	  */*) $(MKDIR_P) `echo "$$dist_files" | \
			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
			   sort -u` ;; \
	esac; \
	for file in $$dist_files; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  if test -d $$d/$$file; then \
	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
	    if test -d "$(distdir)/$$file"; then \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
	  else \
	    test -f "$(distdir)/$$file" \
	    || cp -p $$d/$$file "$(distdir)/$$file" \
	    || exit 1; \
	  fi; \
	done
	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    $(am__make_dryrun) \
	      || test -d "$(distdir)/$$subdir" \
	      || $(MKDIR_P) "$(distdir)/$$subdir" \
	      || exit 1; \
	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
	    $(am__relativize); \
	    new_distdir=$$reldir; \
	    dir1=$$subdir; dir2="$(top_distdir)"; \
	    $(am__relativize); \
	    new_top_distdir=$$reldir; \
	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
	    ($(am__cd) $$subdir && \
	      $(MAKE) $(AM_MAKEFLAGS) \
	        top_distdir="$$new_top_distdir" \
	        distdir="$$new_distdir" \
		am__remove_distdir=: \
		am__skip_length_check=: \
		am__skip_mode_fix=: \
	        distdir) \
	      || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
	for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(vcalendarincludedir)"; do \
	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
	done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
	if test -z '$(STRIP)'; then \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	      install; \
	else \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
	fi
mostlyclean-generic:

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive

clean-am: clean-generic clean-libtool clean-local \
	clean-pluginLTLIBRARIES mostlyclean-am

distclean: distclean-recursive
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-tags

dvi: dvi-recursive

dvi-am:

html: html-recursive

html-am:

info: info-recursive

info-am:

install-data-am: install-pluginLTLIBRARIES \
	install-vcalendarincludeHEADERS

install-dvi: install-dvi-recursive

install-dvi-am:

install-exec-am:

install-html: install-html-recursive

install-html-am:

install-info: install-info-recursive

install-info-am:

install-man:

install-pdf: install-pdf-recursive

install-pdf-am:

install-ps: install-ps-recursive

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-recursive
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-recursive

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool

pdf: pdf-recursive

pdf-am:

ps: ps-recursive

ps-am:

uninstall-am: uninstall-pluginLTLIBRARIES \
	uninstall-vcalendarincludeHEADERS

.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
	install-am install-strip tags-recursive

.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
	all all-am check check-am clean clean-generic clean-libtool \
	clean-local clean-pluginLTLIBRARIES ctags ctags-recursive \
	distclean distclean-compile distclean-generic \
	distclean-libtool distclean-tags distdir dvi dvi-am html \
	html-am info info-am install install-am install-data \
	install-data-am install-dvi install-dvi-am install-exec \
	install-exec-am install-html install-html-am install-info \
	install-info-am install-man install-pdf install-pdf-am \
	install-pluginLTLIBRARIES install-ps install-ps-am \
	install-strip install-vcalendarincludeHEADERS installcheck \
	installcheck-am installdirs installdirs-am maintainer-clean \
	maintainer-clean-generic mostlyclean mostlyclean-compile \
	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
	tags tags-recursive uninstall uninstall-am \
	uninstall-pluginLTLIBRARIES uninstall-vcalendarincludeHEADERS


@OS_WIN32_TRUE@%.lo : %.rc
@OS_WIN32_TRUE@	$(LTRCCOMPILE) -i $< -o $@

@OS_WIN32_TRUE at libclaws.a: claws.def
@OS_WIN32_TRUE@	$(DLLTOOL) --output-lib $@ --def $<

clean-local:
	rm -f libclaws.a

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: common-views.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 *
 * Copyright (c) 2007-2008 Juha Kautto (juha at xfce.org)
 * Copyright (c) 2008 Colin Leroy (colin at colino.net)
 *
 * 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 3 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.
 */

#ifdef HAVE_CONFIG_H
#  include "config.h"
#include "claws-features.h"
#endif

#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "defs.h"

#include <string.h>
#include <time.h>

#include <glib.h>
#include <glib/gprintf.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

#include "summaryview.h"
#include "vcalendar.h"
#include "vcal_folder.h"
#include "vcal_prefs.h"
#include "vcal_manager.h"
#include "vcal_meeting_gtk.h"
#include "menu.h"


static void view_new_meeting_cb			(GtkAction	*action,
						 gpointer	 user_data);
static void view_edit_meeting_cb		(GtkAction	*action,
						 gpointer	 user_data);
static void view_cancel_meeting_cb		(GtkAction	*action,
						 gpointer	 user_data);
static void view_go_today_cb			(GtkAction	*action,
						 gpointer	 user_data);

static GtkActionEntry view_event_popup_entries[] = 
{
	{"VcalViewEvent",		NULL, "VcalViewEvent" },
	{"VcalViewEvent/EditMeeting",	NULL, N_("_Edit this meeting..."), NULL, NULL, G_CALLBACK(view_edit_meeting_cb) },
	{"VcalViewEvent/CancelMeeting",	NULL, N_("_Cancel this meeting..."), NULL, NULL, G_CALLBACK(view_cancel_meeting_cb) },
	{"VcalViewEvent/---",		NULL, "---", NULL, NULL, NULL },
	{"VcalViewEvent/CreateMeeting",	NULL, N_("_Create new meeting..."), NULL, NULL, G_CALLBACK(view_new_meeting_cb) },

	{"VcalViewEvent/GoToday",		NULL, N_("_Go to today"), NULL, NULL, G_CALLBACK(view_go_today_cb) },
};

GtkWidget *build_line(gint start_x, gint start_y
        , gint width, gint height, GtkWidget *hour_line, GdkColor *line_color)
{
    GdkColormap *pic1_cmap;
    GdkVisual *pic1_vis;
    GdkPixmap *pic1;
    GdkGC *pic1_gc;
    GtkWidget *new_hour_line;
    gint depth = 16;
    gboolean first = FALSE;

    /*
     * GdkPixbuf *scaled;
    scaled = gdk_pixbuf_scale_simple (pix, w, h, GDK_INTERP_BILINEAR);
    */
     
    pic1_cmap = gdk_colormap_get_system();
    pic1_vis = gdk_colormap_get_visual(pic1_cmap);
    depth = pic1_vis->depth;
    if (hour_line == NULL) {
        pic1 = gdk_pixmap_new(NULL, width, height, depth);
        gdk_drawable_set_colormap(pic1, pic1_cmap);
        first = TRUE;
    }
    else
        gtk_image_get_pixmap(GTK_IMAGE(hour_line), &pic1, NULL);
    pic1_gc = gdk_gc_new(pic1);
    if (first) {
        gdk_gc_set_foreground(pic1_gc, line_color);
        gdk_draw_rectangle(pic1, pic1_gc, TRUE, start_x, start_y, width, height);
    }
    else {
        gdk_draw_rectangle(pic1, pic1_gc, TRUE, start_x, start_y, width, height);
    }
    
    new_hour_line = gtk_image_new_from_pixmap(pic1, NULL);
    g_object_unref(pic1_gc);
    g_object_unref(pic1);
    return(new_hour_line);
}

/* move one day forward or backward */
void orage_move_day(struct tm *t, int day)
{
    guint monthdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    t->tm_year += 1900;
    if (((t->tm_year%4) == 0) 
    && (((t->tm_year%100) != 0) || ((t->tm_year%400) == 0)))
        ++monthdays[1]; /* leap year, february has 29 days */

    t->tm_mday += day; /* may be negative */
    if (t->tm_mday == 0) { /*  we went to previous month */
        if (--t->tm_mon == -1) { /* previous year */
            --t->tm_year;
            t->tm_mon = 11;
        }
        t->tm_mday = monthdays[t->tm_mon];
    }
    else if (t->tm_mday > (monthdays[t->tm_mon])) { /* next month */
        if (++t->tm_mon == 12) {
            ++t->tm_year;
            t->tm_mon = 0;
        }
        t->tm_mday = 1;
    }
    t->tm_year -= 1900;
    t->tm_wday += day; 
    if (t->tm_wday < 0)
        t->tm_wday = 6;
    t->tm_wday %=7;
}

gint orage_days_between(struct tm *t1, struct tm *t2)
{
    GDate *g_t1, *g_t2;
    gint dd;
    g_t1 = g_date_new_dmy(t1->tm_mday, t1->tm_mon, t1->tm_year);
    g_t2 = g_date_new_dmy(t2->tm_mday, t2->tm_mon, t2->tm_year);
    dd = g_date_days_between(g_t1, g_t2);
    g_date_free(g_t1);
    g_date_free(g_t2);
    return(dd);
}

gint vcal_view_set_calendar_page(GtkWidget *to_show, GCallback cb, gpointer data)
{
    SummaryView *summaryview = NULL;
    gint selsig = -1;
    if (mainwindow_get_mainwindow()) {
	summaryview = mainwindow_get_mainwindow()->summaryview;
	gtk_container_add(GTK_CONTAINER(summaryview->mainwidget_book),
		to_show);
	gtk_notebook_set_current_page(GTK_NOTEBOOK(summaryview->mainwidget_book),
		gtk_notebook_page_num(GTK_NOTEBOOK(summaryview->mainwidget_book), 
		to_show));
	main_window_set_menu_sensitive(mainwindow_get_mainwindow());
	toolbar_main_set_sensitive(mainwindow_get_mainwindow());
	selsig = g_signal_connect(G_OBJECT(summaryview->ctree), "tree_select_row",
			 G_CALLBACK(cb), data);
    }
    return selsig;
}

void vcal_view_set_summary_page(GtkWidget *to_remove, guint selsig)
{
    SummaryView *summaryview = NULL;
    if (mainwindow_get_mainwindow()) {
	summaryview = mainwindow_get_mainwindow()->summaryview;
        if (selsig)
        	g_signal_handler_disconnect(G_OBJECT(summaryview->ctree), selsig);
	gtk_container_remove(GTK_CONTAINER(summaryview->mainwidget_book),
		to_remove);
	gtk_notebook_set_current_page(GTK_NOTEBOOK(summaryview->mainwidget_book),
		gtk_notebook_page_num(GTK_NOTEBOOK(summaryview->mainwidget_book), 
		summaryview->scrolledwin));
	main_window_set_menu_sensitive(mainwindow_get_mainwindow());
	toolbar_main_set_sensitive(mainwindow_get_mainwindow());
    }
	
}

void vcal_view_select_event (const gchar *uid, FolderItem *item, gboolean edit,
		    	    GCallback block_cb, gpointer block_data)
{
	if (edit) {
    		VCalEvent *event = NULL;
        	event = vcal_manager_load_event(uid);
		if (event) {
			vcal_meeting_create(event);
			vcal_manager_free_event(event);
        	}
	} else {
        	SummaryView *summaryview = NULL;
		if (mainwindow_get_mainwindow()) {
		   MsgInfo *info = folder_item_get_msginfo_by_msgid(item, uid);
		   if (info) {
			   summaryview = mainwindow_get_mainwindow()->summaryview;
			   g_signal_handlers_block_by_func(G_OBJECT(summaryview->ctree),
					       G_CALLBACK(block_cb), block_data);
			   summary_select_by_msgnum(summaryview, info->msgnum);
			   summary_display_msg_selected(summaryview, FALSE);
			   procmsg_msginfo_free(info);
			   g_signal_handlers_unblock_by_func(G_OBJECT(summaryview->ctree),
					       G_CALLBACK(block_cb), block_data);
		   }
		}
	}
}

void vcal_view_create_popup_menus(gpointer data, 
				GtkWidget **view_menu,
				GtkWidget **event_menu, GtkActionGroup **event_group,
				GtkUIManager **ui_manager)
{
	*ui_manager = gtk_ui_manager_new();
	*event_group = cm_menu_create_action_group_full(*ui_manager,"VcalViewEvent", view_event_popup_entries,
			G_N_ELEMENTS(view_event_popup_entries), (gpointer)data);

	MENUITEM_ADDUI_MANAGER(*ui_manager, "/", "Menus", "Menus", GTK_UI_MANAGER_MENUBAR)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus", "VcalView", "VcalViewEvent", GTK_UI_MANAGER_MENU)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalView", "CreateMeeting", "VcalViewEvent/CreateMeeting", GTK_UI_MANAGER_MENUITEM)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalView", "Separator1", "VcalViewEvent/---", GTK_UI_MANAGER_SEPARATOR)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalView", "GoToday", "VcalViewEvent/GoToday", GTK_UI_MANAGER_MENUITEM)

	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus", "VcalViewEvent", "VcalViewEvent", GTK_UI_MANAGER_MENU)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "EditMeeting", "VcalViewEvent/EditMeeting", GTK_UI_MANAGER_MENUITEM)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "CancelMeeting", "VcalViewEvent/CancelMeeting", GTK_UI_MANAGER_MENUITEM)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "Separator1", "VcalViewEvent/---", GTK_UI_MANAGER_SEPARATOR)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "CreateMeeting", "VcalViewEvent/CreateMeeting", GTK_UI_MANAGER_MENUITEM)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "Separator2", "VcalViewEvent/---", GTK_UI_MANAGER_SEPARATOR)
	MENUITEM_ADDUI_MANAGER(*ui_manager, "/Menus/VcalViewEvent", "GoToday", "VcalViewEvent/GoToday", GTK_UI_MANAGER_MENUITEM)

	*view_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
				gtk_ui_manager_get_widget(*ui_manager, "/Menus/VcalView")) );
	*event_menu= gtk_menu_item_get_submenu(GTK_MENU_ITEM(
				gtk_ui_manager_get_widget(*ui_manager, "/Menus/VcalViewEvent")) );
}

static void view_new_meeting_cb			(GtkAction	*action,
						 gpointer	 user_data)
{
	gpointer data_i = g_object_get_data(G_OBJECT(user_data), "menu_data_i");
	gpointer data_s = g_object_get_data(G_OBJECT(user_data), "menu_data_s");
	gpointer win = g_object_get_data(G_OBJECT(user_data), "menu_win");
	void (*cb)(gpointer win, gpointer data_i, gpointer data_s) = 
		g_object_get_data(G_OBJECT(user_data), "new_meeting_cb");
	if (cb)
		cb(win, data_i, data_s);
}
static void view_edit_meeting_cb		(GtkAction	*action,
						 gpointer	 user_data)
{
	gpointer data_i = g_object_get_data(G_OBJECT(user_data), "menu_data_i");
	gpointer data_s = g_object_get_data(G_OBJECT(user_data), "menu_data_s");
	gpointer win = g_object_get_data(G_OBJECT(user_data), "menu_win");
	void (*cb)(gpointer win, gpointer data_i, gpointer data_s) = 
		g_object_get_data(G_OBJECT(user_data), "edit_meeting_cb");
	if (cb)
		cb(win, data_i, data_s);
}
static void view_cancel_meeting_cb		(GtkAction	*action,
						 gpointer	 user_data)
{
	gpointer data_i = g_object_get_data(G_OBJECT(user_data), "menu_data_i");
	gpointer data_s = g_object_get_data(G_OBJECT(user_data), "menu_data_s");
	gpointer win = g_object_get_data(G_OBJECT(user_data), "menu_win");
	void (*cb)(gpointer win, gpointer data_i, gpointer data_s) = 
		g_object_get_data(G_OBJECT(user_data), "cancel_meeting_cb");
	if (cb)
		cb(win, data_i, data_s);
}
static void view_go_today_cb			(GtkAction	*action,
						 gpointer	 user_data)
{
	gpointer data_i = g_object_get_data(G_OBJECT(user_data), "menu_data_i");
	gpointer data_s = g_object_get_data(G_OBJECT(user_data), "menu_data_s");
	gpointer win = g_object_get_data(G_OBJECT(user_data), "menu_win");
	void (*cb)(gpointer win, gpointer data_i, gpointer data_s) = 
		g_object_get_data(G_OBJECT(user_data), "go_today_cb");
	if (cb)
		cb(win, data_i, data_s);
}

--- NEW FILE: day-view.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 *
 * Copyright (c) 2007-2008 Juha Kautto (juha at xfce.org)
 * Copyright (c) 2008 Colin Leroy (colin at colino.net)
 *
 * 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 3 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.
 */

#ifdef HAVE_CONFIG_H
#  include "config.h"
#include "claws-features.h"
#endif

#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "defs.h"

#ifdef USE_PTHREAD
#include <pthread.h>
#endif
#include <string.h>
#include <time.h>

#include <glib.h>
#include <glib/gprintf.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

#include "summaryview.h"
#include "vcalendar.h"
#include "vcal_folder.h"
#include "vcal_prefs.h"
#include "vcal_manager.h"
#include "common-views.h"
#include "vcal_meeting_gtk.h"

#define MAX_DAYS 40
struct _day_win
{
    GtkAccelGroup *accel_group;
#if !GTK_CHECK_VERSION(2,12,0)
    GtkTooltips   *Tooltips;
#endif
    GtkWidget *Window;
    GtkWidget *Vbox;

    GtkWidget *Menubar;
    GtkWidget *File_menu;
    GtkWidget *File_menu_new;
    GtkWidget *File_menu_close;
    GtkWidget *View_menu;
    GtkWidget *View_menu_refresh;
    GtkWidget *Go_menu;
    GtkWidget *Go_menu_today;
    GtkWidget *Go_menu_prev;
    GtkWidget *Go_menu_next;

    GtkWidget *Toolbar;
    GtkWidget *Create_toolbutton;
    GtkWidget *Previous_toolbutton;
    GtkWidget *Today_toolbutton;
    GtkWidget *Next_toolbutton;
    GtkWidget *Refresh_toolbutton;
    GtkWidget *Close_toolbutton;

    GtkWidget *StartDate_button;
    GtkRequisition StartDate_button_req;
    GtkWidget *day_spin;

    GtkWidget *day_view_vbox;
    GtkWidget *scroll_win_h;
    GtkWidget *dtable_h; /* header of day table */
    GtkWidget *scroll_win;
    GtkWidget *dtable;   /* day table */
    GtkRequisition hour_req;

    GtkWidget *header[MAX_DAYS];
    GtkWidget *element[24][MAX_DAYS];
    GtkWidget *line[24][MAX_DAYS];

    guint upd_timer;
    gdouble scroll_pos; /* remember the scroll position */

    GdkColor bg1, bg2, line_color, bg_today, fg_sunday;
    GList    *apptw_list; /* keep track of appointments being updated */
    struct tm startdate;
    FolderItem *item;
    gulong selsig;
    GtkWidget *view_menu;
    GtkWidget *event_menu;
    GtkActionGroup *event_group;
    GtkUIManager *ui_manager;
};

static gchar *get_locale_date(struct tm *tmdate)
{
	gchar *d = g_malloc(100);
	strftime(d, 99, "%x", tmdate);
	return d;
}

static void set_scroll_position(day_win *dw)
{
    GtkAdjustment *v_adj;

    v_adj = gtk_scrolled_window_get_vadjustment(
            GTK_SCROLLED_WINDOW(dw->scroll_win));
    if (dw->scroll_pos > 0) /* we have old value */
        gtk_adjustment_set_value(v_adj, dw->scroll_pos);
    else if (dw->scroll_pos < 0)
        /* default: let's try to start roughly from line 8 = 8 o'clock */
        gtk_adjustment_set_value(v_adj, v_adj->upper/3);
    gtk_adjustment_changed(v_adj);
}

static gboolean scroll_position_timer(gpointer user_data)
{
    set_scroll_position((day_win *)user_data);
    return(FALSE); /* only once */
}

static void get_scroll_position(day_win *dw)
{
    GtkAdjustment *v_adj;

    v_adj = gtk_scrolled_window_get_vadjustment(
            GTK_SCROLLED_WINDOW(dw->scroll_win));
    dw->scroll_pos = gtk_adjustment_get_value(v_adj);
}

void dw_close_window(day_win *dw)
{
    vcal_view_set_summary_page(dw->Vbox, dw->selsig);

#if !(GTK_CHECK_VERSION(2,12,0))
    gtk_object_destroy(G_OBJECT(dw->Tooltips));
#endif
    g_free(dw);
    dw = NULL;
}

static char *orage_tm_date_to_i18_date(struct tm *tm_date)
{
    static char i18_date[32];

    if (strftime(i18_date, 32, "%x", tm_date) == 0)
        g_error("Orage: orage_tm_date_to_i18_date too long string in strftime");
    return(i18_date);
}

static void changeSelectedDate(day_win *dw, gint day)
{
    if (day > 0) {
     do {
      orage_move_day(&(dw->startdate), 1);
     } while (--day > 0);
    } else {
     do {
      orage_move_day(&(dw->startdate), -1);
     } while (++day < 0);
    }
}

static gint on_Previous_clicked(GtkWidget *button, GdkEventButton *event,
				    day_win *dw)
{
    int days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
    changeSelectedDate(dw, -days);
    refresh_day_win(dw);
    return TRUE;
}

static gint on_Next_clicked(GtkWidget *button, GdkEventButton *event,
				    day_win *dw)
{
    int days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
    changeSelectedDate(dw, +days);
    refresh_day_win(dw);
    return TRUE;
}

static void dw_summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
			     gint column, day_win *dw)
{
	MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, row);
	int days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
	
	if (msginfo && msginfo->msgid) {
		VCalEvent *event = vcal_manager_load_event(msginfo->msgid);
		if (event) {
			time_t t_first = mktime(&dw->startdate);
			time_t t_start = icaltime_as_timet(icaltime_from_string(event->dtstart));
			struct tm tm_start;
			gboolean changed = FALSE;
			GtkAdjustment *v_adj;

#ifdef G_OS_WIN32
			if (t_start < 0)
				t_start = 1;
#endif
			localtime_r(&t_start, &tm_start);
			tm_start.tm_hour = tm_start.tm_min = tm_start.tm_sec = 0;
			t_start = mktime(&tm_start);

			while (t_start < t_first) {
				changeSelectedDate(dw, -days);
				t_first = mktime(&dw->startdate);
				changed = TRUE;
			}
			while (t_start > t_first + (days-1)*24*60*60) {
				changeSelectedDate(dw, +days);
				t_first = mktime(&dw->startdate);
				changed = TRUE;
			}
			
			t_start = icaltime_as_timet(icaltime_from_string(event->dtstart));
#ifdef G_OS_WIN32
			if (t_start < 0)
				t_start = 1;
#endif
			localtime_r(&t_start, &tm_start);
			if (changed) {
				debug_print("changed from %s\n", event->summary);
				v_adj = gtk_scrolled_window_get_vadjustment(
				    GTK_SCROLLED_WINDOW(dw->scroll_win)); 
#ifdef G_OS_WIN32
				if (t_start < 0)
					t_start = 1;
#endif
				localtime_r(&t_start, &tm_start);
				if (tm_start.tm_hour > 2)
					gtk_adjustment_set_value(v_adj, 
						(v_adj->upper-v_adj->page_size)/(24/(tm_start.tm_hour-2)));
				else
					gtk_adjustment_set_value(v_adj, 0);
				gtk_adjustment_changed(v_adj);
				refresh_day_win(dw);
			}
		}
		vcal_manager_free_event(event);
	}
}

static void day_view_new_meeting_cb(day_win *dw, gpointer data_i, gpointer data_s)
{
    int offset = GPOINTER_TO_INT(data_i);
    struct tm tm_date = dw->startdate;
    int offset_h = offset % 1000;
    int offset_d = (offset-offset_h) / 1000;
    guint monthdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};    
    int mon = tm_date.tm_mon;
    
    if (((tm_date.tm_year%4) == 0) && (((tm_date.tm_year%100) != 0) 
            || ((tm_date.tm_year%400) == 0)))
        monthdays[1] = 29;

    if (offset_d > monthdays[mon]) {
    	while (tm_date.tm_mday > 1)
		orage_move_day(&tm_date, 1);
	offset_d -= monthdays[mon];
    }

    while (offset_d > tm_date.tm_mday) {
	    orage_move_day(&tm_date, 1);
    }
    while (offset_d < tm_date.tm_mday) {
	    orage_move_day(&tm_date, -1);
    }
    tm_date.tm_hour = offset_h;
    vcal_meeting_create_with_start(NULL, &tm_date);
}

static void day_view_edit_meeting_cb(day_win *dw, gpointer data_i, gpointer data_s)
{
	const gchar *uid = (gchar *)data_s;
        vcal_view_select_event (uid, dw->item, TRUE,
		    	    G_CALLBACK(dw_summary_selected), dw);
}

static void day_view_cancel_meeting_cb(day_win *dw, gpointer data_i, gpointer data_s)
{
	const gchar *uid = (gchar *)data_s;
	vcalendar_cancel_meeting(dw->item, uid);
}

static void day_view_today_cb(day_win *dw, gpointer data_i, gpointer data_s)
{
    time_t now = time(NULL);
    struct tm tm_today;
    localtime_r(&now, &tm_today);

    while (tm_today.tm_wday != 1)
    	orage_move_day(&tm_today, -1);
    
    dw->startdate = tm_today;
    refresh_day_win(dw);
}

static void header_button_clicked_cb(GtkWidget *button, day_win *dw)
{
    int offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "offset"));

    day_view_new_meeting_cb(dw, GINT_TO_POINTER(offset), NULL);
}

static void on_button_press_event_cb(GtkWidget *widget
        , GdkEventButton *event, gpointer *user_data)
{
    day_win *dw = (day_win *)user_data;
    gchar *uid = g_object_get_data(G_OBJECT(widget), "UID");
    gpointer offset = g_object_get_data(G_OBJECT(widget), "offset");
 
    if (event->button == 1) {
	if (uid)
            vcal_view_select_event (uid, dw->item, (event->type==GDK_2BUTTON_PRESS),
		    	    G_CALLBACK(dw_summary_selected), dw);
    }
    if (event->button == 3) {
	    g_object_set_data(G_OBJECT(dw->Vbox), "menu_win",
		      dw);
	    g_object_set_data(G_OBJECT(dw->Vbox), "menu_data_i",
		      offset);
	    g_object_set_data(G_OBJECT(dw->Vbox), "menu_data_s",
		      uid);
	    g_object_set_data(G_OBJECT(dw->Vbox), "new_meeting_cb",
		      day_view_new_meeting_cb);
	    g_object_set_data(G_OBJECT(dw->Vbox), "edit_meeting_cb",
		      day_view_edit_meeting_cb);
	    g_object_set_data(G_OBJECT(dw->Vbox), "cancel_meeting_cb",
		      day_view_cancel_meeting_cb);
	    g_object_set_data(G_OBJECT(dw->Vbox), "go_today_cb",
		      day_view_today_cb);
	    if (uid)
		    gtk_menu_popup(GTK_MENU(dw->event_menu), 
			   NULL, NULL, NULL, NULL, 
			   event->button, event->time);    
	    else
		    gtk_menu_popup(GTK_MENU(dw->view_menu), 
			   NULL, NULL, NULL, NULL, 
			   event->button, event->time);    
    }
}

static void add_row(day_win *dw, VCalEvent *event, gint days)
{
    gint row, start_row, end_row;
    gint col, start_col, end_col, first_col, last_col;
    gint height, start_height, end_height;
    gchar *text, *tip, *start_date, *end_date;
    GtkWidget *ev, *lab, *hb;
    time_t t_start, t_end;
    struct tm tm_first, tm_start, tm_end;
#if !(GTK_CHECK_VERSION(2,12,0))
	GtkTooltips *tips = dw->Tooltips;
#endif

    /* First clarify timings */
    t_start = icaltime_as_timet(icaltime_from_string(event->dtstart));
    if (event->dtend && *event->dtend)
        t_end = icaltime_as_timet(icaltime_from_string(event->dtend));
    else 
	t_end = t_start;

#ifdef G_OS_WIN32
	if (t_start < 0)
		t_start = 1;
	if (t_end < 0)
		t_end = 1;
#endif
    localtime_r(&t_start, &tm_start);
    localtime_r(&t_end, &tm_end);
    tm_first = dw->startdate;
   
    tm_first.tm_year += 1900;
    tm_first.tm_mon += 1;
    tm_start.tm_year += 1900;
    tm_start.tm_mon += 1;
    tm_end.tm_year += 1900;
    tm_end.tm_mon += 1;

    start_col = orage_days_between(&tm_first, &tm_start)+1;
    end_col   = orage_days_between(&tm_first, &tm_end)+1;

    if (end_col < 1)
    	return;
    if (start_col > days)
        return;

    else {
        col = start_col;
        row = tm_start.tm_hour;
    }

    /* then add the appointment */
    text = g_strdup(event->summary?event->summary : _("Unknown"));
    ev = gtk_event_box_new();
    lab = gtk_label_new(text);
    gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.5);
    gtk_label_set_ellipsize(GTK_LABEL(lab), PANGO_ELLIPSIZE_END);
    gtk_container_add(GTK_CONTAINER(ev), lab);

    if ((row % 2) == 1)
        gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg1);
    else
        gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg2);
    if (dw->element[row][col] == NULL) {
        hb = gtk_hbox_new(TRUE, 3);
        dw->element[row][col] = hb;
    }
    else {
        hb = dw->element[row][col];
        /* FIXME: set some real bar here to make it visible that we
         * have more than 1 appointment here
         */
    }
    if (orage_days_between(&tm_start, &tm_end) == 0)
        tip = g_strdup_printf("%s\n%02d:%02d-%02d:%02d\n%s"
                , text, tm_start.tm_hour, tm_start.tm_min
                , tm_end.tm_hour, tm_end.tm_min, event->description);
    else {
/* we took the date in unnormalized format, so we need to do that now */
        start_date = g_strdup(orage_tm_date_to_i18_date(&tm_start));
        end_date = g_strdup(orage_tm_date_to_i18_date(&tm_end));
        tip = g_strdup_printf("%s\n%s %02d:%02d - %s %02d:%02d\n%s"
                , text
                , start_date, tm_start.tm_hour, tm_start.tm_min
                , end_date, tm_end.tm_hour, tm_end.tm_min
                , event->description);
        g_free(start_date);
        g_free(end_date);
    }
    CLAWS_SET_TIP(ev, tip);
    /*
    gtk_box_pack_start(GTK_BOX(hb2), ev, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hb), hb2, TRUE, TRUE, 0);
    */
    gtk_box_pack_start(GTK_BOX(hb), ev, TRUE, TRUE, 0);
    g_object_set_data_full(G_OBJECT(ev), "UID", g_strdup(event->uid), g_free);
    g_object_set_data(G_OBJECT(ev), "offset", GINT_TO_POINTER(tm_start.tm_mday*1000 + tm_start.tm_hour));
    g_signal_connect((gpointer)ev, "button-press-event"
            , G_CALLBACK(on_button_press_event_cb), dw);
    g_free(tip);
    g_free(text);

    /* and finally draw the line to show how long the appointment is,
     * but only if it is Busy type event (=availability != 0) 
     * and it is not whole day event */
    if (TRUE) {
        height = dw->StartDate_button_req.height;
        /*
         * same_date = !strncmp(start_ical_time, end_ical_time, 8);
         * */
        if (start_col < 1)
            first_col = 1;
        else
            first_col = start_col;
        if (end_col > days)
            last_col = days;
        else
            last_col = end_col;
        for (col = first_col; col <= last_col; col++) {
            if (col == start_col)
                start_row = tm_start.tm_hour;
            else
                start_row = 0;
            if (col == end_col)
                end_row   = tm_end.tm_hour;
            else
                end_row   = 23;
            for (row = start_row; row <= end_row; row++) {
                if (row == tm_start.tm_hour && col == start_col)
                    start_height = tm_start.tm_min*height/60;
                else
                    start_height = 0;
                if (row == tm_end.tm_hour && col == end_col)
                    end_height = tm_end.tm_min*height/60;
                else
                    end_height = height;
                dw->line[row][col] = build_line(1, start_height
                        , 2, end_height-start_height, dw->line[row][col]
			, &dw->line_color);
            }
        }
    }
}

static void app_rows(day_win *dw, FolderItem *item)
{
   GSList *events = vcal_get_events_list(item);
   GSList *cur = NULL;
   int days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
   for (cur = events; cur ; cur = cur->next) {
   	VCalEvent *event = (VCalEvent *) (cur->data);
	add_row(dw, event, days);
	vcal_manager_free_event(event);
   }
   g_slist_free(events);
}

static void app_data(day_win *dw, FolderItem *item)
{
    app_rows(dw, item);
}


static void fill_days(day_win *dw, gint days, FolderItem *item, gint first_col_day)
{
    gint row, col, height, width;
    GtkWidget *ev, *hb;

    height = dw->StartDate_button_req.height;
    width = dw->StartDate_button_req.width;

    /* first clear the structure */
    for (col = 1; col <  days+1; col++) {
        dw->header[col] = NULL;
        for (row = 0; row < 24; row++) {
            dw->element[row][col] = NULL;
    /* gdk_draw_rectangle(, , , left_x, top_y, width, height); */
            dw->line[row][col] = build_line(0, 0, 3, height, NULL
			, &dw->line_color);
        }
    }

    app_data(dw, item);

    for (col = 1; col < days+1; col++) {
        hb = gtk_hbox_new(FALSE, 0);
        /* check if we have full day events and put them to header */
        if (dw->header[col]) {
            gtk_box_pack_start(GTK_BOX(hb), dw->header[col], TRUE, TRUE, 0);
            gtk_widget_set_size_request(hb, width, -1);
        }
        else {
            ev = gtk_event_box_new();
            gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg2);
            gtk_box_pack_start(GTK_BOX(hb), ev, TRUE, TRUE, 0);
        }
        gtk_table_attach(GTK_TABLE(dw->dtable_h), hb, col, col+1, 1, 2
                 , (GTK_FILL), (0), 0, 0);

        /* check rows */
        for (row = 0; row < 24; row++) {
            hb = gtk_hbox_new(FALSE, 0);
            if (row == 0)
                gtk_widget_set_size_request(hb, width, -1);
            if (dw->element[row][col]) {
                gtk_box_pack_start(GTK_BOX(hb), dw->line[row][col]
                        , FALSE, FALSE, 0);
                gtk_box_pack_start(GTK_BOX(hb), dw->element[row][col]
                        , TRUE, TRUE, 0);
                gtk_widget_set_size_request(hb, width, -1);
            }
            else {
                ev = gtk_event_box_new();
		g_object_set_data(G_OBJECT(ev), "offset", GINT_TO_POINTER(first_col_day*1000 + row));
		g_signal_connect((gpointer)ev, "button-press-event"
        		, G_CALLBACK(on_button_press_event_cb), dw);
                /*
                name = gtk_label_new(" ");
                gtk_container_add(GTK_CONTAINER(ev), name);
                */
                if ((row % 2) == 1)
                    gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg1);
                else
                    gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg2);
                gtk_box_pack_start(GTK_BOX(hb), dw->line[row][col]
                        , FALSE, FALSE, 0);
                gtk_box_pack_start(GTK_BOX(hb), ev, TRUE, TRUE, 0);
            }
            gtk_table_attach(GTK_TABLE(dw->dtable), hb, col, col+1, row, row+1
                     , (GTK_FILL), (0), 0, 0);
        }
	first_col_day++;
    }
}

static void build_day_view_header(day_win *dw, char *start_date)
{
    GtkWidget *hbox, *label, *space_label;
    SummaryView *summaryview = NULL;
    int avail_w = 0, avail_d = 0;

    hbox = gtk_hbox_new(FALSE, 0);

    label = gtk_label_new(_("Start"));
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10);

    /* start date button */
    dw->StartDate_button = gtk_button_new();
    gtk_box_pack_start(GTK_BOX(hbox), dw->StartDate_button, FALSE, FALSE, 0);

    space_label = gtk_label_new("  ");
    gtk_box_pack_start(GTK_BOX(hbox), space_label, FALSE, FALSE, 0);

    space_label = gtk_label_new("     ");
    gtk_box_pack_start(GTK_BOX(hbox), space_label, FALSE, FALSE, 0);

    label = gtk_label_new(_("Show"));
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10);

    /* show days spin = how many days to show */
    dw->day_spin = gtk_spin_button_new_with_range(1, MAX_DAYS, 1);
    gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(dw->day_spin), TRUE);
    gtk_widget_set_size_request(dw->day_spin, 40, -1);
    gtk_box_pack_start(GTK_BOX(hbox), dw->day_spin, FALSE, FALSE, 0);
    label = gtk_label_new(_("days"));
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);

    space_label = gtk_label_new("   ");
    gtk_box_pack_start(GTK_BOX(hbox), space_label, FALSE, FALSE, 0);

    /* sizes */
    gtk_button_set_label(GTK_BUTTON(dw->StartDate_button)
            , (const gchar *)start_date);
    gtk_widget_size_request(dw->StartDate_button, &dw->StartDate_button_req);
    dw->StartDate_button_req.width += dw->StartDate_button_req.width/10;
    label = gtk_label_new("00");
    gtk_widget_size_request(label, &dw->hour_req);

    if (mainwindow_get_mainwindow()) {
        GtkAllocation allocation;
	summaryview = mainwindow_get_mainwindow()->summaryview;
	allocation = summaryview->mainwidget_book->allocation;
	
	avail_w = allocation.width - 20 - 2*(dw->hour_req.width);
	avail_d = avail_w / dw->StartDate_button_req.width;
    }
    if (avail_d >= 7) {
    	avail_d = 7;
	gtk_widget_set_size_request(dw->StartDate_button, avail_w / avail_d, -1);
	gtk_widget_size_request(dw->StartDate_button, &dw->StartDate_button_req);
    }
   
    /* initial values */
    if (avail_d)
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(dw->day_spin), avail_d);

}

static void build_day_view_colours(day_win *dw)
{
    GtkStyle *def_style;
    GdkColormap *pic1_cmap;
    GtkWidget *ctree = NULL;
    def_style = gtk_widget_get_default_style();
    pic1_cmap = gdk_colormap_get_system();
    
    if (mainwindow_get_mainwindow()) {
        ctree = mainwindow_get_mainwindow()->summaryview->ctree;
    }
    if (ctree) {
        dw->bg1 = ctree->style->bg[GTK_STATE_NORMAL];
        dw->bg2 = ctree->style->bg[GTK_STATE_NORMAL];
    } else {
        dw->bg1 = def_style->bg[GTK_STATE_NORMAL];
        dw->bg2 = def_style->bg[GTK_STATE_NORMAL];
    }
    dw->bg1.red +=  (dw->bg1.red < 63000 ? 2000 : -2000);
    dw->bg1.green += (dw->bg1.green < 63000 ? 2000 : -2000);
    dw->bg1.blue += (dw->bg1.blue < 63000 ? 2000 : -2000);
    gdk_colormap_alloc_color(pic1_cmap, &dw->bg1, FALSE, TRUE);

    dw->bg2.red +=  (dw->bg2.red > 1000 ? -1000 : 1000);
    dw->bg2.green += (dw->bg2.green > 1000 ? -1000 : 1000);
    dw->bg2.blue += (dw->bg2.blue > 1000 ? -1000 : 1000);
    gdk_colormap_alloc_color(pic1_cmap, &dw->bg2, FALSE, TRUE);

    if (!gdk_color_parse("white", &dw->line_color)) {
        dw->line_color.red =  239 * (65535/255);
        dw->line_color.green = 235 * (65535/255);
        dw->line_color.blue = 230 * (65535/255);
    }

    if (!gdk_color_parse("blue", &dw->fg_sunday)) {
        g_warning("color parse failed: red\n");
        dw->fg_sunday.red = 10 * (65535/255);
        dw->fg_sunday.green = 10 * (65535/255);
        dw->fg_sunday.blue = 255 * (65535/255);
    }

    if (!gdk_color_parse("gold", &dw->bg_today)) {
        g_warning("color parse failed: gold\n");
        dw->bg_today.red = 255 * (65535/255);
        dw->bg_today.green = 215 * (65535/255);
        dw->bg_today.blue = 115 * (65535/255);
    }

    if (ctree) {
        dw->fg_sunday.red = (dw->fg_sunday.red + ctree->style->fg[GTK_STATE_SELECTED].red)/2;
        dw->fg_sunday.green = (dw->fg_sunday.green + ctree->style->fg[GTK_STATE_SELECTED].red)/2;
        dw->fg_sunday.blue = (3*dw->fg_sunday.blue + ctree->style->fg[GTK_STATE_SELECTED].red)/4;
        dw->bg_today.red = (3*dw->bg_today.red + ctree->style->bg[GTK_STATE_NORMAL].red)/4;
        dw->bg_today.green = (3*dw->bg_today.green + ctree->style->bg[GTK_STATE_NORMAL].red)/4;
        dw->bg_today.blue = (3*dw->bg_today.blue + ctree->style->bg[GTK_STATE_NORMAL].red)/4;
    }

    gdk_colormap_alloc_color(pic1_cmap, &dw->line_color, FALSE, TRUE);
    gdk_colormap_alloc_color(pic1_cmap, &dw->fg_sunday, FALSE, TRUE);
    gdk_colormap_alloc_color(pic1_cmap, &dw->bg_today, FALSE, TRUE);
}

static void fill_hour(day_win *dw, gint col, gint row, char *text)
{
    GtkWidget *name, *ev;

    ev = gtk_event_box_new();
    name = gtk_label_new(text);
    gtk_container_add(GTK_CONTAINER(ev), name);
    if ((row % 2) == 1)
        gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg1);
    else
        gtk_widget_modify_bg(ev, GTK_STATE_NORMAL, &dw->bg2);
    gtk_widget_set_size_request(ev, dw->hour_req.width
            , dw->StartDate_button_req.height);
    if (text)
        gtk_table_attach(GTK_TABLE(dw->dtable), ev, col, col+1, row, row+1
             , (GTK_FILL), (0), 0, 0);
    else  /* special, needed for header table full day events */
        gtk_table_attach(GTK_TABLE(dw->dtable_h), ev, col, col+1, row, row+1
             , (GTK_FILL), (0), 0, 0);
}

static void build_day_view_table(day_win *dw)
{
    gint days;   /* number of days to show */
    int year, month, day;
    gint i = 0;
    GtkWidget *label, *button;
    char text[5+1], *date, *today;
    struct tm tm_date, tm_today;
    guint monthdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    GtkWidget *vp;
    time_t t = time(NULL);
    GtkWidget *arrow;
    gchar *tip;
    gint first_col_day = -1;
#if !(GTK_CHECK_VERSION(2,12,0))
	GtkTooltips *tips = dw->Tooltips;
#endif

#ifdef G_OS_WIN32
	if (t < 0)
		t = 1;
#endif
    localtime_r(&t, &tm_today);
    days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
    today = get_locale_date(&tm_today);
    /****** header of day table = days columns ******/
    dw->scroll_win_h = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dw->scroll_win_h)
            , GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
    gtk_box_pack_start(GTK_BOX(dw->Vbox), dw->scroll_win_h
            , TRUE, TRUE, 0);
    dw->day_view_vbox = gtk_vbox_new(FALSE, 0);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(dw->scroll_win_h)
            , dw->day_view_vbox);
    /*
    gtk_container_add(GTK_CONTAINER(dw->scroll_win_h), dw->day_view_vbox);
    */
    /* row 1= day header buttons 
     * row 2= full day events after the buttons */
    dw->dtable_h = gtk_table_new(2 , days+2, FALSE);
    gtk_box_pack_start(GTK_BOX(dw->day_view_vbox), dw->dtable_h
            , FALSE, FALSE, 0);

    tm_date = dw->startdate;

    year = tm_date.tm_year + 1900;
    month = tm_date.tm_mon;
    day = tm_date.tm_mday;
    if (((tm_date.tm_year%4) == 0) && (((tm_date.tm_year%100) != 0) 
            || ((tm_date.tm_year%400) == 0)))
        monthdays[1] = 29;


    i=0;
    dw->Previous_toolbutton = gtk_event_box_new();
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(dw->Previous_toolbutton), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(dw->Previous_toolbutton), 0);
    arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
    gtk_container_add(GTK_CONTAINER(dw->Previous_toolbutton), arrow);
    gtk_table_attach(GTK_TABLE(dw->dtable_h), dw->Previous_toolbutton, i, i+1, 0, 1
                , (GTK_FILL), (0), 0, 0);
    gtk_widget_show_all(dw->Previous_toolbutton);
    g_signal_connect((gpointer)dw->Previous_toolbutton, "button_release_event"
            , G_CALLBACK(on_Previous_clicked), dw);
    tip = g_strdup_printf("Back %d days", days);
    CLAWS_SET_TIP(dw->Previous_toolbutton, tip);
    g_free(tip);
    for (i = 1; i < days+1; i++) {
        tip = g_malloc(100);
	strftime(tip, 99, "%A %d %B %Y", &tm_date);
	if (first_col_day == -1)
		first_col_day = tm_date.tm_mday;
        date = get_locale_date(&tm_date);
        button = gtk_button_new();
        gtk_button_set_label(GTK_BUTTON(button), date);
        if (strcmp(today, date) == 0) {
            gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &dw->bg_today);
        }

        if (tm_date.tm_wday % 7 == 0) {
            label = gtk_bin_get_child(GTK_BIN(button));
            gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &dw->fg_sunday);
        }
        CLAWS_SET_TIP(button, tip);
	g_free(tip);
        gtk_widget_set_size_request(button, dw->StartDate_button_req.width, -1);
        g_signal_connect((gpointer)button, "clicked"
                , G_CALLBACK(header_button_clicked_cb), dw);
        g_object_set_data(G_OBJECT(button), "offset", GINT_TO_POINTER(tm_date.tm_mday*1000));
        gtk_table_attach(GTK_TABLE(dw->dtable_h), button, i, i+1, 0, 1
                , (GTK_FILL), (0), 0, 0);

        if (++tm_date.tm_mday == (monthdays[tm_date.tm_mon]+1)) {
            if (++tm_date.tm_mon == 12) {
                ++tm_date.tm_year;
                tm_date.tm_mon = 0;
            }
            tm_date.tm_mday = 1;
        }
	++tm_date.tm_wday; tm_date.tm_wday %=7;
	g_free(date);
    }

    dw->Next_toolbutton = gtk_event_box_new();
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(dw->Next_toolbutton), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(dw->Next_toolbutton), 0);
    arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
    gtk_container_add(GTK_CONTAINER(dw->Next_toolbutton), arrow);
    gtk_table_attach(GTK_TABLE(dw->dtable_h), dw->Next_toolbutton, i, i+1, 0, 1
                , (GTK_FILL), (0), 0, 0);
    gtk_widget_show_all(dw->Next_toolbutton);
    g_signal_connect((gpointer)dw->Next_toolbutton, "button_release_event"
            , G_CALLBACK(on_Next_clicked), dw);
    tip = g_strdup_printf("Forward %d days", days);
    CLAWS_SET_TIP(dw->Next_toolbutton, tip);
    g_free(tip);
    g_free(today);

    /****** body of day table ******/
    dw->scroll_win = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dw->scroll_win)
            , GTK_SHADOW_NONE);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dw->scroll_win)
            , GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
    gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(dw->scroll_win)
            , GTK_CORNER_TOP_LEFT);
    gtk_box_pack_start(GTK_BOX(dw->day_view_vbox), dw->scroll_win
            , TRUE, TRUE, 0);
    vp = gtk_viewport_new(NULL, NULL);
    gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE);
    gtk_container_add(GTK_CONTAINER(dw->scroll_win), vp);
    dw->dtable = gtk_table_new(24, days+2, FALSE);
    gtk_container_add(GTK_CONTAINER(vp), dw->dtable);

    gtk_widget_show_all(dw->dtable_h);
    /* hours column = hour rows */
    for (i = 0; i < 24; i++) {
        g_sprintf(text, "%02d", i);
        /* ev is needed for background colour */
        fill_hour(dw, 0, i, text);
        fill_hour(dw, days+1, i, text);
    }
    fill_days(dw, days, dw->item, first_col_day);
}

void refresh_day_win(day_win *dw)
{
    get_scroll_position(dw);
    gtk_widget_destroy(dw->scroll_win_h);
    build_day_view_table(dw);
    gtk_widget_show_all(dw->scroll_win_h);
    /* I was not able to get this work without the timer. Ugly yes, but
     * it works and does not hurt - much */
    g_timeout_add(100, (GSourceFunc)scroll_position_timer, (gpointer)dw);
}

day_win *create_day_win(FolderItem *item, struct tm tmdate)
{
    day_win *dw;
    char *start_date = get_locale_date(&tmdate);

    /* initialisation + main window + base vbox */
    dw = g_new0(day_win, 1);
    dw->scroll_pos = -1; /* not set */
#if !(GTK_CHECK_VERSION(2,12,0))
    dw->Tooltips = tips;
#endif
    dw->accel_group = gtk_accel_group_new();
    
    while (tmdate.tm_wday != 1)
    	orage_move_day(&tmdate, -1);
    
    dw->startdate = tmdate;
    dw->startdate.tm_hour = 0;
    dw->startdate.tm_min = 0;
    dw->startdate.tm_sec = 0;
    dw->Vbox = gtk_vbox_new(FALSE, 0);

    dw->item = item;
    build_day_view_colours(dw);
    build_day_view_header(dw, start_date);
    build_day_view_table(dw);
    gtk_widget_show_all(dw->Vbox);
    dw->selsig = vcal_view_set_calendar_page(dw->Vbox, 
		    G_CALLBACK(dw_summary_selected), dw);
    vcal_view_create_popup_menus(dw->Vbox, &dw->view_menu, 
		    		 &dw->event_menu, &dw->event_group,
		    		 &dw->ui_manager);

    g_timeout_add(100, (GtkFunction)scroll_position_timer, (gpointer)dw);

    return(dw);
}

--- NEW FILE: vcal_interface.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

gboolean vcal_event_exists(const gchar *id);
void vcal_foreach_event(gboolean (*cb_func)(const gchar *vevent));
gboolean vcal_delete_event(const gchar *id);
gchar* vcal_add_event(const gchar *vevent);
gchar* vcal_update_event(const gchar *vevent);
void vcalendar_refresh_folder_contents(FolderItem *item);

--- placeholder.txt DELETED ---

--- NEW FILE: month-view.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 *
 * Copyright (c) 2007-2008 Juha Kautto (juha at xfce.org)
 * Copyright (c) 2008 Colin Leroy (colin at colino.net)
 *
 * 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 3 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.
[...981 lines suppressed...]
    while (tmdate.tm_mday != 1)
    	orage_move_day(&tmdate, -1);

    mw->startdate = tmdate;

    mw->Vbox = gtk_vbox_new(FALSE, 0);

    mw->item = item;
    build_month_view_colours(mw);
    build_month_view_header(mw, start_date);
    build_month_view_table(mw);
    gtk_widget_show_all(mw->Vbox);
    mw->selsig = vcal_view_set_calendar_page(mw->Vbox, 
		    G_CALLBACK(mw_summary_selected), mw);

    vcal_view_create_popup_menus(mw->Vbox, &mw->view_menu,
		    		 &mw->event_menu, &mw->event_group,
		    		 &mw->ui_manager);
    return(mw);
}

--- NEW FILE: vcal_prefs.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifdef HAVE_CONFIG_H
#  include "config.h"
#include "claws-features.h"
#endif

#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>

#include "defs.h"

#include "mainwindow.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "prefswindow.h"
#include "common/utils.h"

#include "vcalendar.h"
#include "vcal_prefs.h"
#include "vcal_folder.h"

#define PREFS_BLOCK_NAME "VCalendar"

struct VcalendarPage
{
	PrefsPage page;
	
	GtkWidget *alert_enable_btn;
	GtkWidget *alert_delay_spinbtn;

	GtkWidget *export_enable_btn;
	GtkWidget *export_subs_btn;
	GtkWidget *export_path_entry;
	GtkWidget *export_command_entry;
	
	GtkWidget *export_user_label;
	GtkWidget *export_user_entry;
	GtkWidget *export_pass_label;
	GtkWidget *export_pass_entry;

	GtkWidget *export_freebusy_enable_btn;
	GtkWidget *export_freebusy_path_entry;
	GtkWidget *export_freebusy_command_entry;
	
	GtkWidget *export_freebusy_user_label;
	GtkWidget *export_freebusy_user_entry;
	GtkWidget *export_freebusy_pass_label;
	GtkWidget *export_freebusy_pass_entry;

	GtkWidget *freebusy_get_url_entry;
};

VcalendarPrefs vcalprefs;
static struct VcalendarPage vcal_prefs_page;

static PrefParam param[] = {
	{"alert_delay", "10", &vcalprefs.alert_delay, P_INT,
	 NULL, NULL, NULL},
	{"alert_enable", "FALSE", &vcalprefs.alert_enable, P_BOOL,
	 NULL, NULL, NULL},

	{"export_enable", "FALSE", &vcalprefs.export_enable, P_BOOL,
	 NULL, NULL, NULL},
	{"export_subs", "TRUE", &vcalprefs.export_subs, P_BOOL,
	 NULL, NULL, NULL},
	{"export_path", "", &vcalprefs.export_path, P_STRING,
	 NULL, NULL, NULL},
	{"export_command", NULL, &vcalprefs.export_command, P_STRING,
	 NULL, NULL, NULL},

	{"export_user", "", &vcalprefs.export_user, P_STRING,
	 NULL, NULL, NULL},
	{"export_pass", "", &vcalprefs.export_pass, P_PASSWORD,
	 NULL, NULL, NULL},

	{"orage_registered", "FALSE", &vcalprefs.orage_registered, P_BOOL,
	 NULL, NULL, NULL},

	{"export_freebusy_enable", "FALSE", &vcalprefs.export_freebusy_enable, P_BOOL,
	 NULL, NULL, NULL},
	{"export_freebusy_path", "", &vcalprefs.export_freebusy_path, P_STRING,
	 NULL, NULL, NULL},
	{"export_freebusy_command", NULL, &vcalprefs.export_freebusy_command, P_STRING,
	 NULL, NULL, NULL},
	{"freebusy_get_url", NULL, &vcalprefs.freebusy_get_url, P_STRING,
	 NULL, NULL, NULL},

	{"export_freebusy_user", "", &vcalprefs.export_freebusy_user, P_STRING,
	 NULL, NULL, NULL},
	{"export_freebusy_pass", "", &vcalprefs.export_freebusy_pass, P_PASSWORD,
	 NULL, NULL, NULL},

	{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};

static void set_auth_sensitivity(struct VcalendarPage *page)
{
	const gchar *export_path, *export_freebusy_path;
	gboolean export_enable, export_freebusy_enable;
	
	export_enable = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->export_enable_btn));
	export_freebusy_enable = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->export_freebusy_enable_btn));
	
	export_path = gtk_entry_get_text(GTK_ENTRY(page->export_path_entry));
	export_freebusy_path = gtk_entry_get_text(GTK_ENTRY(page->export_freebusy_path_entry));
	if (export_enable && export_path &&
	    (!strncmp(export_path, "http://", 7) ||
	     !strncmp(export_path, "ftp://", 6) ||
	     !strncmp(export_path, "https://", 8) ||
	     !strncmp(export_path, "sftp://", 5) ||
	     !strncmp(export_path, "webcal://", 9))) {
		gtk_widget_set_sensitive(page->export_user_label, TRUE);	
		gtk_widget_set_sensitive(page->export_user_entry, TRUE);	
		gtk_widget_set_sensitive(page->export_pass_label, TRUE);	
		gtk_widget_set_sensitive(page->export_pass_entry, TRUE);	
	} else {
		gtk_widget_set_sensitive(page->export_user_label, FALSE);	
		gtk_widget_set_sensitive(page->export_user_entry, FALSE);	
		gtk_widget_set_sensitive(page->export_pass_label, FALSE);	
		gtk_widget_set_sensitive(page->export_pass_entry, FALSE);	
	}
	if (export_freebusy_enable && export_freebusy_path &&
	    (!strncmp(export_freebusy_path, "http://", 7) ||
	     !strncmp(export_freebusy_path, "ftp://", 6) ||
	     !strncmp(export_freebusy_path, "https://", 8) ||
	     !strncmp(export_freebusy_path, "sftp://", 5) ||
	     !strncmp(export_freebusy_path, "webcal://", 9))) {
		gtk_widget_set_sensitive(page->export_freebusy_user_label, TRUE);	
		gtk_widget_set_sensitive(page->export_freebusy_user_entry, TRUE);	
		gtk_widget_set_sensitive(page->export_freebusy_pass_label, TRUE);	
		gtk_widget_set_sensitive(page->export_freebusy_pass_entry, TRUE);	
	} else {
		gtk_widget_set_sensitive(page->export_freebusy_user_label, FALSE);	
		gtk_widget_set_sensitive(page->export_freebusy_user_entry, FALSE);	
		gtk_widget_set_sensitive(page->export_freebusy_pass_label, FALSE);	
		gtk_widget_set_sensitive(page->export_freebusy_pass_entry, FALSE);	
	}	
}

static void path_changed(GtkWidget *widget, gpointer data)
{
	set_auth_sensitivity((struct VcalendarPage *)data);
}

static gboolean orage_available(void)
{
	gchar *tmp = g_find_program_in_path("orage");
	if (tmp) {
		g_free(tmp);
		return TRUE;
	}
	return FALSE;
}

static void orage_register(gboolean reg)
{
	if (orage_available()) {
		gchar *orage_argv[4];
		gchar *cmdline = g_strdup_printf("%s%svcalendar%sinternal.ics",
				get_rc_dir(), G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);

		debug_print("telling Orage %s us ...\n", reg?"about":"to forget");
		orage_argv[0] = "orage";
		orage_argv[1] = reg ? "--add-foreign":"--remove-foreign";
		orage_argv[2] = cmdline;
		orage_argv[3] = NULL;
		g_spawn_async(NULL, (gchar **)orage_argv, NULL, 
			G_SPAWN_SEARCH_PATH|G_SPAWN_STDOUT_TO_DEV_NULL|
				G_SPAWN_STDERR_TO_DEV_NULL,
			NULL, NULL, NULL, FALSE);
		g_free(cmdline);
	}
}

void register_orage_checkbtn_toggled(GtkToggleButton	*toggle_btn,
				 	GtkWidget		*widget)
{
	orage_register(gtk_toggle_button_get_active(toggle_btn));
	vcalprefs.orage_registered = gtk_toggle_button_get_active(toggle_btn);
}

static void vcal_prefs_create_widget_func(PrefsPage * _page,
					   GtkWindow * window,
					   gpointer data)
{
	struct VcalendarPage *page = (struct VcalendarPage *) _page;

	GtkWidget *vbox1, *vbox2, *vbox3;
	GtkWidget *hbox1, *hbox2, *hbox3;
	
	GtkWidget *frame_alert;
	GtkWidget *alert_enable_checkbtn;
	GtkObject *alert_enable_spinbtn_adj;
	GtkWidget *alert_enable_spinbtn;
	GtkWidget *label_alert_enable;

	GtkWidget *frame_export;
	GtkWidget *export_enable_checkbtn;
	GtkWidget *export_subs_checkbtn;
	GtkWidget *export_path_entry;
	GtkWidget *export_command_label;
	GtkWidget *export_command_entry;
	GtkWidget *register_orage_checkbtn;

	GtkWidget *export_user_label;
	GtkWidget *export_user_entry;
	GtkWidget *export_pass_label;
	GtkWidget *export_pass_entry;

	GtkWidget *frame_freebusy_export;
	GtkWidget *export_freebusy_enable_checkbtn;
	GtkWidget *export_freebusy_path_entry;
	GtkWidget *export_freebusy_command_label;
	GtkWidget *export_freebusy_command_entry;

	GtkWidget *export_freebusy_user_label;
	GtkWidget *export_freebusy_user_entry;
	GtkWidget *export_freebusy_pass_label;
	GtkWidget *export_freebusy_pass_entry;

	GtkWidget *freebusy_get_url_label;
	GtkWidget *freebusy_get_url_entry;

	vbox1 = gtk_vbox_new (FALSE, VSPACING);
	gtk_widget_show (vbox1);
	gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);

	vbox2 = gtk_vbox_new (FALSE, 4);
	gtk_widget_show (vbox2);
	gtk_box_pack_start(GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);


/* alert stuff */
	PACK_FRAME(vbox2, frame_alert, _("Reminders"));
	vbox3 = gtk_vbox_new (FALSE, 8);
	gtk_widget_show (vbox3);
	gtk_container_add (GTK_CONTAINER (frame_alert), vbox3);
	gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);
	hbox1 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox1);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox1, TRUE, TRUE, 0);

	alert_enable_checkbtn = gtk_check_button_new_with_label(_("Alert me"));
	gtk_widget_show (alert_enable_checkbtn);
	gtk_box_pack_start(GTK_BOX (hbox1), alert_enable_checkbtn, FALSE, FALSE, 0);

	alert_enable_spinbtn_adj = gtk_adjustment_new (10, 1, 24*60, 1, 10, 0);
	alert_enable_spinbtn = gtk_spin_button_new
		(GTK_ADJUSTMENT (alert_enable_spinbtn_adj), 1, 0);
	gtk_widget_set_size_request (alert_enable_spinbtn, 64, -1);
	gtk_widget_show (alert_enable_spinbtn);
	gtk_box_pack_start(GTK_BOX (hbox1), alert_enable_spinbtn, FALSE, FALSE, 0);
	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (alert_enable_spinbtn), TRUE);

	label_alert_enable = gtk_label_new(_("minutes before an event"));
	gtk_widget_show (label_alert_enable);
	gtk_box_pack_start(GTK_BOX (hbox1), label_alert_enable, FALSE, FALSE, 0);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alert_enable_checkbtn), 
			vcalprefs.alert_enable);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(alert_enable_spinbtn),
			vcalprefs.alert_delay);
	SET_TOGGLE_SENSITIVITY(alert_enable_checkbtn, alert_enable_spinbtn);

/* calendar export */
/* export enable + path stuff */
	PACK_FRAME(vbox2, frame_export, _("Calendar export"));
	vbox3 = gtk_vbox_new (FALSE, 8);
	gtk_widget_show (vbox3);
	gtk_container_add (GTK_CONTAINER (frame_export), vbox3);
	gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);

/* export path */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	export_enable_checkbtn = gtk_check_button_new_with_label(_("Automatically export calendar to"));
	gtk_widget_show(export_enable_checkbtn);
	gtk_box_pack_start(GTK_BOX (hbox2), export_enable_checkbtn, FALSE, FALSE, 0);

	export_path_entry = gtk_entry_new();
	gtk_widget_show(export_path_entry);
	gtk_box_pack_start(GTK_BOX(hbox2), export_path_entry, TRUE, TRUE, 0);
	SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_path_entry);
	CLAWS_SET_TIP(export_enable_checkbtn, 
			    _("You can export to a local file or URL"));
	CLAWS_SET_TIP(export_path_entry, 
			    _("Specify a local file or URL "
			      "(http://server/path/file.ics)"));

/* export auth */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	export_user_label = gtk_label_new(_("User ID"));
	gtk_widget_show(export_user_label);
	gtk_box_pack_start(GTK_BOX (hbox2), export_user_label, FALSE, FALSE, 0);

	export_user_entry = gtk_entry_new();
	gtk_widget_show(export_user_entry);
	gtk_box_pack_start(GTK_BOX (hbox2), export_user_entry, FALSE, FALSE, 0);

	export_pass_label = gtk_label_new(_("Password"));
	gtk_widget_show(export_pass_label);
	gtk_box_pack_start(GTK_BOX (hbox2), export_pass_label, FALSE, FALSE, 0);

	export_pass_entry = gtk_entry_new();
	gtk_entry_set_visibility(GTK_ENTRY(export_pass_entry), FALSE);
	gtk_widget_show(export_pass_entry);
	gtk_box_pack_start(GTK_BOX (hbox2), export_pass_entry, FALSE, FALSE, 0);

/* export subscriptions too */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	export_subs_checkbtn = gtk_check_button_new_with_label(_("Include webcal subscriptions in export"));
	gtk_widget_show(export_subs_checkbtn);
	gtk_box_pack_start(GTK_BOX (hbox2), export_subs_checkbtn, FALSE, FALSE, 0);
	SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_subs_checkbtn);

/* run-command after export stuff */
	hbox3 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox3);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);

	export_command_label = gtk_label_new(_("Command to run after calendar export"));
	gtk_widget_show(export_command_label);
	gtk_box_pack_start(GTK_BOX (hbox3), export_command_label, FALSE, FALSE, 0);
	SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_command_label);

	export_command_entry = gtk_entry_new();
	gtk_widget_show(export_command_entry);
	gtk_box_pack_start(GTK_BOX (hbox3), export_command_entry, TRUE, TRUE, 0);
	SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_command_entry);


	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_enable_checkbtn), 
			vcalprefs.export_enable);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_subs_checkbtn), 
			vcalprefs.export_subs);
	if (vcalprefs.export_path == NULL || *vcalprefs.export_path == '\0')
		vcalprefs.export_path = g_strconcat(get_rc_dir(), 
					G_DIR_SEPARATOR_S,
                                        "claws-mail.ics", NULL);
	if (vcalprefs.export_command == NULL)
		vcalprefs.export_command = g_strdup("");
	gtk_entry_set_text(GTK_ENTRY(export_path_entry), 
			vcalprefs.export_path);
	gtk_entry_set_text(GTK_ENTRY(export_command_entry), 
			vcalprefs.export_command);

	hbox3 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox3);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);
	register_orage_checkbtn = gtk_check_button_new_with_label(_("Register Claws' calendar in XFCE's Orage clock"));
	CLAWS_SET_TIP(register_orage_checkbtn, 
			    _("Allows Orage (version greater than 4.4) to see Claws Mail's calendar"));

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(register_orage_checkbtn), 
			vcalprefs.orage_registered);
	gtk_widget_set_sensitive(register_orage_checkbtn, orage_available());
	g_signal_connect(G_OBJECT(register_orage_checkbtn), "toggled",
			 G_CALLBACK(register_orage_checkbtn_toggled), NULL); 
	gtk_widget_show (register_orage_checkbtn);
	gtk_box_pack_start(GTK_BOX (hbox3), register_orage_checkbtn, TRUE, TRUE, 0);

/* freebusy export */
/* export enable + path stuff */
	PACK_FRAME(vbox2, frame_freebusy_export, _("Free/Busy information"));
	vbox3 = gtk_vbox_new (FALSE, 8);
	gtk_widget_show (vbox3);
	gtk_container_add (GTK_CONTAINER (frame_freebusy_export), vbox3);
	gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);

/* export */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	export_freebusy_enable_checkbtn = gtk_check_button_new_with_label(
		_("Automatically export free/busy status to"));
	gtk_widget_show(export_freebusy_enable_checkbtn);
	gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_enable_checkbtn, FALSE, FALSE, 0);

	export_freebusy_path_entry = gtk_entry_new();
	gtk_widget_show(export_freebusy_path_entry);
	gtk_box_pack_start(GTK_BOX(hbox2), export_freebusy_path_entry, TRUE, TRUE, 0);
	SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_path_entry);
	CLAWS_SET_TIP(export_freebusy_enable_checkbtn, 
			    _("You can export to a local file or URL"));
	CLAWS_SET_TIP(export_freebusy_path_entry, 
			    _("Specify a local file or URL "
			      "(http://server/path/file.ifb)"));

/* auth */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	export_freebusy_user_label = gtk_label_new(_("User ID"));
	gtk_widget_show(export_freebusy_user_label);
	gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_user_label, FALSE, FALSE, 0);

	export_freebusy_user_entry = gtk_entry_new();
	gtk_widget_show(export_freebusy_user_entry);
	gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_user_entry, FALSE, FALSE, 0);

	export_freebusy_pass_label = gtk_label_new(_("Password"));
	gtk_widget_show(export_freebusy_pass_label);
	gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_pass_label, FALSE, FALSE, 0);

	export_freebusy_pass_entry = gtk_entry_new();
	gtk_entry_set_visibility(GTK_ENTRY(export_freebusy_pass_entry), FALSE);
	gtk_widget_show(export_freebusy_pass_entry);
	gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_pass_entry, FALSE, FALSE, 0);

/* run-command after export stuff */
	hbox3 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox3);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);

	export_freebusy_command_label = gtk_label_new(_("Command to run after free/busy status export"));
	gtk_widget_show(export_freebusy_command_label);
	gtk_box_pack_start(GTK_BOX (hbox3), export_freebusy_command_label, FALSE, FALSE, 0);
	SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_command_label);
	export_freebusy_command_entry = gtk_entry_new();
	gtk_widget_show(export_freebusy_command_entry);
	gtk_box_pack_start(GTK_BOX (hbox3), export_freebusy_command_entry, TRUE, TRUE, 0);
	SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_command_entry);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_freebusy_enable_checkbtn), 
			vcalprefs.export_freebusy_enable);
	if (vcalprefs.export_freebusy_path == NULL || 
	    *vcalprefs.export_freebusy_path == '\0')
		vcalprefs.export_freebusy_path = g_strconcat(get_rc_dir(), 
					G_DIR_SEPARATOR_S,
                                        "claws-mail.ifb", NULL);
	if (vcalprefs.export_freebusy_command == NULL)
		vcalprefs.export_freebusy_command = g_strdup("");
	if (vcalprefs.freebusy_get_url == NULL)
		vcalprefs.freebusy_get_url = g_strdup("");

/* free/busy import */
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

	freebusy_get_url_label = gtk_label_new(
		_("Get free/busy status of others from"));
	gtk_widget_show(freebusy_get_url_label);
	gtk_box_pack_start(GTK_BOX (hbox2), freebusy_get_url_label, FALSE, FALSE, 0);

	freebusy_get_url_entry = gtk_entry_new();
	gtk_widget_show(freebusy_get_url_entry);
	gtk_box_pack_start(GTK_BOX(hbox2), freebusy_get_url_entry, TRUE, TRUE, 0);
	CLAWS_SET_TIP(freebusy_get_url_entry, 
			    _("Specify a local file or URL "
			      "(http://server/path/file.ifb). Use %u "
			      "for the left part of the email address, %d for "
			      "the domain"));

	gtk_entry_set_text(GTK_ENTRY(export_freebusy_path_entry), 
			vcalprefs.export_freebusy_path);
	gtk_entry_set_text(GTK_ENTRY(export_freebusy_command_entry), 
			vcalprefs.export_freebusy_command);

	gtk_entry_set_text(GTK_ENTRY(freebusy_get_url_entry), 
			vcalprefs.freebusy_get_url);

	if (!vcalprefs.export_user)
		vcalprefs.export_user = g_strdup("");
	if (!vcalprefs.export_pass)
		vcalprefs.export_pass = g_strdup("");
	if (!vcalprefs.export_freebusy_user)
		vcalprefs.export_freebusy_user = g_strdup("");
	if (!vcalprefs.export_freebusy_pass)
		vcalprefs.export_freebusy_pass = g_strdup("");

	gtk_entry_set_text(GTK_ENTRY(export_user_entry), vcalprefs.export_user);
	gtk_entry_set_text(GTK_ENTRY(export_pass_entry), vcalprefs.export_pass);
	gtk_entry_set_text(GTK_ENTRY(export_freebusy_user_entry), vcalprefs.export_freebusy_user);
	gtk_entry_set_text(GTK_ENTRY(export_freebusy_pass_entry), vcalprefs.export_freebusy_pass);

	g_signal_connect(G_OBJECT(export_enable_checkbtn),
			 "toggled", G_CALLBACK(path_changed), page);
	g_signal_connect(G_OBJECT(export_freebusy_enable_checkbtn),
			 "toggled", G_CALLBACK(path_changed), page);
	g_signal_connect(G_OBJECT(export_path_entry),
			 "changed", G_CALLBACK(path_changed), page);
	g_signal_connect(G_OBJECT(export_freebusy_path_entry),
			 "changed", G_CALLBACK(path_changed), page);

	page->alert_enable_btn = alert_enable_checkbtn;
	page->alert_delay_spinbtn = alert_enable_spinbtn;

	page->export_enable_btn = export_enable_checkbtn;
	page->export_subs_btn = export_subs_checkbtn;
	page->export_path_entry = export_path_entry;
	page->export_command_entry = export_command_entry;

	page->export_freebusy_enable_btn = export_freebusy_enable_checkbtn;
	page->export_freebusy_path_entry = export_freebusy_path_entry;
	page->export_freebusy_command_entry = export_freebusy_command_entry;

	page->export_user_label = export_user_label;
	page->export_user_entry = export_user_entry;
	page->export_pass_label = export_pass_label;
	page->export_pass_entry = export_pass_entry;

	page->export_freebusy_user_label = export_freebusy_user_label;
	page->export_freebusy_user_entry = export_freebusy_user_entry;
	page->export_freebusy_pass_label = export_freebusy_pass_label;
	page->export_freebusy_pass_entry = export_freebusy_pass_entry;

	set_auth_sensitivity(page);

	page->freebusy_get_url_entry = freebusy_get_url_entry;

	page->page.widget = vbox1;
}

static void vcal_prefs_destroy_widget_func(PrefsPage *_page)
{
}

void vcal_prefs_save(void)
{
	PrefFile *pfile;
	gchar *rcpath;
	rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
	pfile = prefs_write_open(rcpath);
	g_free(rcpath);
	if (!pfile || (prefs_set_block_label(pfile, PREFS_BLOCK_NAME) < 0))
		return;

	if (prefs_write_param(param, pfile->fp) < 0) {
		g_warning("failed to write Vcalendar configuration to file\n");
		prefs_file_close_revert(pfile);
		return;
	}
        if (fprintf(pfile->fp, "\n") < 0) {
		FILE_OP_ERROR(rcpath, "fprintf");
		prefs_file_close_revert(pfile);
	} else
	        prefs_file_close(pfile);
}

static void vcal_prefs_save_func(PrefsPage * _page)
{
	struct VcalendarPage *page = (struct VcalendarPage *) _page;

/* alert */
	vcalprefs.alert_enable =
	    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
					 (page->alert_enable_btn));
	vcalprefs.alert_delay =
		gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
						 (page->alert_delay_spinbtn));

/* calendar export */
	vcalprefs.export_enable = 
	    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
					 (page->export_enable_btn));
	
	vcalprefs.export_subs = 
	    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
					 (page->export_subs_btn));
	
	g_free(vcalprefs.export_path);
	vcalprefs.export_path =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_path_entry), 0, -1);

	g_free(vcalprefs.export_command);
	vcalprefs.export_command =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_command_entry), 0, -1);
	
	g_free(vcalprefs.export_user);
	vcalprefs.export_user =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_user_entry), 0, -1);
	g_free(vcalprefs.export_pass);
	vcalprefs.export_pass =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_pass_entry), 0, -1);
	
/* free/busy export */
	vcalprefs.export_freebusy_enable = 
	    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
					 (page->export_freebusy_enable_btn));
	
	g_free(vcalprefs.export_freebusy_path);
	vcalprefs.export_freebusy_path =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_path_entry), 0, -1);

	g_free(vcalprefs.export_freebusy_command);
	vcalprefs.export_freebusy_command =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_command_entry), 0, -1);

	g_free(vcalprefs.export_freebusy_user);
	vcalprefs.export_freebusy_user =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_user_entry), 0, -1);
	g_free(vcalprefs.export_freebusy_pass);
	vcalprefs.export_freebusy_pass =
	    gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_pass_entry), 0, -1);
	

/* free/busy import */
	g_free(vcalprefs.freebusy_get_url);
	vcalprefs.freebusy_get_url =
	    gtk_editable_get_chars(GTK_EDITABLE(page->freebusy_get_url_entry), 0, -1);


	vcal_prefs_save();
	vcal_folder_export(NULL);
}

void vcal_prefs_init(void)
{
	static gchar *path[3];
	gchar *rcpath;

	path[0] = _("Plugins");
	path[1] = _("vCalendar");
	path[2] = NULL;

	prefs_set_default(param);
	rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
	prefs_read_config(param, PREFS_BLOCK_NAME, rcpath, NULL);
	g_free(rcpath);

	vcal_prefs_page.page.path = path;
	vcal_prefs_page.page.create_widget = vcal_prefs_create_widget_func;
	vcal_prefs_page.page.destroy_widget = vcal_prefs_destroy_widget_func;
	vcal_prefs_page.page.save_page = vcal_prefs_save_func;

	prefs_gtk_register_page((PrefsPage *) &vcal_prefs_page);
}

void vcal_prefs_done(void)
{
	prefs_gtk_unregister_page((PrefsPage *) &vcal_prefs_page);
}

--- NEW FILE: icaltime_as_local.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: vcal_folder.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */
[...2392 lines suppressed...]
		vcal_manager_free_event(event);
	}

	return retVal;
}

/* please call vcalendar_refresh_folder_contents() after one or more 
 * calls to this function */
gchar* vcal_update_event(const gchar *vevent)
{
	VCalEvent *event = vcal_get_event_from_ical(vevent, NULL);
	gboolean r = FALSE;
	if (event) {
		r = vcal_delete_event(event->uid);
		vcal_manager_free_event(event);
		if (r)
			return vcal_add_event(vevent);
	}
	return NULL;
}

--- NEW FILE: vcal_folder.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef __VCAL_FOLDER_H__
#define __VCAL_FOLDER_H__

#include <glib.h>
#include "folder.h"

extern gboolean manual_update;
typedef struct _day_win day_win;
typedef struct _month_win month_win;
FolderClass *vcal_folder_get_class();
void vcal_folder_gtk_init(void);
void vcal_folder_gtk_done(void);
GSList *vcal_folder_get_waiting_events(void);
GSList *vcal_folder_get_webcal_events(void);
GSList * vcal_folder_get_webcal_events_for_folder(FolderItem *item);
void vcal_folder_export(Folder *folder);

gboolean vcal_curl_put(gchar *url, FILE *fp, gint filesize, const gchar *user, const gchar *pass);
gchar *vcal_curl_read(const char *url, const gchar *label, gboolean verbose, 
	void (*callback)(const gchar *url, gchar *data, gboolean verbose, gchar
		*error));
gchar* get_item_event_list_for_date(FolderItem *item, EventTime date);
void vcal_folder_block_export(gboolean block);
void vcal_folder_refresh_cal(FolderItem *item);
GSList *vcal_get_events_list(FolderItem *item);

day_win *create_day_win(FolderItem *item, struct tm tmdate);
void refresh_day_win(day_win *dw);
void dw_close_window(day_win *dw);

month_win *create_month_win(FolderItem *item, struct tm tmdate);
void refresh_month_win(month_win *dw);
void mw_close_window(month_win *dw);

VCalEvent *vcal_get_event_from_ical(const gchar *ical, const gchar *charset);

void vcal_folder_free_data(void);
#endif

--- NEW FILE: Makefile.am ---
SUBDIRS = libical
EXTRA_DIST = claws.def plugin.def version.rc

if OS_WIN32

LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RC) \
     `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
     sed -e 's/-I/--include-dir /g;s/-D/--define /g'`

%.lo : %.rc
	$(LTRCCOMPILE) -i $< -o $@

plugin_res = version.lo
plugin_res_ldflag = -Wl,.libs/version.o

export_symbols = -export-symbols $(srcdir)/plugin.def

plugin_deps = libclaws.a $(plugin_res) plugin.def

libclaws.a: claws.def
	$(DLLTOOL) --output-lib $@ --def $<

plugin_ldadd = -L. -lclaws

else
plugin_res =
plugin_res_ldflag =
export_symbols =
plugin_deps =
plugin_ldadd =
endif

if PLATFORM_WIN32
no_undefined = -no-undefined
else
no_undefined =
endif

if CYGWIN
cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
else
cygwin_export_lib = 
endif

plugindir = $(pkglibdir)/plugins

plugin_LTLIBRARIES = vcalendar.la

INCLUDES= \
	-I$(top_srcdir)/src \
	-I$(top_srcdir)/src/common \
	-I$(top_builddir)/src/common \
	-I$(top_srcdir)/src/gtk \
	-I$(top_srcdir)/src/plugins/vcalendar/libical/libical

vcalendar_la_SOURCES = \
	plugin.c \
	vcalendar.c vcalendar.h \
	vcal_manager.c vcal_manager.h \
	vcal_folder.c vcal_folder.h \
	vcal_meeting_gtk.c vcal_meeting_gtk.h \
	vcal_prefs.c vcal_prefs.h \
	vcal_dbus.c vcal_dbus.h \
	icaltime_as_local.c icaltime_as_local.h \
	common-views.c common-views.h \
	day-view.c month-view.c

vcalendarincludedir = $(includedir)/claws-mail/plugins/vcalendar
vcalendarinclude_HEADERS = \
	vcal_interface.h
 
vcalendar_la_LDFLAGS = \
	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
	-avoid-version -module \
	$(GTK_LIBS)

vcalendar_la_DEPENDENCIES = $(plugin_deps)

vcalendar_la_LIBADD = $(plugin_ldadd) $(cygwin_export_lib) \
	$(GTK_LIBS) \
        $(top_builddir)/src/plugins/vcalendar/libical/libical/libical.la

AM_CPPFLAGS = \
	$(CLAWS_MAIL_CFLAGS) \
	$(GLIB_CFLAGS) \
	$(GTK_CFLAGS) \
	-DLOCALEDIR=\""$(localedir)"\"

clean-local:
	rm -f libclaws.a

--- NEW FILE: vcal_meeting_gtk.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef __VCAL_MEETING_GTK_H__
#define __VCAL_MEETING_GTK_H__

#include <glib.h>
#include <gtk/gtk.h>
#include "vcal_manager.h"

typedef struct _VCalMeeting VCalMeeting;
typedef struct _VCalAttendee VCalAttendee;

VCalMeeting *vcal_meeting_create(VCalEvent *event);
VCalMeeting *vcal_meeting_create_hidden(VCalEvent *event);
VCalMeeting *vcal_meeting_create_with_start(VCalEvent *event, struct tm *sdate);
gboolean vcal_meeting_send(VCalMeeting *meet);
gboolean vcal_meeting_alert_check(gpointer data);
gboolean vcal_meeting_export_calendar(const gchar *path, const gchar *user, const gchar *pass,gboolean automatic);
gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user, const gchar *pass);
gboolean attendee_available(VCalAttendee *attendee, const gchar *dtstart, const gchar *dtend, const gchar *contents);
#endif

--- NEW FILE: vcal_dbus.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2011 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef __VCAL_DBUS_H__
#define __VCAL_DBUS_H__

void connect_dbus(void);
void disconnect_dbus(void);

#endif

--- NEW FILE: vcal_prefs.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef VCALPREFS_H
#define VCALPREFS_H

#include <glib.h>

typedef struct _VcalendarPrefs VcalendarPrefs;

struct _VcalendarPrefs
{
	gboolean	 alert_enable;
	gint		 alert_delay;
	gboolean	 export_enable;
	gboolean	 export_freebusy_enable;
	gboolean	 export_subs;
	gchar 		*export_path;	
	gchar 		*export_freebusy_path;	
	gchar 		*export_command;	
	gchar		*export_user;
	gchar		*export_pass;
	gchar 		*export_freebusy_command;
	gchar		*freebusy_get_url;	
	gchar		*export_freebusy_user;
	gchar		*export_freebusy_pass;
	gboolean	 orage_registered;
};

extern VcalendarPrefs vcalprefs;

void vcal_prefs_init	(void);
void vcal_prefs_done	(void);
void vcal_prefs_save	(void);
#endif

--- NEW FILE: vcal_dbus.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2011 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifdef HAVE_CONFIG_H
#  include "config.h"
#include "claws-features.h"
#endif

#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>

#include <ical.h>
#include <gtk/gtk.h>

#include "utils.h"
#include "vcal_manager.h"
#include "vcal_folder.h"

#if(GLIB_CHECK_VERSION(2,26,0))

static guint dbus_own_id;

static void add_event_to_builder_if_match(VCalEvent *event, GVariantBuilder *array,
					  time_t start, time_t end)
{
	time_t evt_start = icaltime_as_timet((icaltime_from_string(event->dtstart)));
	time_t evt_end = icaltime_as_timet((icaltime_from_string(event->dtend)));
	if ((evt_start >= start && evt_start <= end)
	 || (evt_end >= start && evt_end <= end)) {
		g_variant_builder_open(array, 
			G_VARIANT_TYPE("(sssbxxa{sv})"));
			g_variant_builder_add(array, "s", event->uid);
			g_variant_builder_add(array, "s", event->summary);
			g_variant_builder_add(array, "s", event->description);
			g_variant_builder_add(array, "b", FALSE);
			g_variant_builder_add(array, "x", (gint64)evt_start);
			g_variant_builder_add(array, "x", (gint64)evt_end);
			g_variant_builder_open(array, G_VARIANT_TYPE("a{sv}"));
				/* We don't put stuff there. */
			g_variant_builder_close(array);
		g_variant_builder_close(array);
	 }
}

static void handle_method_call (GDBusConnection       *connection,
			        const gchar           *sender,
			        const gchar           *object_path,
			        const gchar           *interface_name,
			        const gchar           *method_name,
			        GVariant              *parameters,
			        GDBusMethodInvocation *invocation,
			        gpointer               user_data)
{
	time_t start, end;
	gboolean refresh;
	GSList *list, *cur;
	int i;
	GVariantBuilder *array = g_variant_builder_new(
			G_VARIANT_TYPE("(a(sssbxxa{sv}))"));
	GVariant *value;

	if (g_strcmp0(method_name, "GetEvents") != 0) {
		debug_print("Unknown method %s\n", method_name);
	}
	
	g_variant_get(parameters, "(xxb)", &start, &end, &refresh);

	
	g_variant_builder_open(array, G_VARIANT_TYPE("a(sssbxxa{sv})"));

	/* First our own calendar */
	list = vcal_folder_get_waiting_events();
	for (cur = list, i = 0; cur; cur = cur->next, i++) {
		VCalEvent *event = (VCalEvent *)cur->data;

		add_event_to_builder_if_match(event, array, start, end);

		g_free(event);
	}
	g_slist_free(list);

	/* Then subs. */
	list = vcal_folder_get_webcal_events();
	for (cur = list; cur; cur = cur->next) {
		/* Don't free that, it's done when subscriptions are
		 * fetched */
		icalcomponent *ical = (icalcomponent *)cur->data;
		VCalEvent *event = vcal_get_event_from_ical(
			icalcomponent_as_ical_string(ical), NULL);

		add_event_to_builder_if_match(event, array, start, end);
		g_free(event);
	}
	g_slist_free(list);

	g_variant_builder_close(array);
	
	value = g_variant_builder_end(array);
	g_variant_builder_unref(array);

	g_dbus_method_invocation_return_value (invocation, value);
	g_variant_unref(value);
}


static const GDBusInterfaceVTable interface_vtable =
{
	handle_method_call,
	NULL,
	NULL
};

static GDBusNodeInfo *introspection_data = NULL;
static GDBusInterfaceInfo *interface_info = NULL;

static const gchar introspection_xml[] =
  "<node>"
  "  <interface name='org.gnome.Shell.CalendarServer'>"
  "    <method name='GetEvents'>"
  "      <arg type='x' name='greeting' direction='in'/>"
  "      <arg type='x' name='greeting' direction='in'/>"
  "      <arg type='b' name='greeting' direction='in'/>"
  "      <arg type='a(sssbxxa{sv})' name='events' direction='out'/>"
  "    </method>"
  "  </interface>"
  "</node>";

static void name_acquired (GDBusConnection *connection,
			   const gchar     *name,
			   gpointer	    user_data)
{
	debug_print("Acquired DBUS name %s\n", name);
}

static void name_lost (GDBusConnection *connection,
		       const gchar     *name,
		       gpointer		user_data)
{
	debug_print("Lost DBUS name %s\n", name);
}

static void bus_acquired(GDBusConnection *connection,
			 const gchar     *name,
			 gpointer         user_data)
{
	GError *err = NULL;
	g_dbus_connection_register_object(connection,
		"/org/gnome/Shell/CalendarServer",
		introspection_data->interfaces[0],
		&interface_vtable, NULL, NULL, &err);
	if (err != NULL)
		debug_print("Error: %s\n", err->message);
}

void connect_dbus(void)
{
	introspection_data = g_dbus_node_info_new_for_xml(
				introspection_xml, NULL);
	if (introspection_data == NULL) {
		debug_print("Couldn't figure out XML.");
		return;
	}
	
	interface_info = g_dbus_node_info_lookup_interface(
				introspection_data,
				"org.gnome.Shell.CalendarServer");
	dbus_own_id = g_bus_own_name(G_BUS_TYPE_SESSION,
			"org.gnome.Shell.CalendarServer",
			G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT
			| G_BUS_NAME_OWNER_FLAGS_REPLACE,
			bus_acquired,
			name_acquired,
			name_lost,
			NULL, NULL);
}

void disconnect_dbus(void)
{
	g_bus_unown_name(dbus_own_id);
}

#else
void connect_dbus(void)
{
	debug_print("DBUS calendar export is not supported with Glib < 2.26\n");
}
void disconnect_dbus(void)
{
	debug_print("DBUS calendar export is not supported with Glib < 2.26\n");
}
#endif

--- NEW FILE: vcal_meeting_gtk.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */
[...2245 lines suppressed...]
			res = FALSE;
		}
		g_free(afile);
		g_free(file);
	} else if (file) {
		FILE *fp = g_fopen(tmpfile, "rb");
		if (!strncmp(file, "webcal://", 9)) {
			gchar *tmp = g_strdup_printf("http://%s", file+9);
			g_free(file);
			file = tmp;
		}
		if (fp) {
			res = vcal_curl_put(file, fp, filesize, user, pass);
			fclose(fp);
		}
		g_free(file);
	}
	g_free(tmpfile);
	return res;
}

--- NEW FILE: version.rc ---
1 VERSIONINFO
 FILEVERSION 0, 0, 0, 0
 PRODUCTVERSION 0, 0, 0, 0
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "000004b0"
        BEGIN
            VALUE "FileDescription", "VCalendar Plugin\0"
            VALUE "FileVersion", "0.0.0.0\0"
            VALUE "ProductVersion", "0.0.0.0 Win32\0"
            VALUE "LegalCopyright", "GPL / © 1999-2008 Hiroyuki Yamamoto & The Claws Mail Team\0"
            VALUE "CompanyName", "GNU / Free Software Foundation\0"
            VALUE "ProductName", "Claws Mail\0"
//            VALUE "Comments", "\0"
//            VALUE "InternalName", "\0"
//            VALUE "LegalTrademarks", "\0"
//            VALUE "OriginalFilename", "\0"
//            VALUE "PrivateBuild", "\0"
//            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0, 1200
    END
END

--- NEW FILE: plugin.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifdef HAVE_CONFIG_H
#  include "config.h"
#include "claws-features.h"
#endif

#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>

#include <time.h>
#include <stddef.h>
#include <curl/curl.h>

#include "version.h"
#include "vcalendar.h"
#include "claws.h"
#include "plugin.h"

#include "vcal_dbus.h"

gint plugin_init(gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,8,1,46),
				VERSION_NUMERIC, _("vCalendar"), error))
		return -1;

	tzset();

	curl_global_init(CURL_GLOBAL_DEFAULT);
	vcalendar_init();
	connect_dbus();

	return 0;	
}

gboolean plugin_done(void)
{
	disconnect_dbus();
	vcalendar_done();
	return TRUE;
}

const gchar *plugin_name(void)
{
	return _("vCalendar");
}

const gchar *plugin_desc(void)
{
	return _("This plugin enables vCalendar message handling like that produced "
		 "by Evolution or Outlook.\n\n"
		 "When loaded, it will create a vCalendar mailbox in the Folder "
		 "List, which will be populated by meetings that you have accepted "
		 "or created.\n"
		 "Meeting requests that you receive will be presented in an "
		 "appropriate form and you will be able to accept or decline them.\n"
		 "To create a meeting right-click on the vCalendar or "
		 "Meetings folder and choose \"New meeting...\".\n\n"
		 "You will also be able to subscribe to remote webCal feeds,"
		 "export your meetings and calendars, publish your free/busy "
		 "information and retrieve that information from others.");
}

const gchar *plugin_type(void)
{
	return "GTK2";
}

const gchar *plugin_licence(void)
{
	return "GPL3+";
}

const gchar *plugin_version(void)
{
	return VERSION;
}

struct PluginFeature *plugin_provides(void)
{
	static struct PluginFeature features[] = 
		{ {PLUGIN_MIMEVIEWER, "text/calendar"},
		  {PLUGIN_FOLDERCLASS, N_("Calendar")},
		  {PLUGIN_NOTHING, NULL}};
	return features;
}

--- NEW FILE: icaltime_as_local.h ---
#ifndef __ICALTIME_AS_LOCAL_H__
#define __ICALTIME_AS_LOCAL_H__
#include <time.h>
#include <ical.h>
#undef PACKAGE_BUGREPORT        /* Why are they in ical.h? */
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE
#undef VERSION

#if !HAVE_ICALTIME_AS_LOCAL

struct icaltimetype icaltime_as_local(struct icaltimetype tt);

#endif
#endif

--- NEW FILE: vcalendar.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */
[...1378 lines suppressed...]
		folderview_unselect(folderview);
		summary_clear_all(folderview->summaryview);
		if (fitem->folder->klass->item_closed)
			fitem->folder->klass->item_closed(fitem);
	}

	mimeview_unregister_viewer_factory(&vcal_viewer_factory);
	folder_unregister_class(vcal_folder_get_class());
	vcal_folder_gtk_done();
	vcal_prefs_done();
	g_source_remove(alert_timeout_tag);
	alert_timeout_tag = 0;
	g_source_remove(scan_timeout_tag);
	scan_timeout_tag = 0;

	MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "Message/CreateMeeting", main_menu_id);
	main_menu_id = 0;
	MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "Message/CreateMeeting", context_menu_id);
	context_menu_id = 0;
}

--- NEW FILE: vcalendar.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef __VCALENDAR_H__
#define __VCALENDAR_H__
#include <ical.h>
#include "vcal_manager.h"
#include "prefs_account.h"
#include "procmime.h"
#include "folder.h"

typedef struct _VCalViewer VCalViewer;

void vcalendar_init(void);
void vcalendar_done(void);
void vcalviewer_display_event (VCalViewer *vcalviewer, VCalEvent *event);
gchar *vcalviewer_get_uid_from_mimeinfo(MimeInfo *mimeinfo);
void vcalviewer_reload(FolderItem *item);
void vcalendar_cancel_meeting(FolderItem *item, const gchar *uid);
#endif

--- NEW FILE: vcal_manager.h ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */

#ifndef __VCAL_MANAGER_H__
#define __VCAL_MANAGER_H__

#include <glib.h>
#include <ical.h>
#include "prefs_account.h"
#include "folder.h"

#define EVENT_PAST_ID "past-events at vcal"
#define EVENT_TODAY_ID "today-events at vcal"
#define EVENT_TOMORROW_ID "tomorrow-events at vcal"
#define EVENT_THISWEEK_ID "thisweek-events at vcal"
#define EVENT_LATER_ID "later-events at vcal"
typedef struct _VCalEvent VCalEvent;

struct _VCalEvent 
{
	gchar *uid;
	gchar *organizer;
	gchar *orgname;
	gchar *start;
	gchar *end;
	gchar *dtstart;
	gchar *dtend;
	gchar *recur;
	gchar *tzid;
	gchar *location;
	gchar *summary;
	gchar *description;
	GSList *answers;
	enum icalproperty_method method;
	gint sequence;	
	gchar *url;
	enum icalproperty_kind type;
	time_t postponed;
	gboolean rec_occurence;
};

typedef struct _Answer Answer;

struct _Answer {
	gchar *attendee;
	gchar *name;
	enum icalparameter_partstat answer;
	enum icalparameter_cutype cutype;
};

typedef enum {
	EVENT_PAST = 0,
	EVENT_TODAY,
	EVENT_TOMORROW,
	EVENT_THISWEEK,
	EVENT_LATER
} EventTime;
VCalEvent *vcal_manager_new_event	(const gchar 	*uid, 
					 const gchar	*organizer,
					 const gchar	*orgname,
					 const gchar	*location,
					 const gchar	*summary,
					 const gchar	*description,
					 const gchar	*dtstart,
					 const gchar	*dtend,
					 const gchar	*recur,
					 const gchar	*tzid,
					 const gchar	*url,
					 enum icalproperty_method method,
					 gint		 sequence,
					 enum icalproperty_kind type);
					 
void vcal_manager_free_event (VCalEvent *event);
void vcal_manager_save_event (VCalEvent *event, gboolean export_after);
void vcal_manager_update_answer (VCalEvent 	*event, 
				 const gchar 	*attendee,
				 const gchar 	*name,
				 enum icalparameter_partstat ans,
				 enum icalparameter_cutype cutype);

VCalEvent *vcal_manager_load_event (const gchar *uid);
gboolean vcal_manager_reply (PrefsAccount 	*account, 
			     VCalEvent 		*event);
gboolean vcal_manager_request (PrefsAccount 	*account, 
			       VCalEvent 	*event);

GSList *vcal_manager_get_answers_emails(VCalEvent *event);
gchar *vcal_manager_get_attendee_name(VCalEvent *event, const gchar *attendee);
gchar *vcal_manager_get_reply_text_for_attendee(VCalEvent *event, const gchar *att);
gchar *vcal_manager_get_cutype_text_for_attendee(VCalEvent *event, const gchar *att);
enum icalparameter_partstat vcal_manager_get_reply_for_attendee(VCalEvent *event, const gchar *att);
enum icalparameter_partstat vcal_manager_get_cutype_for_attendee(VCalEvent *event, const gchar *att);
gchar *vcal_manager_get_event_path(void);
gchar *vcal_manager_get_event_file(const gchar *uid);
gchar *vcal_manager_event_dump(VCalEvent *event, gboolean change_date, gboolean
		change_from, icalcomponent *use_calendar, gboolean modif);
gchar *vcal_manager_icalevent_dump(icalcomponent *event, gchar *orga, icalcomponent *use_calendar);
gchar *vcal_manager_dateevent_dump(const gchar *uid, FolderItem *item);

gchar *vcal_manager_answer_get_text(enum icalparameter_partstat ans);
gchar *vcal_manager_cutype_get_text(enum icalparameter_cutype type);

PrefsAccount *vcal_manager_get_account_from_event(VCalEvent *event);

void vcal_manager_event_print(VCalEvent *event);
EventTime event_to_today(VCalEvent *event, time_t t);
const gchar *event_to_today_str(VCalEvent *event, time_t t);
void vcal_manager_copy_attendees(VCalEvent *src, VCalEvent *dest);
Answer *answer_new(const gchar *attendee, 
			  const gchar *name,
			  enum icalparameter_partstat ans,
			  enum icalparameter_cutype cutype);
#endif

--- NEW FILE: vcal_manager.c ---
/*
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Colin Leroy <colin at colino.net> and 
 * the Claws Mail team
 *
 * 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 3 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.
 */
[...1504 lines suppressed...]
		return EVENT_LATER;
}

const gchar *event_to_today_str(VCalEvent *event, time_t t)
{
	EventTime days = event_to_today(event, t);
	switch(days) {
	case EVENT_PAST:
		return EVENT_PAST_ID;
	case EVENT_TODAY:
		return EVENT_TODAY_ID;
	case EVENT_TOMORROW:
		return EVENT_TOMORROW_ID;
	case EVENT_THISWEEK:
		return EVENT_THISWEEK_ID;
	case EVENT_LATER:
		return EVENT_LATER_ID;
	}
	return NULL;
}



More information about the Commits mailing list