aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/year-view.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-15 15:59:09 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-15 15:59:09 +0800
commitf89cf24d2093c9982e461a2478d0acb4eeacc408 (patch)
treec87e7b2f1ea8090de832c0930c7a675044d0816b /calendar/gui/year-view.c
parent3ef4dcf9bbf11bc5b1a83bc4360733e730411f7c (diff)
downloadgsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar.gz
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar.bz2
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar.lz
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar.xz
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.tar.zst
gsoc2013-evolution-f89cf24d2093c9982e461a2478d0acb4eeacc408.zip
Year view marks ranges of new dates (on update view). Recurrence iterator
Year view marks ranges of new dates (on update view). Recurrence iterator functions are here now (clap, clap, clap). Microsoft Outlook's days are counted. Miguel. svn path=/trunk/; revision=139
Diffstat (limited to 'calendar/gui/year-view.c')
-rw-r--r--calendar/gui/year-view.c57
1 files changed, 49 insertions, 8 deletions
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index c3d6057086..c3db60f28b 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -72,7 +72,7 @@ gncal_year_view_init (GncalYearView *yview)
}
GtkWidget *
-gncal_year_view_new (time_t date)
+gncal_year_view_new (GnomeCalendar *calendar, time_t date)
{
struct tm my_tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
char monthbuff[40];
@@ -85,7 +85,8 @@ gncal_year_view_new (time_t date)
tmptm = localtime(&date);
yview->year = tmptm->tm_year;
- my_tm.tm_mon = tmptm->tm_year;
+ yview->gcal = calendar;
+ my_tm.tm_year = tmptm->tm_year;
yview->year_label = gtk_label_new("");
gtk_table_attach (GTK_TABLE (yview),
GTK_WIDGET (yview->year_label),
@@ -151,11 +152,51 @@ void gncal_year_view_set (GncalYearView *yview, time_t date)
}
}
-/*void
-gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
+static void
+year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
+{
+ GncalYearView *yview = (GncalYearView *) closure;
+ struct tm *tm_s;
+ int days, day;
+
+ tm_s = localtime (&start);
+ days = difftime (end, start) / (60*60*24);
+
+ for (day = 0; day <= days; day++){
+ time_t new = mktime (tm_s);
+ struct tm *tm_day;
+
+ tm_day = localtime (&new);
+ gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day->tm_mon]),
+ tm_day->tm_mday);
+ tm_s->tm_mday++;
+ }
+}
+
+void
+gncal_year_view_update (GncalYearView *yview, iCalObject *ico, int flags)
{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_YEAR_VIEW (wview));
+ g_return_if_fail (yview != NULL);
+ g_return_if_fail (GNCAL_IS_YEAR_VIEW (yview));
+
+ /* If only the summary changed, we dont care */
+ if ((flags & CHANGE_SUMMARY) == flags)
+ return;
+
+ if (flags & CHANGE_NEW){
+ time_t year_begin, year_end;
+ GList *l, *nl;
+
+ year_begin = time_year_begin (yview->year);
+ year_end = time_year_end (yview->year);
+
+ l = g_list_append (NULL, ico);
+ nl = calendar_get_objects_in_range (l, year_begin, year_end, NULL);
+ if (nl){
+ ical_foreach (nl, year_view_mark_day, yview);
+ g_list_free (nl);
+ }
+ g_list_free (l);
+ }
+}
- update (wview, TRUE, ico, flags);
-}*/