diff options
Diffstat (limited to 'shell/evolution-shell-component-client.c')
-rw-r--r-- | shell/evolution-shell-component-client.c | 128 |
1 files changed, 65 insertions, 63 deletions
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index f8e00de066..02a2fc7400 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -90,48 +90,6 @@ corba_exception_to_result (const CORBA_Environment *ev) } } -static void -dispatch_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result) -{ - EvolutionShellComponentClientPrivate *priv; - EvolutionShellComponentClientCallback callback; - PortableServer_ObjectId *oid; - void *callback_data; - CORBA_Environment ev; - - priv = shell_component_client->priv; - - g_return_if_fail (priv->callback != NULL); - g_return_if_fail (priv->listener_servant != NULL); - - /* Notice that we destroy the interface and reset the callback information before - dispatching the callback so that the callback can generate another request. */ - - CORBA_exception_init (&ev); - - oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev); - POA_GNOME_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev); - CORBA_free (oid); - - CORBA_Object_release (priv->listener_interface, &ev); - free_ShellComponentListener_servant (priv->listener_servant); - - CORBA_exception_free (&ev); - - priv->listener_servant = NULL; - priv->listener_interface = CORBA_OBJECT_NIL; - - callback = priv->callback; - callback_data = priv->callback_data; - - priv->callback = NULL; - priv->callback_data = NULL; - - (* callback) (shell_component_client, result, callback_data); -} - static EvolutionShellComponentResult shell_component_result_from_corba_exception (const CORBA_Environment *ev) { @@ -150,12 +108,35 @@ static POA_GNOME_Evolution_ShellComponentListener__epv ShellComponentListener_e static POA_GNOME_Evolution_ShellComponentListener__vepv ShellComponentListener_vepv; static gboolean ShellComponentListener_vepv_initialized = FALSE; +static void ShellComponentListener_vepv_initialize (void); + struct _ShellComponentListenerServant { POA_GNOME_Evolution_ShellComponentListener servant; EvolutionShellComponentClient *component_client; }; typedef struct _ShellComponentListenerServant ShellComponentListenerServant; +static PortableServer_Servant * +create_ShellComponentListener_servant (EvolutionShellComponentClient *component_client) +{ + ShellComponentListenerServant *servant; + + if (! ShellComponentListener_vepv_initialized) + ShellComponentListener_vepv_initialize (); + + servant = g_new0 (ShellComponentListenerServant, 1); + servant->servant.vepv = &ShellComponentListener_vepv; + servant->component_client = component_client; + + return (PortableServer_Servant) servant; +} + +static void +free_ShellComponentListener_servant (PortableServer_Servant servant) +{ + g_free (servant); +} + static EvolutionShellComponentClient * component_client_from_ShellComponentListener_servant (PortableServer_Servant servant) { @@ -189,6 +170,48 @@ result_from_async_corba_result (GNOME_Evolution_ShellComponentListener_Result as } static void +dispatch_callback (EvolutionShellComponentClient *shell_component_client, + EvolutionShellComponentResult result) +{ + EvolutionShellComponentClientPrivate *priv; + EvolutionShellComponentClientCallback callback; + PortableServer_ObjectId *oid; + void *callback_data; + CORBA_Environment ev; + + priv = shell_component_client->priv; + + g_return_if_fail (priv->callback != NULL); + g_return_if_fail (priv->listener_servant != NULL); + + /* Notice that we destroy the interface and reset the callback information before + dispatching the callback so that the callback can generate another request. */ + + CORBA_exception_init (&ev); + + oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev); + PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev); + POA_GNOME_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev); + CORBA_free (oid); + + CORBA_Object_release (priv->listener_interface, &ev); + free_ShellComponentListener_servant (priv->listener_servant); + + CORBA_exception_free (&ev); + + priv->listener_servant = NULL; + priv->listener_interface = CORBA_OBJECT_NIL; + + callback = priv->callback; + callback_data = priv->callback_data; + + priv->callback = NULL; + priv->callback_data = NULL; + + (* callback) (shell_component_client, result, callback_data); +} + +static void impl_ShellComponentListener_report_result (PortableServer_Servant servant, const GNOME_Evolution_ShellComponentListener_Result result, CORBA_Environment *ev) @@ -214,27 +237,6 @@ ShellComponentListener_vepv_initialize (void) ShellComponentListener_vepv_initialized = TRUE; } -static PortableServer_Servant * -create_ShellComponentListener_servant (EvolutionShellComponentClient *component_client) -{ - ShellComponentListenerServant *servant; - - if (! ShellComponentListener_vepv_initialized) - ShellComponentListener_vepv_initialize (); - - servant = g_new0 (ShellComponentListenerServant, 1); - servant->servant.vepv = &ShellComponentListener_vepv; - servant->component_client = component_client; - - return (PortableServer_Servant) servant; -} - -static void -free_ShellComponentListener_servant (PortableServer_Servant servant) -{ - g_free (servant); -} - static void create_listener_interface (EvolutionShellComponentClient *shell_component_client) { |