Index: calendar/gui/e-calendar-table.c
===================================================================
--- calendar/gui/e-calendar-table.c	(revision 35859)
+++ calendar/gui/e-calendar-table.c	(working copy)
@@ -296,6 +296,8 @@ query_tooltip_cb (GtkWidget *widget, gin
 	icaltimezone *zone, *default_zone;
 	GSList *desc, *p;
 	int len;
+	ETable *etable;
+	ESelectionModel *esm;
 
 	if (keyboard_mode)
 		return FALSE;
@@ -306,10 +308,16 @@ query_tooltip_cb (GtkWidget *widget, gin
 
 	cal_table = E_CALENDAR_TABLE (user_data);
 
-	e_table_get_mouse_over_cell (e_calendar_table_get_table (cal_table), x, y, &row, &col);
-	if (row == -1)
+	etable = e_calendar_table_get_table (cal_table);
+	e_table_get_mouse_over_cell (etable, x, y, &row, &col);
+	if (row == -1 || !etable)
 		return FALSE;
 
+	/* respect sorting option, the 'e_table_get_mouse_over_cell' returns sorted row, not the model one */
+	esm = e_table_get_selection_model (etable);
+	if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter))
+		row = e_sorter_sorted_to_model (esm->sorter, row);
+
 	comp = e_cal_model_get_component_at (cal_table->model, row);
 	if (!comp || !comp->icalcomp)
 		return FALSE;
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 35859)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-07-29  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #329821
+
+	* gui/e-calendar-table.c: (query_tooltip_cb):
+	Recalculate returned row to the model row, if we are sorting.
+
 2008-07-20  Andre Klapper  <a9016009@gmx.de>
 
 	* calendar.error.xml: Fix some strings. See bug #543753.
