From 6dc395e2641eb93323879e9dac7980d27a8ba878 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 6 Dec 2000 23:03:49 +0000 Subject: Fix up shutdown so that things that should be destroyed get destroyed. Among other things, this fixes the bug where IMAP stores weren't disconnected at shutdown. * mail-threads.c (update_active_views): Update for folder_browser_factory_get_control_list change to EList. * folder-browser-factory.c: Turn control_list into an EList so that we can safely remove items from it while it's being iterated (which will happen as FolderBrowsers are destroyed at shutdown while the thread code is trying to update the status bars). (control_destroy_cb): Just destroy the folder_browser. (browser_destroy_cb): New callback for FolderBrowser destroy. Remove the control from control_list here instead of control_destroy_cb, because the controls don't seem to get destroyed reliably... * component-factory.c: Clean up stuff. (factory_destroy): Get rid of this. (owner_unset_cb): Schedule an idle handler to quit. (idle_quit): Wait for all of the FolderBrowsers to be destroyed and then destroy the storages and quit. svn path=/trunk/; revision=6830 --- mail/folder-browser-factory.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'mail/folder-browser-factory.c') diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 0095ded338..1846bc2ac0 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -31,7 +31,7 @@ #include "mail-session.h" /* The FolderBrowser BonoboControls we have. */ -static GList *control_list = NULL; +static EList *control_list = NULL; /* * Add with 'folder_browser' @@ -207,13 +207,30 @@ control_activate_cb (BonoboControl *control, static void control_destroy_cb (BonoboControl *control, - gpointer user_data) + GtkObject *folder_browser) { - GtkWidget *folder_browser = user_data; - - control_list = g_list_remove (control_list, control); + gtk_object_destroy (folder_browser); +} - gtk_object_destroy (GTK_OBJECT (folder_browser)); +static void +browser_destroy_cb (FolderBrowser *fb, + BonoboControl *control) +{ + EIterator *it; + + /* We do this from browser_destroy_cb rather than + * control_destroy_cb because currently, the controls + * don't seem to all get destroyed properly at quit + * time (but the widgets get destroyed by X). FIXME. + */ + + for (it = e_list_get_iterator (control_list); e_iterator_is_valid (it); e_iterator_next (it)) { + if (e_iterator_get (it) == control) { + e_iterator_delete (it); + break; + } + } + gtk_object_unref (GTK_OBJECT (it)); } BonoboControl * @@ -246,14 +263,21 @@ folder_browser_factory_new_control (const char *uri, gtk_signal_connect (GTK_OBJECT (control), "destroy", control_destroy_cb, folder_browser); + gtk_signal_connect (GTK_OBJECT (folder_browser), "destroy", + browser_destroy_cb, control); + + if (!control_list) + control_list = e_list_new (NULL, NULL, NULL); - control_list = g_list_prepend (control_list, control); + e_list_append (control_list, control); return control; } -GList * +EList * folder_browser_factory_get_control_list (void) { + if (!control_list) + control_list = e_list_new (NULL, NULL, NULL); return control_list; } -- cgit