aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1998-04-03 04:35:12 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-03 04:35:12 +0800
commitf6963100c2509175cbd22b1556273ddbc0dd4e7d (patch)
tree5cfbf3602fda3fe5ecaaa716a2094c5aa2f3c0a7 /calendar
parentd4f096e0ca0ec461d5ab7a3369aaa95480561d92 (diff)
downloadgsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.gz
gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.zst
gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.zip
Day events are now cached inside the widget. They get initialized at this
1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx> * gncal-day-view.c (gncal_day_view_update): Day events are now cached inside the widget. They get initialized at this time. * view-utils.c (view_utils_draw_events): Use the list of events. svn path=/trunk/; revision=95
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gncal-day-view.c28
-rw-r--r--calendar/gncal-day-view.h12
-rw-r--r--calendar/gncal-week-view.c6
-rw-r--r--calendar/gncal-week-view.h6
-rw-r--r--calendar/gnome-cal.c8
-rw-r--r--calendar/gnome-cal.h1
-rw-r--r--calendar/gui/gncal-day-view.c28
-rw-r--r--calendar/gui/gncal-day-view.h12
-rw-r--r--calendar/gui/gncal-week-view.c6
-rw-r--r--calendar/gui/gncal-week-view.h6
-rw-r--r--calendar/gui/gnome-cal.c8
-rw-r--r--calendar/gui/gnome-cal.h1
-rw-r--r--calendar/gui/main.c4
-rw-r--r--calendar/gui/view-utils.c14
-rw-r--r--calendar/gui/view-utils.h2
-rw-r--r--calendar/main.c4
-rw-r--r--calendar/view-utils.c14
-rw-r--r--calendar/view-utils.h2
19 files changed, 97 insertions, 72 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 045ee929d9..560261725e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * gncal-day-view.c (gncal_day_view_update): Day events are now
+ cached inside the widget. They get initialized at this time.
+
+ * view-utils.c (view_utils_draw_events): Use the list of events.
+
1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gncal-day-view.c (gncal_day_view_set_shadow): New customization
diff --git a/calendar/gncal-day-view.c b/calendar/gncal-day-view.c
index ce0b363c62..eef854322d 100644
--- a/calendar/gncal-day-view.c
+++ b/calendar/gncal-day-view.c
@@ -93,24 +93,26 @@ gncal_day_view_destroy (GtkObject *object)
if (dview->day_str)
g_free (dview->day_str);
-
+ if (dview->events)
+ g_list_free (dview->events);
+
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
GtkWidget *
-gncal_day_view_new (Calendar *calendar, time_t lower, time_t upper)
+gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
{
GncalDayView *dview;
-#if 0
+
g_return_val_if_fail (calendar != NULL, NULL);
-#endif
+
dview = gtk_type_new (gncal_day_view_get_type ());
dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
-
+ dview->lower = lower;
+ dview->upper = upper;
+ dview->events = 0;
gncal_day_view_update (dview);
return GTK_WIDGET (dview);
@@ -268,7 +270,7 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
widget->style->fg_gc[GTK_STATE_NORMAL],
&rect,
VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->calendar,
+ dview->events,
dview->lower,
dview->upper);
@@ -288,10 +290,18 @@ gncal_day_view_update (GncalDayView *dview)
g_free (dview->day_str);
tm = *localtime (&dview->lower);
- strftime (buf, 256, "%A %d", &tm);
+ strftime (buf, sizeof (buf)-1, "%A %d", &tm);
dview->day_str = g_strdup (buf);
gtk_widget_draw (GTK_WIDGET (dview), NULL);
+
+ if (dview->events)
+ g_list_free (dview->events);
+
+ dview->events = calendar_get_events_in_range (dview->calendar->cal,
+ dview->lower,
+ dview->upper,
+ calendar_compare_by_dtstart);
}
void
diff --git a/calendar/gncal-day-view.h b/calendar/gncal-day-view.h
index e17eabcab7..80e8a6299f 100644
--- a/calendar/gncal-day-view.h
+++ b/calendar/gncal-day-view.h
@@ -12,7 +12,7 @@
#include <gtk/gtkwidget.h>
#include <libgnome/gnome-defs.h>
#include "calendar.h"
-
+#include "gnome-cal.h"
BEGIN_GNOME_DECLS
@@ -28,13 +28,13 @@ typedef struct _GncalDayViewClass GncalDayViewClass;
struct _GncalDayView {
GtkWidget widget;
- Calendar *calendar; /* the calendar we are associated to */
+ GnomeCalendar *calendar;/* the calendar we are associated to */
time_t lower; /* lower and upper times to display */
- time_t upper;
-
- char *day_str; /* what day is it? */
+ time_t upper; /* these include the full day */
+ char *day_str; /* what day is it? */
+ GList *events; /* the events for the this day */
GtkShadowType shadow_type;
};
@@ -44,7 +44,7 @@ struct _GncalDayViewClass {
guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (Calendar *calendar, time_t lower, time_t upper);
+GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
void gncal_day_view_update (GncalDayView *dview);
void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
diff --git a/calendar/gncal-week-view.c b/calendar/gncal-week-view.c
index ced5f13627..f7d3222cfe 100644
--- a/calendar/gncal-week-view.c
+++ b/calendar/gncal-week-view.c
@@ -49,13 +49,13 @@ gncal_week_view_init (GncalWeekView *wview)
}
GtkWidget *
-gncal_week_view_new (Calendar *calendar, time_t start_of_week)
+gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
{
GncalWeekView *wview;
int i;
-#if 0
+
g_return_val_if_fail (calendar != NULL, NULL);
-#endif
+
wview = gtk_type_new (gncal_week_view_get_type ());
wview->table.homogeneous = TRUE; /* FIXME: eeeeeeeeeek, GtkTable does not have a function to set this */
diff --git a/calendar/gncal-week-view.h b/calendar/gncal-week-view.h
index c7bfb1a19d..6bf29e40c4 100644
--- a/calendar/gncal-week-view.h
+++ b/calendar/gncal-week-view.h
@@ -13,7 +13,7 @@
#include <libgnome/gnome-defs.h>
#include <libgnomeui/gtkcalendar.h>
#include "gncal-day-view.h"
-
+#include "gnome-cal.h"
BEGIN_GNOME_DECLS
@@ -29,7 +29,7 @@ typedef struct _GncalWeekViewClass GncalWeekViewClass;
struct _GncalWeekView {
GtkTable table;
- Calendar *calendar; /* the calendar we are associated to */
+ GnomeCalendar *calendar; /* the calendar we are associated to */
struct tm start_of_week;
@@ -43,7 +43,7 @@ struct _GncalWeekViewClass {
guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (Calendar *calendar, time_t start_of_week);
+GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
void gncal_week_view_update (GncalWeekView *wview);
void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index 0b22a1a684..7e3755b0dc 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -8,6 +8,7 @@
#include <gnome.h>
#include "calendar.h"
#include "gnome-cal.h"
+#include "gncal-week-view.h"
#include "views.h"
static void gnome_calendar_init (GnomeCalendar *gcal);
@@ -38,19 +39,19 @@ static void
setup_widgets (GnomeCalendar *gcal)
{
GtkWidget *notebook;
- GtkWidget *day_view, *week_view, *year_view, *task_view;
+ GtkWidget *day_view, *year_view, *task_view;
time_t now;
now = time (NULL);
notebook = gtk_notebook_new ();
day_view = day_view_create (gcal);
- week_view = gncal_week_view_new (gcal->cal, now);
+ gcal->week_view = gncal_week_view_new (gcal, now);
year_view = year_view_create (gcal);
task_view = tasks_create (gcal);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), day_view, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), week_view, gtk_label_new (_("Week View")));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gcal->week_view, gtk_label_new (_("Week View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), year_view, gtk_label_new (_("Year View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), task_view, gtk_label_new (_("Tasks")));
@@ -92,4 +93,5 @@ void
gnome_calendar_load (GnomeCalendar *gcal, char *file)
{
calendar_load (gcal->cal, file);
+ gncal_week_view_update (GNCAL_WEEK_VIEW (gcal->week_view));
}
diff --git a/calendar/gnome-cal.h b/calendar/gnome-cal.h
index 2b30bf1f7c..3b2108c560 100644
--- a/calendar/gnome-cal.h
+++ b/calendar/gnome-cal.h
@@ -20,6 +20,7 @@ BEGIN_GNOME_DECLS
typedef struct {
GnomeApp gnome_app;
Calendar *cal;
+ GtkWidget *week_view;
} GnomeCalendar;
typedef struct {
diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c
index ce0b363c62..eef854322d 100644
--- a/calendar/gui/gncal-day-view.c
+++ b/calendar/gui/gncal-day-view.c
@@ -93,24 +93,26 @@ gncal_day_view_destroy (GtkObject *object)
if (dview->day_str)
g_free (dview->day_str);
-
+ if (dview->events)
+ g_list_free (dview->events);
+
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
GtkWidget *
-gncal_day_view_new (Calendar *calendar, time_t lower, time_t upper)
+gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
{
GncalDayView *dview;
-#if 0
+
g_return_val_if_fail (calendar != NULL, NULL);
-#endif
+
dview = gtk_type_new (gncal_day_view_get_type ());
dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
-
+ dview->lower = lower;
+ dview->upper = upper;
+ dview->events = 0;
gncal_day_view_update (dview);
return GTK_WIDGET (dview);
@@ -268,7 +270,7 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
widget->style->fg_gc[GTK_STATE_NORMAL],
&rect,
VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->calendar,
+ dview->events,
dview->lower,
dview->upper);
@@ -288,10 +290,18 @@ gncal_day_view_update (GncalDayView *dview)
g_free (dview->day_str);
tm = *localtime (&dview->lower);
- strftime (buf, 256, "%A %d", &tm);
+ strftime (buf, sizeof (buf)-1, "%A %d", &tm);
dview->day_str = g_strdup (buf);
gtk_widget_draw (GTK_WIDGET (dview), NULL);
+
+ if (dview->events)
+ g_list_free (dview->events);
+
+ dview->events = calendar_get_events_in_range (dview->calendar->cal,
+ dview->lower,
+ dview->upper,
+ calendar_compare_by_dtstart);
}
void
diff --git a/calendar/gui/gncal-day-view.h b/calendar/gui/gncal-day-view.h
index e17eabcab7..80e8a6299f 100644
--- a/calendar/gui/gncal-day-view.h
+++ b/calendar/gui/gncal-day-view.h
@@ -12,7 +12,7 @@
#include <gtk/gtkwidget.h>
#include <libgnome/gnome-defs.h>
#include "calendar.h"
-
+#include "gnome-cal.h"
BEGIN_GNOME_DECLS
@@ -28,13 +28,13 @@ typedef struct _GncalDayViewClass GncalDayViewClass;
struct _GncalDayView {
GtkWidget widget;
- Calendar *calendar; /* the calendar we are associated to */
+ GnomeCalendar *calendar;/* the calendar we are associated to */
time_t lower; /* lower and upper times to display */
- time_t upper;
-
- char *day_str; /* what day is it? */
+ time_t upper; /* these include the full day */
+ char *day_str; /* what day is it? */
+ GList *events; /* the events for the this day */
GtkShadowType shadow_type;
};
@@ -44,7 +44,7 @@ struct _GncalDayViewClass {
guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (Calendar *calendar, time_t lower, time_t upper);
+GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
void gncal_day_view_update (GncalDayView *dview);
void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
index ced5f13627..f7d3222cfe 100644
--- a/calendar/gui/gncal-week-view.c
+++ b/calendar/gui/gncal-week-view.c
@@ -49,13 +49,13 @@ gncal_week_view_init (GncalWeekView *wview)
}
GtkWidget *
-gncal_week_view_new (Calendar *calendar, time_t start_of_week)
+gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
{
GncalWeekView *wview;
int i;
-#if 0
+
g_return_val_if_fail (calendar != NULL, NULL);
-#endif
+
wview = gtk_type_new (gncal_week_view_get_type ());
wview->table.homogeneous = TRUE; /* FIXME: eeeeeeeeeek, GtkTable does not have a function to set this */
diff --git a/calendar/gui/gncal-week-view.h b/calendar/gui/gncal-week-view.h
index c7bfb1a19d..6bf29e40c4 100644
--- a/calendar/gui/gncal-week-view.h
+++ b/calendar/gui/gncal-week-view.h
@@ -13,7 +13,7 @@
#include <libgnome/gnome-defs.h>
#include <libgnomeui/gtkcalendar.h>
#include "gncal-day-view.h"
-
+#include "gnome-cal.h"
BEGIN_GNOME_DECLS
@@ -29,7 +29,7 @@ typedef struct _GncalWeekViewClass GncalWeekViewClass;
struct _GncalWeekView {
GtkTable table;
- Calendar *calendar; /* the calendar we are associated to */
+ GnomeCalendar *calendar; /* the calendar we are associated to */
struct tm start_of_week;
@@ -43,7 +43,7 @@ struct _GncalWeekViewClass {
guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (Calendar *calendar, time_t start_of_week);
+GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
void gncal_week_view_update (GncalWeekView *wview);
void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 0b22a1a684..7e3755b0dc 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -8,6 +8,7 @@
#include <gnome.h>
#include "calendar.h"
#include "gnome-cal.h"
+#include "gncal-week-view.h"
#include "views.h"
static void gnome_calendar_init (GnomeCalendar *gcal);
@@ -38,19 +39,19 @@ static void
setup_widgets (GnomeCalendar *gcal)
{
GtkWidget *notebook;
- GtkWidget *day_view, *week_view, *year_view, *task_view;
+ GtkWidget *day_view, *year_view, *task_view;
time_t now;
now = time (NULL);
notebook = gtk_notebook_new ();
day_view = day_view_create (gcal);
- week_view = gncal_week_view_new (gcal->cal, now);
+ gcal->week_view = gncal_week_view_new (gcal, now);
year_view = year_view_create (gcal);
task_view = tasks_create (gcal);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), day_view, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), week_view, gtk_label_new (_("Week View")));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gcal->week_view, gtk_label_new (_("Week View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), year_view, gtk_label_new (_("Year View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), task_view, gtk_label_new (_("Tasks")));
@@ -92,4 +93,5 @@ void
gnome_calendar_load (GnomeCalendar *gcal, char *file)
{
calendar_load (gcal->cal, file);
+ gncal_week_view_update (GNCAL_WEEK_VIEW (gcal->week_view));
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 2b30bf1f7c..3b2108c560 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -20,6 +20,7 @@ BEGIN_GNOME_DECLS
typedef struct {
GnomeApp gnome_app;
Calendar *cal;
+ GtkWidget *week_view;
} GnomeCalendar;
typedef struct {
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index be54ba2d81..628626dcb8 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -163,7 +163,7 @@ GnomeUIInfo gnome_cal_file_menu [] = {
GnomeUIInfo gnome_cal_about_menu [] = {
{ GNOME_APP_UI_ITEM, N_("About"), NULL, about_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT },
- GNOMEUIINFO_HELP ("midnight-commander"),
+ GNOMEUIINFO_HELP ("cal"),
GNOMEUIINFO_END
};
@@ -182,7 +182,7 @@ GnomeUIInfo gnome_toolbar [] = {
{ GNOME_APP_UI_ITEM, N_("Next"), N_("Next"), /*previous_clicked*/0, 0, 0,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD },
-
+
GNOMEUIINFO_END
};
diff --git a/calendar/gui/view-utils.c b/calendar/gui/view-utils.c
index 6b317fd70e..6e8c4044dd 100644
--- a/calendar/gui/view-utils.c
+++ b/calendar/gui/view-utils.c
@@ -11,6 +11,7 @@
/* FIXME: remove this function later */
+#if 0
static GList *
calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
{
@@ -50,10 +51,10 @@ calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareF
return list;
}
-
+#endif
void
view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, Calendar *calendar, time_t start, time_t end)
+ int flags, GList *events, time_t start, time_t end)
{
int font_height;
int x, y, max_y;
@@ -62,7 +63,7 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
struct tm tm_start, tm_end;
char *str;
iCalObject *ico;
- GList *the_list, *list;
+ GList *list;
gdk_gc_set_clip_rectangle (gc, area);
@@ -70,9 +71,7 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
- the_list = calendar_get_events_in_range (calendar, start, end, calendar_compare_by_dtstart);
-
- for (y = area->y, list = the_list; (y < max_y) && list; y += font_height, list = list->next) {
+ for (y = area->y, list = events; (y < max_y) && list; y += font_height, list = list->next) {
ico = list->data;
tm_start = *localtime (&ico->dtstart);
@@ -106,8 +105,5 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
y + widget->style->font->ascent,
str);
}
-
- g_list_free (the_list);
-
gdk_gc_set_clip_rectangle (gc, NULL);
}
diff --git a/calendar/gui/view-utils.h b/calendar/gui/view-utils.h
index c334bbd6d3..ea6e885eb0 100644
--- a/calendar/gui/view-utils.h
+++ b/calendar/gui/view-utils.h
@@ -20,7 +20,7 @@ enum {
void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, Calendar *calendar, time_t start, time_t end);
+ int flags, GList *events, time_t start, time_t end);
#endif
diff --git a/calendar/main.c b/calendar/main.c
index be54ba2d81..628626dcb8 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -163,7 +163,7 @@ GnomeUIInfo gnome_cal_file_menu [] = {
GnomeUIInfo gnome_cal_about_menu [] = {
{ GNOME_APP_UI_ITEM, N_("About"), NULL, about_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT },
- GNOMEUIINFO_HELP ("midnight-commander"),
+ GNOMEUIINFO_HELP ("cal"),
GNOMEUIINFO_END
};
@@ -182,7 +182,7 @@ GnomeUIInfo gnome_toolbar [] = {
{ GNOME_APP_UI_ITEM, N_("Next"), N_("Next"), /*previous_clicked*/0, 0, 0,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD },
-
+
GNOMEUIINFO_END
};
diff --git a/calendar/view-utils.c b/calendar/view-utils.c
index 6b317fd70e..6e8c4044dd 100644
--- a/calendar/view-utils.c
+++ b/calendar/view-utils.c
@@ -11,6 +11,7 @@
/* FIXME: remove this function later */
+#if 0
static GList *
calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
{
@@ -50,10 +51,10 @@ calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareF
return list;
}
-
+#endif
void
view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, Calendar *calendar, time_t start, time_t end)
+ int flags, GList *events, time_t start, time_t end)
{
int font_height;
int x, y, max_y;
@@ -62,7 +63,7 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
struct tm tm_start, tm_end;
char *str;
iCalObject *ico;
- GList *the_list, *list;
+ GList *list;
gdk_gc_set_clip_rectangle (gc, area);
@@ -70,9 +71,7 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
- the_list = calendar_get_events_in_range (calendar, start, end, calendar_compare_by_dtstart);
-
- for (y = area->y, list = the_list; (y < max_y) && list; y += font_height, list = list->next) {
+ for (y = area->y, list = events; (y < max_y) && list; y += font_height, list = list->next) {
ico = list->data;
tm_start = *localtime (&ico->dtstart);
@@ -106,8 +105,5 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
y + widget->style->font->ascent,
str);
}
-
- g_list_free (the_list);
-
gdk_gc_set_clip_rectangle (gc, NULL);
}
diff --git a/calendar/view-utils.h b/calendar/view-utils.h
index c334bbd6d3..ea6e885eb0 100644
--- a/calendar/view-utils.h
+++ b/calendar/view-utils.h
@@ -20,7 +20,7 @@ enum {
void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, Calendar *calendar, time_t start, time_t end);
+ int flags, GList *events, time_t start, time_t end);
#endif