aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/Evolution-Offline.idl17
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell-offline-handler.c100
-rw-r--r--shell/e-shell-offline-handler.h2
-rw-r--r--shell/e-shell-offline-sync.c433
-rw-r--r--shell/e-shell-offline-sync.h33
-rw-r--r--shell/e-shell.c77
8 files changed, 129 insertions, 552 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 44801a4461..0ab18beb32 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,20 @@
+2003-11-30 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell.c (struct _EShellPrivate): New member offline_handler.
+ (offline_procedure_started_cb): New.
+ (offline_procedure_finished_cb): New.
+ (e_shell_go_offline): Implement (putting back the code that we had
+ #if 0'ed out).
+ (e_shell_go_online): Likewise.
+
+ * e-shell-offline-handler.c, e-shell-offline-handler.h: Put back
+ in, massage for the changes in the Offline interface.
+
+ * e-shell-offline-sync.c, e-shell-offline-sync.h: Remove from CVS.
+
+ * Evolution-Offline.idl (SyncFolderProgressListener): Remove.
+ (Offline::SyncFolder): Remove.
+
2003-11-23 JP Rosevear <jpr@ximian.com>
* Makefile.am: remove gtk deprecated flag
diff --git a/shell/Evolution-Offline.idl b/shell/Evolution-Offline.idl
index 4c3f3f7392..4648fd9a7f 100644
--- a/shell/Evolution-Offline.idl
+++ b/shell/Evolution-Offline.idl
@@ -25,18 +25,6 @@ interface OfflineProgressListener {
void updateProgress (in ConnectionList current_active_connections);
};
-interface SyncFolderProgressListener {
- /* Report that syncing has progressed. @progress has to be between 0.0
- and 1.0. */
- void updateProgress (in float progress);
-
- /* Report that the operation has finished. */
- void reportSuccess ();
-
- /* Report an error. */
- void reportFailure (in string message);
-};
-
interface Offline : Bonobo::Unknown {
exception notPrepared {};
exception notSyncing {};
@@ -56,11 +44,6 @@ interface Offline : Bonobo::Unknown {
*/
void prepareForOffline (out ConnectionList active_connection_list);
- /* Request the component to sync the specified folder. This has to
- happen after ::prepareForOffline. */
- oneway void syncFolder (in Folder folder,
- in SyncFolderProgressListener listener);
-
/* Request the component to stop syncing the specified folder. This
has to happen after ::syncFolder. */
oneway void cancelSyncFolder (in Folder folder);
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 882336daae..7dc9e7e896 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -172,6 +172,8 @@ evolution_SOURCES = \
e-shell-constants.h \
e-shell-folder-title-bar.c \
e-shell-folder-title-bar.h \
+ e-shell-offline-handler.c \
+ e-shell-offline-handler.h \
e-shell-settings-dialog.c \
e-shell-settings-dialog.h \
e-shell-startup-wizard.c \
diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c
index 3554705f9f..008af4dd93 100644
--- a/shell/e-shell-offline-handler.c
+++ b/shell/e-shell-offline-handler.c
@@ -29,8 +29,6 @@
#include "e-shell-offline-handler.h"
-#include "e-shell-offline-sync.h"
-
#include "e-shell-marshal.h"
#include <gtk/gtkcellrenderertext.h>
@@ -52,14 +50,14 @@
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-exception.h>
-
+
#define GLADE_DIALOG_FILE_NAME EVOLUTION_GLADEDIR "/e-active-connection-dialog.glade"
-
+
#define PARENT_TYPE GTK_TYPE_OBJECT
static GtkObjectClass *parent_class = NULL;
-
+
/* Private part. */
struct _OfflineProgressListenerServant {
@@ -105,7 +103,7 @@ struct _EShellOfflineHandlerPrivate {
int finished : 1;
};
-
+
/* Signals. */
enum {
@@ -116,12 +114,12 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-
+
/* Forward declarations for the dialog handling. */
static void update_dialog_clist (EShellOfflineHandler *offline_handler);
-
+
/* Implementation for the OfflineProgressListener interface. */
static PortableServer_ServantBase__epv OfflineProgressListener_base_epv;
@@ -274,7 +272,7 @@ create_progress_listener (EShellOfflineHandler *offline_handler,
return TRUE;
}
-
+
/* ComponentInfo handling. */
static ComponentInfo *
@@ -322,7 +320,7 @@ component_info_free (ComponentInfo *component_info)
CORBA_exception_free (&ev);
}
-
+
/* Utility functions. */
static void
@@ -336,7 +334,25 @@ hash_foreach_free_component_info (void *key,
component_info_free (component_info);
}
-
+
+static GNOME_Evolution_Offline
+get_offline_interface (GNOME_Evolution_Component objref)
+{
+ GNOME_Evolution_Offline interface;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ interface = Bonobo_Unknown_queryInterface (objref, "IDL:GNOME/Evolution/Offline:1.0", &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ interface = CORBA_OBJECT_NIL;
+
+ CORBA_exception_free (&ev);
+ return interface;
+}
+
+
/* Cancelling the off-line procedure. */
static void
@@ -344,24 +360,21 @@ cancel_offline (EShellOfflineHandler *offline_handler)
{
EShellOfflineHandlerPrivate *priv;
EComponentRegistry *component_registry;
- GList *component_ids;
- GList *p;
+ GSList *component_infos;
+ GSList *p;
priv = offline_handler->priv;
- component_registry = e_shell_get_component_registry (priv->shell);
- component_ids = e_component_registry_get_id_list (component_registry);
+ component_registry = e_shell_peek_component_registry (priv->shell);
+ component_infos = e_component_registry_peek_list (component_registry);
- for (p = component_ids; p != NULL; p = p->next) {
- EvolutionShellComponentClient *shell_component_client;
+ for (p = component_infos; p != NULL; p = p->next) {
+ EComponentInfo *info = p->data;
GNOME_Evolution_Offline offline_interface;
CORBA_Environment ev;
const char *id;
- id = (const char *) p->data;
- 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);
+ offline_interface = get_offline_interface (info->iface);
if (offline_interface == CORBA_OBJECT_NIL)
continue;
@@ -374,8 +387,6 @@ cancel_offline (EShellOfflineHandler *offline_handler)
CORBA_exception_free (&ev);
}
- e_free_string_list (component_ids);
-
priv->num_total_connections = 0;
if (! priv->finished) {
@@ -384,7 +395,7 @@ cancel_offline (EShellOfflineHandler *offline_handler)
}
}
-
+
/* Preparing the off-line procedure. */
static gboolean
@@ -392,18 +403,17 @@ prepare_for_offline (EShellOfflineHandler *offline_handler)
{
EComponentRegistry *component_registry;
EShellOfflineHandlerPrivate *priv;
- GList *component_ids;
- GList *p;
+ GSList *component_infos;
+ GSList *p;
gboolean error;
priv = offline_handler->priv;
- component_registry = e_shell_get_component_registry (priv->shell);
-
- component_ids = e_component_registry_get_id_list (component_registry);
+ component_registry = e_shell_peek_component_registry (priv->shell);
+ component_infos = e_component_registry_peek_list (component_registry);
error = FALSE;
- for (p = component_ids; p != NULL; p = p->next) {
- EvolutionShellComponentClient *shell_component_client;
+ for (p = component_infos; p != NULL; p = p->next) {
+ EComponentInfo *info = p->data;
GNOME_Evolution_Offline offline_interface;
GNOME_Evolution_OfflineProgressListener progress_listener_interface;
GNOME_Evolution_ConnectionList *active_connection_list;
@@ -412,9 +422,7 @@ prepare_for_offline (EShellOfflineHandler *offline_handler)
CORBA_Environment ev;
const char *id;
- id = (const char *) p->data;
- 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);
+ offline_interface = get_offline_interface (info->iface);
if (offline_interface == CORBA_OBJECT_NIL)
continue;
@@ -461,12 +469,10 @@ prepare_for_offline (EShellOfflineHandler *offline_handler)
if (error)
cancel_offline (offline_handler);
- e_free_string_list (component_ids);
-
return ! error;
}
-
+
/* Finalizing the off-line procedure. */
static void
@@ -519,7 +525,7 @@ finalize_offline (EShellOfflineHandler *offline_handler)
g_object_unref (offline_handler);
}
-
+
/* The confirmation dialog. */
static void
@@ -587,8 +593,6 @@ dialog_handle_ok (GtkDialog *dialog,
g_assert (instruction_label != NULL);
g_assert (GTK_IS_LABEL (instruction_label));
- e_shell_offline_sync_all_folders (priv->shell, GTK_WINDOW (dialog));
-
gtk_label_set_text (GTK_LABEL (instruction_label), _("Closing connections..."));
finalize_offline (offline_handler);
@@ -665,7 +669,7 @@ pop_up_confirmation_dialog (EShellOfflineHandler *offline_handler)
gtk_widget_show (dialog);
}
-
+
/* GObject methods. */
static void
@@ -712,7 +716,7 @@ impl_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
-
+
/* GTK type handling. */
static void
@@ -768,7 +772,7 @@ init (EShellOfflineHandler *shell_offline_handler)
shell_offline_handler->priv = priv;
}
-
+
/**
* e_shell_offline_handler_construct:
* @offline_handler: A pointer to an EShellOfflineHandler to construct.
@@ -815,7 +819,7 @@ e_shell_offline_handler_new (EShell *shell)
return offline_handler;
}
-
+
/**
* e_shell_offline_handler_put_components_offline:
* @offline_handler: A pointer to an EShellOfflineHandler object.
@@ -855,15 +859,13 @@ e_shell_offline_handler_put_components_offline (EShellOfflineHandler *offline_ha
return;
}
- if (priv->num_total_connections > 0 && priv->parent_window != NULL) {
+ if (priv->num_total_connections > 0 && priv->parent_window != NULL)
pop_up_confirmation_dialog (offline_handler);
- } else {
- e_shell_offline_sync_all_folders (priv->shell, parent_window);
+ else
finalize_offline (offline_handler);
- }
g_object_unref (offline_handler);
}
-
+
E_MAKE_TYPE (e_shell_offline_handler, "EShellOfflineHandler", EShellOfflineHandler, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shell-offline-handler.h b/shell/e-shell-offline-handler.h
index 4a7f60ebf3..912ba143f4 100644
--- a/shell/e-shell-offline-handler.h
+++ b/shell/e-shell-offline-handler.h
@@ -26,7 +26,7 @@
#include <gtk/gtkobject.h>
#include <gtk/gtkwindow.h>
-#include "e-component-registry.h"
+#include "e-shell.h"
#ifdef __cplusplus
diff --git a/shell/e-shell-offline-sync.c b/shell/e-shell-offline-sync.c
deleted file mode 100644
index c37839e455..0000000000
--- a/shell/e-shell-offline-sync.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-shell-offline-sync.c - Sync folders before going into Offline mode.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-shell-offline-sync.h"
-
-#include "e-shell.h"
-#include "e-shell-constants.h"
-
-#include "Evolution.h"
-
-#include "e-util/e-dialog-utils.h"
-
-#include <gconf/gconf-client.h>
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkstock.h>
-
-#include <libgnome/gnome-i18n.h>
-
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-exception.h>
-
-
-typedef struct _SyncData SyncData;
-typedef struct _SyncFolderProgressListenerServant SyncFolderProgressListenerServant;
-
-struct _SyncFolderProgressListenerServant {
- POA_GNOME_Evolution_SyncFolderProgressListener servant;
- SyncData *sync_data;
-};
-
-struct _SyncData {
- /* The shell. */
- EShell *shell;
-
- /* Parent view. */
- GtkWindow *parent_window;
-
- /* The progress dialog. */
- GtkWidget *dialog;
-
- /* Label in the progress dialog. */
- GtkWidget *label;
-
- /* Progress bar in the progress dialog. */
- GtkWidget *progress_bar;
-
- /* Path of the folder currently being synced. */
- char *current_folder_path;
-
- /* Whether to cancel the current folder's syncing. */
- gboolean cancel;
-
- /* Whether the current folder is finished syncing; used for async
- notification of completion. */
- gboolean current_folder_finished;
-
- /* CORBA cruft. */
- SyncFolderProgressListenerServant *progress_listener_servant;
- GNOME_Evolution_SyncFolderProgressListener progress_listener_objref;
-};
-
-
-/* The progress listener interface. */
-
-static PortableServer_ServantBase__epv SyncFolderProgressListener_base_epv;
-static POA_GNOME_Evolution_SyncFolderProgressListener__epv SyncFolderProgressListener_epv;
-static POA_GNOME_Evolution_SyncFolderProgressListener__vepv SyncFolderProgressListener_vepv;
-
-static SyncFolderProgressListenerServant *
-progress_listener_servant_new (SyncData *sync_data)
-{
- SyncFolderProgressListenerServant *servant;
-
- servant = g_new0 (SyncFolderProgressListenerServant, 1);
-
- servant->servant.vepv = &SyncFolderProgressListener_vepv;
- servant->sync_data = sync_data;
-
- return servant;
-}
-
-static void
-progress_listener_servant_free (SyncFolderProgressListenerServant *servant)
-{
- CORBA_Environment ev;
- PortableServer_ObjectId *oid;
-
- CORBA_exception_init (&ev);
-
- oid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev);
- CORBA_free (oid);
-
- CORBA_exception_free (&ev);
-
- g_free (servant);
-}
-
-static void
-impl_SyncFolderProgressListener_updateProgress (PortableServer_Servant servant,
- const CORBA_float percent,
- CORBA_Environment *ev)
-{
- SyncData *sync_data;
-
- sync_data = ((SyncFolderProgressListenerServant *) servant)->sync_data;
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (sync_data->progress_bar), percent);
-}
-
-static void
-impl_SyncFolderProgressListener_reportSuccess (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- SyncData *sync_data;
-
- sync_data = ((SyncFolderProgressListenerServant *) servant)->sync_data;
- sync_data->current_folder_finished = TRUE;
-}
-
-static void
-impl_SyncFolderProgressListener_reportFailure (PortableServer_Servant servant,
- const CORBA_char *message,
- CORBA_Environment *ev)
-{
- EFolder *folder;
- SyncData *sync_data;
-
- sync_data = ((SyncFolderProgressListenerServant *) servant)->sync_data;
-
- folder = e_storage_set_get_folder (e_shell_get_storage_set (sync_data->shell),
- sync_data->current_folder_path);
-
- /* FIXME -- We probably should give the user more of a chance to do
- something about it. */
- e_notice (sync_data->dialog, GTK_MESSAGE_ERROR,
- _("Error synchronizing \"%s\":\n%s"), e_folder_get_name (folder), message);
-
- sync_data->current_folder_finished = TRUE;
-}
-
-static gboolean
-setup_progress_listener (SyncData *sync_data)
-{
- SyncFolderProgressListenerServant *servant;
- CORBA_Environment ev;
-
- SyncFolderProgressListener_base_epv._private = NULL;
- SyncFolderProgressListener_base_epv.finalize = NULL;
- SyncFolderProgressListener_base_epv.default_POA = NULL;
-
- SyncFolderProgressListener_epv.updateProgress = impl_SyncFolderProgressListener_updateProgress;
- SyncFolderProgressListener_epv.reportSuccess = impl_SyncFolderProgressListener_reportSuccess;
- SyncFolderProgressListener_epv.reportFailure = impl_SyncFolderProgressListener_reportFailure;
-
- SyncFolderProgressListener_vepv._base_epv = &SyncFolderProgressListener_base_epv;
- SyncFolderProgressListener_vepv.GNOME_Evolution_SyncFolderProgressListener_epv = &SyncFolderProgressListener_epv;
-
- servant = progress_listener_servant_new (sync_data);
-
- CORBA_exception_init (&ev);
-
- POA_GNOME_Evolution_SyncFolderProgressListener__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Cannot initialize GNOME::Evolution::Offline::ProgressListener");
- progress_listener_servant_free (servant);
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev));
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Cannot activate GNOME::Evolution::Offline::ProgressListener");
- progress_listener_servant_free (servant);
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- sync_data->progress_listener_servant = servant;
- sync_data->progress_listener_objref = PortableServer_POA_servant_to_reference (bonobo_poa (),
- servant, &ev);
-
- CORBA_exception_free (&ev);
-
- return TRUE;
-}
-
-
-/* Setting up the progress dialog. */
-
-static void
-progress_dialog_response_callback (GtkDialog *dialog,
- int response_id,
- void *data)
-{
- SyncData *sync_data;
-
- sync_data = (SyncData *) data;
- sync_data->cancel = TRUE;
-}
-
-static void
-setup_dialog (SyncData *sync_data)
-{
- sync_data->dialog = gtk_dialog_new_with_buttons (_("Syncing Folder"),
- sync_data->parent_window,
- 0,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
- gtk_widget_set_size_request (sync_data->dialog, 300, -1);
- gtk_window_set_resizable (GTK_WINDOW (sync_data->dialog), FALSE);
-
- g_signal_connect (sync_data->dialog, "response",
- G_CALLBACK (progress_dialog_response_callback), sync_data);
-
- sync_data->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (sync_data->dialog)->vbox),
- sync_data->label, FALSE, TRUE, 0);
-
- sync_data->progress_bar = gtk_progress_bar_new ();
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (sync_data->dialog)->vbox),
- sync_data->progress_bar, FALSE, TRUE, 0);
-
- gtk_widget_show_all (sync_data->dialog);
-}
-
-
-/* Sync the folder at the specified @folder_path. */
-static void
-sync_folder (SyncData *sync_data,
- const char *folder_path,
- int num,
- int total)
-{
- EvolutionShellComponentClient *component_client;
- EStorageSet *storage_set;
- GNOME_Evolution_Folder *corba_folder;
- GNOME_Evolution_Offline offline_interface;
- CORBA_Environment ev;
- EFolder *folder;
- char *evolution_uri;
- char *msg;
-
- CORBA_exception_init (&ev);
-
- /* Retrieve the folder that needs to be synced from the storage set, as
- well as the component that should perform the syncing. */
-
- storage_set = e_shell_get_storage_set (sync_data->shell);
-
- folder = e_storage_set_get_folder (storage_set, folder_path);
- if (folder == NULL) {
- /* This might be a remote folder that is not visible right now,
- or is otherwise hidden from the tree somehow. So we just
- ignore it, and keep going without signalling any error. */
- return;
- }
-
- /* Don't attempt to sync folders that don't have the can_sync_offline
- property set. */
- if (! e_folder_get_can_sync_offline (folder))
- return;
-
- component_client = e_folder_type_registry_get_handler_for_type (e_shell_get_folder_type_registry (sync_data->shell),
- e_folder_get_type_string (folder));
-
- offline_interface = evolution_shell_component_client_get_offline_interface (component_client);
- if (offline_interface == CORBA_OBJECT_NIL) {
- /* The component doesn't support going off-line, just ignore
- this as it's probably a programming error in the
- implementation of the component. */
- return;
- }
-
- /* Prepare the CORBA folder to be passed to the component. */
-
- corba_folder = GNOME_Evolution_Folder__alloc ();
- evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, "/", folder_path, NULL);
- e_folder_to_corba (folder, evolution_uri, corba_folder);
- g_free (evolution_uri);
-
- /* Prepare the dialog. */
-
- msg = g_strdup_printf (_("Synchronizing \"%s\" (%d of %d) ..."),
- e_folder_get_name (folder), num, total);
- gtk_label_set_text (GTK_LABEL (sync_data->label), msg);
- g_free (msg);
-
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (sync_data->progress_bar), 0.0);
-
- /* Get the data ready. */
-
- g_free (sync_data->current_folder_path);
- sync_data->current_folder_path = g_strdup (folder_path);
- sync_data->current_folder_finished = FALSE;
- sync_data->cancel = FALSE;
-
- /* Tell the component to start syncing. */
-
- GNOME_Evolution_Offline_syncFolder (offline_interface,
- corba_folder,
- sync_data->progress_listener_objref,
- &ev);
- if (BONOBO_EX (&ev)) {
- g_warning ("Error invoking ::syncFolder -- %s", BONOBO_EX_REPOID (&ev));
- CORBA_free (corba_folder);
- CORBA_exception_free (&ev);
- return;
- }
-
- /* Wait for the component to signal completion... */
-
- while (! sync_data->current_folder_finished && ! sync_data->cancel) {
- gtk_main_iteration ();
-
- /* Check if the user clicked the Cancel button. */
- if (sync_data->cancel) {
- gtk_dialog_set_response_sensitive (GTK_DIALOG (sync_data->dialog),
- GTK_RESPONSE_CANCEL, FALSE);
-
- GNOME_Evolution_Offline_cancelSyncFolder (offline_interface, corba_folder, &ev);
-
- while (! sync_data->current_folder_finished)
- gtk_main_iteration ();
-
- break;
- }
- }
-
- /* All done. */
-
- CORBA_free (corba_folder);
- CORBA_exception_free (&ev);
-}
-
-/* Free up the data needed for syncing. */
-static void
-cleanup (SyncData *sync_data)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- if (sync_data->dialog != NULL)
- gtk_widget_destroy (sync_data->dialog);
-
- if (sync_data->progress_listener_servant != NULL)
- progress_listener_servant_free (sync_data->progress_listener_servant);
-
- if (sync_data->progress_listener_objref != CORBA_OBJECT_NIL)
- CORBA_Object_release (sync_data->progress_listener_objref, &ev);
-
- g_free (sync_data);
-
- CORBA_exception_free (&ev);
-}
-
-
-void
-e_shell_offline_sync_all_folders (EShell *shell,
- GtkWindow *parent_window)
-{
- GConfClient *gconf_client;
- SyncData *sync_data;
- GSList *path_list;
- GSList *p;
- int i;
-
- gconf_client = gconf_client_get_default ();
-
- path_list = gconf_client_get_list (gconf_client, "/apps/evolution/shell/offline/folder_paths",
- GCONF_VALUE_STRING, NULL);
-
- sync_data = g_new0 (SyncData, 1);
- sync_data->shell = shell;
- sync_data->parent_window = parent_window;
-
- /* Initialize everything, then go ahead and sync. */
-
- if (! setup_progress_listener (sync_data))
- goto done;
-
- setup_dialog (sync_data);
-
- for (p = path_list, i = 1; p != NULL; p = p->next, i ++) {
- const char *path;
-
- path = (const char *) p->data;
-
- sync_folder (sync_data, path, i, g_slist_length (path_list));
-
- /* If the operation has been cancelled, stop syncing and
- return. */
- if (sync_data->cancel) {
- /* FIXME: Do we want to pop up a dialog asking for
- confirmation? */
- break;
- }
- }
-
- done:
- cleanup (sync_data);
-
- g_slist_foreach (path_list, (GFunc) g_free, NULL);
- g_slist_free (path_list);
-}
diff --git a/shell/e-shell-offline-sync.h b/shell/e-shell-offline-sync.h
deleted file mode 100644
index f214938585..0000000000
--- a/shell/e-shell-offline-sync.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-shell-offline-sync.h - Sync folders before going into Offline mode.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef E_SHELL_OFFLINE_SYNC_H
-#define E_SHELL_OFFLINE_SYNC_H
-
-#include "e-shell.h"
-
-#include <gtk/gtkwidget.h>
-
-void e_shell_offline_sync_all_folders (EShell *shell,
- GtkWindow *widget);
-
-#endif /* E_SHELL_OFFLINE_SYNC_H */
diff --git a/shell/e-shell.c b/shell/e-shell.c
index d84cd4c0d5..3406dec228 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -31,6 +31,7 @@
#include "e-activity-handler.h"
#include "e-setup.h"
#include "e-shell-constants.h"
+#include "e-shell-offline-handler.h"
#include "e-shell-settings-dialog.h"
#include "e-shell-startup-wizard.h"
@@ -88,6 +89,10 @@ struct _EShellPrivate {
/* Line status. */
EShellLineStatus line_status;
+ /* This object handles going off-line. If the pointer is not NULL, it
+ means we have a going-off-line process in progress. */
+ EShellOfflineHandler *offline_handler;
+
/* Settings Dialog */
GtkWidget *settings_dialog;
@@ -359,6 +364,11 @@ impl_dispose (GObject *object)
}
#endif
+ if (priv->offline_handler != NULL) {
+ g_object_unref (priv->offline_handler);
+ priv->offline_handler = NULL;
+ }
+
for (p = priv->windows; p != NULL; p = p->next) {
EShellWindow *window;
@@ -826,6 +836,45 @@ e_shell_get_line_status (EShell *shell)
return shell->priv->line_status;
}
+
+/* Offline/online handling. */
+
+static void
+offline_procedure_started_cb (EShellOfflineHandler *offline_handler,
+ void *data)
+{
+ EShell *shell;
+ EShellPrivate *priv;
+
+ shell = E_SHELL (data);
+ priv = shell->priv;
+
+ priv->line_status = E_SHELL_LINE_STATUS_GOING_OFFLINE;
+ g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
+}
+
+static void
+offline_procedure_finished_cb (EShellOfflineHandler *offline_handler,
+ gboolean now_offline,
+ void *data)
+{
+ EShell *shell;
+ EShellPrivate *priv;
+
+ shell = E_SHELL (data);
+ priv = shell->priv;
+
+ if (now_offline)
+ priv->line_status = E_SHELL_LINE_STATUS_OFFLINE;
+ else
+ priv->line_status = E_SHELL_LINE_STATUS_ONLINE;
+
+ g_object_unref (priv->offline_handler);
+ priv->offline_handler = NULL;
+
+ g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
+}
+
/**
* e_shell_go_offline:
* @shell:
@@ -849,17 +898,14 @@ e_shell_go_offline (EShell *shell,
if (priv->line_status != E_SHELL_LINE_STATUS_ONLINE)
return;
-#if 0
priv->offline_handler = e_shell_offline_handler_new (shell);
- /* FIXME TODO */
g_signal_connect (priv->offline_handler, "offline_procedure_started",
G_CALLBACK (offline_procedure_started_cb), shell);
g_signal_connect (priv->offline_handler, "offline_procedure_finished",
G_CALLBACK (offline_procedure_finished_cb), shell);
e_shell_offline_handler_put_components_offline (priv->offline_handler, GTK_WINDOW (action_window));
-#endif
}
/**
@@ -873,10 +919,9 @@ void
e_shell_go_online (EShell *shell,
EShellWindow *action_window)
{
-#if 0 /* FIXME TODO */
EShellPrivate *priv;
- GList *component_ids;
- GList *p;
+ GSList *component_infos;
+ GSList *p;
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
@@ -884,26 +929,23 @@ e_shell_go_online (EShell *shell,
priv = shell->priv;
- component_ids = e_component_registry_get_id_list (priv->component_registry);
-
- for (p = component_ids; p != NULL; p = p->next) {
+ component_infos = e_component_registry_peek_list (priv->component_registry);
+ for (p = component_infos; p != NULL; p = p->next) {
+ EComponentInfo *info = p->data;
CORBA_Environment ev;
- EvolutionShellComponentClient *client;
GNOME_Evolution_Offline offline_interface;
const char *id;
- id = (const char *) p->data;
- client = e_component_registry_get_component_by_id (priv->component_registry, id);
-
CORBA_exception_init (&ev);
- offline_interface = evolution_shell_component_client_get_offline_interface (client);
-
- if (CORBA_Object_is_nil (offline_interface, &ev) || ev._major != CORBA_NO_EXCEPTION) {
+ offline_interface = Bonobo_Unknown_queryInterface (info->iface, "IDL:GNOME/Evolution/Offline:1.0", &ev);
+ if (ev._major != CORBA_NO_EXCEPTION || offline_interface == CORBA_OBJECT_NIL) {
CORBA_exception_free (&ev);
continue;
}
+ CORBA_exception_free (&ev);
+
GNOME_Evolution_Offline_goOnline (offline_interface, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Error putting component `%s' online.", id);
@@ -911,11 +953,8 @@ e_shell_go_online (EShell *shell,
CORBA_exception_free (&ev);
}
- e_free_string_list (component_ids);
-
priv->line_status = E_SHELL_LINE_STATUS_ONLINE;
g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
-#endif
}