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
This commit is contained in:
Ettore Perazzoli
2002-05-14 04:23:27 +00:00
parent 17f6f9980a
commit 48ef648a2e
4 changed files with 41 additions and 32 deletions

View File

@ -1,3 +1,15 @@
2002-05-14 Ettore Perazzoli <ettore@ximian.com>
* 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 <clahey@ximian.com>
* e-storage-set-view.c (e_storage_set_view_get_checkboxes_list):

View File

@ -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;
}

View File

@ -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);

View File

@ -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);