From efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 14 Jun 2001 23:26:30 +0000 Subject: finished implementation of Paste stuff 2001-06-15 Rodrigo Moya * gui/e-day-view.c (selection_received): finished implementation of Paste stuff * gui/e-week-view.c (selection_received): ditto svn path=/trunk/; revision=10243 --- calendar/gui/e-week-view.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'calendar/gui/e-week-view.c') diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index fa4ea144d0..65ec0bfa21 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3017,6 +3017,11 @@ enum { }; static EPopupMenu main_items [] = { + { N_("Paste"), NULL, + e_week_view_on_paste, NULL, 0 }, + + { "", NULL, NULL, NULL, 0 }, + { N_("New Appointment..."), NULL, e_week_view_on_new_appointment, NULL, 0 }, { N_("New All Day Event"), NULL, @@ -3464,13 +3469,40 @@ selection_clear_event (GtkWidget *invisible, } } -static void selection_received (GtkWidget *invisible, - GtkSelectionData *selection_data, - guint time, - EWeekView *week_view) +static void +selection_received (GtkWidget *invisible, + GtkSelectionData *selection_data, + guint time, + EWeekView *week_view) { + char *comp_str; + icalcomponent *icalcomp; + time_t dtstart, dtend; + struct icaltimetype itime; + CalComponent *comp; + + g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { return; } + + comp_str = (char *) selection_data->data; + icalcomp = icalparser_parse_string ((const char *) comp_str); + if (icalcomp) { + dtstart = week_view->day_starts[week_view->selection_start_day]; + itime = icaltime_from_timet (dtstart, TRUE); + icalcomponent_set_dtstart (icalcomp, itime); + + dtend = week_view->day_starts[week_view->selection_end_day + 1]; + itime = icaltime_from_timet (dtend, TRUE); + icalcomponent_set_dtend (icalcomp, itime); + + comp = cal_component_new (); + cal_component_set_icalcomponent (comp, icalcomp); + cal_client_update_object (week_view->client, comp); + + gtk_object_unref (GTK_OBJECT (comp)); + } } -- cgit v1.2.3