diff options
Diffstat (limited to 'calendar/gui/e-calendar-view.c')
-rw-r--r-- | calendar/gui/e-calendar-view.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 84dab61a86..8913da5de2 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -509,14 +509,18 @@ e_cal_view_cut_clipboard (ECalView *cal_view) e_cal_view_copy_clipboard (cal_view); for (l = selected; l != NULL; l = l->next) { - CalComponent *comp = l->data; + ECalViewEvent *event = (ECalViewEvent *) l->data; - if (itip_organizer_is_user (comp, cal_view->priv->client) + if (!event) + continue; + + if (itip_organizer_is_user (event->comp, cal_view->priv->client) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (cal_view), - cal_view->priv->client, comp, TRUE)) - itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, cal_view->priv->client, NULL); + cal_view->priv->client, event->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, + cal_view->priv->client, NULL); - cal_component_get_uid (comp, &uid); + cal_component_get_uid (event->comp, &uid); delete_error_dialog (cal_client_remove_object (cal_view->priv->client, uid), CAL_COMPONENT_EVENT); } @@ -533,6 +537,7 @@ e_cal_view_copy_clipboard (ECalView *cal_view) gchar *comp_str; icalcomponent *vcal_comp; icalcomponent *new_icalcomp; + ECalViewEvent *event; g_return_if_fail (E_IS_CAL_VIEW (cal_view)); @@ -542,13 +547,17 @@ e_cal_view_copy_clipboard (ECalView *cal_view) /* create top-level VCALENDAR component and add VTIMEZONE's */ vcal_comp = cal_util_new_top_level (); - for (l = selected; l != NULL; l = l->next) - cal_util_add_timezones_from_component (vcal_comp, (CalComponent *) l->data); + for (l = selected; l != NULL; l = l->next) { + event = (ECalViewEvent *) l->data; + + if (event) + cal_util_add_timezones_from_component (vcal_comp, event->comp); + } for (l = selected; l != NULL; l = l->next) { - CalComponent *comp = (CalComponent *) l->data; + event = (ECalViewEvent *) l->data; - new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (comp)); + new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (event->comp)); icalcomponent_add_component (vcal_comp, new_icalcomp); } @@ -605,14 +614,15 @@ void e_cal_view_delete_selected_event (ECalView *cal_view) { GList *selected; - CalComponent *comp; + ECalViewEvent *event; selected = e_cal_view_get_selected_events (cal_view); if (!selected) return; - comp = CAL_COMPONENT (selected->data); - delete_event (cal_view, comp); + event = (ECalViewEvent *) selected->data; + if (event) + delete_event (cal_view, event->comp); g_list_free (selected); } @@ -621,15 +631,16 @@ void e_cal_view_delete_selected_events (ECalView *cal_view) { GList *selected, *l; - CalComponent *comp; + ECalViewEvent *event; selected = e_cal_view_get_selected_events (cal_view); if (!selected) return; for (l = selected; l != NULL; l = l->next) { - comp = CAL_COMPONENT (l->data); - delete_event (cal_view, comp); + event = (ECalViewEvent *) l->data; + if (event) + delete_event (cal_view, event->comp); } g_list_free (selected); @@ -696,7 +707,10 @@ on_edit_appointment (GtkWidget *widget, gpointer user_data) selected = e_cal_view_get_selected_events (cal_view); if (selected) { - gnome_calendar_edit_object (cal_view->priv->calendar, CAL_COMPONENT (selected->data), FALSE); + ECalViewEvent *event = (ECalViewEvent *) selected->data; + + if (event) + gnome_calendar_edit_object (cal_view->priv->calendar, event->comp, FALSE); g_list_free (selected); } @@ -745,6 +759,7 @@ on_save_as (GtkWidget *widget, gpointer user_data) char *filename; char *ical_string; FILE *file; + ECalViewEvent *event; cal_view = E_CAL_VIEW (user_data); @@ -756,8 +771,8 @@ on_save_as (GtkWidget *widget, gpointer user_data) if (filename == NULL) return; - ical_string = cal_client_get_component_as_string (cal_view->priv->client, - CAL_COMPONENT (selected->data)); + event = (ECalViewEvent *) selected->data; + ical_string = cal_client_get_component_as_string (cal_view->priv->client, event->comp); if (ical_string == NULL) { g_warning ("Couldn't convert item to a string"); return; @@ -781,13 +796,15 @@ on_print_event (GtkWidget *widget, gpointer user_data) { ECalView *cal_view; GList *selected; + ECalViewEvent *event; cal_view = E_CAL_VIEW (user_data); selected = e_cal_view_get_selected_events (cal_view); if (!selected) return; - print_comp (CAL_COMPONENT (selected->data), cal_view->priv->client, FALSE); + event = (ECalViewEvent *) selected->data; + print_comp (event->comp, cal_view->priv->client, FALSE); } static void @@ -798,7 +815,8 @@ on_meeting (GtkWidget *widget, gpointer user_data) selected = e_cal_view_get_selected_events (cal_view); if (selected) { - gnome_calendar_edit_object (cal_view->priv->calendar, CAL_COMPONENT (selected->data), TRUE); + ECalViewEvent *event = (ECalViewEvent *) selected->data; + gnome_calendar_edit_object (cal_view->priv->calendar, event->comp, TRUE); g_list_free (selected); } @@ -812,8 +830,8 @@ on_forward (GtkWidget *widget, gpointer user_data) selected = e_cal_view_get_selected_events (cal_view); if (selected) { - itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, CAL_COMPONENT (selected->data), - cal_view->priv->client, NULL); + ECalViewEvent *event = (ECalViewEvent *) selected->data; + itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp, cal_view->priv->client, NULL); g_list_free (selected); } @@ -1058,21 +1076,23 @@ e_cal_view_create_popup_menu (ECalView *cal_view) main_items[9].submenu = cal_view->priv->view_menu; context_menu = main_items; } else { + ECalViewEvent *event; + context_menu = child_items; - if (cal_component_has_recurrences (CAL_COMPONENT (selected->data))) + event = (ECalViewEvent *) selected->data; + if (cal_component_has_recurrences (event->comp)) hide_mask |= MASK_SINGLE; else hide_mask |= MASK_RECURRING; - if (cal_component_is_instance (CAL_COMPONENT (selected->data))) + if (cal_component_is_instance (event->comp)) hide_mask |= MASK_INSTANCE; - if (cal_component_has_organizer (CAL_COMPONENT (selected->data))) { + if (cal_component_has_organizer (event->comp)) { disable_mask |= MASK_MEETING; - if (!itip_organizer_is_user (CAL_COMPONENT (selected->data), - cal_view->priv->client)) + if (!itip_organizer_is_user (event->comp, cal_view->priv->client)) disable_mask |= MASK_MEETING_ORGANIZER; } } |