Index: calendar/gui/dialogs/event-page.c
===================================================================
--- calendar/gui/dialogs/event-page.c	(revision 34017)
+++ calendar/gui/dialogs/event-page.c	(working copy)
@@ -268,8 +268,6 @@
 	priv->is_meeting = FALSE;
 	priv->sync_timezones = FALSE;
 
-	priv->default_address = NULL;
-
 	priv->alarm_list_dlg_widget = NULL;
 }
 
@@ -322,6 +320,9 @@
 
 	priv->alarm_list_dlg_widget = NULL;
 
+	g_free (priv->default_address);
+	priv->default_address = NULL;
+
 	g_free (priv);
 	epage->priv = NULL;
 
@@ -587,7 +588,8 @@
 	/* Categories */
 	e_dialog_editable_set (priv->categories, NULL);
 
-	gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), priv->default_address);
+	if (priv->default_address)
+		gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), priv->default_address);
 }
 
 static gboolean
@@ -3178,7 +3180,8 @@
 			priv->default_address = full;
 		} else if (a == def_account && !priv->default_address) 
 			priv->default_address = full;
-		
+		else
+			g_free (full);
 	}
 	g_object_unref(it);
 
Index: calendar/gui/e-week-view.c
===================================================================
--- calendar/gui/e-week-view.c	(revision 34017)
+++ calendar/gui/e-week-view.c	(working copy)
@@ -2061,7 +2061,7 @@
 		return FALSE;
 
 	if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
-		e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), TRUE, FALSE, FALSE);
+		e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), FALSE, FALSE, FALSE);
 		return TRUE;
 	}
 
Index: calendar/gui/e-calendar-view.c
===================================================================
--- calendar/gui/e-calendar-view.c	(revision 34017)
+++ calendar/gui/e-calendar-view.c	(working copy)
@@ -1886,31 +1886,56 @@
 }
 
 /**
- * e_calendar_view_new_appointment
- * @cal_view: A calendar view.
+ * e_calendar_view_new_appointment_full
+ * @param cal_view: A calendar view.
+ * @param all_day: Whether create all day event or not.
+ * @param meeting: This is a meeting or an appointment.
+ * @param no_past_date: Don't create event in past date, use actual date instead (if TRUE).
  *
  * 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 view.
  *
- * With @actual_day set to TRUE, there will be always used actual day.
+ * When the selection is for all day and we don't need @all_day event,
+ * then this do a rounding to the actual hour in selected day.
  */
 void
-e_calendar_view_new_appointment_full (ECalendarView *cal_view, gboolean all_day, gboolean meeting, gboolean actual_day)
+e_calendar_view_new_appointment_full (ECalendarView *cal_view, gboolean all_day, gboolean meeting, gboolean no_past_date)
 {
-	time_t dtstart, dtend;
+	time_t dtstart, dtend, now;
+	gboolean do_rounding = FALSE;
 
 	g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
 
-	if (actual_day ||
-	    !e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend)) {
-		dtstart = time (NULL);
+	now = time (NULL);
+
+	if (!e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend)) {
+		dtstart = now;
 		dtend = dtstart + 3600;
 	}
-	/* FIXME This is a rough hack to make sure "all day" is set for */
-	if ((dtend - dtstart) % (60 * 60 * 24) == 0)
-		all_day = TRUE;
-	
+
+	if (no_past_date && dtstart < now) {
+		dtend = time_day_begin (now) + (dtend - dtstart);
+		dtstart = time_day_begin (now);
+		do_rounding = TRUE;
+	}
+
+	/* We either need rounding or don't want to set all_day for this, we will rather use actual */
+	/* time in this cases; dtstart should be a midnight in this case */
+	if (do_rounding || (!all_day && (dtend - dtstart) % (60 * 60 * 24) == 0)) {
+		struct tm *local = localtime (&now);
+		int mins = local->tm_min;
+		int time_div = calendar_config_get_time_divisions ();
+
+		/* round minutes to nearest time division, up or down */
+		if ((mins % time_div) >= time_div / 2)
+			mins += time_div;
+		mins = (mins - (mins % time_div));
+
+		dtstart = dtstart + (60 * 60 * local->tm_hour) + (mins * 60);
+		dtend = dtstart + (time_div * 60);
+	}
+
 	e_calendar_view_new_appointment_for (cal_view, dtstart, dtend, all_day, meeting);
 }
 
Index: calendar/gui/e-calendar-view.h
===================================================================
--- calendar/gui/e-calendar-view.h	(revision 34017)
+++ calendar/gui/e-calendar-view.h	(working copy)
@@ -153,7 +153,7 @@
 void           e_calendar_view_new_appointment_full (ECalendarView *cal_view,
 						     gboolean all_day,
 						     gboolean meeting,
-						     gboolean actual_day);
+						     gboolean no_past_date);
 void           e_calendar_view_new_appointment (ECalendarView *cal_view);
 void           e_calendar_view_edit_appointment (ECalendarView *cal_view,
 					    ECal *client,
Index: calendar/gui/calendar-component.c
===================================================================
--- calendar/gui/calendar-component.c	(revision 34017)
+++ calendar/gui/calendar-component.c	(working copy)
@@ -1267,15 +1267,6 @@
 		return FALSE;
 
 	if (component_view && (view = E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (component_view->calendar)))) {
-		GnomeCalendarViewType view_type;
-
-		/* Force all for these view types because thats what's selected and it mimics a double click */
-		view_type = gnome_calendar_get_view (component_view->calendar);
-		if (view_type == GNOME_CAL_WEEK_VIEW 
-		    || view_type == GNOME_CAL_MONTH_VIEW
-		    || view_type == GNOME_CAL_LIST_VIEW)
-			is_allday = TRUE;
-
 		e_calendar_view_new_appointment_full (view, is_allday, is_meeting, TRUE);
 	} else {
 		ECalComponent *comp;
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 34017)
+++ calendar/ChangeLog	(working copy)
@@ -1,5 +1,27 @@
 2007-08-16  Milan Crha  <mcrha@redhat.com>
 
+	** Fix for bug #262226
+
+	* gui/e-calendar-view.h:
+	* gui/e-calendar-view.c: (e_calendar_view_new_appointment_full):
+	Changed meaning of the last parameter: no_past_date to indicate if
+	we accept past dates (we do not for File->New->items).
+	Also changed behavior: when don't need all_day event and there are
+	24 hours selected, then change start/end to actual time in selected day,
+	instead of setting all_day event to TRUE.
+	* gui/calendar-component.c: (create_new_event):
+	Don't force all day event.
+	* gui/e-week-view.c: (e_week_view_on_button_press):
+	Changing call of 'e_calendar_view_new_appointment_full'.
+
+	* gui/dialogs/event-page.c: (clear_widgets):
+	Fixed critical warning when no default_address set.
+	* gui/dialogs/event-page.c: (event_page_finalize),
+	(event_page_select_organizer): Free memory when no longer needed.
+	* gui/dialogs/event-page.c: (event_page_init): There was twice the same.
+
+2007-08-16  Milan Crha  <mcrha@redhat.com>
+
 	** Part of fix for bug #350539
 
 	* gui/e-cal-popup.c: (ecalp_part_popup_set_background):
