From bce08f29c3bfe5f60befb6d68f88f3a165a66ed5 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 22 Oct 2001 19:16:47 +0000 Subject: Move the folder sync code along with a few other things from 2001-10-22 Jeffrey Stedfast * folder-browser.c (folder_browser_destroy): Move the folder sync code along with a few other things from folder_browser_finalise() into here instead. (folder_browser_finalise): Moved some cleanup functions into destroy. svn path=/trunk/; revision=13892 --- mail/ChangeLog | 8 +++++ mail/folder-browser.c | 90 +++++++++++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 39 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index dcd356683e..0483e7135e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-10-22 Jeffrey Stedfast + + * folder-browser.c (folder_browser_destroy): Move the folder sync + code along with a few other things from folder_browser_finalise() + into here instead. + (folder_browser_finalise): Moved some cleanup functions into + destroy. + 2001-10-22 Dan Winship PGP verification UI changes to make it not HTML spoofable. diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 6c5b6f57ed..6f75607ee0 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1,11 +1,24 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * folder-browser.c: Folder browser top level component + * Authors: Miguel De Icaza + * Jeffrey Stedfast * - * Author: - * Miguel de Icaza (miguel@kernel.org) + * Copyright 2000,2001 Ximain, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * - * (C) 2000, 2001 Ximian, Inc. */ #ifdef HAVE_CONFIG_H @@ -112,57 +125,33 @@ folder_browser_finalise (GtkObject *object) { FolderBrowser *folder_browser; CORBA_Environment ev; - - folder_browser = FOLDER_BROWSER(object); - - if (folder_browser->seen_id != 0) { - gtk_timeout_remove (folder_browser->seen_id); - folder_browser->seen_id = 0; - } - - if (folder_browser->loading_id != 0) { - gtk_timeout_remove(folder_browser->loading_id); - folder_browser->loading_id = 0; - } - - /* wait for all outstanding async events against us */ - mail_async_event_destroy(folder_browser->async_event); - - if (folder_browser->folder) { - camel_object_unhook_event(CAMEL_OBJECT(folder_browser->folder), "folder_changed", - folder_changed, folder_browser); - camel_object_unhook_event(CAMEL_OBJECT(folder_browser->folder), "message_changed", - folder_changed, folder_browser); - mail_sync_folder (folder_browser->folder, NULL, NULL); - camel_object_unref (CAMEL_OBJECT (folder_browser->folder)); - folder_browser->folder = NULL; - } - + + folder_browser = FOLDER_BROWSER (object); + CORBA_exception_init (&ev); - + if (folder_browser->search_full) gtk_object_unref (GTK_OBJECT (folder_browser->search_full)); if (folder_browser->sensitize_timeout_id) g_source_remove (folder_browser->sensitize_timeout_id); - + if (folder_browser->shell != CORBA_OBJECT_NIL) { CORBA_Object_release (folder_browser->shell, &ev); folder_browser->shell = CORBA_OBJECT_NIL; } - + if (folder_browser->shell_view != CORBA_OBJECT_NIL) { CORBA_Object_release(folder_browser->shell_view, &ev); folder_browser->shell_view = CORBA_OBJECT_NIL; } - + if (folder_browser->uicomp) bonobo_object_unref (BONOBO_OBJECT (folder_browser->uicomp)); g_free (folder_browser->uri); folder_browser->uri = NULL; - CORBA_exception_free (&ev); if (folder_browser->view_collection) { @@ -177,11 +166,11 @@ folder_browser_finalise (GtkObject *object) gtk_object_unref (GTK_OBJECT (folder_browser->invisible)); folder_browser->invisible = NULL; - + if (folder_browser->clipboard_selection) g_byte_array_free (folder_browser->clipboard_selection, TRUE); - - folder_browser_parent_class->finalize(object); + + folder_browser_parent_class->finalize (object); } static void @@ -190,7 +179,17 @@ folder_browser_destroy (GtkObject *object) FolderBrowser *folder_browser; folder_browser = FOLDER_BROWSER (object); - + + if (folder_browser->seen_id != 0) { + gtk_timeout_remove (folder_browser->seen_id); + folder_browser->seen_id = 0; + } + + if (folder_browser->loading_id != 0) { + gtk_timeout_remove(folder_browser->loading_id); + folder_browser->loading_id = 0; + } + if (folder_browser->message_list) { gtk_widget_destroy (GTK_WIDGET (folder_browser->message_list)); folder_browser->message_list = NULL; @@ -201,6 +200,19 @@ folder_browser_destroy (GtkObject *object) folder_browser->mail_display = NULL; } + /* wait for all outstanding async events against us */ + mail_async_event_destroy (folder_browser->async_event); + + if (folder_browser->folder) { + camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "folder_changed", + folder_changed, folder_browser); + camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "message_changed", + folder_changed, folder_browser); + mail_sync_folder (folder_browser->folder, NULL, NULL); + camel_object_unref (CAMEL_OBJECT (folder_browser->folder)); + folder_browser->folder = NULL; + } + folder_browser_parent_class->destroy (object); } -- cgit