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 | |
parent | 6651d98ae36bc2565d5d6bb6914dc397278e00fd (diff) | |
download | gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.gz gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.bz2 gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.lz gsoc2013-evolution-e40b1868be45996f361fce9c1ea30dacd03306b2.tar.xz 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')
-rw-r--r-- | calendar/gui/e-calendar-table.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 32 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 32 |
3 files changed, 59 insertions, 8 deletions
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index f8f5e1568b..f775b68f1a 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -834,6 +834,9 @@ copy_row_cb (int model_row, gpointer data) if (!comp) return; + /* add timezones to the VCALENDAR component */ + cal_util_add_timezones_from_component (cal_table->tmp_vcal, comp); + /* add the new component to the VCALENDAR component */ comp_str = cal_component_get_as_string (comp); child = icalparser_parse_string (comp_str); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 378de58323..c73b969731 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2769,6 +2769,8 @@ e_day_view_copy_clipboard (EDayView *day_view) { EDayViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; g_return_if_fail (E_IS_DAY_VIEW (day_view)); @@ -2776,11 +2778,21 @@ e_day_view_copy_clipboard (EDayView *day_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 (day_view->clipboard_selection != NULL) g_free (day_view->clipboard_selection); - day_view->clipboard_selection = comp_str; + day_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (day_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } void @@ -4133,6 +4145,8 @@ e_day_view_on_copy (GtkWidget *widget, gpointer data) EDayView *day_view; EDayViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; day_view = E_DAY_VIEW (data); @@ -4140,12 +4154,22 @@ e_day_view_on_copy (GtkWidget *widget, gpointer data) 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 (day_view->clipboard_selection) g_free (day_view->clipboard_selection); - day_view->clipboard_selection = comp_str; + day_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (day_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } static void 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 |