aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-09-27 15:46:05 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-09-27 15:46:05 +0800
commit10c781d6838d73998c417e2090bf413e09b12807 (patch)
tree61648afddeff03f98e57fdc8f766ae5d516a0227 /calendar/gui/gnome-cal.c
parentc54e15f7cfe18f697baa11a8a44b458cb7694c28 (diff)
downloadgsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.gz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.bz2
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.lz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.xz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.zst
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.zip
2007-09-27 mcrha Fixes part of bug #228832
svn path=/trunk/; revision=34311
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 81b8893bfa..3fe343dba9 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -3210,11 +3210,13 @@ gnome_calendar_get_selected_time_range (GnomeCalendar *gcal,
/**
* gnome_calendar_new_task:
* @gcal: An Evolution calendar.
+ * @param dtstart Start time of the task, in same timezone as model.
+ * @param dtend End time of the task, in same timezone as model.
*
- * Opens a task editor dialog for a new task.
+ * Opens a task editor dialog for a new task. dtstart or dtend can be NULL.
**/
void
-gnome_calendar_new_task (GnomeCalendar *gcal)
+gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend)
{
GnomeCalendarPrivate *priv;
ECal *ecal;
@@ -3224,6 +3226,8 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
icalcomponent *icalcomp;
const char *category;
guint32 flags = 0;
+ ECalComponentDateTime dt;
+ struct icaltimetype itt;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -3244,6 +3248,22 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
e_cal_component_set_categories (comp, category);
+ dt.value = &itt;
+ dt.tzid = icaltimezone_get_tzid (e_cal_model_get_timezone (model));
+
+ if (dtstart) {
+ itt = icaltime_from_timet_with_zone (*dtstart, FALSE, e_cal_model_get_timezone (model));
+ e_cal_component_set_dtstart (comp, &dt);
+ }
+
+ if (dtend) {
+ itt = icaltime_from_timet_with_zone (*dtend, FALSE, e_cal_model_get_timezone (model));
+ e_cal_component_set_due (comp, &dt); /* task uses 'due' not 'dtend' */
+ }
+
+ if (dtstart || dtend)
+ e_cal_component_commit_sequence (comp);
+
comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
g_object_unref (comp);