From 6c6dba281e93d9f5aff9dc9f7260c470857ae400 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 30 Aug 2000 09:29:17 +0000 Subject: Oops, set the dtstart/dtend on the component before adding it. 2000-08-30 Federico Mena Quintero * gui/e-day-view.c (e_day_view_key_press): Oops, set the dtstart/dtend on the component before adding it. (e_day_view_on_editing_stopped): No need to check for an UID. Update the summary properly. svn path=/trunk/; revision=5113 --- calendar/ChangeLog | 7 +++++++ calendar/gui/e-day-view.c | 36 +++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 3de92f9e40..839870da44 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2000-08-30 Federico Mena Quintero + + * gui/e-day-view.c (e_day_view_key_press): Oops, set the + dtstart/dtend on the component before adding it. + (e_day_view_on_editing_stopped): No need to check for an UID. + Update the summary properly. + 2000-08-30 JP Rosevear * gui/e-week-view.c: Make sure the is_utc flag is always diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 8d7bcebf01..1767624627 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4074,6 +4074,8 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event) guint keyval; gboolean stop_emission; time_t dtstart, dtend; + CalComponentDateTime dt; + struct icaltimetype itt; const char *uid; g_return_val_if_fail (widget != NULL, FALSE); @@ -4156,13 +4158,22 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event) initial_text = event->string; } - /* Add a new event covering the selected range. - Note that user_name is a global variable. */ + /* Add a new event covering the selected range */ + comp = cal_component_new (); cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); e_day_view_get_selected_time_range (day_view, &dtstart, &dtend); + dt.value = &itt; + dt.tzid = NULL; + + *dt.value = icaltime_from_timet (dtstart, FALSE, FALSE); + cal_component_set_dtstart (comp, &dt); + + *dt.value = icaltime_from_timet (dtend, FALSE, FALSE); + cal_component_set_dtend (comp, &dt); + /* We add the event locally and start editing it. When we get the "update_event" callback from the server, we basically ignore it. If we were to wait for the "update_event" callback it wouldn't be @@ -4611,7 +4622,6 @@ e_day_view_on_editing_stopped (EDayView *day_view, EDayViewEvent *event; gchar *text = NULL; CalComponentText summary; - const char *uid; /* Note: the item we are passed here isn't reliable, so we just stop the edit of whatever item was being edited. We also receive this @@ -4623,11 +4633,6 @@ e_day_view_on_editing_stopped (EDayView *day_view, if (day == -1) return; -#if 0 - g_print ("In e_day_view_on_editing_stopped Day:%i Event:%i\n", - day, event_num); -#endif - if (day == E_DAY_VIEW_LONG_EVENT) { editing_long_event = TRUE; event = &g_array_index (day_view->long_events, EDayViewEvent, @@ -4649,11 +4654,6 @@ e_day_view_on_editing_stopped (EDayView *day_view, day_view->resize_bars_event_day = -1; day_view->resize_bars_event_num = -1; - /* Check that the event is still valid. */ - cal_component_get_uid (event->comp, &uid); - if (!uid) - return; - gtk_object_get (GTK_OBJECT (event->canvas_item), "text", &text, NULL); @@ -4668,8 +4668,14 @@ e_day_view_on_editing_stopped (EDayView *day_view, return; } - cal_component_set_summary (event->comp, &summary); - g_free (text); + if (text) { + summary.value = text; + summary.altrep = NULL; + cal_component_set_summary (event->comp, &summary); + + g_free (text); + } else + cal_component_set_summary (event->comp, NULL); if (!cal_client_update_object (day_view->client, event->comp)) g_message ("e_day_view_on_editing_stopped(): Could not update the object!"); -- cgit