diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-11-15 07:26:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-11-15 07:26:55 +0800 |
commit | 4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0 (patch) | |
tree | db724db4e864ce41a136ab6820559346c9cd9fe0 | |
parent | 334b42bda165b9cfd18f60f60742f850f9154c2e (diff) | |
download | gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar.gz gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar.bz2 gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar.lz gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar.xz gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.tar.zst gsoc2013-evolution-4ff0a43cd48adc7cdc98be078cdfbc425aa7e8b0.zip |
Use g_object_weak_ref rather than connecting to destroy.
2002-11-14 Jeffrey Stedfast <fejj@ximian.com>
* 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
-rw-r--r-- | mail/ChangeLog | 22 | ||||
-rw-r--r-- | mail/mail-accounts.c | 27 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 16 | ||||
-rw-r--r-- | mail/mail-config-factory.c | 10 | ||||
-rw-r--r-- | mail/mail-display.c | 44 | ||||
-rw-r--r-- | mail/mail-search.c | 2 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 7 | ||||
-rw-r--r-- | mail/mail-session.c | 2 | ||||
-rw-r--r-- | mail/mail-summary.c | 7 |
9 files changed, 75 insertions, 62 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 8ad06c8466..946ec61033 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,25 @@ +2002-11-14 Jeffrey Stedfast <fejj@ximian.com> + + * 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. + 2002-11-14 Ettore Perazzoli <ettore@ximian.com> * component-factory.c (owner_set_cb): Want a (GWeakNotify) cast diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index f946ddc8f0..550017a543 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -121,20 +121,18 @@ mail_accounts_tab_finalise (GObject *obj) } static void -account_add_finished (GtkWidget *widget, gpointer user_data) +account_add_finished (MailAccountsTab *prefs, GObject *deadbeef) { /* Either Cancel or Finished was clicked in the druid so reload the accounts */ - MailAccountsTab *prefs = user_data; - prefs->druid = NULL; - + #warning "GTK_OBJECT_DESTROYED" #if 0 if (!GTK_OBJECT_DESTROYED (prefs)) #endif mail_accounts_load (prefs); - g_object_unref ((GtkObject *) prefs); + g_object_unref (prefs); } static void @@ -144,29 +142,28 @@ account_add_clicked (GtkButton *button, gpointer user_data) if (prefs->druid == NULL) { prefs->druid = (GtkWidget *) mail_config_druid_new (prefs->shell); - g_signal_connect((prefs->druid), "destroy", - G_CALLBACK (account_add_finished), prefs); + g_object_weak_ref ((GObject *) prefs->druid, + (GWeakNotify) account_add_finished, prefs); gtk_widget_show (prefs->druid); - g_object_ref ((GtkObject *) prefs); + g_object_ref (prefs); } else { gdk_window_raise (prefs->druid->window); } } static void -account_edit_finished (GtkWidget *widget, gpointer user_data) +account_edit_finished (MailAccountsTab *prefs, GObject *deadbeef) { - MailAccountsTab *prefs = user_data; - prefs->editor = NULL; +#warning "GTK_OBJECT_DESTROYED" #if 0 if (!GTK_OBJECT_DESTROYED (prefs)) #endif mail_accounts_load (prefs); - g_object_unref(prefs); + g_object_unref (prefs); } static void @@ -193,11 +190,9 @@ account_edit_clicked (GtkButton *button, gpointer user_data) account = gtk_clist_get_row_data (prefs->table, row); #endif prefs->editor = (GtkWidget *) mail_account_editor_new (account, GTK_WINDOW (window), prefs); - g_signal_connect((prefs->editor), "destroy", - G_CALLBACK (account_edit_finished), - prefs); + g_object_weak_notify ((GObject *) prefs->editor, (GWeakNotify) account_edit_finished, prefs); gtk_widget_show (prefs->editor); - g_object_ref ((GtkObject *) prefs); + g_object_ref (prefs); } } else { gdk_window_raise (prefs->editor->window); 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 { diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c index fe1aa9cb2e..4e7e0ee2ed 100644 --- a/mail/mail-config-factory.c +++ b/mail/mail-config-factory.c @@ -48,16 +48,14 @@ struct _config_data { }; static void -config_control_destroy_callback (EvolutionConfigControl *config_control, void *user_data) +config_control_destroy_cb (struct _config_data *data, GObject *deadbeef) { - struct _config_data *data = user_data; - g_object_unref (data->prefs); g_free (data); } static void -config_control_apply_callback (EvolutionConfigControl *config_control, void *user_data) +config_control_apply_cb (EvolutionConfigControl *config_control, void *user_data) { struct _config_data *data = user_data; @@ -116,8 +114,8 @@ config_control_factory_cb (BonoboGenericFactory *factory, const char *component_ g_assert_not_reached (); } - g_signal_connect(control, "apply", G_CALLBACK (config_control_apply_callback), data); - g_signal_connect(control, "destroy", G_CALLBACK (config_control_destroy_callback), data); + g_signal_connect (control, "apply", G_CALLBACK (config_control_apply_cb), data); + g_object_weak_ref (control, (GWeakNotify) config_control_destroy_cb, data); return BONOBO_OBJECT (control); } 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; } diff --git a/mail/mail-search.c b/mail/mail-search.c index 4ca999bb9c..4d7a4c4ed6 100644 --- a/mail/mail-search.c +++ b/mail/mail-search.c @@ -171,7 +171,7 @@ toggled_fwd_cb (GtkToggleButton *b, MailSearch *ms) #endif static void -dialog_destroy_cb (GtkWidget *w, MailSearch *ms) +dialog_destroy_cb (GtkWidget *w, MailSearch *ms) { ESearchingTokenizer *st = mail_search_tokenizer (ms); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 95e609e825..3d049dd9c8 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -206,7 +206,7 @@ static void hide_send_info(void *key, struct _send_info *info, void *data) } static void -dialog_destroy (struct _send_data *data, GtkProgressBar *bar) +dialog_destroy_cb (struct _send_data *data, GObject *deadbeef) { g_hash_table_foreach (data->active, (GHFunc) hide_send_info, NULL); data->gd = NULL; @@ -432,8 +432,9 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) gtk_widget_show (GTK_WIDGET (gd)); - g_signal_connect(gd, "response", G_CALLBACK(dialogue_response), data); - g_signal_connect(gd, "destroy", G_CALLBACK(dialog_destroy), data); + g_signal_connect (gd, "response", G_CALLBACK (dialogue_response), data); + + g_object_weak_notify ((GObject *) gd, (GWeakNotify) dialog_destroy_cb, data); data->infos = list; data->gd = gd; diff --git a/mail/mail-session.c b/mail/mail-session.c index f12a65a478..00c58f4220 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -274,7 +274,7 @@ request_password(struct _pass_msg *m) title = e_utf8_to_gtk_string (GTK_WIDGET (check_label), m->prompt); password_dialogue = (GnomeDialog *)dialogue = gnome_request_dialog (m->secret, title, NULL, 0, pass_got, m, NULL); g_free(title); - password_destroy_id = g_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m); + password_destroy_id = g_signal_connect (dialogue, "destroy", request_password_deleted, m); check = gtk_check_button_new (); gtk_misc_set_alignment (GTK_MISC (check_label), 0.0, 0.5); diff --git a/mail/mail-summary.c b/mail/mail-summary.c index 95aaeb7c64..0ddaa6412f 100644 --- a/mail/mail-summary.c +++ b/mail/mail-summary.c @@ -162,8 +162,7 @@ summary_free (MailSummary *summary) } static void -view_destroy_cb (GtkObject *object, - MailSummary *summary) +view_destroy_cb (MailSummary *summary, GObject *deadbeef) { summary_free (summary); g_free (summary); @@ -478,8 +477,8 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, view = executive_summary_html_view_new_full (event_source); bonobo_object_add_interface (component, view); summary->view = view; - gtk_signal_connect (GTK_OBJECT (view), "destroy", - GTK_SIGNAL_FUNC (view_destroy_cb), summary); + + g_object_weak_notify ((GObject *) view, (GWeakNotify) view_destroy_cb, summary); bag = bonobo_property_bag_new_full (get_property, NULL, event_source, summary); |