diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1998-04-03 04:35:12 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-03 04:35:12 +0800 |
commit | f6963100c2509175cbd22b1556273ddbc0dd4e7d (patch) | |
tree | 5cfbf3602fda3fe5ecaaa716a2094c5aa2f3c0a7 /calendar/gui/gncal-day-view.c | |
parent | d4f096e0ca0ec461d5ab7a3369aaa95480561d92 (diff) | |
download | gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.gz gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.bz2 gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.lz gsoc2013-evolution-f6963100c2509175cbd22b1556273ddbc0dd4e7d.tar.xz 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/gui/gncal-day-view.c')
-rw-r--r-- | calendar/gui/gncal-day-view.c | 28 |
1 files changed, 19 insertions, 9 deletions
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 |