diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-07-27 00:32:33 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-07-27 00:32:33 +0800 |
commit | e40b1868be45996f361fce9c1ea30dacd03306b2 (patch) | |
tree | 0463640cbb4c87e65c99c78ab80038e5b03768d0 /calendar/gui/e-week-view.c | |
parent | 6651d98ae36bc2565d5d6bb6914dc397278e00fd (diff) | |
download | gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.gz gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.zst gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.zip |
new function for adding VTIMEZONE components to a VCALENDAR component.
2002-07-26 Rodrigo Moya <rodrigo@ximian.com>
* cal-util/cal-util.[ch] (cal_util_add_timezones_from_component):
new function for adding VTIMEZONE components to a VCALENDAR
component.
* gui/e-calendar-table.c (copy_row_cb): added VTIMEZONE components
to resulting VCALENDAR top-level component.
* gui/e-week-view.c (e_week_view_copy_clipboard): copy to the
clipboard a top-level VCALENDAR component, with all the needed
VTIMEZONE components.
(e_week_view_on_copy): likewise.
* gui/e-day-view.c (e_day_view_copy_clipboard): likewise.
(e_day_view_on_copy): likewise.
svn path=/trunk/; revision=17604
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 1f6768c4cb..69533969d4 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -1865,6 +1865,8 @@ e_week_view_copy_clipboard (EWeekView *week_view) { EWeekViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; g_return_if_fail (E_IS_WEEK_VIEW (week_view)); @@ -1873,11 +1875,21 @@ e_week_view_copy_clipboard (EWeekView *week_view) if (event == NULL) return; - comp_str = cal_component_get_as_string (event->comp); + /* create top-level VCALENDAR component and add VTIMEZONE's */ + vcal_comp = cal_util_new_top_level (); + cal_util_add_timezones_from_component (vcal_comp, event->comp); + + new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (event->comp)); + icalcomponent_add_component (vcal_comp, new_icalcomp); + + comp_str = icalcomponent_as_ical_string (vcal_comp); if (week_view->clipboard_selection != NULL) g_free (week_view->clipboard_selection); - week_view->clipboard_selection = comp_str; + week_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (week_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } void @@ -3994,6 +4006,8 @@ e_week_view_on_copy (GtkWidget *widget, gpointer data) EWeekView *week_view; EWeekViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; week_view = E_WEEK_VIEW (data); @@ -4003,12 +4017,22 @@ e_week_view_on_copy (GtkWidget *widget, gpointer data) event = &g_array_index (week_view->events, EWeekViewEvent, week_view->popup_event_num); - comp_str = cal_component_get_as_string (event->comp); + /* create top-level VCALENDAR component and add VTIMEZONE's */ + vcal_comp = cal_util_new_top_level (); + cal_util_add_timezones_from_component (vcal_comp, event->comp); + + new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (event->comp)); + icalcomponent_add_component (vcal_comp, new_icalcomp); + + comp_str = icalcomponent_as_ical_string (vcal_comp); if (week_view->clipboard_selection) g_free (week_view->clipboard_selection); - week_view->clipboard_selection = comp_str; + week_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (week_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } static void |