aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog14
-rw-r--r--calendar/gui/e-day-view.c37
-rw-r--r--calendar/gui/e-week-view.c8
3 files changed, 30 insertions, 29 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index d73c888fda..02ccd1eedd 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,19 @@
2003-03-28 Hans Petter Jansson <hpj@ximian.com>
+ * gui/e-day-view.c (comp_destroy_cb)
+ (e_day_view_on_long_event_button_press)
+ (e_day_view_on_event_button_press)
+ (e_day_view_on_long_event_click)
+ (e_day_view_on_event_click)
+ (e_day_view_on_event_double_click)
+ (e_day_view_on_delete_appointment): Hold weak references to the
+ CalComponent instead of connecting to the "destroy" signal.
+
+ * gui/e-week-view.c (comp_destroy_cb)
+ (e_week_view_on_text_item_event): Ditto.
+
+2003-03-28 Hans Petter Jansson <hpj@ximian.com>
+
Fixes #39954
* gui/dialogs/recurrence-page.c (make_recurrence_special):
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 106cd4de87..d43d0f71ed 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -3219,7 +3219,7 @@ e_day_view_on_time_canvas_button_press (GtkWidget *widget,
* a pointer to a boolean; will set it to TRUE.
*/
static void
-comp_destroy_cb (GtkObject *object, gpointer data)
+comp_destroy_cb (gpointer data, GObject *deadbeef)
{
gboolean *destroyed;
@@ -3252,18 +3252,16 @@ e_day_view_on_long_event_button_press (EDayView *day_view,
} 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 = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (day_view))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
if (!destroyed) {
- g_signal_handler_disconnect (e->comp, id);
+ g_object_weak_unref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end);
@@ -3303,19 +3301,17 @@ e_day_view_on_event_button_press (EDayView *day_view,
} 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 = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (day_view))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
if (!destroyed) {
- g_signal_handler_disconnect (e->comp, id);
+ g_object_weak_unref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
e_day_view_set_selected_time_range_visible (day_view, e->start, e->end);
@@ -3353,7 +3349,6 @@ e_day_view_on_long_event_click (EDayView *day_view,
&& (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,
@@ -3362,8 +3357,7 @@ e_day_view_on_long_event_click (EDayView *day_view,
return;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) event->comp, 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. */
@@ -3373,7 +3367,7 @@ e_day_view_on_long_event_click (EDayView *day_view,
if (destroyed)
return;
- g_signal_handler_disconnect (event->comp, id);
+ g_object_weak_unref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
if (gdk_pointer_grab (GTK_LAYOUT (day_view->top_canvas)->bin_window, FALSE,
GDK_POINTER_MOTION_MASK
@@ -3439,11 +3433,9 @@ e_day_view_on_event_click (EDayView *day_view,
&& (pos == E_DAY_VIEW_POS_TOP_EDGE
|| pos == E_DAY_VIEW_POS_BOTTOM_EDGE)) {
gboolean destroyed;
- guint id;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) event->comp, 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. */
@@ -3453,7 +3445,7 @@ e_day_view_on_event_click (EDayView *day_view,
if (destroyed)
return;
- g_signal_handler_disconnect (event->comp, id);
+ g_object_weak_unref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
if (gdk_pointer_grab (GTK_LAYOUT (day_view->main_canvas)->bin_window, FALSE,
GDK_POINTER_MOTION_MASK
@@ -3589,7 +3581,6 @@ e_day_view_on_event_double_click (EDayView *day_view,
{
EDayViewEvent *event;
gboolean destroyed;
- guint id;
if (day == -1)
event = &g_array_index (day_view->long_events, EDayViewEvent,
@@ -3599,13 +3590,12 @@ e_day_view_on_event_double_click (EDayView *day_view,
event_num);
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
e_day_view_stop_editing_event (day_view);
if (!destroyed) {
- g_signal_handler_disconnect (event->comp, id);
+ g_object_weak_unref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
if (day_view->calendar)
gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
@@ -4139,7 +4129,6 @@ 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);
@@ -4148,13 +4137,13 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data)
return;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy", G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
if (day_view->editing_event_day >= 0)
e_day_view_stop_editing_event (day_view);
if (!destroyed) {
- g_signal_handler_disconnect (event->comp, id);
+ g_object_weak_unref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
e_day_view_delete_event_internal (day_view, event);
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 07429cf771..06d3dfb906 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3014,7 +3014,7 @@ cancel_editing (EWeekView *week_view)
* a pointer to a boolean; will set it to TRUE.
*/
static void
-comp_destroy_cb (GtkObject *object, gpointer data)
+comp_destroy_cb (gpointer data, GObject *deadbeef)
{
gboolean *destroyed;
@@ -3077,19 +3077,17 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
if (gdkevent->button.button == 3) {
EWeekViewEvent *e;
gboolean destroyed;
- int id;
e = &g_array_index (week_view->events, EWeekViewEvent, event_num);
destroyed = FALSE;
- id = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ g_object_weak_ref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (week_view))
gtk_widget_grab_focus (GTK_WIDGET (week_view));
if (!destroyed) {
- g_signal_handler_disconnect (e->comp, id);
+ g_object_weak_unref ((GObject *) e->comp, comp_destroy_cb, &destroyed);
e_week_view_set_selected_time_range_visible (week_view, e->start, e->end);