From f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 18 Mar 2001 08:16:40 +0000 Subject: Added ShowWeekView, ShowMonthView, ShowDay, ShowWorkWeek to the View menu. 2001-03-17 Miguel de Icaza * evolution-calendar.xml: Added ShowWeekView, ShowMonthView, ShowDay, ShowWorkWeek to the View menu. * evolution.xml, evolution-mail.xml: Provide "Actions" in the toplevel evolution. Fill in Actions/Component in Evolution-mail (no visual changes, just internal changes). * evolution-calendar.xml: Added Actions menu. Added New Verb EditNewEvent. 2001-03-17 Miguel de Icaza * gui/e-day-view.c (e_day_view_on_new_event, e_day_view_on_new_appointment): Simplifed this function to use the shared code. * gui/e-week-view.c (e_week_view_on_new_event, e_week_view_on_new_appointment): ditto. * gui/gnome-cal.c (gnome_calendar_new_appointment_for): New function used to launch editor components with a time range. A bunch of functions use this code now instead of duplicating code all over the place svn path=/trunk/; revision=8794 --- calendar/gui/gnome-cal.c | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 588a7a6687..e5ae424f3e 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1151,23 +1151,30 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp) /** * gnome_calendar_new_appointment: * @gcal: An Evolution calendar. + * @dtstart: a Unix time_t that marks the beginning of the appointment. + * @dtend: a Unix time_t that marks the end of the appointment. + * @all_day: if true, the dtstart and dtend are expanded to cover the entire day. + * + * Opens an event editor dialog for a new appointment. * - * Opens an event editor dialog for a new appointment. The appointment's start - * and end times are set to the currently selected time range in the calendar - * views. **/ void -gnome_calendar_new_appointment (GnomeCalendar *gcal) +gnome_calendar_new_appointment_for (GnomeCalendar *cal, + time_t dtstart, time_t dtend, + gboolean all_day) { - CalComponent *comp; - time_t dtstart, dtend; - CalComponentDateTime dt; struct icaltimetype itt; + CalComponentDateTime dt; + CalComponent *comp; - g_return_if_fail (gcal != NULL); - g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + g_return_if_fail (cal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (cal)); - gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend); + if (all_day){ + dtstart = time_day_begin (dtstart); + dtend = time_day_end (dtend); + } + dt.value = &itt; dt.tzid = NULL; @@ -1182,9 +1189,28 @@ gnome_calendar_new_appointment (GnomeCalendar *gcal) cal_component_commit_sequence (comp); - gnome_calendar_edit_object (gcal, comp); + gnome_calendar_edit_object (cal, comp); gtk_object_unref (GTK_OBJECT (comp)); +} + +/** + * gnome_calendar_new_appointment: + * @gcal: An Evolution calendar. + * + * Opens an event editor dialog for a new appointment. The appointment's start + * and end times are set to the currently selected time range in the calendar + * views. + **/ +void +gnome_calendar_new_appointment (GnomeCalendar *gcal) +{ + time_t dtstart, dtend; + g_return_if_fail (gcal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend); + gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE); } /* Returns the selected time range for the current view. Note that this may be -- cgit v1.2.3