aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-05-05 05:04:40 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-05-05 05:04:40 +0800
commitea787be7184b4d0c5d093b3c560b8f1879839d73 (patch)
tree367fc0091afe6bfaaeca7971fce0221319a6bef7 /calendar/gui/e-day-view.c
parentbe8e1b8c1f5e52bdb0e3c674da29dc3ca8bc49f4 (diff)
downloadgsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar.gz
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar.bz2
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar.lz
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar.xz
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.tar.zst
gsoc2013-evolution-ea787be7184b4d0c5d093b3c560b8f1879839d73.zip
for the long events pass E_DAY_VIEW_LONG_EVENT as the day. Fixes SEGV.
2000-05-04 Damon Chaplin <damon@helixcode.com> * gui/e-day-view.c (e_day_view_foreach_event_with_uid): for the long events pass E_DAY_VIEW_LONG_EVENT as the day. Fixes SEGV. * gui/calendar-commands.c: when we switch views, grab the focus. * gui/gnome-cal.c (gnome_calendar_tag_calendar): (gnome_calendar_mark_gtk_calendar_day): changed this so it uses cal_client_get_events_in_range(), and doesn't load any objects. Also just return if it isn't visible. * gui/calendar-commands.c (calendar_get_events_in_range): call g_list_sort() to sort the list rather than g_list_insert_sorted() for each element. It is much more efficient. Also changed it so that the co->ev_start/end fields are copied from the CalObjInstance rather than the parameters to the function (that is right, isn't it?) Also freed the list elements, and finally the list. (calendar_iterate): changed this to use cal_client_get_events_in_range since that is more efficient than getting all the uids and then loading and parsing all the events. * pcs/cal-backend.c (save): output the '... saved' message before freeing the string! * gui/gncal-todo.c (gncal_todo_update): * gui/e-week-view.c (e_week_view_update_event): * gui/e-day-view.c (e_day_view_update_event): * gui/calendar-commands.c (calendar_get_events_in_range): (calendar_iterate): free obj_string after it is parsed. svn path=/trunk/; revision=2802
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r--calendar/gui/e-day-view.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 6a1383d180..655afd73dc 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -775,11 +775,11 @@ e_day_view_init (EDayView *day_view)
day_view->last_cursor_set_in_main_canvas = NULL;
/* Set up the drop sites. */
- gtk_drag_dest_set (GTK_WIDGET (day_view->top_canvas),
+ gtk_drag_dest_set (day_view->top_canvas,
GTK_DEST_DEFAULT_ALL,
target_table, n_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
- gtk_drag_dest_set (GTK_WIDGET (day_view->main_canvas),
+ gtk_drag_dest_set (day_view->main_canvas,
GTK_DEST_DEFAULT_ALL,
target_table, n_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
@@ -1034,6 +1034,8 @@ e_day_view_focus_in (GtkWidget *widget, GdkEventFocus *event)
g_return_val_if_fail (E_IS_DAY_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
+ g_print ("In e_day_view_focus_in\n");
+
day_view = E_DAY_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
@@ -1054,6 +1056,8 @@ e_day_view_focus_out (GtkWidget *widget, GdkEventFocus *event)
g_return_val_if_fail (E_IS_DAY_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
+ g_print ("In e_day_view_focus_out\n");
+
day_view = E_DAY_VIEW (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
@@ -1099,6 +1103,9 @@ e_day_view_update_event (EDayView *day_view,
g_return_if_fail (E_IS_DAY_VIEW (day_view));
#if 0
+ /* FIXME: Just for testing. */
+ chdir ("/home/damon/tmp");
+
g_print ("In e_day_view_update_event day_view:%p uid:%s\n",
day_view, uid);
#endif
@@ -1111,6 +1118,7 @@ e_day_view_update_event (EDayView *day_view,
/* Get the event from the server. */
obj_string = cal_client_get_object (day_view->calendar->client, uid);
status = ical_object_find_in_string (uid, obj_string, &ico);
+ g_free (obj_string);
switch (status) {
case CAL_OBJ_FIND_SUCCESS:
@@ -1132,6 +1140,7 @@ e_day_view_update_event (EDayView *day_view,
update the event fairly easily without changing the events arrays
or computing a new layout. */
if (e_day_view_find_event_from_uid (day_view, uid, &day, &event_num)) {
+ g_print (" updating existing event\n");
if (day == E_DAY_VIEW_LONG_EVENT)
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
@@ -1140,6 +1149,7 @@ e_day_view_update_event (EDayView *day_view,
EDayViewEvent, event_num);
if (ical_object_compare_dates (event->ico, ico)) {
+ g_print (" unchanged dates\n");
e_day_view_foreach_event_with_uid (day_view, uid, e_day_view_update_event_cb, ico);
gtk_widget_queue_draw (day_view->top_canvas);
gtk_widget_queue_draw (day_view->main_canvas);
@@ -1148,12 +1158,14 @@ e_day_view_update_event (EDayView *day_view,
/* The dates have changed, so we need to remove the
old occurrrences before adding the new ones. */
+ g_print (" changed dates\n");
e_day_view_foreach_event_with_uid (day_view, uid,
e_day_view_remove_event_cb,
NULL);
}
/* Add the occurrences of the event. */
+ g_print (" generating events\n");
ical_object_generate_events (ico, day_view->lower, day_view->upper,
e_day_view_add_event, day_view);
@@ -1175,6 +1187,9 @@ e_day_view_update_event_cb (EDayView *day_view,
ico = data;
+ g_print ("In e_day_view_update_event_cb day:%i event_num:%i\n",
+ day, event_num);
+
/* FIXME: When do ico's get freed? */
if (day == E_DAY_VIEW_LONG_EVENT) {
event = &g_array_index (day_view->long_events, EDayViewEvent,
@@ -1240,7 +1255,8 @@ e_day_view_foreach_event_with_uid (EDayView *day_view,
EDayViewEvent, event_num);
if (event->ico && event->ico->uid
&& !strcmp (uid, event->ico->uid)) {
- if (!(*callback) (day_view, day, event_num, data))
+ if (!(*callback) (day_view, E_DAY_VIEW_LONG_EVENT,
+ event_num, data))
return;
}
}
@@ -1405,9 +1421,13 @@ e_day_view_find_event_from_item (EDayView *day_view,
}
-/* Finds the day and index of the event containing the iCalObject.
+/* Finds the day and index of the event with the given uid.
If is is a long event, E_DAY_VIEW_LONG_EVENT is returned as the day.
- Returns TRUE if the event was found. */
+ Returns TRUE if an event with the uid was found.
+ Note that for recurring events there may be several EDayViewEvents, one
+ for each instance, all with the same iCalObject and uid. So only use this
+ function if you know the event doesn't recur or you are just checking to
+ see if any events with the uid exist. */
static gboolean
e_day_view_find_event_from_uid (EDayView *day_view,
const gchar *uid,