diff options
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index a7092f8f91..1c655ad7f2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4224,6 +4224,9 @@ e_day_view_add_event (ECalComponent *comp, } event.start = start; + event.tooltip = NULL; + event.color = NULL; + event.timeout = -1; event.end = end; event.canvas_item = NULL; event.comp_data->instance_start = start; @@ -4465,6 +4468,7 @@ e_day_view_reshape_long_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event); g_signal_emit_by_name (G_OBJECT(day_view), "event_added", event); @@ -4646,6 +4650,7 @@ e_day_view_reshape_day_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event); g_signal_emit_by_name (G_OBJECT(day_view), "event_added", event); @@ -5765,7 +5770,6 @@ cancel_editing (EDayView *day_view) e_day_view_stop_editing_event (day_view); } - static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *event, @@ -5825,10 +5829,50 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, e_day_view_on_editing_stopped (day_view, item); return FALSE; + case GDK_ENTER_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + pevent->x = ((GdkEventCrossing *)event)->x_root; + pevent->y = ((GdkEventCrossing *)event)->y_root; + pevent->tooltip = NULL; + pevent->timeout = g_timeout_add (500, (GSourceFunc)e_calendar_view_get_tooltips, pevent); + + return TRUE; + } + case GDK_LEAVE_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + if (pevent && pevent->tooltip) { + gtk_widget_destroy (pevent->tooltip); + pevent->tooltip = NULL; + } + + if (pevent && pevent->timeout != -1) { + g_source_remove (pevent->timeout); + pevent->timeout = -1; + } + + return TRUE; + } + case GDK_MOTION_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + pevent->x = ((GdkEventMotion *)event)->x_root; + pevent->y = ((GdkEventMotion *)event)->y_root; + + if (pevent->tooltip) { + gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16); + } + + return TRUE; + } default: break; } - + return FALSE; } |