diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-12-01 04:53:42 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-12-01 04:53:42 +0800 |
commit | 5f2ba41078c760533e5650752dc6f8712e864ddc (patch) | |
tree | 6e3e528dd8bba86a0e54489fdd2850e0c6fb118f /shell/e-shell-offline-handler.c | |
parent | 483d4847364b887974668b846b94e3408dae2c63 (diff) | |
download | gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar.gz gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar.bz2 gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar.lz gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar.xz gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.tar.zst gsoc2013-evolution-5f2ba41078c760533e5650752dc6f8712e864ddc.zip |
New member offline_handler. (offline_procedure_started_cb): New.
* 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.
svn path=/trunk/; revision=23505
Diffstat (limited to 'shell/e-shell-offline-handler.c')
-rw-r--r-- | shell/e-shell-offline-handler.c | 100 |
1 files changed, 51 insertions, 49 deletions
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) |