From e9691668bc50836d03ddb13d17b75c9fa389a21d Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Mon, 17 May 1999 23:15:56 +0000 Subject: Add missing file -miguel svn path=/trunk/; revision=929 --- calendar/html-month.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 calendar/html-month.c (limited to 'calendar/html-month.c') diff --git a/calendar/html-month.c b/calendar/html-month.c new file mode 100644 index 0000000000..9d4af13c33 --- /dev/null +++ b/calendar/html-month.c @@ -0,0 +1,110 @@ +/* + * Creates an HTML rendering for this month + * Copyright (C) 1999 the Free Software Foundation + * + * Authors: + * Miguel de Icaza (miguel@kernel.org) + */ +#include +#include +#include +#include +#include +#include +#include +#include "calendar.h" +#include "alarm.h" +#include "eventedit.h" +#include "gnome-cal.h" +#include "main.h" +#include "timeutil.h" + +static void +make_html_header (GnomeCalendar *gcal, GString *s) +{ + g_string_sprintf (s, + "\n" + " \n" + " %s\n" + " \n" + " \n", + gcal->cal->title); +} + +static void +make_html_footer (GString *s) +{ + g_string_sprintf (s, ""); +} + +static void +make_days_headers (GString *s) +{ + g_string_append (s, + "

\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"); +} + +static void +make_days (GnomeCalendar *gcal, GString *s) +{ + struct tm tm, month; + time_t month_start; + int day; + time_t now = time (NULL); + + make_days_headers (s); + tm = *localtime (&now); + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_mday = 1; + month_start = mktime (&tm); + month = *localtime (&month_start); + + for (day = 0; day < month.tm_mday; day++){ + + } +#if 0 + day = 0; + for (y = 0; y < 5; y++){ + for (x = 0; x < 7; x++){ + if (month.tm_mday < day + } + } +#endif +} + +void +make_month_html (GnomeCalendar *gcal, char *output) +{ + FILE *f; + GString *s; + + g_return_if_fail (gcal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + f = fopen (output, "w"); + if (!f){ + g_warning ("Add nice error message here"); + return; + } + + s = g_string_new (""); + + make_html_header (gcal, s); + make_days (gcal, s); + make_html_footer (s); + + fwrite (s->str, strlen (s->str), 1, f); + + g_string_free (s, TRUE); + fclose (f); +} -- cgit v1.2.3
MONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAY