aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r--calendar/gui/e-day-view.c106
1 files changed, 96 insertions, 10 deletions
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