[evolution-patches] 61058 Calendar week view creates an event per keystroke
- From: JP Rosevear <jpr novell com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] 61058 Calendar week view creates an event per keystroke
- Date: Sun, 25 Jul 2004 21:45:04 -0400
The code was cycling if the event couldn't actually be shown on the
screen - it would create the event then "lose" it and then create
another. This fix does two things, first by prepending a new user
created event to the event list it makes the event be the first event
drawn for a day so if at least one event can be shown the right thing
happens, if no events can be shown then the UI refuses to let the user
create anything.
-JP
--
JP Rosevear <jpr novell com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2459
diff -u -r1.2459 ChangeLog
--- ChangeLog 24 Jul 2004 15:30:47 -0000 1.2459
+++ ChangeLog 26 Jul 2004 01:46:00 -0000
@@ -1,3 +1,17 @@
+2004-07-25 JP Rosevear <jpr ximian com>
+
+ 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-23 JP Rosevear <jpr ximian com>
Fixes #61571
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.219
diff -u -r1.219 e-week-view.c
--- gui/e-week-view.c 24 Jul 2004 15:30:47 -0000 1.219
+++ gui/e-week-view.c 26 Jul 2004 01:46:14 -0000
@@ -147,6 +147,7 @@
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 @@
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 @@
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 @@
e_week_view_add_event (ECalComponent *comp,
time_t start,
time_t end,
+ gboolean prepend,
gpointer data)
{
@@ -2439,7 +2450,10 @@
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 @@
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");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]