From 48ef648a2e06d32439c1e732fbb3dd28fedb0a30 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 14 May 2002 04:23:27 +0000 Subject: Pass self to e_shell_offline_handler_new() instead of the component * e-shell.c (e_shell_go_offline): Pass self to e_shell_offline_handler_new() instead of the component registry. * e-shell-offline-handler.c: Replace member `component_registry' in EShellOfflineHandlerPrivate with a `shell' member. Updated all the code to retrieve the component registry from the shell instead of directly. (e_shell_offline_handler_construct): Get a @shell instead of a @component_registry. svn path=/trunk/; revision=16779 --- shell/ChangeLog | 12 +++++++++ shell/e-shell-offline-handler.c | 55 +++++++++++++++++++---------------------- shell/e-shell-offline-handler.h | 4 +-- shell/e-shell.c | 2 +- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 6240195fa2..d8486caf54 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,15 @@ +2002-05-14 Ettore Perazzoli + + * e-shell.c (e_shell_go_offline): Pass self to + e_shell_offline_handler_new() instead of the component registry. + + * e-shell-offline-handler.c: Replace member `component_registry' + in EShellOfflineHandlerPrivate with a `shell' member. Updated all + the code to retrieve the component registry from the shell instead + of directly. + (e_shell_offline_handler_construct): Get a @shell instead of a + @component_registry. + 2002-05-13 Christopher James Lahey * e-storage-set-view.c (e_storage_set_view_get_checkboxes_list): diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c index 4566584a82..4e77bd1eb9 100644 --- a/shell/e-shell-offline-handler.c +++ b/shell/e-shell-offline-handler.c @@ -80,7 +80,7 @@ struct _ComponentInfo { typedef struct _ComponentInfo ComponentInfo; struct _EShellOfflineHandlerPrivate { - EComponentRegistry *component_registry; + EShell *shell; EShellView *parent_shell_view; @@ -331,12 +331,14 @@ static void cancel_offline (EShellOfflineHandler *offline_handler) { EShellOfflineHandlerPrivate *priv; + EComponentRegistry *component_registry; GList *component_ids; GList *p; priv = offline_handler->priv; - component_ids = e_component_registry_get_id_list (priv->component_registry); + component_registry = e_shell_get_component_registry (priv->shell); + component_ids = e_component_registry_get_id_list (component_registry); for (p = component_ids; p != NULL; p = p->next) { EvolutionShellComponentClient *shell_component_client; @@ -345,7 +347,7 @@ cancel_offline (EShellOfflineHandler *offline_handler) const char *id; id = (const char *) p->data; - shell_component_client = e_component_registry_get_component_by_id (priv->component_registry, id); + shell_component_client = e_component_registry_get_component_by_id (component_registry, id); offline_interface = evolution_shell_component_client_get_offline_interface (shell_component_client); if (offline_interface == CORBA_OBJECT_NIL) @@ -376,14 +378,16 @@ cancel_offline (EShellOfflineHandler *offline_handler) static gboolean prepare_for_offline (EShellOfflineHandler *offline_handler) { + EComponentRegistry *component_registry; EShellOfflineHandlerPrivate *priv; GList *component_ids; GList *p; gboolean error; priv = offline_handler->priv; + component_registry = e_shell_get_component_registry (priv->shell); - component_ids = e_component_registry_get_id_list (priv->component_registry); + component_ids = e_component_registry_get_id_list (component_registry); error = FALSE; for (p = component_ids; p != NULL; p = p->next) { @@ -397,7 +401,7 @@ prepare_for_offline (EShellOfflineHandler *offline_handler) const char *id; id = (const char *) p->data; - shell_component_client = e_component_registry_get_component_by_id (priv->component_registry, id); + shell_component_client = e_component_registry_get_component_by_id (component_registry, id); offline_interface = evolution_shell_component_client_get_offline_interface (shell_component_client); if (offline_interface == CORBA_OBJECT_NIL) continue; @@ -659,8 +663,7 @@ impl_destroy (GtkObject *object) offline_handler = E_SHELL_OFFLINE_HANDLER (object); priv = offline_handler->priv; - if (priv->component_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->component_registry)); + /* (We don't unref the shell, as it's our owner.) */ g_hash_table_foreach (priv->id_to_component_info, hash_foreach_free_component_info, NULL); g_hash_table_destroy (priv->id_to_component_info); @@ -722,16 +725,16 @@ init (EShellOfflineHandler *shell_offline_handler) priv = g_new (EShellOfflineHandlerPrivate, 1); - priv->component_registry = NULL; - priv->parent_shell_view = NULL; + priv->shell = NULL; + priv->parent_shell_view = NULL; - priv->dialog_gui = NULL; + priv->dialog_gui = NULL; - priv->num_total_connections = 0; - priv->id_to_component_info = g_hash_table_new (g_str_hash, g_str_equal); + priv->num_total_connections = 0; + priv->id_to_component_info = g_hash_table_new (g_str_hash, g_str_equal); - priv->procedure_in_progress = FALSE; - priv->finished = FALSE; + priv->procedure_in_progress = FALSE; + priv->finished = FALSE; shell_offline_handler->priv = priv; } @@ -740,51 +743,45 @@ init (EShellOfflineHandler *shell_offline_handler) /** * e_shell_offline_handler_construct: * @offline_handler: A pointer to an EShellOfflineHandler to construct. - * @component_registry: The registry for the components that we want to put - * off-line. + * @shell: The Evolution shell. * * Construct the @offline_handler. **/ void e_shell_offline_handler_construct (EShellOfflineHandler *offline_handler, - EComponentRegistry *component_registry) + EShell *shell) { EShellOfflineHandlerPrivate *priv; - g_return_if_fail (offline_handler != NULL); g_return_if_fail (E_IS_SHELL_OFFLINE_HANDLER (offline_handler)); - g_return_if_fail (component_registry != NULL); - g_return_if_fail (E_IS_COMPONENT_REGISTRY (component_registry)); + g_return_if_fail (E_IS_SHELL (shell)); priv = offline_handler->priv; - g_assert (priv->component_registry == NULL); + g_assert (priv->shell == NULL); GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (offline_handler), GTK_FLOATING); - gtk_object_ref (GTK_OBJECT (component_registry)); - priv->component_registry = component_registry; + priv->shell = shell; } /** * e_shell_offline_handler_new: - * @component_registry: The registry for the components that we want to put - * off-line. + * @shell: The Evolution shell. * * Create a new offline handler. * * Return value: A pointer to the newly created EShellOfflineHandler object. **/ EShellOfflineHandler * -e_shell_offline_handler_new (EComponentRegistry *component_registry) +e_shell_offline_handler_new (EShell *shell) { EShellOfflineHandler *offline_handler; - g_return_val_if_fail (component_registry != NULL, NULL); - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); offline_handler = (EShellOfflineHandler *) gtk_type_new (e_shell_offline_handler_get_type ()); - e_shell_offline_handler_construct (offline_handler, component_registry); + e_shell_offline_handler_construct (offline_handler, shell); return offline_handler; } diff --git a/shell/e-shell-offline-handler.h b/shell/e-shell-offline-handler.h index 12218a5c3e..3b70e5bd00 100644 --- a/shell/e-shell-offline-handler.h +++ b/shell/e-shell-offline-handler.h @@ -72,8 +72,8 @@ struct _EShellOfflineHandlerClass { GtkType e_shell_offline_handler_get_type (void); void e_shell_offline_handler_construct (EShellOfflineHandler *offline_handler, - EComponentRegistry *component_registry); -EShellOfflineHandler *e_shell_offline_handler_new (EComponentRegistry *component_registry); + EShell *shell); +EShellOfflineHandler *e_shell_offline_handler_new (EShell *shell); void e_shell_offline_handler_put_components_offline (EShellOfflineHandler *offline_handler, EShellView *parent_shell_view); diff --git a/shell/e-shell.c b/shell/e-shell.c index 73734c346d..ff227dbb23 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1921,7 +1921,7 @@ e_shell_go_offline (EShell *shell, g_assert (priv->offline_handler == NULL); - priv->offline_handler = e_shell_offline_handler_new (priv->component_registry); + priv->offline_handler = e_shell_offline_handler_new (shell); gtk_signal_connect (GTK_OBJECT (priv->offline_handler), "offline_procedure_started", GTK_SIGNAL_FUNC (offline_procedure_started_cb), shell); -- cgit v1.2.3