diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-05-06 18:43:14 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-05-06 18:43:14 +0800 |
commit | 10ee8953e2d461f3164cbc32784af1ab887aa0c7 (patch) | |
tree | e4604f9a32f3e0b569e566216d4d2a969734a23d /calendar/gui/e-week-view.c | |
parent | 154973985a05b17e29e1588adccaee0c17dd11d5 (diff) | |
download | gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar.gz gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar.bz2 gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar.lz gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar.xz gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.tar.zst gsoc2013-evolution-10ee8953e2d461f3164cbc32784af1ab887aa0c7.zip |
added guint ref_count to iCalObject struct, and ical_object_ref/unref()
2000-05-06 Damon Chaplin <damon@helixcode.com>
* cal-util/calobj.[hc]: added guint ref_count to iCalObject struct,
and ical_object_ref/unref() functions. I've updated all the gui/
stuff to use ref_counts but I haven't touched the pcs/ stuff. Maybe
just using ical_object_destroy() is OK there.
* gui/gncal-todo.c:
* gui/calendar-commands.c:
* gui/eventedit.c:
* gui/e-week-view.c:
* gui/e-day-view.c: use refcounting for iCalObjects.
* gui/e-day-view-main-item.c:
* gui/e-day-view-top-item.c:
* gui/e-day-view.c: try not to ever draw outside the event, even when
the event is very small.
2000-05-05 Damon Chaplin <damon@helixcode.com>
* gui/e-day-view.c: don't allow recurring events to be resized or
dragged, and don't show the resize/drag cursors. Actually it may be
better to let the user do the resize/drag and then ask them what they
want to do - change the single occurrence or the entire series.
* gui/e-day-view-time-item.c (e_day_view_time_item_show_popup_menu):
use e_auto_kill_popup_menu_on_hide() to destroy the popup menu.
* gui/popup-menu.c: include e-gui-utils.h
svn path=/trunk/; revision=2823
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index bf01b66831..2c740d6df4 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -990,7 +990,7 @@ e_week_view_update_event (EWeekView *week_view, switch (status) { case CAL_OBJ_FIND_SUCCESS: - /* Fall through. */ + /* Do nothing. */ break; case CAL_OBJ_FIND_SYNTAX_ERROR: g_warning ("syntax error uid=%s\n", uid); @@ -1001,8 +1001,10 @@ e_week_view_update_event (EWeekView *week_view, } /* We only care about events. */ - if (ico && ico->type != ICAL_EVENT) + if (ico && ico->type != ICAL_EVENT) { + ical_object_unref (ico); return; + } /* If the event already exists and the dates didn't change, we can update the event fairly easily without changing the events arrays @@ -1015,6 +1017,7 @@ e_week_view_update_event (EWeekView *week_view, if (ical_object_compare_dates (event->ico, ico)) { g_print (" dates unchanged\n"); e_week_view_foreach_event_with_uid (week_view, uid, e_week_view_update_event_cb, ico); + ical_object_unref (ico); gtk_widget_queue_draw (week_view->main_canvas); return; } @@ -1034,6 +1037,7 @@ e_week_view_update_event (EWeekView *week_view, week_view->day_starts[num_days], e_week_view_add_event, week_view); + ical_object_unref (ico); e_week_view_check_layout (week_view); @@ -1055,8 +1059,8 @@ e_week_view_update_event_cb (EWeekView *week_view, ico = data; event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - /* FIXME: When do ico's get freed? */ event->ico = ico; + ical_object_ref (ico); /* If we are editing an event which we have just created, we will get an update_event callback from the server. But we need to ignore it @@ -1102,7 +1106,7 @@ e_week_view_foreach_event_with_uid (EWeekView *week_view, event_num--) { event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - if (event->ico && event->ico->uid + if (event->ico->uid && !strcmp (uid, event->ico->uid)) { if (!(*callback) (week_view, event_num, data)) return; @@ -1159,6 +1163,9 @@ e_week_view_remove_event_cb (EWeekView *week_view, span->background_item = NULL; } } + + ical_object_unref (event->ico); + g_array_remove_index (week_view->events, event_num); week_view->events_need_layout = TRUE; @@ -1527,19 +1534,16 @@ e_week_view_reload_events (EWeekView *week_view) static void e_week_view_free_events (EWeekView *week_view) { + EWeekViewEvent *event; EWeekViewEventSpan *span; - gint span_num; + gint event_num, span_num; - /* There is nothing to free in the event structs at present. */ -#if 0 for (event_num = 0; event_num < week_view->events->len; event_num++) { event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - - if (event->canvas_item) - gtk_object_destroy (GTK_OBJECT (event->canvas_item)); + ical_object_unref (event->ico); } -#endif + g_array_set_size (week_view->events, 0); /* Destroy all the old canvas items. */ @@ -1591,6 +1595,7 @@ e_week_view_add_event (iCalObject *ico, end_tm = *(localtime (&end)); event.ico = ico; + ical_object_ref (event.ico); event.start = start; event.end = end; event.spans_index = 0; @@ -2252,6 +2257,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item, g_print (" button release\n"); if (!E_TEXT (item)->editing) { g_print (" stopping signal\n"); + gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event"); @@ -2430,8 +2436,7 @@ e_week_view_find_event_from_uid (EWeekView *week_view, for (event_num = 0; event_num < num_events; event_num++) { event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - if (event->ico && event->ico->uid - && !strcmp (uid, event->ico->uid)) { + if (event->ico->uid && !strcmp (uid, event->ico->uid)) { *event_num_return = event_num; return TRUE; } @@ -2536,6 +2541,8 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) gnome_calendar_add_object (week_view->calendar, ico); + ical_object_unref (ico); + return TRUE; } @@ -2625,6 +2632,7 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data) ico->dtend = week_view->day_starts[week_view->selection_end_day + 1]; event_editor = event_editor_new (week_view->calendar, ico); + ical_object_unref (ico); gtk_widget_show (event_editor); } @@ -2650,6 +2658,7 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data) ico = ical_object_duplicate (event->ico); event_editor = event_editor_new (week_view->calendar, ico); + ical_object_unref (ico); gtk_widget_show (event_editor); } @@ -2725,4 +2734,6 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data) gnome_calendar_object_changed (week_view->calendar, event->ico, CHANGE_ALL); gnome_calendar_add_object (week_view->calendar, ico); + + ical_object_unref (ico); } |