From d5a5d18cb16de2a36d7d1edf640dc5bb5a698289 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 27 Jul 2004 02:29:11 +0000 Subject: Fixes #61058 2004-07-25 JP Rosevear Fixes #61058 * gui/e-week-view.c (process_component_recur_cb): add but don't prepend (process_component): use above as call back so we can pass the prepend bool (e_week_view_add_event): take a prepend bool and prepend to the events array if asked so the event will be shown first when drawn (e_week_view_do_key_press): If the event can't be fit on the screen, ie not even one event can be shown in the day, don't try to edit it svn path=/trunk/; revision=26741 --- calendar/ChangeLog | 14 ++++++++++++++ calendar/gui/e-week-view.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index c65e88d134..5c3a3703bb 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +2004-07-25 JP Rosevear + + Fixes #61058 + + * gui/e-week-view.c (process_component_recur_cb): add but don't + prepend + (process_component): use above as call back so we can pass the + prepend bool + (e_week_view_add_event): take a prepend bool and prepend to the + events array if asked so the event will be shown first when drawn + (e_week_view_do_key_press): If the event can't be fit on the + screen, ie not even one event can be shown in the day, don't try + to edit it + 2004-07-26 Rodney Dawes * gui/dialogs/event-page.glade: Fix mnemonic for "Location" to not diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 8be692efc4..66b0f24133 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -147,6 +147,7 @@ static void e_week_view_free_events (EWeekView *week_view); static gboolean e_week_view_add_event (ECalComponent *comp, time_t start, time_t end, + gboolean prepend, gpointer data); static void e_week_view_check_layout (EWeekView *week_view); static void e_week_view_ensure_events_sorted (EWeekView *week_view); @@ -307,6 +308,15 @@ time_range_changed_cb (ECalModel *model, time_t start_time, time_t end_time, gpo e_week_view_set_selected_time_range (E_CALENDAR_VIEW (week_view), start_time, start_time); } +static gboolean +process_component_recur_cb (ECalComponent *comp, time_t start, time_t end, gpointer data) +{ + AddEventData *add_event_data; + + add_event_data = data; + + return e_week_view_add_event (comp, start, end, FALSE, add_event_data); +} static void process_component (EWeekView *week_view, ECalModelComponent *comp_data) @@ -375,7 +385,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) e_cal_generate_instances_for_object (comp_data->client, comp_data->icalcomp, week_view->day_starts[0], week_view->day_starts[num_days], - e_week_view_add_event, &add_event_data); + process_component_recur_cb, &add_event_data); g_object_unref (comp); } @@ -2386,6 +2396,7 @@ static gboolean e_week_view_add_event (ECalComponent *comp, time_t start, time_t end, + gboolean prepend, gpointer data) { @@ -2439,7 +2450,10 @@ e_week_view_add_event (ECalComponent *comp, e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view)))) event.different_timezone = TRUE; - g_array_append_val (add_event_data->week_view->events, event); + if (prepend) + g_array_prepend_val (add_event_data->week_view->events, event); + else + g_array_append_val (add_event_data->week_view->events, event); add_event_data->week_view->events_sorted = FALSE; add_event_data->week_view->events_need_layout = TRUE; @@ -3769,13 +3783,28 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) to the server until the user finishes editing it. */ add_event_data.week_view = week_view; add_event_data.comp_data = NULL; - e_week_view_add_event (comp, dtstart, dtend, &add_event_data); + e_week_view_add_event (comp, dtstart, dtend, TRUE, &add_event_data); e_week_view_check_layout (week_view); gtk_widget_queue_draw (week_view->main_canvas); if (e_week_view_find_event_from_uid (week_view, uid, &event_num)) { - e_week_view_start_editing_event (week_view, event_num, 0, - initial_text); + EWeekViewEvent *event; + EWeekViewEventSpan *span; + + event = &g_array_index (week_view->events, EWeekViewEvent, + event_num); + span = &g_array_index (week_view->spans, EWeekViewEventSpan, + event->spans_index + 0); + + /* If the event can't be fit on the screen, don't try to edit it. */ + if (!span->text_item) { + e_week_view_foreach_event_with_uid (week_view, uid, + e_week_view_remove_event_cb, NULL); + } else { + e_week_view_start_editing_event (week_view, event_num, 0, + initial_text); + } + } else { g_warning ("Couldn't find event to start editing.\n"); } -- cgit v1.2.3