diff options
author | JP Rosevear <jpr@ximian.com> | 2002-03-15 03:08:20 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-03-15 03:08:20 +0800 |
commit | f3a444674878385818f5fb13f5e65bae9a50eca3 (patch) | |
tree | 7024fcd4242427caf0e98f9db26d100dc3e0c879 /calendar/gui/comp-editor-factory.c | |
parent | b7fc0ec31acaead06c9d9889ef65af0c35ed7693 (diff) | |
download | gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar.gz gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar.bz2 gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar.lz gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar.xz gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.tar.zst gsoc2013-evolution-f3a444674878385818f5fb13f5e65bae9a50eca3.zip |
add all day event editor mode
2002-03-14 JP Rosevear <jpr@ximian.com>
* idl/evolution-calendar.idl: add all day event editor mode
* gui/component-factory.c: clean up exception handling
(sc_user_create_new_item_cb): support the all day event id
(create_object): add a user creatable all day appointment item
* gui/comp-editor-factory.c (get_default_event): get a default
event either all day or starting at the top of the hour
(get_default_task): get a default task
(edit_new): support the all day event mode
* gui/calendar-commands.c: remove unused functions/verbs
svn path=/trunk/; revision=16157
Diffstat (limited to 'calendar/gui/comp-editor-factory.c')
-rw-r--r-- | calendar/gui/comp-editor-factory.c | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index fbf81248a7..54f0f00569 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -347,34 +347,54 @@ edit_existing (OpenClient *oc, const char *uid) * type. */ static CalComponent * -get_default_component (CalComponentVType vtype) +get_default_event (gboolean all_day) { CalComponent *comp; + struct icaltimetype itt; + CalComponentDateTime dt; + char *location; + icaltimezone *zone; - if (vtype == CAL_COMPONENT_EVENT) { - struct icaltimetype itt; - CalComponentDateTime dt; - char *location; - icaltimezone *zone; + comp = cal_comp_event_new_with_defaults (); - comp = cal_comp_event_new_with_defaults (); + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); + if (all_day) { itt = icaltime_today (); dt.value = &itt; - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); dt.tzid = icaltimezone_get_tzid (zone); - + cal_component_set_dtstart (comp, &dt); - cal_component_set_dtend (comp, &dt); - - cal_component_commit_sequence (comp); + cal_component_set_dtend (comp, &dt); } else { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, vtype); + itt = icaltime_current_time_with_zone (zone); + itt.hour++; + itt.minute = 0; + itt.second = 0; + + dt.value = &itt; + dt.tzid = icaltimezone_get_tzid (zone); + + cal_component_set_dtstart (comp, &dt); + itt.hour++; + cal_component_set_dtend (comp, &dt); } + cal_component_commit_sequence (comp); + + return comp; +} + +static CalComponent * +get_default_task (void) +{ + CalComponent *comp; + + comp = cal_component_new (); + cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); + return comp; } @@ -385,25 +405,26 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE CalComponent *comp; Component *c; CompEditor *editor; - CalComponentVType vtype; switch (type) { case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT: case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING: editor = COMP_EDITOR (event_editor_new ()); - vtype = CAL_COMPONENT_EVENT; + comp = get_default_event (FALSE); + break; + case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT: + editor = COMP_EDITOR (event_editor_new ()); + comp = get_default_event (TRUE); break; case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: editor = COMP_EDITOR (task_editor_new ()); - vtype = CAL_COMPONENT_TODO; + comp = get_default_task (); break; default: g_assert_not_reached (); return; } - comp = get_default_component (vtype); - c = g_new (Component, 1); c->parent = oc; cal_component_get_uid (comp, &c->uid); |