diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-01-24 07:42:54 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-01-24 07:42:54 +0800 |
commit | 9d3fd8c92531b33d5974b790c092c06f914a6282 (patch) | |
tree | e07518050631c868d8ae7695f911c28298ec9976 /executive-summary/component/component-factory.c | |
parent | e441180783a0d5af0664b991bd99906f5bd993f5 (diff) | |
download | gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.gz gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.zst gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.zip |
Lots of stuff like memory leaks and things I forgot ages ago...
Enjoy.
svn path=/trunk/; revision=7763
Diffstat (limited to 'executive-summary/component/component-factory.c')
-rw-r--r-- | executive-summary/component/component-factory.c | 135 |
1 files changed, 71 insertions, 64 deletions
diff --git a/executive-summary/component/component-factory.c b/executive-summary/component/component-factory.c index 56a516a5eb..7e1dc17b45 100644 --- a/executive-summary/component/component-factory.c +++ b/executive-summary/component/component-factory.c @@ -44,8 +44,8 @@ static BonoboGenericFactory *factory = NULL; static gint running_objects = 0; static const EvolutionShellComponentFolderType folder_types[] = { - { "executive-summary", "evolution-today.png" }, - { NULL, NULL } + { "executive-summary", "evolution-today.png" }, + { NULL, NULL } }; char *evolution_dir; @@ -59,23 +59,23 @@ create_view (EvolutionShellComponent *shell_component, BonoboControl **control_return, void *closure) { - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - BonoboControl *control; - - if (g_strcasecmp (folder_type, "executive-summary") != 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - shell_client = evolution_shell_component_get_owner (shell_component); - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - control = e_summary_factory_new_control (physical_uri, corba_shell); - if (!control) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - - *control_return = control; - - return EVOLUTION_SHELL_COMPONENT_OK; + EvolutionShellClient *shell_client; + GNOME_Evolution_Shell corba_shell; + BonoboControl *control; + + if (g_strcasecmp (folder_type, "executive-summary") != 0) + return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; + + shell_client = evolution_shell_component_get_owner (shell_component); + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); + + control = e_summary_factory_new_control (physical_uri, corba_shell); + if (!control) + return EVOLUTION_SHELL_COMPONENT_NOTFOUND; + + *control_return = control; + + return EVOLUTION_SHELL_COMPONENT_OK; } static void @@ -84,72 +84,79 @@ owner_set_cb (EvolutionShellComponent *shell_component, const char *evolution_homedir, gpointer user_data) { - GNOME_Evolution_Shell corba_shell; - - evolution_dir = g_strdup (evolution_homedir); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); + GNOME_Evolution_Shell corba_shell; + + evolution_dir = g_strdup (evolution_homedir); + + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); } static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) { - gtk_main_quit (); + gtk_main_quit (); +} + +static void +component_destroy_cb (GtkObject *object, + gpointer user_data) +{ + gtk_main_quit (); } 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 (); + 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, - NULL, NULL, NULL, 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", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - return BONOBO_OBJECT (shell_component); + EvolutionShellComponent *shell_component; + + running_objects++; + + shell_component = evolution_shell_component_new (folder_types, + create_view, + NULL, NULL, NULL, 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", + GTK_SIGNAL_FUNC (owner_unset_cb), NULL); + + return BONOBO_OBJECT (shell_component); } void component_factory_init (void) { - if (factory != NULL) - return; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID, - factory_fn, NULL); - - if (factory == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's Executive Summary component.")); - exit (1); - } + if (factory != NULL) + return; + + factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID, + factory_fn, NULL); + + if (factory == NULL) { + e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, + _("Cannot initialize Evolution's Executive Summary component.")); + exit (1); + } } |