aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-06-20 07:11:51 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-06-20 07:11:51 +0800
commit31ec46f9fd5d7caa6dc407dba4d93ad655888db2 (patch)
tree88077d12db402a2ddf1c10d819db543dee062054 /calendar/gui
parent991d25c1877401228d4905a382edaf3cc75b9031 (diff)
downloadgsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar
gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.gz
gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.bz2
gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.lz
gsoc2013-evolution-31ec46f9fd5d7caa6dc407dba4d93ad655888db2.tar.xz
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')
-rw-r--r--calendar/gui/calendar-component.c26
-rw-r--r--calendar/gui/component-factory.c26
-rw-r--r--calendar/gui/control-factory.c5
3 files changed, 33 insertions, 24 deletions
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.");
}