[evolution/clutter-calendar-v2] Render top date canvas & all-day event area under clutter. Render selection efficiently.



commit 1eee56d30559b25274b2e2a709852cc8a1dea122
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Thu Sep 2 14:15:22 2010 +0530

    Render top date canvas & all-day event area under clutter. Render
    selection efficiently.

 calendar/gui/Makefile.am                   |    2 +
 calendar/gui/e-day-view-clutter-top-item.c | 1016 ++++++++++++++++++++++++++++
 calendar/gui/e-day-view-clutter-top-item.h |   92 +++
 calendar/gui/e-day-view-top-item.c         |    2 +-
 calendar/gui/e-day-view.c                  |  249 ++++++-
 calendar/gui/e-day-view.h                  |    7 +
 6 files changed, 1329 insertions(+), 39 deletions(-)
---
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 55a084f..b7c158b 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -90,6 +90,8 @@ libevolution_calendar_la_SOURCES = \
 	e-day-view-clutter-time-item.h		\
 	e-day-view-clutter-main-item.c		\
 	e-day-view-clutter-main-item.h		\
+	e-day-view-clutter-top-item.c		\
+	e-day-view-clutter-top-item.h		\
 	cal-editor-utils.c			\
 	cal-editor-utils.h			\
 	calendar-config.c			\
diff --git a/calendar/gui/e-day-view-clutter-top-item.c b/calendar/gui/e-day-view-clutter-top-item.c
new file mode 100644
index 0000000..2951282
--- /dev/null
+++ b/calendar/gui/e-day-view-clutter-top-item.c
@@ -0,0 +1,1016 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ *		Srinivasa Ragavan <sragavan gnome com>
+ *
+ * Copyright (C) 2010 Intel Corporation. (www.intel.com)
+ *
+ */
+
+/*
+ * EDayViewClutterTopItem - displays the top part of the Day/Work Week calendar view.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include "e-util/e-categories-config.h"
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-categories.h>
+#include "calendar-config.h"
+#include "e-calendar-view.h"
+#include "e-day-view-clutter-top-item.h"
+
+#define E_DAY_VIEW_CLUTTER_TOP_ITEM_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM, EDayViewClutterTopItemPrivate))
+
+struct _EDayViewClutterTopItemPrivate {
+	/* The parent EDayView widget. */
+	EDayView *day_view;
+
+	/* Show dates or events. */
+	gboolean show_dates;
+
+#if HAVE_CLUTTER
+	/* Selection Actor*/
+	ClutterActor *selection_actor;
+#endif
+};
+
+enum {
+	PROP_0,
+	PROP_DAY_VIEW,
+	PROP_SHOW_DATES
+};
+
+static gpointer parent_class;
+
+/* This draws a little triangle to indicate that an event extends past
+   the days visible on screen. */
+static void
+day_view_clutter_top_item_draw_triangle (EDayViewClutterTopItem *top_item,
+                                 GdkDrawable *drawable,
+                                 gint x,
+                                 gint y,
+                                 gint w,
+                                 gint h,
+                                 gint event_num)
+{
+	EDayView *day_view;
+	EDayViewEvent *event;
+	GdkColor bg_color;
+	GdkPoint points[3];
+	gint c1, c2;
+	cairo_t *cr;
+
+	cr = gdk_cairo_create (drawable);
+
+	day_view = e_day_view_clutter_top_item_get_day_view (top_item);
+
+	points[0].x = x;
+	points[0].y = y;
+	points[1].x = x + w;
+	points[1].y = y + (h / 2);
+	points[2].x = x;
+	points[2].y = y + h - 1;
+
+	/* If the height is odd we can use the same central point for both
+	   lines. If it is even we use different end-points. */
+	c1 = c2 = y + (h / 2);
+	if (h % 2 == 0)
+		c1--;
+
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
+	event = &g_array_index (day_view->long_events, EDayViewEvent,
+				event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
+	cairo_save (cr);
+	/* Fill it in. */
+	if (gdk_color_parse (
+		e_cal_model_get_color_for_component (
+		e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
+		event->comp_data), &bg_color)) {
+		GdkColormap *colormap;
+
+		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
+		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
+			gdk_cairo_set_source_color (cr, &bg_color);
+		} else {
+			gdk_cairo_set_source_color (
+				cr, &day_view->colors
+				[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
+		}
+	} else {
+		gdk_cairo_set_source_color (
+			cr, &day_view->colors
+			[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
+	}
+
+	cairo_move_to (cr, points[0].x, points[0].y);
+	cairo_line_to (cr, points[1].x, points[1].y);
+	cairo_line_to (cr, points[2].x, points[2].y);
+	cairo_line_to (cr, points[0].x, points[0].y);
+	cairo_fill (cr);
+	cairo_restore (cr);
+
+	cairo_save (cr);
+	gdk_cairo_set_source_color (
+		cr, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]);
+	cairo_move_to (cr, x, y);
+	cairo_line_to (cr, x + w, c1);
+	cairo_move_to (cr, x, y + h - 1);
+	cairo_line_to (cr, x + w, c2);
+	cairo_stroke (cr);
+	cairo_restore (cr);
+
+	cairo_destroy (cr);
+}
+
+/* This draws one event in the top canvas. */
+static void
+day_view_clutter_top_item_draw_long_event (EDayViewClutterTopItem *top_item,
+                                   gint event_num,
+                                   GdkDrawable *drawable,
+                                   gint x,
+                                   gint y,
+                                   gint width,
+                                   gint height)
+{
+	EDayView *day_view;
+	EDayViewEvent *event;
+	GtkStyle *style;
+	GdkGC *gc, *fg_gc;
+	gint start_day, end_day;
+	gint item_x, item_y, item_w, item_h;
+	gint text_x, icon_x, icon_y, icon_x_inc;
+	ECalModel *model;
+	ECalComponent *comp;
+	gchar buffer[16];
+	gint hour, display_hour, minute, offset, time_width, time_x;
+	gint min_end_time_x, suffix_width, max_icon_x;
+	const gchar *suffix;
+	gboolean draw_start_triangle, draw_end_triangle;
+	GdkRectangle clip_rect;
+	GSList *categories_list, *elem;
+	PangoLayout *layout;
+	GdkColor bg_color;
+	cairo_t *cr;
+	cairo_pattern_t *pat;
+	guint16 red, green, blue;
+	gdouble cc = 65535.0;
+	gboolean gradient;
+	gfloat alpha;
+	gdouble x0, y0, rect_height, rect_width, radius;
+
+	day_view = e_day_view_clutter_top_item_get_day_view (top_item);
+	model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+
+	cr = gdk_cairo_create (drawable);
+
+	gradient = calendar_config_get_display_events_gradient ();
+	alpha = calendar_config_get_display_events_alpha ();
+
+	/* If the event is currently being dragged, don't draw it. It will
+	   be drawn in the special drag items. */
+	if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT
+	    && day_view->drag_event_num == event_num)
+		return;
+
+	if (!e_day_view_get_long_event_position (day_view, event_num,
+						 &start_day, &end_day,
+						 &item_x, &item_y,
+						 &item_w, &item_h))
+		return;
+
+	if (!is_array_index_in_bounds (day_view->long_events, event_num))
+		return;
+
+	event = &g_array_index (day_view->long_events, EDayViewEvent,
+				event_num);
+
+	if (!is_comp_data_valid (event))
+		return;
+
+	style = gtk_widget_get_style (GTK_WIDGET (day_view));
+	gc = day_view->main_gc;
+	fg_gc = style->fg_gc[GTK_STATE_NORMAL];
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (
+		comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+
+	if (gdk_color_parse (
+		e_cal_model_get_color_for_component (
+		e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
+		event->comp_data), &bg_color)) {
+		GdkColormap *colormap;
+
+		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
+		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
+			red = bg_color.red;
+			green = bg_color.green;
+			blue = bg_color.blue;
+		} else {
+			red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red;
+			green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green;
+			blue = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue;
+		}
+	} else {
+		red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red;
+		green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green;
+		blue = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue;
+	}
+
+	/* Fill the background with white to play with transparency */
+	cairo_save (cr);
+	x0	   = item_x - x + 4;
+	y0	   = item_y + 1 - y;
+	rect_width  = item_w - 8;
+	rect_height = item_h - 2;
+
+	radius = 12;
+
+	draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, alpha);
+	cairo_fill_preserve (cr);
+
+	cairo_restore (cr);
+
+	/* Draw the border around the event */
+
+	cairo_save (cr);
+	x0	   = item_x - x + 4;
+	y0	   = item_y + 1 - y;
+	rect_width  = item_w - 8;
+	rect_height = item_h - 2;
+
+	radius = 12;
+
+	draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
+
+	cairo_set_source_rgb (cr, red/cc, green/cc, blue/cc);
+	cairo_set_line_width (cr, 1.5);
+	cairo_stroke (cr);
+	cairo_restore (cr);
+
+	/* Fill in with gradient */
+
+	cairo_save (cr);
+
+	x0	   = item_x - x + 5.5;
+	y0	   = item_y + 2.5 - y;
+	rect_width  = item_w - 11;
+	rect_height = item_h - 5;
+
+	radius = 10;
+
+	draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
+
+	if (gradient) {
+		pat = cairo_pattern_create_linear (item_x - x + 5.5, item_y + 2.5 - y,
+						item_x - x + 5, item_y - y + item_h + 7.5);
+		cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+		cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
+		cairo_set_source (cr, pat);
+		cairo_fill_preserve (cr);
+		cairo_pattern_destroy (pat);
+	} else {
+		cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.8);
+		cairo_fill_preserve (cr);
+	}
+	cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0);
+	cairo_set_line_width (cr, 0.5);
+	cairo_stroke (cr);
+	cairo_restore (cr);
+
+	/* When resizing we don't draw the triangles.*/
+	draw_start_triangle = TRUE;
+	draw_end_triangle = TRUE;
+	if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
+	    && day_view->resize_event_day == E_DAY_VIEW_LONG_EVENT
+	    && day_view->resize_event_num == event_num) {
+		if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE)
+			draw_start_triangle = FALSE;
+
+		if  (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_RIGHT_EDGE)
+			draw_end_triangle = FALSE;
+	}
+
+	/* If the event starts before the first day shown, draw a triangle */
+	if (draw_start_triangle
+	    && event->start < day_view->day_starts[start_day]) {
+		day_view_clutter_top_item_draw_triangle (
+			top_item, drawable, item_x - x + 4, item_y - y,
+			-E_DAY_VIEW_BAR_WIDTH, item_h, event_num);
+	}
+
+	/* Similar for the event end. */
+	if (draw_end_triangle
+	    && event->end > day_view->day_starts[end_day + 1]) {
+		day_view_clutter_top_item_draw_triangle (
+			top_item, drawable, item_x + item_w - 4 - x,
+			item_y - y, E_DAY_VIEW_BAR_WIDTH, item_h,
+			event_num);
+	}
+
+	/* If we are editing the event we don't show the icons or the start
+	   & end times. */
+	if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT
+	    && day_view->editing_event_num == event_num) {
+		g_object_unref (comp);
+		cairo_destroy (cr);
+		return;
+	}
+
+	/* Determine the position of the label, so we know where to place the
+	   icons. Note that since the top canvas never scrolls we don't need
+	   to take the scroll offset into account. It will always be 0. */
+	text_x = event->canvas_item->x1;
+
+	/* Draw the start & end times, if necessary. */
+	min_end_time_x = item_x + E_DAY_VIEW_LONG_EVENT_X_PAD - x;
+
+	time_width = e_day_view_get_time_string_width (day_view);
+
+	if (event->start > day_view->day_starts[start_day]) {
+		offset = day_view->first_hour_shown * 60
+			+ day_view->first_minute_shown + event->start_minute;
+		hour = offset / 60;
+		minute = offset % 60;
+		/* Calculate the actual hour number to display. For 12-hour
+		   format we convert 0-23 to 12-11am/12-11pm. */
+		e_day_view_convert_time_to_display (day_view, hour,
+						    &display_hour,
+						    &suffix, &suffix_width);
+		if (e_cal_model_get_use_24_hour_format (model)) {
+			g_snprintf (buffer, sizeof (buffer), "%i:%02i",
+				    display_hour, minute);
+		} else {
+			g_snprintf (buffer, sizeof (buffer), "%i:%02i%s",
+				    display_hour, minute, suffix);
+		}
+
+		clip_rect.x = item_x - x;
+		clip_rect.y = item_y - y;
+		clip_rect.width = item_w - E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH;
+		clip_rect.height = item_h;
+		gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
+
+		time_x = item_x + E_DAY_VIEW_LONG_EVENT_X_PAD - x;
+		if (display_hour < 10)
+			time_x += day_view->digit_width;
+
+		layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer);
+		gdk_draw_layout (drawable, fg_gc,
+				 time_x,
+				 item_y + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT +
+				 E_DAY_VIEW_LONG_EVENT_Y_PAD - y,
+				 layout);
+		g_object_unref (layout);
+
+		gdk_gc_set_clip_rectangle (fg_gc, NULL);
+
+		min_end_time_x += time_width
+			+ E_DAY_VIEW_LONG_EVENT_TIME_X_PAD;
+	}
+
+	max_icon_x = item_x + item_w - E_DAY_VIEW_LONG_EVENT_X_PAD
+		- E_DAY_VIEW_ICON_WIDTH;
+
+	if (event->end < day_view->day_starts[end_day + 1]) {
+		offset = day_view->first_hour_shown * 60
+			+ day_view->first_minute_shown
+			+ event->end_minute;
+		hour = offset / 60;
+		minute = offset % 60;
+		time_x =
+			item_x + item_w - E_DAY_VIEW_LONG_EVENT_X_PAD -
+			time_width - E_DAY_VIEW_LONG_EVENT_TIME_X_PAD - x;
+
+		if (time_x >= min_end_time_x) {
+			/* Calculate the actual hour number to display. */
+			e_day_view_convert_time_to_display (day_view, hour,
+							    &display_hour,
+							    &suffix,
+							    &suffix_width);
+			if (e_cal_model_get_use_24_hour_format (model)) {
+				g_snprintf (buffer, sizeof (buffer),
+					    "%i:%02i", display_hour, minute);
+			} else {
+				g_snprintf (buffer, sizeof (buffer),
+					    "%i:%02i%s", display_hour, minute,
+					    suffix);
+			}
+
+			if (display_hour < 10)
+				time_x += day_view->digit_width;
+
+			layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer);
+			gdk_draw_layout (drawable, fg_gc,
+					 time_x,
+					 item_y + E_DAY_VIEW_LONG_EVENT_Y_PAD + 1 - y,
+					 layout);
+			g_object_unref (layout);
+
+			max_icon_x -= time_width + E_DAY_VIEW_LONG_EVENT_TIME_X_PAD;
+		}
+	}
+
+	/* Draw the icons. */
+	icon_x_inc = E_DAY_VIEW_ICON_WIDTH + E_DAY_VIEW_ICON_X_PAD;
+	icon_x = text_x - E_DAY_VIEW_LONG_EVENT_ICON_R_PAD
+		- icon_x_inc - x;
+	icon_y = item_y + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT
+		+ E_DAY_VIEW_ICON_Y_PAD - y;
+
+	if (icon_x <= max_icon_x && (
+		e_cal_component_has_recurrences (comp) ||
+		e_cal_component_is_instance (comp))) {
+		cairo_save (cr);
+		gdk_cairo_set_source_pixbuf (cr, day_view->recurrence_icon, icon_x, icon_y);
+		cairo_paint (cr);
+		cairo_restore (cr);
+
+		icon_x -= icon_x_inc;
+	}
+
+	if (icon_x <= max_icon_x && e_cal_component_has_attachments (comp)) {
+		cairo_save (cr);
+		gdk_cairo_set_source_pixbuf (cr, day_view->attach_icon, icon_x, icon_y);
+		cairo_paint (cr);
+		cairo_restore (cr);
+
+		icon_x -= icon_x_inc;
+	}
+	if (icon_x <= max_icon_x && e_cal_component_has_alarms (comp)) {
+		cairo_save (cr);
+		gdk_cairo_set_source_pixbuf (cr, day_view->reminder_icon, icon_x, icon_y);
+		cairo_paint (cr);
+		cairo_restore (cr);
+
+		icon_x -= icon_x_inc;
+	}
+
+	if (icon_x <= max_icon_x && e_cal_component_has_attendees (comp)) {
+		cairo_save (cr);
+		gdk_cairo_set_source_pixbuf (cr, day_view->meeting_icon, icon_x, icon_y);
+		cairo_paint (cr);
+		cairo_restore (cr);
+
+		icon_x -= icon_x_inc;
+	}
+
+	/* draw categories icons */
+	e_cal_component_get_categories_list (comp, &categories_list);
+	for (elem = categories_list; elem; elem = elem->next) {
+		gchar *category;
+		const gchar *file;
+		GdkPixbuf *pixbuf;
+
+		category = (gchar *) elem->data;
+		file = e_categories_get_icon_file_for (category);
+		if (!file)
+			continue;
+
+		pixbuf = gdk_pixbuf_new_from_file (file, NULL);
+		if (pixbuf == NULL)
+			continue;
+
+		if (icon_x <= max_icon_x) {
+			gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+			gdk_draw_pixbuf (drawable, gc,
+					 pixbuf,
+					 0, 0, icon_x, icon_y,
+					 E_DAY_VIEW_ICON_WIDTH,
+					 E_DAY_VIEW_ICON_HEIGHT,
+					 GDK_RGB_DITHER_NORMAL, 0, 0);
+			icon_x -= icon_x_inc;
+		}
+	}
+
+	e_cal_component_free_categories_list (categories_list);
+	g_object_unref (comp);
+	cairo_destroy (cr);
+	gdk_gc_set_clip_mask (gc, NULL);
+}
+
+static void
+day_view_clutter_top_item_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_DAY_VIEW:
+			e_day_view_clutter_top_item_set_day_view (
+				E_DAY_VIEW_CLUTTER_TOP_ITEM (object),
+				g_value_get_object (value));
+			return;
+
+		case PROP_SHOW_DATES:
+			e_day_view_clutter_top_item_set_show_dates (
+				E_DAY_VIEW_CLUTTER_TOP_ITEM (object),
+				g_value_get_boolean (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+day_view_clutter_top_item_get_property (GObject *object,
+                                guint property_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_DAY_VIEW:
+			g_value_set_object (
+				value, e_day_view_clutter_top_item_get_day_view (
+				E_DAY_VIEW_CLUTTER_TOP_ITEM (object)));
+			return;
+
+		case PROP_SHOW_DATES:
+			g_value_set_boolean (
+				value, e_day_view_clutter_top_item_get_show_dates (
+				E_DAY_VIEW_CLUTTER_TOP_ITEM (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+day_view_clutter_top_item_dispose (GObject *object)
+{
+	EDayViewClutterTopItemPrivate *priv;
+
+	priv = E_DAY_VIEW_CLUTTER_TOP_ITEM_GET_PRIVATE (object);
+
+	if (priv->day_view != NULL) {
+		g_object_unref (priv->day_view);
+		priv->day_view = NULL;
+	}
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+day_view_clutter_top_item_draw_selection (ClutterCairoTexture *canvas_item)
+{
+	EDayViewClutterTopItem *top_item;
+	EDayView *day_view;
+	cairo_t *cr;
+	int x=0, y=0;
+	guint width, height;
+	gboolean show_dates;
+	gint canvas_height;
+
+	clutter_cairo_texture_get_surface_size (canvas_item, &width, &height);	
+	
+	top_item = E_DAY_VIEW_CLUTTER_TOP_ITEM (canvas_item);
+	day_view = e_day_view_clutter_top_item_get_day_view (top_item);
+	show_dates = top_item->priv->show_dates;
+
+	canvas_height =
+		(show_dates ? 1 :
+		(MAX (1, day_view->rows_in_top_display) + 1)) *
+		day_view->top_row_height;
+
+	if (!top_item->priv->selection_actor) {
+		top_item->priv->selection_actor = clutter_cairo_texture_new (width, height);
+		clutter_actor_set_opacity (top_item->priv->selection_actor, 155);
+		clutter_container_add_actor (day_view->top_canvas_stage, top_item->priv->selection_actor);
+		clutter_actor_show (top_item->priv->selection_actor);
+		clutter_actor_raise (top_item->priv->selection_actor, (ClutterActor *)canvas_item);
+
+	}
+
+	if (!show_dates) {
+		if (gtk_widget_has_focus (GTK_WIDGET (day_view))
+			&& day_view->selection_start_day != -1) {
+			gint start_col, end_col, rect_x, rect_y, rect_w, rect_h;
+
+			start_col = day_view->selection_start_day;
+			end_col = day_view->selection_end_day;
+			
+			clutter_cairo_texture_clear (top_item->priv->selection_actor);
+			cr = clutter_cairo_texture_create (top_item->priv->selection_actor);
+
+			if (end_col > start_col
+			    || day_view->selection_start_row == -1
+			    || day_view->selection_end_row == -1) {
+				rect_x = day_view->day_offsets[start_col];
+				rect_y = 0;
+				rect_w = day_view->day_offsets[end_col + 1] - rect_x;
+				rect_h = canvas_height - 1 - rect_y;
+				
+				cairo_save (cr);
+				gdk_cairo_set_source_color (
+					cr, &day_view->colors
+					[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED]);
+				cairo_rectangle (cr, rect_x - x, rect_y - y,
+						 rect_w, rect_h);
+				cairo_fill (cr);
+				cairo_restore (cr);
+			}
+
+			cairo_destroy (cr);
+		}
+	}
+	
+}
+
+static void
+day_view_clutter_top_item_draw (ClutterCairoTexture *canvas_item)
+{
+	EDayViewClutterTopItem *top_item;
+	EDayView *day_view;
+	GtkStyle *style;
+	gchar buffer[128];
+	GtkAllocation allocation;
+	GdkRectangle clip_rect;
+	gint canvas_width, canvas_height, left_edge, day, date_width, date_x;
+	gint item_height, event_num;
+	PangoLayout *layout;
+	cairo_t *cr;
+	GdkColor bg, light, dark;
+	gboolean show_dates;
+	int x=0, y=0;
+	guint width, height;
+
+	clutter_cairo_texture_get_surface_size (canvas_item, &width, &height);	
+	cr = clutter_cairo_texture_create ((ClutterCairoTexture *)canvas_item);
+	
+	top_item = E_DAY_VIEW_CLUTTER_TOP_ITEM (canvas_item);
+	day_view = e_day_view_clutter_top_item_get_day_view (top_item);
+	g_return_if_fail (day_view != NULL);
+	show_dates = top_item->priv->show_dates;
+
+	style = gtk_widget_get_style (GTK_WIDGET (day_view));
+	canvas_width = width;
+	canvas_height =
+		(show_dates ? 1 :
+		(MAX (1, day_view->rows_in_top_display) + 1)) *
+		day_view->top_row_height;
+	left_edge = 0;
+	item_height = day_view->top_row_height - E_DAY_VIEW_TOP_CANVAS_Y_GAP;
+
+	bg = style->bg[GTK_STATE_NORMAL];
+	light = style->light[GTK_STATE_NORMAL];
+	dark = style->dark[GTK_STATE_NORMAL];
+
+	if (show_dates) {
+		/* Draw the shadow around the dates. */
+		cairo_save (cr);
+		gdk_cairo_set_source_color (cr, &light);
+		cairo_move_to (cr, left_edge - x, 1 - y);
+		cairo_line_to (cr, canvas_width - 2 - x, 1 - y);
+		cairo_move_to (cr, left_edge - x, 2 - y);
+		cairo_line_to (cr, left_edge - x, item_height - 2 - y);
+		cairo_stroke (cr);
+		cairo_restore (cr);
+
+		cairo_save (cr);
+		gdk_cairo_set_source_color (cr, &dark);
+		cairo_move_to (cr, left_edge - x, item_height - 1 - y);
+		cairo_line_to (cr, canvas_width - 1 - x, item_height - 1 - y);
+		cairo_move_to (cr, canvas_width - 1 - x, 1 - y);
+		cairo_line_to (cr, canvas_width - 1 - x, item_height - 1 - y);
+		cairo_stroke (cr);
+		cairo_restore (cr);
+
+		/* Draw the background for the dates. */
+		cairo_save (cr);
+		gdk_cairo_set_source_color (cr, &bg);
+		cairo_rectangle (cr, left_edge + 2 - x, 2 - y,
+				 canvas_width - left_edge - 3,
+				 item_height - 3);
+		cairo_fill (cr);
+		cairo_restore (cr);
+	}
+
+	if (!show_dates) {
+		/* Clear the main area background. */
+		cairo_save (cr);
+		gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS]);
+		cairo_rectangle (cr, left_edge - x, - y,
+				 canvas_width - left_edge,
+				 canvas_height);
+		cairo_fill (cr);
+		cairo_restore (cr);
+
+		day_view_clutter_top_item_draw_selection (canvas_item);
+#if 0
+		/* Draw the selection background. */
+		if (gtk_widget_has_focus (GTK_WIDGET (day_view))
+			&& day_view->selection_start_day != -1) {
+			gint start_col, end_col, rect_x, rect_y, rect_w, rect_h;
+
+			start_col = day_view->selection_start_day;
+			end_col = day_view->selection_end_day;
+
+			if (end_col > start_col
+			    || day_view->selection_start_row == -1
+			    || day_view->selection_end_row == -1) {
+				rect_x = day_view->day_offsets[start_col];
+				rect_y = 0;
+				rect_w = day_view->day_offsets[end_col + 1] - rect_x;
+				rect_h = canvas_height - 1 - rect_y;
+
+				cairo_save (cr);
+				gdk_cairo_set_source_color (
+					cr, &day_view->colors
+					[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED]);
+				cairo_rectangle (cr, rect_x - x, rect_y - y,
+						 rect_w, rect_h);
+				cairo_fill (cr);
+				cairo_restore (cr);
+			}
+		}
+#endif		
+	}
+
+	if (show_dates) {
+		/* Draw the date. Set a clipping rectangle so we don't draw over the
+		   next day. */
+		for (day = 0; day < day_view->days_shown; day++) {
+			e_day_view_clutter_top_item_get_day_label (day_view, day, buffer, sizeof (buffer));
+			clip_rect.x = day_view->day_offsets[day] - x;
+			clip_rect.y = 2 - y;
+			if (day_view->days_shown == 1) {
+				gtk_widget_get_allocation (
+					day_view->top_canvas, &allocation);
+				clip_rect.width = allocation.width - day_view->day_offsets[day];
+			} else
+				clip_rect.width = day_view->day_widths[day];
+			clip_rect.height = item_height - 2;
+			
+			cairo_save (cr);
+			cairo_rectangle (cr, (double)clip_rect.x , (double)clip_rect.y, (double)clip_rect.width, (double)clip_rect.height);
+			cairo_clip(cr);
+
+
+			layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer);
+			pango_layout_get_pixel_size (layout, &date_width, NULL);
+			date_x = day_view->day_offsets[day] + (clip_rect.width - date_width) / 2;
+
+			cairo_move_to (cr, date_x - x, 3 - y);
+			pango_cairo_show_layout (cr, layout);
+			cairo_stroke(cr);
+			cairo_restore(cr);
+			g_object_unref (layout);
+
+			/* Draw the lines down the left and right of the date cols. */
+			if (day != 0) {
+				cairo_save (cr);
+				gdk_cairo_set_source_color (cr, &light);
+				cairo_move_to (cr, day_view->day_offsets[day] - x,
+						4 - y);
+				cairo_line_to (cr, day_view->day_offsets[day] - x,
+						item_height - 4 - y);
+				cairo_stroke (cr);
+				gdk_cairo_set_source_color (cr, &dark);
+				cairo_move_to (cr, day_view->day_offsets[day] - 1 - x,
+						4 - y);
+				cairo_line_to (cr, day_view->day_offsets[day] - 1 - x,
+						item_height - 4 - y);
+				cairo_stroke (cr);
+				cairo_restore (cr);
+			}
+
+			/* Draw the lines between each column. */
+			if (day != 0) {
+				cairo_save (cr);
+				gdk_cairo_set_source_color (
+					cr, &day_view->colors
+					[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID]);
+				cairo_move_to (cr, day_view->day_offsets[day] - x,
+						item_height - y);
+				cairo_line_to (cr, day_view->day_offsets[day] - x,
+						canvas_height - y);
+				cairo_stroke (cr);
+				cairo_restore (cr);
+			}
+		}
+	}
+#if 0
+	if (!show_dates) {
+		/* Draw the long events. */
+		for (event_num = 0; event_num < day_view->long_events->len; event_num++) {
+			day_view_clutter_top_item_draw_long_event (
+				top_item, event_num, drawable,
+				x, y, width, height);
+		}
+	}
+#endif
+	cairo_destroy (cr);
+}
+
+
+static void
+day_view_clutter_top_item_class_init (EDayViewClutterTopItemClass *class)
+{
+	GObjectClass *object_class;
+	ClutterCairoTextureClass *item_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EDayViewClutterTopItemPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = day_view_clutter_top_item_set_property;
+	object_class->get_property = day_view_clutter_top_item_get_property;
+	object_class->dispose = day_view_clutter_top_item_dispose;
+
+	item_class = CLUTTER_CAIRO_TEXTURE_CLASS (class);
+
+	g_object_class_install_property (
+		object_class,
+		PROP_DAY_VIEW,
+		g_param_spec_object (
+			"day_view",
+			"Day View",
+			NULL,
+			E_TYPE_DAY_VIEW,
+			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SHOW_DATES,
+		g_param_spec_boolean (
+			"show_dates",
+			"Show Dates",
+			NULL,
+			TRUE,
+			G_PARAM_READWRITE));
+}
+
+static void
+day_view_clutter_top_item_init (EDayViewClutterTopItem *top_item)
+{
+	top_item->priv = E_DAY_VIEW_CLUTTER_TOP_ITEM_GET_PRIVATE (top_item);
+}
+
+GType
+e_day_view_clutter_top_item_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		const GTypeInfo type_info = {
+			sizeof (EDayViewClutterTopItemClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) day_view_clutter_top_item_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,  /* class_data */
+			sizeof (EDayViewClutterTopItem),
+			0,     /* n_preallocs */
+			(GInstanceInitFunc) day_view_clutter_top_item_init,
+			NULL   /* value_table */
+		};
+
+		type = g_type_register_static (
+			CLUTTER_TYPE_CAIRO_TEXTURE, "EDayViewClutterTopItem",
+			&type_info, 0);
+	}
+
+	return type;
+}
+
+void
+e_day_view_clutter_top_item_get_day_label (EDayView *day_view, gint day,
+				   gchar *buffer, gint buffer_len)
+{
+	struct icaltimetype day_start_tt;
+	struct tm day_start = { 0 };
+	const gchar *format;
+
+	day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day],
+						      FALSE,
+						      e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+	day_start.tm_year = day_start_tt.year - 1900;
+	day_start.tm_mon = day_start_tt.month - 1;
+	day_start.tm_mday = day_start_tt.day;
+	day_start.tm_isdst = -1;
+
+	day_start.tm_wday = time_day_of_week (day_start_tt.day,
+					      day_start_tt.month - 1,
+					      day_start_tt.year);
+
+	if (day_view->date_format == E_DAY_VIEW_DATE_FULL)
+		/* strftime format %A = full weekday name, %d = day of month,
+		   %B = full month name. Don't use any other specifiers. */
+		format = _("%A %d %B");
+	else if (day_view->date_format == E_DAY_VIEW_DATE_ABBREVIATED)
+		/* strftime format %a = abbreviated weekday name, %d = day of month,
+		   %b = abbreviated month name. Don't use any other specifiers. */
+		format = _("%a %d %b");
+	else if (day_view->date_format == E_DAY_VIEW_DATE_NO_WEEKDAY)
+		/* strftime format %d = day of month, %b = abbreviated month name.
+		   Don't use any other specifiers. */
+		format = _("%d %b");
+	else
+		format = "%d";
+
+	e_utf8_strftime (buffer, buffer_len, format, &day_start);
+}
+
+EDayView *
+e_day_view_clutter_top_item_get_day_view (EDayViewClutterTopItem *top_item)
+{
+	g_return_val_if_fail (E_IS_DAY_VIEW_CLUTTER_TOP_ITEM (top_item), NULL);
+
+	return top_item->priv->day_view;
+}
+
+void
+e_day_view_clutter_top_item_set_day_view (EDayViewClutterTopItem *top_item,
+                                  EDayView *day_view)
+{
+	g_return_if_fail (E_IS_DAY_VIEW_CLUTTER_TOP_ITEM (top_item));
+	g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+	if (top_item->priv->day_view != NULL)
+		g_object_unref (top_item->priv->day_view);
+
+	top_item->priv->day_view = g_object_ref (day_view);
+
+	g_object_notify (G_OBJECT (top_item), "day-view");
+}
+
+gboolean
+e_day_view_clutter_top_item_get_show_dates (EDayViewClutterTopItem *top_item)
+{
+	g_return_val_if_fail (E_IS_DAY_VIEW_CLUTTER_TOP_ITEM (top_item), FALSE);
+
+	return top_item->priv->show_dates;
+}
+
+void
+e_day_view_clutter_top_item_set_show_dates (EDayViewClutterTopItem *top_item,
+                                    gboolean show_dates)
+{
+	g_return_if_fail (E_IS_DAY_VIEW_CLUTTER_TOP_ITEM (top_item));
+
+	top_item->priv->show_dates = show_dates;
+
+	g_object_notify (G_OBJECT (top_item), "show-dates");
+}
+
+void
+e_day_view_clutter_top_item_set_size (EDayViewClutterTopItem *item, int width, int height)
+{
+	guint owidth, oheight;
+
+	clutter_cairo_texture_get_surface_size (item, &owidth, &oheight);	
+
+	clutter_cairo_texture_set_surface_size ((ClutterCairoTexture *)item, width > 0 ? width : owidth, height > 0 ? height : oheight);
+	clutter_cairo_texture_clear ((ClutterCairoTexture *)item);
+	if (item->priv->selection_actor) {
+		clutter_actor_destroy (item->priv->selection_actor);
+		item->priv->selection_actor = NULL;	
+	}	
+	day_view_clutter_top_item_draw (item);
+}
+
+void
+e_day_view_clutter_top_item_redraw (EDayViewClutterTopItem *item)
+{
+	if (item->priv->selection_actor) {
+		clutter_actor_destroy (item->priv->selection_actor);
+		item->priv->selection_actor = NULL;	
+	}		
+	clutter_cairo_texture_clear ((ClutterCairoTexture *)item);
+	day_view_clutter_top_item_draw (item);
+}
+
+void
+e_day_view_clutter_top_item_update_selection (EDayViewClutterTopItem *item)
+{
+	day_view_clutter_top_item_draw_selection (item);
+}
diff --git a/calendar/gui/e-day-view-clutter-top-item.h b/calendar/gui/e-day-view-clutter-top-item.h
new file mode 100644
index 0000000..dd69c8f
--- /dev/null
+++ b/calendar/gui/e-day-view-clutter-top-item.h
@@ -0,0 +1,92 @@
+/*
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ *		Srinivasa Ragavan <sragavan gnome org>
+ *
+ * Copyright (C) 2010 Intel Corporation. (www.intel.com)
+ *
+ */
+
+/*
+ * EDayViewClutterTopItem - displays the top part of the Day/Work Week calendar view.
+ */
+
+#ifndef E_DAY_VIEW_CLUTTER_TOP_ITEM_H
+#define E_DAY_VIEW_CLUTTER_TOP_ITEM_H
+
+#include "e-day-view.h"
+
+/* Standard GObject macros */
+#define E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM \
+	(e_day_view_clutter_top_item_get_type ())
+#define E_DAY_VIEW_CLUTTER_TOP_ITEM(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM, EDayViewClutterTopItem))
+#define E_DAY_VIEW_CLUTTER_TOP_ITEM_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM, EDayViewClutterTopItemClass))
+#define E_IS_DAY_VIEW_CLUTTER_TOP_ITEM(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM))
+#define E_IS_DAY_VIEW_CLUTTER_TOP_ITEM_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM))
+#define E_DAY_VIEW_CLUTTER_TOP_ITEM_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM, EDayViewClutterTopItemClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EDayViewClutterTopItem EDayViewClutterTopItem;
+typedef struct _EDayViewClutterTopItemClass EDayViewClutterTopItemClass;
+typedef struct _EDayViewClutterTopItemPrivate EDayViewClutterTopItemPrivate;
+
+struct _EDayViewClutterTopItem {
+	ClutterCairoTexture parent;
+	EDayViewClutterTopItemPrivate *priv;
+};
+
+struct _EDayViewClutterTopItemClass {
+	ClutterCairoTextureClass parent_class;
+};
+
+GType		e_day_view_clutter_top_item_get_type	(void);
+void		e_day_view_clutter_top_item_get_day_label
+						(EDayView *day_view,
+						 gint day,
+						 gchar *buffer,
+						 gint buffer_len);
+EDayView *	e_day_view_clutter_top_item_get_day_view(EDayViewClutterTopItem *top_item);
+void		e_day_view_clutter_top_item_set_day_view(EDayViewClutterTopItem *top_item,
+						 EDayView *day_view);
+gboolean	e_day_view_clutter_top_item_get_show_dates
+						(EDayViewClutterTopItem *top_item);
+void		e_day_view_clutter_top_item_set_show_dates
+						(EDayViewClutterTopItem *top_item,
+						 gboolean show_dates);
+void		e_day_view_clutter_top_item_set_size 
+						(EDayViewClutterTopItem *item, 
+						 int width, 
+						 int height);
+void		e_day_view_clutter_top_item_redraw 
+						(EDayViewClutterTopItem *item);
+void		e_day_view_clutter_top_item_update_selection 
+						(EDayViewClutterTopItem *item);
+
+G_END_DECLS
+
+#endif /* E_DAY_VIEW_CLUTTER_TOP_ITEM_H */
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index c0b718d..ef7ae0f 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -679,7 +679,7 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
 		cairo_restore (cr);
 
 		/* Draw the selection background. */
-		if (gtk_widget_has_focus (GTK_WIDGET (day_view))
+		if ((1 ||gtk_widget_has_focus (GTK_WIDGET (day_view)))
 			&& day_view->selection_start_day != -1) {
 			gint start_col, end_col, rect_x, rect_y, rect_w, rect_h;
 
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 690cb9f..1e82c44 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -58,6 +58,7 @@
 #if HAVE_CLUTTER
 #include "e-day-view-clutter-time-item.h"
 #include "e-day-view-clutter-main-item.h"
+#include "e-day-view-clutter-top-item.h"
 #endif
 #include "e-day-view-time-item.h"
 #include "e-day-view-top-item.h"
@@ -867,14 +868,15 @@ update_row (EDayView *day_view, gint row)
 
 	process_component (day_view, comp_data);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	e_day_view_queue_layout (day_view);
@@ -929,14 +931,15 @@ model_rows_inserted_cb (ETableModel *etm, gint row, gint count, gpointer user_da
 		process_component (day_view, comp_data);
 	}
 
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	e_day_view_queue_layout (day_view);
@@ -976,14 +979,15 @@ model_comps_deleted_cb (ETableModel *etm, gpointer data, gpointer user_data)
 		g_free (rid);
 	}
 
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	e_day_view_queue_layout (day_view);
@@ -1019,6 +1023,40 @@ timezone_changed_cb (ECalModel *cal_model, icaltimezone *old_zone,
 }
 
 static void                
+top_dates_canvas_set_canvas_size (GtkWidget     *widget,
+		 GtkAllocation *allocation,
+		  EDayView *day_view)
+{
+	ClutterActor *stage = day_view->top_dates_canvas_stage;
+	GtkWidget *embed = day_view->top_dates_canvas_embed;
+	guint w,h;
+
+	gtk_layout_get_size ((GtkLayout *)day_view->top_dates_canvas, &w, &h);
+
+	gtk_widget_set_size_request (embed, allocation->width, h);
+	clutter_actor_set_size (stage, allocation->width, h);
+	clutter_actor_set_size (day_view->top_dates_canvas_actor, allocation->width, h);
+	e_day_view_clutter_top_item_set_size ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor, allocation->width, h);
+}
+
+static void                
+top_canvas_set_canvas_size (GtkWidget     *widget,
+		 GtkAllocation *allocation,
+		  EDayView *day_view)
+{
+	ClutterActor *stage = day_view->top_canvas_stage;
+	GtkWidget *embed = day_view->top_canvas_embed;
+	guint w,h;
+
+	gtk_layout_get_size ((GtkLayout *)day_view->top_canvas, &w, &h);
+
+	gtk_widget_set_size_request (embed, allocation->width, h);
+	clutter_actor_set_size (stage, allocation->width, h);
+	clutter_actor_set_size (day_view->top_canvas_actor, allocation->width, h);
+	e_day_view_clutter_top_item_set_size ((EDayViewClutterTopItem *)day_view->top_canvas_actor, allocation->width, h);
+}
+
+static void                
 main_canvas_set_canvas_size (GtkWidget     *widget,
 		 GtkAllocation *allocation,
 		  EDayView *day_view)
@@ -1058,7 +1096,7 @@ static void
 e_day_view_init (EDayView *day_view)
 {
 	gint day;
-	GnomeCanvasGroup *canvas_group;
+	GnomeCanvasGroup *canvas_group = NULL;
 	GtkAdjustment *adjustment;
 	GtkLayout *layout;
 	GtkWidget *w;
@@ -1166,9 +1204,18 @@ e_day_view_init (EDayView *day_view)
 	 */
 	w = gtk_vbox_new (FALSE, 0);
 
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {
+#endif		
 	day_view->top_dates_canvas = e_canvas_new ();
-	gtk_box_pack_start (GTK_BOX (w), day_view->top_dates_canvas, TRUE, TRUE, 0);
 	day_view->top_canvas = e_canvas_new ();
+#if HAVE_CLUTTER
+	} else {
+	day_view->top_dates_canvas = gtk_layout_new (NULL, NULL);
+	day_view->top_canvas = gtk_layout_new (NULL, NULL);	
+	}
+#endif
+	gtk_box_pack_start (GTK_BOX (w), day_view->top_dates_canvas, TRUE, TRUE, 0);
 	gtk_box_pack_end (GTK_BOX (w), day_view->top_canvas, TRUE, TRUE, 0);
 
 	gtk_table_attach (GTK_TABLE (day_view), w,
@@ -1197,6 +1244,9 @@ e_day_view_init (EDayView *day_view)
 	g_signal_connect (day_view->top_canvas, "drag_data_received",
 			  G_CALLBACK (e_day_view_on_top_canvas_drag_data_received), day_view);
 
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {
+#endif		
 	canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_dates_canvas)->root);
 
 	day_view->top_dates_canvas_item =
@@ -1215,7 +1265,48 @@ e_day_view_init (EDayView *day_view)
 				       "EDayViewTopItem::day_view", day_view,
 				       "EDayViewTopItem::show_dates", FALSE,
 				       NULL);
+#if HAVE_CLUTTER
+	} else {
+	day_view->top_dates_canvas_embed = gtk_clutter_embed_new ();
+	gtk_widget_show (day_view->top_dates_canvas_embed);
+	gtk_container_add ((GtkContainer *)day_view->top_dates_canvas, (GtkWidget *)day_view->top_dates_canvas_embed);
+	g_signal_connect (day_view->top_dates_canvas, "size-allocate", G_CALLBACK(top_dates_canvas_set_canvas_size), day_view);
+
+	day_view->top_dates_canvas_stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *) day_view->top_dates_canvas_embed);
+
+	day_view->top_dates_canvas_actor = g_object_new (
+			E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM,
+			"EDayViewClutterTopItem::day_view", day_view,
+		       "EDayViewClutterTopItem::show_dates", TRUE,			
+                       "surface-width", 64,
+                       "surface-height", 50,			
+			NULL);
+	clutter_actor_set_reactive (day_view->top_dates_canvas_actor, FALSE);
+	((EDayViewClutterMainItem *)day_view->top_dates_canvas_actor)->stage = day_view->top_dates_canvas_stage;
+	clutter_container_add_actor ((ClutterContainer *)day_view->top_dates_canvas_stage, (ClutterActor *)day_view->top_dates_canvas_actor);
+	clutter_actor_show ((ClutterActor *)day_view->top_dates_canvas_actor);
+	gtk_widget_set_size_request (day_view->top_dates_canvas, -1, day_view->top_row_height);
+
+	day_view->top_canvas_embed = gtk_clutter_embed_new ();
+	gtk_widget_show (day_view->top_canvas_embed);
+	gtk_container_add ((GtkContainer *)day_view->top_canvas, (GtkWidget *)day_view->top_canvas_embed);
+	g_signal_connect (day_view->top_canvas, "size-allocate", G_CALLBACK(top_canvas_set_canvas_size), day_view);
 
+	day_view->top_canvas_stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *) day_view->top_canvas_embed);
+
+	day_view->top_canvas_actor = g_object_new (
+			E_TYPE_DAY_VIEW_CLUTTER_TOP_ITEM,
+			"EDayViewClutterTopItem::day_view", day_view,
+		       "EDayViewClutterTopItem::show_dates", FALSE,			
+                       "surface-width", 64,
+                       "surface-height", 50,			
+			NULL);
+	clutter_actor_set_reactive (day_view->top_canvas_actor, TRUE);
+	((EDayViewClutterMainItem *)day_view->top_canvas_actor)->stage = day_view->top_canvas_stage;
+	clutter_container_add_actor ((ClutterContainer *)day_view->top_canvas_stage, (ClutterActor *)day_view->top_canvas_actor);
+	clutter_actor_show ((ClutterActor *)day_view->top_canvas_actor);	
+	}
+#endif	
 	day_view->drag_long_event_rect_item =
 		gnome_canvas_item_new (canvas_group,
 				       gnome_canvas_rect_get_type (),
@@ -2081,14 +2172,15 @@ e_day_view_focus_in (GtkWidget *widget, GdkEventFocus *event)
 	GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
 #endif
 
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	return FALSE;
@@ -2111,14 +2203,15 @@ e_day_view_focus_out (GtkWidget *widget, GdkEventFocus *event)
 	GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
 #endif
 
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	return FALSE;
@@ -2549,15 +2642,18 @@ e_day_view_set_selected_time_range_in_top_visible	(EDayView	*day_view,
 	}
 
 	if (need_redraw) {
-		gtk_widget_queue_draw (day_view->top_canvas);
-		gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
+
 	}
 #endif	
 		
@@ -2613,15 +2709,17 @@ e_day_view_set_selected_time_range_visible	(EDayView	*day_view,
 	}
 
 	if (need_redraw) {
-		gtk_widget_queue_draw (day_view->top_canvas);
-		gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 		
@@ -2728,15 +2826,17 @@ e_day_view_set_selected_time_range	(ECalendarView	*cal_view,
 	}
 
 	if (need_redraw) {
-		gtk_widget_queue_draw (day_view->top_canvas);
-		gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 		
@@ -4113,15 +4213,17 @@ e_day_view_update_query (EDayView *day_view)
 
 	e_day_view_stop_editing_event (day_view);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 	e_day_view_free_events (day_view);
@@ -4475,14 +4577,16 @@ e_day_view_start_selection (EDayView *day_view,
 	day_view->selection_in_top_canvas = (row == -1) ? TRUE : FALSE;
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
+
+	gtk_widget_queue_draw (day_view->top_canvas);
 	gtk_widget_queue_draw (day_view->main_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 }
@@ -4527,14 +4631,15 @@ e_day_view_update_selection (EDayView *day_view,
 
 	/* FIXME: Optimise? */
 	if (need_redraw) {
-		gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 	}
@@ -4600,7 +4705,15 @@ e_day_view_update_long_event_resize (EDayView *day_view,
 	/* FIXME: Optimise? */
 	if (need_reshape) {
 		e_day_view_reshape_long_event (day_view, event_num);
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {	
+#endif		
 		gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+	} else {
+		e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	}
+#endif	
 	}
 }
 
@@ -4740,7 +4853,15 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
 	e_cal_component_commit_sequence (comp);
 	if (e_cal_component_has_recurrences (comp)) {
 		if (!recur_component_dialog (client, comp, &mod, NULL, FALSE)) {
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {	
+#endif		
 			gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+	} else {
+			e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	}
+#endif	
 			goto out;
 		}
 
@@ -4856,7 +4977,15 @@ e_day_view_finish_resize (EDayView *day_view)
 
 	if (e_cal_component_has_recurrences (comp)) {
 		if (!recur_component_dialog (client, comp, &mod, NULL, FALSE)) {
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {	
+#endif		
 			gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+	} else {
+			e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	}
+#endif	
 			goto out;
 		}
 
@@ -4909,7 +5038,15 @@ e_day_view_abort_resize (EDayView *day_view)
 
 	if (day == E_DAY_VIEW_LONG_EVENT) {
 		e_day_view_reshape_long_event (day_view, event_num);
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {	
+#endif		
 		gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+	} else {
+		e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	}
+#endif	
 
 		day_view->last_cursor_set_in_top_canvas = day_view->normal_cursor;
 		window = gtk_widget_get_window (day_view->top_canvas);
@@ -5175,7 +5312,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
 	gint text_x, text_w, num_icons, icons_width, width, time_width;
 	ECalComponent *comp;
 	gint min_text_x, max_text_w, text_width, line_len;
-	gchar *text, *end_of_line;
+	gchar *text = NULL, *end_of_line;
 	gboolean show_icons = TRUE, use_max_width = FALSE;
 	PangoContext *pango_context;
 	PangoLayout *layout;
@@ -5632,14 +5769,15 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view, GdkEventKey *key
 	add_event_data.comp_data = NULL;
 	e_day_view_add_event (comp, dtstart, dtend, &add_event_data);
 	e_day_view_check_layout (day_view);
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif	
 
@@ -5823,15 +5961,17 @@ e_day_view_goto_start_of_work_day (EDayView *day_view)
 
 	e_day_view_update_calendar_selection_time (day_view);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 }
@@ -5855,15 +5995,17 @@ e_day_view_goto_end_of_work_day (EDayView *day_view)
 
 	e_day_view_update_calendar_selection_time (day_view);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 }
@@ -5896,15 +6038,17 @@ e_day_view_change_duration_to_start_of_work_day (EDayView *day_view)
 
 	e_day_view_update_calendar_selection_time (day_view);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 }
@@ -5939,15 +6083,17 @@ e_day_view_change_duration_to_end_of_work_day (EDayView *day_view)
 
 	e_day_view_update_calendar_selection_time (day_view);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif	
 }
@@ -5977,14 +6123,15 @@ e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6267,14 +6414,15 @@ e_day_view_cursor_key_down_shifted (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6299,14 +6447,15 @@ e_day_view_cursor_key_left_shifted (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6331,14 +6480,15 @@ e_day_view_cursor_key_right_shifted (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6371,14 +6521,15 @@ e_day_view_cursor_key_up (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6411,14 +6562,15 @@ e_day_view_cursor_key_down (EDayView *day_view, GdkEventKey *event)
 	e_day_view_update_calendar_selection_time (day_view);
 
 	/* FIXME: Optimise? */
-	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif		
 }
@@ -6435,14 +6587,15 @@ e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event)
 		e_day_view_update_calendar_selection_time (day_view);
 
 		/* FIXME: Optimise? */
-		gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif			
 	}
@@ -6461,14 +6614,15 @@ e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
 		e_day_view_update_calendar_selection_time (day_view);
 
 		/* FIXME: Optimise? */
-		gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_update_selection ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_update_selection ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif			
 	}
@@ -7050,7 +7204,15 @@ e_day_view_change_event_time (EDayView *day_view, time_t start_dt, time_t end_dt
 
 	if (e_cal_component_has_recurrences (comp)) {
 		if (!recur_component_dialog (client, comp, &mod, NULL, FALSE)) {
+#if HAVE_CLUTTER
+		if (WITHOUT_CLUTTER) {
+#endif			
 			gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+		} else {
+			e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);	
+		}
+#endif		
 			goto out;
 		}
 
@@ -7276,14 +7438,15 @@ e_day_view_on_editing_stopped (EDayView *day_view,
 		e_day_view_foreach_event_with_uid (day_view, uid,
 						   e_day_view_remove_event_cb, NULL);
 		e_day_view_check_layout (day_view);
-		gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
 	}
 #endif			
 		goto out;
@@ -8305,7 +8468,15 @@ e_day_view_on_drag_end (GtkWidget      *widget,
 
 		event = &g_array_index (day_view->long_events, EDayViewEvent,
 					event_num);
+#if HAVE_CLUTTER
+	if (WITHOUT_CLUTTER) {
+#endif		
 		gtk_widget_queue_draw (day_view->top_canvas);
+#if HAVE_CLUTTER
+	} else {
+		e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	}
+#endif	
 	} else {
 		if (!is_array_index_in_bounds (day_view->events[day], event_num))
 			return;
@@ -8931,15 +9102,17 @@ e_day_view_layout_timeout_cb (gpointer data)
 {
 	EDayView *day_view = E_DAY_VIEW (data);
 
-	gtk_widget_queue_draw (day_view->top_canvas);
-	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	if (WITHOUT_CLUTTER) {
 #endif
 	gtk_widget_queue_draw (day_view->main_canvas);
+	gtk_widget_queue_draw (day_view->top_canvas);
+	gtk_widget_queue_draw (day_view->top_dates_canvas);
 #if HAVE_CLUTTER
 	} else {
 	e_day_view_clutter_main_item_redraw ((EDayViewClutterMainItem *)day_view->main_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_canvas_actor);
+	e_day_view_clutter_top_item_redraw ((EDayViewClutterTopItem *)day_view->top_dates_canvas_actor);
 	}
 #endif		
 	e_day_view_check_layout (day_view);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index dc9fc3a..acd3619 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -217,12 +217,19 @@ struct _EDayView {
 	/* The top canvas where the dates are shown. */
 	GtkWidget *top_dates_canvas;
 	GnomeCanvasItem *top_dates_canvas_item;
+#if HAVE_CLUTTER
+	ClutterActor *top_dates_canvas_actor;
+	GtkWidget *top_dates_canvas_embed;
+	ClutterActor *top_dates_canvas_stage;
+#endif
 
 	/* The top canvas where the dates and long appointments are shown. */
 	GtkWidget *top_canvas;
 	GnomeCanvasItem *top_canvas_item;
 #if HAVE_CLUTTER
 	ClutterActor *top_canvas_actor;
+	GtkWidget *top_canvas_embed;
+	ClutterActor *top_canvas_stage;
 #endif
 	/* scrollbar for top_canvas */
 	GtkWidget *tc_vscrollbar;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]