aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-08-11 05:43:22 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-08-11 05:43:22 +0800
commitadc07dd4d08a53f8167ebf033381992e952d40e8 (patch)
treec01adc2931d989817a0e23a8d5a0476d346c41aa /calendar/gui/gnome-cal.c
parent0aed413e61ead24e0bf3811a4d77f2caf4145f33 (diff)
downloadgsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar.gz
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar.bz2
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar.lz
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar.xz
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.tar.zst
gsoc2013-evolution-adc07dd4d08a53f8167ebf033381992e952d40e8.zip
New function. Mostly moved over from
2000-08-10 Federico Mena Quintero <federico@helixcode.com> * gui/gnome-cal.c (gnome_calendar_new_appointment): New function. Mostly moved over from calendar-commands.c:display_objedit(). * gui/calendar-commands.c (calendar_iterate): Removed. Wheee! (display_objedit): Removed. (new_appointment_cb): New function. Just call gnome_calendar_new_appointment(). (display_objedit_today): Removed. (calendar_control_activate): Removed the "New appointment for today" option, since it is pretty useless. svn path=/trunk/; revision=4707
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 5ef2fe141f..b32623152e 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1361,6 +1361,43 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, iCalObject *ico)
event_editor_focus (ee);
}
+/**
+ * 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)
+{
+ CalComponent *comp;
+ time_t dtstart, dtend;
+ CalComponentDateTime dt;
+ struct icaltimetype itt;
+
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
+ gnome_calendar_get_current_time_range (gcal, dtstart, dtend);
+ dt.value = &itt;
+ dt.tzid = NULL;
+
+ comp = cal_component_new ();
+ cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
+
+ itt = icaltimetype_from_timet (dtstart);
+ cal_component_set_dtstart (comp, &dt);
+
+ itt = icaltimetype_from_timet (dtend);
+ cal_component_set_dtend (comp, &dt);
+
+ gnome_calendar_edit_object (gcal, comp);
+ gtk_object_unref (GTK_OBJECT (comp));
+
+}
+
/* Returns the selected time range for the current view. Note that this may be
different from the fields in the GnomeCalendar, since the view may clip
this or choose a more appropriate time. */