Bug free version of the range computation in place.
1998-05-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * gnome-cal.c (mark_gtk_calendar_day): Bug free version of the range computation in place. * gncal-year-view.c (year_view_mark_day): Use the same new version of the range computation here. * calobj.c (ical_object_generate_events): Fix the begin/end condition. svn path=/trunk/; revision=215
This commit is contained in:

committed by
Arturo Espinosa

parent
3799134926
commit
418f8bfcb5
@ -1,3 +1,14 @@
|
|||||||
|
1998-05-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
|
* gnome-cal.c (mark_gtk_calendar_day): Bug free version of the
|
||||||
|
range computation in place.
|
||||||
|
|
||||||
|
* gncal-year-view.c (year_view_mark_day): Use the same new version
|
||||||
|
of the range computation here.
|
||||||
|
|
||||||
|
* calobj.c (ical_object_generate_events): Fix the begin/end
|
||||||
|
condition.
|
||||||
|
|
||||||
1998-05-14 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
1998-05-14 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
* timeutil.c (isodate_from_time_t): Do not add the spurious
|
* timeutil.c (isodate_from_time_t): Do not add the spurious
|
||||||
|
@ -1049,8 +1049,8 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
|
|||||||
int first_week_day, i;
|
int first_week_day, i;
|
||||||
|
|
||||||
if (!ico->recur){
|
if (!ico->recur){
|
||||||
if (time_in_range (ico->dtstart, start, end) ||
|
if ((end && (ico->dtstart < end) && ico->dtend > start) ||
|
||||||
time_in_range (ico->dtend, start, end)){
|
(end == 0 && ico->dtend > start)){
|
||||||
time_t ev_s, ev_e;
|
time_t ev_s, ev_e;
|
||||||
|
|
||||||
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
||||||
|
@ -1049,8 +1049,8 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
|
|||||||
int first_week_day, i;
|
int first_week_day, i;
|
||||||
|
|
||||||
if (!ico->recur){
|
if (!ico->recur){
|
||||||
if (time_in_range (ico->dtstart, start, end) ||
|
if ((end && (ico->dtstart < end) && ico->dtend > start) ||
|
||||||
time_in_range (ico->dtend, start, end)){
|
(end == 0 && ico->dtend > start)){
|
||||||
time_t ev_s, ev_e;
|
time_t ev_s, ev_e;
|
||||||
|
|
||||||
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
||||||
|
@ -335,19 +335,20 @@ static int
|
|||||||
mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
|
mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
|
||||||
{
|
{
|
||||||
GtkCalendar *gtk_cal = c;
|
GtkCalendar *gtk_cal = c;
|
||||||
struct tm *tm_s;
|
struct tm tm_s;
|
||||||
int days, day;
|
int days, day;
|
||||||
|
time_t t, day_end;
|
||||||
|
|
||||||
tm_s = localtime (&start);
|
tm_s = *localtime (&start);
|
||||||
days = difftime (end, start) / (60*60*24);
|
day_end = time_end_of_day (end);
|
||||||
|
|
||||||
for (day = 0; day <= days; day++){
|
for (t = start; t <= day_end; t += 60*60*24){
|
||||||
time_t new = mktime (tm_s);
|
time_t new = mktime (&tm_s);
|
||||||
struct tm *tm_day;
|
struct tm tm_day;
|
||||||
|
|
||||||
tm_day = localtime (&new);
|
tm_day = *localtime (&new);
|
||||||
gtk_calendar_mark_day (gtk_cal, tm_day->tm_mday);
|
gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday);
|
||||||
tm_s->tm_mday++;
|
tm_s.tm_mday++;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -335,19 +335,20 @@ static int
|
|||||||
mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
|
mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
|
||||||
{
|
{
|
||||||
GtkCalendar *gtk_cal = c;
|
GtkCalendar *gtk_cal = c;
|
||||||
struct tm *tm_s;
|
struct tm tm_s;
|
||||||
int days, day;
|
int days, day;
|
||||||
|
time_t t, day_end;
|
||||||
|
|
||||||
tm_s = localtime (&start);
|
tm_s = *localtime (&start);
|
||||||
days = difftime (end, start) / (60*60*24);
|
day_end = time_end_of_day (end);
|
||||||
|
|
||||||
for (day = 0; day <= days; day++){
|
for (t = start; t <= day_end; t += 60*60*24){
|
||||||
time_t new = mktime (tm_s);
|
time_t new = mktime (&tm_s);
|
||||||
struct tm *tm_day;
|
struct tm tm_day;
|
||||||
|
|
||||||
tm_day = localtime (&new);
|
tm_day = *localtime (&new);
|
||||||
gtk_calendar_mark_day (gtk_cal, tm_day->tm_mday);
|
gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday);
|
||||||
tm_s->tm_mday++;
|
tm_s.tm_mday++;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -168,20 +168,21 @@ static void
|
|||||||
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
||||||
{
|
{
|
||||||
GncalYearView *yview = (GncalYearView *) closure;
|
GncalYearView *yview = (GncalYearView *) closure;
|
||||||
struct tm *tm_s;
|
struct tm tm_s;
|
||||||
int days, day;
|
int days, day;
|
||||||
|
time_t t, day_end;
|
||||||
|
|
||||||
tm_s = localtime (&start);
|
tm_s = *localtime (&start);
|
||||||
days = difftime (end, start) / (60*60*24);
|
day_end = time_end_of_day (end);
|
||||||
|
|
||||||
for (day = 0; day <= days; day++){
|
for (t = start; t <= day_end; t+= 60*60*24){
|
||||||
time_t new = mktime (tm_s);
|
time_t new = mktime (&tm_s);
|
||||||
struct tm *tm_day;
|
struct tm tm_day;
|
||||||
|
|
||||||
tm_day = localtime (&new);
|
tm_day = *localtime (&new);
|
||||||
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day->tm_mon]),
|
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day.tm_mon]),
|
||||||
tm_day->tm_mday);
|
tm_day.tm_mday);
|
||||||
tm_s->tm_mday++;
|
tm_s.tm_mday++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,8 +1049,8 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
|
|||||||
int first_week_day, i;
|
int first_week_day, i;
|
||||||
|
|
||||||
if (!ico->recur){
|
if (!ico->recur){
|
||||||
if (time_in_range (ico->dtstart, start, end) ||
|
if ((end && (ico->dtstart < end) && ico->dtend > start) ||
|
||||||
time_in_range (ico->dtend, start, end)){
|
(end == 0 && ico->dtend > start)){
|
||||||
time_t ev_s, ev_e;
|
time_t ev_s, ev_e;
|
||||||
|
|
||||||
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
ev_s = ico->dtstart < start ? start : ico->dtstart;
|
||||||
|
@ -168,20 +168,21 @@ static void
|
|||||||
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
||||||
{
|
{
|
||||||
GncalYearView *yview = (GncalYearView *) closure;
|
GncalYearView *yview = (GncalYearView *) closure;
|
||||||
struct tm *tm_s;
|
struct tm tm_s;
|
||||||
int days, day;
|
int days, day;
|
||||||
|
time_t t, day_end;
|
||||||
|
|
||||||
tm_s = localtime (&start);
|
tm_s = *localtime (&start);
|
||||||
days = difftime (end, start) / (60*60*24);
|
day_end = time_end_of_day (end);
|
||||||
|
|
||||||
for (day = 0; day <= days; day++){
|
for (t = start; t <= day_end; t+= 60*60*24){
|
||||||
time_t new = mktime (tm_s);
|
time_t new = mktime (&tm_s);
|
||||||
struct tm *tm_day;
|
struct tm tm_day;
|
||||||
|
|
||||||
tm_day = localtime (&new);
|
tm_day = *localtime (&new);
|
||||||
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day->tm_mon]),
|
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day.tm_mon]),
|
||||||
tm_day->tm_mday);
|
tm_day.tm_mday);
|
||||||
tm_s->tm_mday++;
|
tm_s.tm_mday++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user