diff options
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/em-folder-view.c | 20 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in.in | 15 | ||||
-rw-r--r-- | mail/mail-component.c | 3 | ||||
-rw-r--r-- | mail/mail-ops.c | 65 | ||||
-rw-r--r-- | mail/mail.error.xml | 7 |
6 files changed, 121 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 93b68cad34..163c80da53 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2007-05-15 Srinivasa Ragavan <sragavan@novell.com> + + ** Improved options for offline support. + + * em-folder-view.c: (prepare_offline), (emfv_prepare_offline): Adds + option for downloading for offline. + * evolution-mail.schemas.in.in: + * mail-component.c: (status_check): Adds a option for non-sync while + going offline. + * mail-ops.c: (prepare_offline_desc), (prepare_offline_do), + (prepare_offline_done), (prepare_offline_free), + (mail_store_prepare_offline): + * mail.error.xml: + 2007-05-13 Srinivasa Ragavan <sragavan@novell.com> ** Fix for bug #334966 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 30a736d49b..0ebb079e49 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -56,6 +56,8 @@ #include <camel/camel-stream-mem.h> #include <camel/camel-url.h> #include <camel/camel-vee-folder.h> +#include <camel/camel-disco-store.h> +#include <camel/camel-offline-store.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-object.h> @@ -1322,6 +1324,22 @@ emfv_empty_trash(BonoboUIComponent *uid, void *data, const char *path) em_utils_empty_trash (gtk_widget_get_toplevel ((GtkWidget *) emfv)); } +static void +prepare_offline(void *key, void *value, void *data) +{ + CamelService *service = key; + + if (CAMEL_IS_DISCO_STORE(service) + || CAMEL_IS_OFFLINE_STORE(service)) { + mail_store_prepare_offline((CamelStore *)service); + } +} + +static void +emfv_prepare_offline(BonoboUIComponent *uid, void *data, const char *path) +{ + mail_component_stores_foreach(mail_component_peek(), prepare_offline, NULL); +} static void emfv_edit_cut(BonoboUIComponent *uid, void *data, const char *path) @@ -1737,7 +1755,7 @@ EMFV_MAP_CALLBACK(emfv_tools_vfolder_mlist, emfv_popup_vfolder_mlist) static BonoboUIVerb emfv_message_verbs[] = { BONOBO_UI_UNSAFE_VERB ("EmptyTrash", emfv_empty_trash), - + BONOBO_UI_UNSAFE_VERB ("PrepareForOffline", emfv_prepare_offline), BONOBO_UI_UNSAFE_VERB ("EditCut", emfv_edit_cut), BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy), BONOBO_UI_UNSAFE_VERB ("EditPaste", emfv_edit_paste), diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index e2f7d41abb..1276d96ac0 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -790,7 +790,20 @@ </locale> </schema> - <!-- Trash settings --> + <schema> + <key>/schemas/apps/evolution/mail/prompts/quick_offline</key> + <applyto>/apps/evolution/mail/prompts/quick_offline</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Prompt to check if the user wants to go offline immediately </short> + <long> + It disables the feature where repeated prompts to ask if offline sync is required. + </long> + </locale> + </schema> + <!-- Trash settings --> <schema> <key>/schemas/apps/evolution/mail/trash/empty_on_exit</key> diff --git a/mail/mail-component.c b/mail/mail-component.c index 9bd59e06c2..804788912f 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -1099,7 +1099,8 @@ status_check (GNOME_Evolution_ShellState shell_state) { case GNOME_Evolution_USER_OFFLINE: status = OFFLINE; - break; + if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/quick_offline", "mail:ask-quick-offline", NULL)) + break; case GNOME_Evolution_FORCED_OFFLINE: /*Network is down so change network state on the camel session*/ status = OFFLINE; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 2c09c26833..777639fc50 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2350,6 +2350,71 @@ mail_store_set_offline (CamelStore *store, gboolean offline, return id; } +/* ** Prepare OFFLINE ***************************************************** */ + +static char *prepare_offline_desc(struct _mail_msg *mm, int done) +{ + struct _set_offline_msg *m = (struct _set_offline_msg *)mm; + char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); + char *msg; + + msg = g_strdup_printf(_("Preparing account '%s' for offline"), service_name); + g_free(service_name); + + return msg; +} + +static void prepare_offline_do(struct _mail_msg *mm) +{ + struct _set_offline_msg *m = (struct _set_offline_msg *)mm; + + camel_disco_store_prepare_for_offline (CAMEL_DISCO_STORE (m->store), + &mm->ex); +} + +static void prepare_offline_done(struct _mail_msg *mm) +{ + struct _set_offline_msg *m = (struct _set_offline_msg *)mm; + + if (m->done) + m->done(m->store, m->data); +} + +static void prepare_offline_free(struct _mail_msg *mm) +{ + struct _set_offline_msg *m = (struct _set_offline_msg *)mm; + + camel_object_unref(m->store); +} + +static struct _mail_msg_op prepare_offline_op = { + prepare_offline_desc, + prepare_offline_do, + prepare_offline_done, + prepare_offline_free, +}; + +int +mail_store_prepare_offline (CamelStore *store) +{ + struct _set_offline_msg *m; + int id; + + /* Cancel any pending connect first so the set_offline_op + * thread won't get queued behind a hung connect op. + */ + + m = mail_msg_new(&prepare_offline_op, NULL, sizeof(*m)); + m->store = store; + camel_object_ref(store); + m->data = NULL; + m->done = NULL; + + id = m->msg.seq; + e_thread_put(mail_thread_new, (EMsg *)m); + + return id; +} /* ** Execute Shell Command ***************************************************** */ void diff --git a/mail/mail.error.xml b/mail/mail.error.xml index 936bcf9748..87a1ea5f8d 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -368,6 +368,13 @@ You can choose to ignore this folder, overwrite or append its contents, or quit. <button stock="gtk-yes" _label="Mark as _Read" response="GTK_RESPONSE_YES"/> </error> + <error id="ask-quick-offline" type="question" default="GTK_RESPONSE_NO"> + <_primary>Synchronize folders locally for offline usage?</_primary> + <_secondary xml:space="preserve">Do you want to locally synchronize the folders that are marked for offline usage?</_secondary> + <button stock="gtk-no" _label="_Do not Synchronize" response="GTK_RESPONSE_NO"/> + <button stock="gtk-yes" _label="Synchronize" response="GTK_RESPONSE_YES"/> + </error> + <error id="ask-mark-all-read" type="question" default="GTK_RESPONSE_NO"> <_title>Mark all messages as read</_title> <_primary>Do you want to mark all messages as read?</_primary> |