aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c40
1 files changed, 36 insertions, 4 deletions
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));
+ }
}