diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-11-15 04:45:46 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-11-15 04:45:46 +0800 |
commit | 2829e1602b1d53832d6e6ff441bdeb36c778a70d (patch) | |
tree | 41f39480dc8c937acd2e97a25c96f977ffca907e /calendar | |
parent | 21a7225dbcde4ec617ffd51f1f633f4c6750d024 (diff) | |
download | gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar.gz gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar.bz2 gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar.lz gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar.xz gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.tar.zst gsoc2013-evolution-2829e1602b1d53832d6e6ff441bdeb36c778a70d.zip |
(committed to CVS by Damon) Fixes bug #15137.
2001-11-13 Federico Mena Quintero <federico@ximian.com>
(committed to CVS by Damon)
Fixes bug #15137.
* gui/e-day-view.c (e_day_view_on_delete_appointment): Do not try
to operate on the event if it gets deleted while stopping the
edition.
(e_day_view_on_event_double_click): Likewise.
(e_day_view_on_long_event_button_press): Likewise.
(e_day_view_on_event_button_press): Likewise.
(e_day_view_on_long_event_click): Likewise.
(e_day_view_on_event_click): Likewise.
* gui/e-week-view.c (e_week_view_on_text_item_event): Likewise.
svn path=/trunk/; revision=14701
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 16 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 106 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 35 |
3 files changed, 144 insertions, 13 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a3333c3bf5..51d42e9c97 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,19 @@ +2001-11-13 Federico Mena Quintero <federico@ximian.com> + + (committed to CVS by Damon) + Fixes bug #15137. + + * gui/e-day-view.c (e_day_view_on_delete_appointment): Do not try + to operate on the event if it gets deleted while stopping the + edition. + (e_day_view_on_event_double_click): Likewise. + (e_day_view_on_long_event_button_press): Likewise. + (e_day_view_on_event_button_press): Likewise. + (e_day_view_on_long_event_click): Likewise. + (e_day_view_on_event_click): Likewise. + + * gui/e-week-view.c (e_week_view_on_text_item_event): Likewise. + 2001-11-14 JP Rosevear <jpr@ximian.com> * conduits/calendar/calendar-conduit.c (pre_sync): remove silly diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index a884aa8ac4..7d00a208f3 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -3100,6 +3100,19 @@ e_day_view_on_time_canvas_button_press (GtkWidget *widget, } +/* Callback used when a component is destroyed. Expects the closure data to be + * a pointer to a boolean; will set it to TRUE. + */ +static void +comp_destroy_cb (GtkObject *object, gpointer data) +{ + gboolean *destroyed; + + destroyed = data; + *destroyed = TRUE; +} + + static gboolean e_day_view_on_long_event_button_press (EDayView *day_view, gint event_num, @@ -3122,12 +3135,26 @@ e_day_view_on_long_event_button_press (EDayView *day_view, return TRUE; } } else if (event->button == 3) { + EDayViewEvent *e; + gboolean destroyed; + guint id; + + e = &g_array_index (day_view->long_events, EDayViewEvent, event_num); + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + if (!GTK_WIDGET_HAS_FOCUS (day_view)) gtk_widget_grab_focus (GTK_WIDGET (day_view)); - e_day_view_on_event_right_click (day_view, event, - E_DAY_VIEW_LONG_EVENT, - event_num); + if (!destroyed) { + gtk_signal_disconnect (GTK_OBJECT (e->comp), id); + + e_day_view_on_event_right_click (day_view, event, + E_DAY_VIEW_LONG_EVENT, + event_num); + } + return TRUE; } return FALSE; @@ -3157,11 +3184,26 @@ e_day_view_on_event_button_press (EDayView *day_view, return TRUE; } } else if (event->button == 3) { + EDayViewEvent *e; + gboolean destroyed; + guint id; + + e = &g_array_index (day_view->events[day], EDayViewEvent, event_num); + + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + if (!GTK_WIDGET_HAS_FOCUS (day_view)) gtk_widget_grab_focus (GTK_WIDGET (day_view)); - e_day_view_on_event_right_click (day_view, event, - day, event_num); + if (!destroyed) { + gtk_signal_disconnect (GTK_OBJECT (e->comp), id); + + e_day_view_on_event_right_click (day_view, event, + day, event_num); + } + return TRUE; } return FALSE; @@ -3191,17 +3233,29 @@ e_day_view_on_long_event_click (EDayView *day_view, if (!(cal_component_has_recurrences (event->comp)) && (pos == E_DAY_VIEW_POS_LEFT_EDGE || pos == E_DAY_VIEW_POS_RIGHT_EDGE)) { + gboolean destroyed; + guint id; + if (!e_day_view_find_long_event_days (event, day_view->days_shown, day_view->day_starts, &start_day, &end_day)) return; + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + /* Grab the keyboard focus, so the event being edited is saved and we can use the Escape key to abort the resize. */ if (!GTK_WIDGET_HAS_FOCUS (day_view)) gtk_widget_grab_focus (GTK_WIDGET (day_view)); + if (destroyed) + return; + + gtk_signal_disconnect (GTK_OBJECT (event->comp), id); + if (gdk_pointer_grab (GTK_LAYOUT (day_view->top_canvas)->bin_window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, @@ -3265,11 +3319,23 @@ e_day_view_on_event_click (EDayView *day_view, if (!(cal_component_has_recurrences (event->comp)) && (pos == E_DAY_VIEW_POS_TOP_EDGE || pos == E_DAY_VIEW_POS_BOTTOM_EDGE)) { + gboolean destroyed; + guint id; + + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + /* Grab the keyboard focus, so the event being edited is saved and we can use the Escape key to abort the resize. */ if (!GTK_WIDGET_HAS_FOCUS (day_view)) gtk_widget_grab_focus (GTK_WIDGET (day_view)); + if (destroyed) + return; + + gtk_signal_disconnect (GTK_OBJECT (event->comp), id); + if (gdk_pointer_grab (GTK_LAYOUT (day_view->main_canvas)->bin_window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, @@ -3403,6 +3469,8 @@ e_day_view_on_event_double_click (EDayView *day_view, gint event_num) { EDayViewEvent *event; + gboolean destroyed; + guint id; if (day == -1) event = &g_array_index (day_view->long_events, EDayViewEvent, @@ -3411,12 +3479,20 @@ e_day_view_on_event_double_click (EDayView *day_view, event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + e_day_view_stop_editing_event (day_view); - if (day_view->calendar) - gnome_calendar_edit_object (day_view->calendar, event->comp); - else - g_warning ("Calendar not set"); + if (!destroyed) { + gtk_signal_disconnect (GTK_OBJECT (event->comp), id); + + if (day_view->calendar) + gnome_calendar_edit_object (day_view->calendar, event->comp); + else + g_warning ("Calendar not set"); + } } enum { @@ -3673,6 +3749,8 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data) { EDayView *day_view; EDayViewEvent *event; + gboolean destroyed; + guint id; day_view = E_DAY_VIEW (data); @@ -3680,10 +3758,18 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data) if (event == NULL) return; + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + if (day_view->editing_event_day >= 0) e_day_view_stop_editing_event (day_view); - e_day_view_delete_event_internal (day_view, event); + if (!destroyed) { + gtk_signal_disconnect (GTK_OBJECT (event->comp), id); + + e_day_view_delete_event_internal (day_view, event); + } } void diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 53376ba352..ba54529e4b 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2914,6 +2914,19 @@ cancel_editing (EWeekView *week_view) e_week_view_stop_editing_event (week_view); } +/* Callback used when a component is destroyed. Expects the closure data to be + * a pointer to a boolean; will set it to TRUE. + */ +static void +comp_destroy_cb (GtkObject *object, gpointer data) +{ + gboolean *destroyed; + + destroyed = data; + *destroyed = TRUE; +} + + static gboolean e_week_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *gdkevent, @@ -2966,11 +2979,27 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item, return FALSE; if (gdkevent->button.button == 3) { + EWeekViewEvent *e; + gboolean destroyed; + int id; + + e = &g_array_index (week_view->events, EWeekViewEvent, event_num); + + destroyed = FALSE; + id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy", + GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed); + if (!GTK_WIDGET_HAS_FOCUS (week_view)) gtk_widget_grab_focus (GTK_WIDGET (week_view)); - e_week_view_show_popup_menu (week_view, - (GdkEventButton*) gdkevent, - event_num); + + if (!destroyed) { + gtk_signal_disconnect (GTK_OBJECT (e->comp), id); + + e_week_view_show_popup_menu (week_view, + (GdkEventButton*) gdkevent, + event_num); + } + gtk_signal_emit_stop_by_name (GTK_OBJECT (item->canvas), "button_press_event"); return TRUE; |