diff options
author | JP Rosevear <jpr@ximian.com> | 2001-06-20 07:11:51 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-06-20 07:11:51 +0800 |
commit | 31ec46f9fd5d7caa6dc407dba4d93ad655888db2 (patch) | |
tree | 88077d12db402a2ddf1c10d819db543dee062054 /calendar/gui/component-factory.c | |
parent | 991d25c1877401228d4905a382edaf3cc75b9031 (diff) | |
download | gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.gz gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.zst gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.zip |
add auto exit unref
2001-06-19 JP Rosevear <jpr@ximian.com>
* gui/control-factory.c (control_factory_init): add auto exit unref
* gui/component-factory.c (destroy_cb): destroy our selves if we
have no more shells
(component_factory_init): add auto exit unref
svn path=/trunk/; revision=10312
Diffstat (limited to 'calendar/gui/component-factory.c')
-rw-r--r-- | calendar/gui/component-factory.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index da68cabf05..17242740de 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -30,6 +30,7 @@ #include <libgnomevfs/gnome-vfs-ops.h> #include <bonobo/bonobo-generic-factory.h> +#include <bonobo/bonobo-context.h> #include "evolution-shell-component.h" #include "component-factory.h" #include "tasks-control-factory.h" @@ -269,7 +270,7 @@ xfer_folder (EvolutionShellComponent *shell_component, CORBA_exception_free (&ev); } -static gint owner_count = 0; +static GList *shells = NULL; static void owner_set_cb (EvolutionShellComponent *shell_component, @@ -278,8 +279,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, gpointer user_data) { static gboolean migrated = FALSE; - - owner_count ++; + evolution_dir = g_strdup (evolution_homedir); calendar_config_init (); @@ -291,12 +291,13 @@ owner_set_cb (EvolutionShellComponent *shell_component, } static void -owner_unset_cb (EvolutionShellComponent *shell_component, - gpointer user_data) +destroy_cb (EvolutionShellComponent *shell_component, + gpointer user_data) { - owner_count --; - if (owner_count <= 0) - gtk_main_quit(); + shells = g_list_remove (shells, shell_component); + + if (g_list_length (shells) == 0) + gtk_main_quit (); } @@ -307,7 +308,7 @@ factory_fn (BonoboGenericFactory *factory, void *closure) { EvolutionShellComponent *shell_component; - + shell_component = evolution_shell_component_new (folder_types, create_view, create_folder, @@ -319,9 +320,11 @@ factory_fn (BonoboGenericFactory *factory, 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", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); + gtk_signal_connect (GTK_OBJECT (shell_component), "destroy", + GTK_SIGNAL_FUNC (destroy_cb), NULL); + shells = g_list_append (shells, shell_component); + return BONOBO_OBJECT (shell_component); } @@ -334,6 +337,7 @@ component_factory_init (void) return; factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); + bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); if (factory == NULL) g_error ("Cannot initialize Evolution's calendar component."); |