From 5e2c2e595ea43689b22a0c93e978c3a8afa60e06 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Sun, 3 Sep 2000 15:13:48 +0000 Subject: Copy the passed in item before adding (mail_config_add_source): ditto 2000-09-03 JP Rosevear * mail-config.c (mail_config_add_news): Copy the passed in item before adding (mail_config_add_source): ditto (mail_config_add_identity): ditto * mail-config-gui.c (mail_config): We don't actually need a notebook pointer. (identities_edit_clicked): Don't explicitly destroy, we are using gtk_clist_set_data_full now (sources_edit_clicked): ditto (news_edit_clicked): ditto (mail_config): Use gtk_clist_set_row_data_full to kill leaks svn path=/trunk/; revision=5185 --- mail/ChangeLog | 15 +++++++++++++++ mail/mail-config-gui.c | 38 +++++++++++++++++++++----------------- mail/mail-config.c | 12 +++++++++--- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index bbd5a267cb..6e95356be3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2000-09-03 JP Rosevear + + * mail-config.c (mail_config_add_news): Copy the passed in item + before adding + (mail_config_add_source): ditto + (mail_config_add_identity): ditto + + * mail-config-gui.c (mail_config): We don't actually need a notebook + pointer. + (identities_edit_clicked): Don't explicitly destroy, we are using + gtk_clist_set_data_full now + (sources_edit_clicked): ditto + (news_edit_clicked): ditto + (mail_config): Use gtk_clist_set_row_data_full to kill leaks + 2000-09-03 Jeffrey Stedfast * folder-browser-factory.c: Change the "Get Mail" toolbar button diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index 90437f6267..abe582fe27 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -161,7 +161,6 @@ typedef struct Evolution_Shell shell; GladeXML *gui; GtkWidget *dialog; - GtkWidget *notebook; GtkWidget *clistIdentities; gint idrow; gint maxidrow; @@ -1757,7 +1756,6 @@ identities_edit_clicked (GtkWidget *widget, MailDialog *dialog) e_utf8_gtk_clist_set_text (clist, dialog->idrow, 3, id2->sig); gtk_clist_set_row_data (clist, dialog->idrow, id2); - identity_destroy (id); gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); } @@ -1830,7 +1828,6 @@ sources_edit_clicked (GtkWidget *widget, MailDialog *dialog) e_utf8_gtk_clist_set_text (clist, dialog->srow, 0, source2->url); gtk_clist_set_row_data (clist, dialog->srow, source2); - service_destroy (source); gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); } @@ -1903,7 +1900,6 @@ news_edit_clicked (GtkWidget *widget, MailDialog *dialog) e_utf8_gtk_clist_set_text (clist, dialog->nrow, 0, news2->url); gtk_clist_set_row_data (clist, dialog->nrow, news2); - service_destroy (news); gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); } @@ -2030,6 +2026,13 @@ mail_config_apply_clicked (GnomePropertyBox *property_box, mail_config_write (); } +static void +mail_config_close (GnomePropertyBox *property_box, MailDialog *dialog) +{ + gtk_object_unref (GTK_OBJECT (dialog->gui)); + g_free (dialog); +} + void mail_config (Evolution_Shell shell) { @@ -2039,17 +2042,16 @@ mail_config (Evolution_Shell shell) GtkCList *clist; GtkWidget *button, *tvbox; GSList *l, *sources, *news, *transports; - + provider_list (&sources, &news, &transports); dialog = g_new0 (MailDialog, 1); - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); + dialog->gui = gui; dialog->shell = shell; - /*gtk_object_ref (GTK_OBJECT (dialog->fb)); no place to unref it*/ dialog->dialog = glade_xml_get_widget (gui, "dialog"); - dialog->notebook = glade_xml_get_widget (gui, "notebook"); /* Identities Page */ dialog->clistIdentities = @@ -2075,7 +2077,7 @@ mail_config (Evolution_Shell shell) text[3] = id->sig; row = e_utf8_gtk_clist_append (clist, text); - gtk_clist_set_row_data (clist, row, id); + gtk_clist_set_row_data_full (clist, row, id, (GtkDestroyNotify) identity_destroy); } gtk_signal_connect (GTK_OBJECT (clist), "select_row", @@ -2115,7 +2117,7 @@ mail_config (Evolution_Shell shell) text[0] = source->url; row = e_utf8_gtk_clist_append (clist, text); - gtk_clist_set_row_data (clist, row, source); + gtk_clist_set_row_data_full (clist, row, source, (GtkDestroyNotify) service_destroy); } gtk_signal_connect (GTK_OBJECT (clist), "select_row", @@ -2155,7 +2157,7 @@ mail_config (Evolution_Shell shell) text[0] = news->url; row = e_utf8_gtk_clist_append (clist, text); - gtk_clist_set_row_data (clist, row, news); + gtk_clist_set_row_data_full (clist, row, news, (GtkDestroyNotify) service_destroy); } gtk_signal_connect (GTK_OBJECT (clist), "select_row", @@ -2204,16 +2206,18 @@ mail_config (Evolution_Shell shell) GTK_SIGNAL_FUNC (timeout_changed), dialog); - /* Listen for apply signal */ + /* Listen for signals */ gtk_signal_connect (GTK_OBJECT (dialog->dialog), "apply", GTK_SIGNAL_FUNC (mail_config_apply_clicked), dialog); + gtk_signal_connect (GTK_OBJECT (dialog->dialog), "destroy", + GTK_SIGNAL_FUNC (mail_config_close), + dialog); + gtk_signal_connect (GTK_OBJECT (dialog->dialog), "delete_event", + GTK_SIGNAL_FUNC (mail_config_close), + dialog); - gnome_dialog_run (GNOME_DIALOG (dialog->dialog)); - - /* Clean up */ - gtk_object_unref (GTK_OBJECT (gui)); - g_free (dialog); + gtk_widget_show (dialog->dialog); } /* ************************************************************************ */ diff --git a/mail/mail-config.c b/mail/mail-config.c index da9629488e..fc8fa7203e 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -484,7 +484,9 @@ mail_config_get_identities (void) void mail_config_add_identity (MailConfigIdentity *id) { - config->ids = g_slist_append (config->ids, id); + MailConfigIdentity *new_id = identity_copy (id); + + config->ids = g_slist_append (config->ids, new_id); } MailConfigService * @@ -505,7 +507,9 @@ mail_config_get_sources (void) void mail_config_add_source (MailConfigService *source) { - config->sources = g_slist_append (config->sources, source); + MailConfigService *new_source = service_copy (source); + + config->sources = g_slist_append (config->sources, new_source); } MailConfigService * @@ -541,7 +545,9 @@ mail_config_get_news (void) void mail_config_add_news (MailConfigService *news) { - config->news = g_slist_append (config->news, news); + MailConfigService *new_news = service_copy (news); + + config->news = g_slist_append (config->news, new_news); } -- cgit