diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-07-24 22:58:40 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-07-24 22:58:40 +0800 |
commit | 3f060f07b401bad248daab957bbc79a6d21afb6c (patch) | |
tree | dfcf1194499596f2d95f70e727291c10bb263fd5 /calendar/gui/e-cal-view.c | |
parent | 148cb18a9a6cb68aefc6cbe0c12f9c8616e46aec (diff) | |
download | gsoc2013-evolution-3f060f07b401bad248daab957bbc79a6d21afb6c.tar.gz gsoc2013-evolution-3f060f07b401bad248daab957bbc79a6d21afb6c.tar.zst gsoc2013-evolution-3f060f07b401bad248daab957bbc79a6d21afb6c.zip |
define ECalViewEvent as the base struct for the other views.
2003-07-24 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-cal-view.h: define ECalViewEvent as the base struct for
the other views.
* gui/e-day-view.[ch]: EDayViewEvent is now based on ECalViewEvent.
(e_day_view_get_selected_events): made it return a list of
ECalViewEvent's, not CalComponent's, so that we can get more
information about the events.
* gui/e-week-view.[ch]: EWeekViewEvent is now based on ECalViewEvent.
(e_week_view_get_selected_events): same as e_day_view_get_selected_events.
* gui/e-cal-view.c (e_cal_view_cut_clipboard, e_cal_view_copy_clipboard,
e_cal_view_delete_selected_event, e_cal_view_delete_selected_events,
on_edit_appointment, on_save_as, on_print_event, on_meeting,
on_forward, e_cal_view_create_popup_menu):
* gui/calendar-commands.c (sensitize_calendar_commands): updated
to read ECalViewEvent's instead of CalComponent's as returned
by e_cal_view_get_selected_events().
svn path=/trunk/; revision=21946
Diffstat (limited to 'calendar/gui/e-cal-view.c')
-rw-r--r-- | calendar/gui/e-cal-view.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 84dab61a86..8913da5de2 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-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; } } |