aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/gui/calendar-component.c26
-rw-r--r--calendar/gui/component-factory.c26
-rw-r--r--calendar/gui/control-factory.c5
4 files changed, 41 insertions, 24 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index da49c4f122..98d6eba9c4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,13 @@
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
+
+2001-06-19 JP Rosevear <jpr@ximian.com>
+
* gui/Makefile.am: don't compile or install the old meeting edit
stuff
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index da68cabf05..17242740de 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.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.");
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.");
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index be41f9d420..47704f8cae 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -27,6 +27,7 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-persist-file.h>
+#include <bonobo/bonobo-context.h>
#include <glade/glade.h>
#include <liboaf/liboaf.h>
@@ -61,7 +62,6 @@ control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
calendar_control_deactivate (control, gcal);
}
-
static void
get_prop (BonoboPropertyBag *bag,
BonoboArg *arg,
@@ -156,7 +156,8 @@ control_factory_init (void)
return;
factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory_fn, NULL);
-
+ bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
+
if (factory == NULL)
g_error ("I could not register a Calendar control factory.");
}