From 4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 14 Nov 2002 23:26:55 +0000 Subject: Use g_object_weak_ref rather than connecting to destroy. 2002-11-14 Jeffrey Stedfast * mail-accounts.c (account_edit_clicked): Use g_object_weak_ref rather than connecting to destroy. (account_add_clicked): Same. * mail-callbacks.c (addrbook_sender): Make this use g_object_weak_notify also. (subscribe_dialog_destroy): Add NULL guards here since I think we really do want to connect to the "destroy" signal in the function that connects us to that signal. * mail-config-factory.c (config_control_factory_cb): Same. * mail-display.c (save_part): Here too. (make_popup_window): And here. * mail-send-recv.c (build_dialogue): Same here. * mail-summary.c (create_summary_view): Use g_object_weak_notify instead of connecting to the destroy signal. svn path=/trunk/; revision=18764 --- mail/mail-callbacks.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mail/mail-callbacks.c') diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 29aa2498ef..649c7634ea 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1806,10 +1806,8 @@ addrbook_sender (GtkWidget *widget, gpointer user_data) popup_listener_cb, NULL, NULL, win); socket = find_socket (GTK_CONTAINER (control)); - gtk_signal_connect_object (GTK_OBJECT (socket), - "destroy", - G_CALLBACK (gtk_widget_destroy), - GTK_OBJECT (win)); + + g_object_weak_ref ((GObject *) socket, (GWeakNotify) gtk_widget_destroy, win); gtk_container_add (GTK_CONTAINER (win), control); gtk_widget_show_all (win); @@ -3225,8 +3223,10 @@ static GtkObject *subscribe_dialog = NULL; static void subscribe_dialog_destroy (GtkWidget *widget, gpointer user_data) { - g_object_unref (subscribe_dialog); - subscribe_dialog = NULL; + if (subscribe_dialog) { + g_object_unref (subscribe_dialog); + subscribe_dialog = NULL; + } } void @@ -3234,8 +3234,8 @@ manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path) { if (!subscribe_dialog) { subscribe_dialog = subscribe_dialog_new (); - g_signal_connect(SUBSCRIBE_DIALOG (subscribe_dialog)->app, "destroy", - G_CALLBACK(subscribe_dialog_destroy), NULL); + g_signal_connect (SUBSCRIBE_DIALOG (subscribe_dialog)->app, "destroy", + G_CALLBACK (subscribe_dialog_destroy), NULL); subscribe_dialog_show (subscribe_dialog); } else { -- cgit v1.2.3