diff options
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-config.c | 33 | ||||
-rw-r--r-- | mail/mail-ops.c | 92 |
3 files changed, 85 insertions, 48 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index c96533d9db..54f486da5c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-06-26 Jeffrey Stedfast <fejj@ximian.com> + + * mail-config.c (config_read): Read in the default show_preview + value. + (mail_config_write_on_exit): Save the default show_preview value + as well as saving the individual settings for each URI that has + been changed. + 2001-06-25 Joe Shaw <joe@ximian.com> * folder-browser.c (invisible_destroyed): Check to make sure that diff --git a/mail/mail-config.c b/mail/mail-config.c index 1bf052fa5b..48e8fe0182 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -464,6 +464,14 @@ config_read (void) config->thread_list = FALSE; g_free (str); + /* Show Message Preview */ + str = g_strdup_printf ("=%s/config/Mail=/Display/preview_pane", + evolution_dir); + config->show_preview = gnome_config_get_bool_with_default (str, &def); + if (def) + config->show_preview = TRUE; + g_free (str); + /* Hide deleted automatically */ str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted", evolution_dir); @@ -667,11 +675,11 @@ mail_config_write (void) } static gboolean -threaded_save_state (gpointer key, gpointer value, gpointer user_data) +hash_save_state (gpointer key, gpointer value, gpointer user_data) { - gboolean threaded = GPOINTER_TO_INT (value); + gboolean bool = GPOINTER_TO_INT (value); - gnome_config_set_bool ((char *) key, threaded); + gnome_config_set_bool ((char *) key, bool); g_free (key); return TRUE; @@ -690,6 +698,12 @@ mail_config_write_on_exit (void) gnome_config_set_bool (str, config->thread_list); g_free (str); + /* Show Message Preview */ + str = g_strdup_printf ("=%s/config/Mail=/Display/preview_pane", + evolution_dir); + gnome_config_set_bool (str, config->show_preview); + g_free (str); + /* Hide deleted automatically */ str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted", evolution_dir); @@ -777,7 +791,15 @@ mail_config_write_on_exit (void) gnome_config_push_prefix (str); g_free (str); - g_hash_table_foreach_remove (config->threaded_hash, threaded_save_state, NULL); + g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, NULL); + + gnome_config_pop_prefix (); + + str = g_strdup_printf ("=%s/config/Mail=/Preview/", evolution_dir); + gnome_config_push_prefix (str); + g_free (str); + + g_hash_table_foreach_remove (config->preview_hash, hash_save_state, NULL); gnome_config_pop_prefix (); @@ -1354,7 +1376,8 @@ struct _check_msg { gboolean *success; }; -static void check_service_check(struct _mail_msg *mm) +static void +check_service_check (struct _mail_msg *mm) { struct _check_msg *m = (struct _check_msg *)mm; CamelService *service = NULL; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index d8897e3726..dde285e827 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -145,44 +145,44 @@ filter_folder_filter(struct _mail_msg *mm) struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; CamelFolder *folder; GPtrArray *uids, *folder_uids = NULL; - + if (m->cancel) - camel_operation_register(m->cancel); - + camel_operation_register (m->cancel); + folder = m->source_folder; - + if (folder == NULL || camel_folder_get_message_count (folder) == 0) { if (m->cancel) - camel_operation_unregister(m->cancel); + camel_operation_unregister (m->cancel); return; } - + if (m->destination) { - camel_folder_freeze(m->destination); - camel_filter_driver_set_default_folder(m->driver, m->destination); + camel_folder_freeze (m->destination); + camel_filter_driver_set_default_folder (m->driver, m->destination); } - - camel_folder_freeze(folder); - + + camel_folder_freeze (folder); + if (m->source_uids) uids = m->source_uids; else folder_uids = uids = camel_folder_get_uids (folder); - - camel_filter_driver_filter_folder(m->driver, folder, uids, m->delete, &mm->ex); - + + camel_filter_driver_filter_folder (m->driver, folder, uids, m->delete, &mm->ex); + if (folder_uids) - camel_folder_free_uids(folder, folder_uids); - + camel_folder_free_uids (folder, folder_uids); + /* sync and expunge */ camel_folder_sync (folder, TRUE, &mm->ex); - camel_folder_thaw(folder); - + camel_folder_thaw (folder); + if (m->destination) - camel_folder_thaw(m->destination); - + camel_folder_thaw (m->destination); + if (m->cancel) - camel_operation_unregister(m->cancel); + camel_operation_unregister (m->cancel); } static void @@ -195,20 +195,25 @@ filter_folder_free(struct _mail_msg *mm) { struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; int i; - + if (m->source_folder) - camel_object_unref((CamelObject *)m->source_folder); + camel_object_unref (CAMEL_OBJECT (m->source_folder)); + if (m->source_uids) { - for (i=0;i<m->source_uids->len;i++) - g_free(m->source_uids->pdata[i]); - g_ptr_array_free(m->source_uids, TRUE); + for (i = 0; i < m->source_uids->len; i++) + g_free (m->source_uids->pdata[i]); + + g_ptr_array_free (m->source_uids, TRUE); } + if (m->cancel) - camel_operation_unref(m->cancel); + camel_operation_unref (m->cancel); + if (m->destination) - camel_object_unref((CamelObject *)m->destination); + camel_object_unref (CAMEL_OBJECT (m->destination)); + if (m->driver) - camel_object_unref((CamelObject *)m->driver); + camel_object_unref (CAMEL_OBJECT (m->driver)); } static struct _mail_msg_op filter_folder_op = { @@ -224,31 +229,32 @@ mail_filter_folder(CamelFolder *source_folder, GPtrArray *uids, CamelOperation *cancel) { struct _filter_mail_msg *m; - - m = mail_msg_new(&filter_folder_op, NULL, sizeof(*m)); + + m = mail_msg_new (&filter_folder_op, NULL, sizeof (*m)); m->source_folder = source_folder; - camel_object_ref((CamelObject *)source_folder); + camel_object_ref (CAMEL_OBJECT (source_folder)); m->source_uids = uids; m->delete = FALSE; if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_operation_ref (cancel); } - - m->driver = camel_filter_driver_new(filter_get_folder, NULL); - setup_filter_driver(m->driver, fc, type); - - e_thread_put(mail_thread_new, (EMsg *)m); + + m->driver = camel_filter_driver_new (filter_get_folder, NULL); + setup_filter_driver (m->driver, fc, type); + + e_thread_put (mail_thread_new, (EMsg *)m); } /* convenience function for it */ -void mail_filter_on_demand(CamelFolder *folder, GPtrArray *uids) +void +mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids) { FilterContext *fc; - - fc = mail_load_filter_context(); - mail_filter_folder(folder, uids, fc, FILTER_SOURCE_INCOMING, NULL); - gtk_object_unref((GtkObject *)fc); + + fc = mail_load_filter_context (); + mail_filter_folder (folder, uids, fc, FILTER_SOURCE_INCOMING, NULL); + gtk_object_unref (GTK_OBJECT (fc)); } /* ********************************************************************** */ |