aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/year-view.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-18 03:35:43 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-18 03:35:43 +0800
commit55f88f14fed53f67e4b3cd5337cbe92aee0ec638 (patch)
treed783e0896a0649b70ec67c13073841c7f3fbd64f /calendar/gui/year-view.c
parentad0347d16bfd10f5f6b0783d7030cac420c4362a (diff)
downloadgsoc2013-evolution-55f88f14fed53f67e4b3cd5337cbe92aee0ec638.tar.gz
gsoc2013-evolution-55f88f14fed53f67e4b3cd5337cbe92aee0ec638.tar.zst
gsoc2013-evolution-55f88f14fed53f67e4b3cd5337cbe92aee0ec638.zip
Large number of updates. Recurrence basically works now in most of its
Large number of updates. Recurrence basically works now in most of its forms (daily, weekly, month-by-position). Miguel. svn path=/trunk/; revision=148
Diffstat (limited to 'calendar/gui/year-view.c')
-rw-r--r--calendar/gui/year-view.c76
1 files changed, 44 insertions, 32 deletions
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index 8f5a786239..a8972a7558 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -136,23 +136,6 @@ gncal_year_view_new (GnomeCalendar *calendar, time_t date)
return GTK_WIDGET (yview);
}
-void gncal_year_view_set (GncalYearView *yview, time_t date)
-{
- int i;
- char buff[10];
- struct tm *tmptm;
-
- tmptm = localtime(&date);
- yview->year = tmptm->tm_year;
-
- snprintf(buff, 10, "%d", yview->year + 1900);
- gtk_label_set(GTK_LABEL(yview->year_label), buff);
-
- for (i = 0; i < 12; i++) {
- gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year);
- }
-}
-
static void
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
{
@@ -174,6 +157,47 @@ year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
}
}
+static void
+gncal_year_view_set_year (GncalYearView *yview, int year)
+{
+ time_t year_begin, year_end;
+ char buff[20];
+ GList *l;
+ int i;
+
+ if (!yview->gcal->cal)
+ return;
+
+ snprintf(buff, 20, "%d", yview->year + 1900);
+ gtk_label_set(GTK_LABEL(yview->year_label), buff);
+
+ for (i = 0; i < 12; i++) {
+ gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year);
+ }
+
+ year_begin = time_year_begin (yview->year);
+ year_end = time_year_end (yview->year);
+
+ l = calendar_get_events_in_range (yview->gcal->cal, year_begin, year_end);
+ for (; l; l = l->next){
+ CalendarObject *co = l->data;
+
+ year_view_mark_day (co->ico, co->ev_start, co->ev_end, yview);
+ }
+ calendar_destroy_event_list (l);
+}
+
+void
+gncal_year_view_set (GncalYearView *yview, time_t date)
+{
+ struct tm *tmptm;
+
+ tmptm = localtime(&date);
+ yview->year = tmptm->tm_year;
+
+ gncal_year_view_set_year (yview, yview->year);
+}
+
void
gncal_year_view_update (GncalYearView *yview, iCalObject *ico, int flags)
{
@@ -184,19 +208,7 @@ gncal_year_view_update (GncalYearView *yview, iCalObject *ico, int flags)
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);
- }
+ printf ("MARCANDO!\n");
+ if (flags & CHANGE_NEW)
+ gncal_year_view_set_year (yview, yview->year);
}