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-display.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'mail/mail-display.c') diff --git a/mail/mail-display.c b/mail/mail-display.c index 427f660a92..0d9305344e 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -252,7 +252,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data) } static void -save_destroy_cb (GtkWidget *widget, CamelMimePart *part) +save_destroy_cb (CamelMimePart *part, GObject *deadbeef) { camel_object_unref (part); } @@ -330,9 +330,8 @@ save_part (CamelMimePart *part) G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (file_select)); - g_signal_connect(file_select, "destroy", - G_CALLBACK (save_destroy_cb), part); - + g_object_weak_ref ((GObject *) file_select, (GWeakNotify) save_destroy_cb, part); + gtk_widget_show (GTK_WIDGET (file_select)); } @@ -1114,13 +1113,13 @@ do_signature (GtkHTML *html, GtkHTMLEmbedded *eb, gtk_widget_set_size_request (pbl->pixmap, 24, 24); pbl->eb = eb; pbl->destroy_id = g_signal_connect(eb, "destroy", G_CALLBACK(embeddable_destroy_cb), pbl); - + g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, pbl, NULL); - + button = gtk_button_new (); GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); - g_object_set_data(G_OBJECT(button), "MailDisplay", md); - g_signal_connect(button, "clicked", G_CALLBACK (button_press), part); + g_object_set_data ((GObject *) button, "MailDisplay", md); + g_signal_connect (button, "clicked", G_CALLBACK (button_press), part); gtk_container_add (GTK_CONTAINER (button), pbl->pixmap); gtk_widget_show_all (button); gtk_container_add (GTK_CONTAINER (eb), button); @@ -2144,12 +2143,10 @@ popup_info_free (PopupInfo *pop) } static void -popup_window_destroy_cb (GtkWidget *w, gpointer user_data) +popup_window_destroy_cb (PopupInfo *pop, GObject *deadbeef) { - PopupInfo *pop = (PopupInfo *) user_data; - the_popup = NULL; - + popup_info_free (pop); } @@ -2228,30 +2225,31 @@ make_popup_window (GtkWidget *w) { PopupInfo *pop = g_new0 (PopupInfo, 1); GtkWidget *fr; - + /* Only allow for one popup at a time. Ugly. */ if (the_popup) gtk_widget_destroy (the_popup); - + pop->w = w; the_popup = pop->win = gtk_window_new (GTK_WINDOW_POPUP); fr = gtk_frame_new (NULL); - + gtk_container_add (GTK_CONTAINER (pop->win), fr); gtk_container_add (GTK_CONTAINER (fr), w); - + gtk_window_set_policy (GTK_WINDOW (pop->win), FALSE, FALSE, FALSE); - - g_signal_connect(pop->win, "destroy", G_CALLBACK (popup_window_destroy_cb), pop); - g_signal_connect(pop->win, "enter_notify_event", G_CALLBACK (popup_enter_cb), pop); - g_signal_connect(pop->win, "leave_notify_event", G_CALLBACK (popup_leave_cb), pop); + + g_signal_connect (pop->win, "enter_notify_event", G_CALLBACK (popup_enter_cb), pop); + g_signal_connect (pop->win, "leave_notify_event", G_CALLBACK (popup_leave_cb), pop); g_signal_connect_after (pop->win, "realize", G_CALLBACK (popup_realize_cb), pop); - g_signal_connect(pop->win, "size_allocate", G_CALLBACK (popup_size_allocate_cb), pop); - + g_signal_connect (pop->win, "size_allocate", G_CALLBACK (popup_size_allocate_cb), pop); + + g_object_weak_ref ((GObject *) pop->win, (GWeakNotify) popup_window_destroy_cb, pop); + gtk_widget_show (w); gtk_widget_show (fr); gtk_widget_show (pop->win); - + return pop; } -- cgit