diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/mail-component.c | 32 | ||||
-rw-r--r-- | mail/mail-component.h | 1 |
3 files changed, 38 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 80f33e7760..d1bc0381b3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2005-12-22 Shreyas Srinivasan <sshreyas@novell.com> + + * mail-component.[c,h]: Handle Network Disconnect + sent by the shell. Add function status_check which + handles various Network states. + 2005-12-21 Tor Lillqvist <tml@novell.com> * em-camel-stream.c (em_camel_stream_init) diff --git a/mail/mail-component.c b/mail/mail-component.c index 9a0533f338..96285c997a 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -73,6 +73,7 @@ #include <gtk/gtklabel.h> #include <e-util/e-mktemp.h> +#include <Evolution.h> #include <table/e-tree.h> #include <table/e-tree-memory.h> @@ -95,6 +96,9 @@ static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char #define PARENT_TYPE evolution_component_get_type () static BonoboObjectClass *parent_class = NULL; +#define OFFLINE 0 +#define ONLINE 1 + struct _store_info { CamelStore *store; char *name; @@ -973,10 +977,36 @@ setline_check(void *key, void *value, void *data) } } +int +status_check (GNOME_Evolution_ShellState shell_state) +{ + int status; + + switch (shell_state) + { + case GNOME_Evolution_USER_OFFLINE: + status = OFFLINE; + break; + case GNOME_Evolution_FORCED_OFFLINE: + /*Network is down so change network state on the camel session*/ + status = OFFLINE; + /* Cancel all operations as they wont happen anyway cos Network is down*/ + mail_cancel_all (); + camel_session_set_network_state (session, FALSE); + break; + case GNOME_Evolution_USER_ONLINE: + camel_session_set_network_state (session, TRUE); + status = ONLINE; + } + + return status; +} + static void -impl_setLineStatus(PortableServer_Servant servant, CORBA_boolean status, GNOME_Evolution_Listener listener, CORBA_Environment *ev) +impl_setLineStatus(PortableServer_Servant servant, GNOME_Evolution_ShellState shell_state, GNOME_Evolution_Listener listener, CORBA_Environment *ev) { struct _setline_data *sd; + int status = status_check(shell_state); /* This will dis/enable further auto-mail-check action. */ /* FIXME: If send/receive active, wait for it to finish? */ diff --git a/mail/mail-component.h b/mail/mail-component.h index d8e0dbaba4..55cbe34597 100644 --- a/mail/mail-component.h +++ b/mail/mail-component.h @@ -98,4 +98,5 @@ struct _CamelStore *mail_component_peek_local_store (MailComponent *mc); struct _CamelFolder *mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id); const char *mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id); +int status_check (GNOME_Evolution_ShellState shell_state); #endif /* _MAIL_COMPONENT_H_ */ |