aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-offline-handler.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-05-14 12:23:27 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-05-14 12:23:27 +0800
commit48ef648a2e06d32439c1e732fbb3dd28fedb0a30 (patch)
tree9e98888e0991dd12f5e6956661139b10a31548df /shell/e-shell-offline-handler.c
parent17f6f9980adefe5642c165fef6b1e9b15dd7cf7d (diff)
downloadgsoc2013-evolution-48ef648a2e06d32439c1e732fbb3dd28fedb0a30.tar.gz
gsoc2013-evolution-48ef648a2e06d32439c1e732fbb3dd28fedb0a30.tar.zst
gsoc2013-evolution-48ef648a2e06d32439c1e732fbb3dd28fedb0a30.zip
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
Diffstat (limited to 'shell/e-shell-offline-handler.c')
-rw-r--r--shell/e-shell-offline-handler.c55
1 files changed, 26 insertions, 29 deletions
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;
}