From 87a09855fa42b43e11769b39c89336660f3467e7 Mon Sep 17 00:00:00 2001 From: Shreyas Srinivasan Date: Thu, 22 Dec 2005 02:12:34 +0000 Subject: Evolution is now Network Aware, the day of complete awareness beckons, The 2005-12-22 Shreyas Srinivasan * Evolution is now Network Aware, the day of complete awareness beckons, The machines are taking over... * Network Manager support for evolution svn path=/trunk/; revision=30926 --- mail/ChangeLog | 6 ++++++ mail/mail-component.c | 32 +++++++++++++++++++++++++++++++- mail/mail-component.h | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) (limited to 'mail') 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 + + * 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 * 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 #include +#include #include #include
@@ -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_ */ -- cgit