From f9377c48533c15010ef9a76c8d6126ebe4732f88 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 15 Jan 2004 13:46:47 +0000 Subject: fixes #23281, some refactoring and list view get_selected_time_range implementation 2004-01-15 Radek Doulik * gui/calendar-component.c (impl_requestCreateItem): merge with JP's changes 2004-01-14 Radek Doulik * gui/e-cal-list-view.c (e_cal_list_view_get_selected_time_range): new implementation, use time range from selected event * gui/e-cal-view.c (e_calendar_view_get_selected_time_range): return gboolean, TRUE if requested time was set, FALSE otherwise (e_calendar_view_new_appointment_full): use current time if time range is unavailable * gui/calendar-component.c (impl_requestCreateItem): use e_calendar_view_new_appointment_full instead of cal_comp_event_new_with_current_time * gui/e-cal-view.c (e_calendar_view_new_appointment_full): new helper function * gui/comp-editor-factory.c (edit_new): use cal_comp_event_new_with_current_time * gui/calendar-component.c (impl_requestCreateItem): use cal_comp_event_new_with_current_time * gui/comp-util.c (cal_comp_event_new_with_current_time): new function, cut'n'pasted from get_default_event (calendar-component.c and comp-editor-factory.c) svn path=/trunk/; revision=24238 --- calendar/gui/comp-editor-factory.c | 46 ++------------------------------------ 1 file changed, 2 insertions(+), 44 deletions(-) (limited to 'calendar/gui/comp-editor-factory.c') diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index 04a53b30b3..e3904bbbf2 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -291,48 +291,6 @@ edit_existing (OpenClient *oc, const char *uid) e_comp_editor_registry_add (comp_editor_registry, editor, TRUE); } -/* Creates a component with the appropriate defaults for the specified component - * type. - */ -static ECalComponent * -get_default_event (ECal *client, gboolean all_day) -{ - ECalComponent *comp; - struct icaltimetype itt; - ECalComponentDateTime dt; - char *location; - icaltimezone *zone; - - comp = cal_comp_event_new_with_defaults (client); - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - if (all_day) { - itt = icaltime_from_timet_with_zone (time (NULL), 1, zone); - - dt.value = &itt; - dt.tzid = icaltimezone_get_tzid (zone); - - e_cal_component_set_dtstart (comp, &dt); - e_cal_component_set_dtend (comp, &dt); - } else { - itt = icaltime_current_time_with_zone (zone); - icaltime_adjust (&itt, 0, 1, -itt.minute, -itt.second); - - dt.value = &itt; - dt.tzid = icaltimezone_get_tzid (zone); - - e_cal_component_set_dtstart (comp, &dt); - icaltime_adjust (&itt, 0, 1, 0, 0); - e_cal_component_set_dtend (comp, &dt); - } - - e_cal_component_commit_sequence (comp); - - return comp; -} - static ECalComponent * get_default_task (ECal *client) { @@ -354,11 +312,11 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT: case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING: editor = COMP_EDITOR (event_editor_new (oc->client)); - comp = get_default_event (oc->client, FALSE); + comp = cal_comp_event_new_with_current_time (oc->client, FALSE); break; case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT: editor = COMP_EDITOR (event_editor_new (oc->client)); - comp = get_default_event (oc->client, TRUE); + comp = cal_comp_event_new_with_current_time (oc->client, TRUE); break; case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: editor = COMP_EDITOR (task_editor_new (oc->client)); -- cgit