diff options
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r-- | mail/component-factory.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/mail/component-factory.c b/mail/component-factory.c index 8f25483f0d..595d184551 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -50,6 +50,7 @@ static void real_create_news_storage( gpointer user_data ); #define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-mail:0ea887d5-622b-4b8c-b525-18aa1cbe18a6" static BonoboGenericFactory *factory = NULL; +static gint running_objects = 0; static const EvolutionShellComponentFolderType folder_types[] = { { "mail", "evolution-inbox.png" }, @@ -153,13 +154,30 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) gtk_main_quit (); } -/* The factory function. */ +static void +factory_destroy (BonoboEmbeddable *embeddable, + gpointer dummy) +{ + running_objects--; + if (running_objects > 0) + return; + + if (factory) + bonobo_object_unref (BONOBO_OBJECT (factory)); + else + g_warning ("Serious ref counting error"); + factory = NULL; + + gtk_main_quit (); +} static BonoboObject * factory_fn (BonoboGenericFactory *factory, void *closure) { EvolutionShellComponent *shell_component; + running_objects++; + shell_component = evolution_shell_component_new (folder_types, create_view, create_folder, @@ -167,6 +185,8 @@ factory_fn (BonoboGenericFactory *factory, void *closure) NULL, NULL); + gtk_signal_connect (GTK_OBJECT (shell_component), "destroy", + GTK_SIGNAL_FUNC (factory_destroy), NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", GTK_SIGNAL_FUNC (owner_set_cb), NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", |