aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-28 22:15:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-28 22:15:07 +0800
commit86efefd39f4e0b9c5f7eaaee4048ecb52260559e (patch)
treec42f164e35d2b51ff2f5da929d6e0ccfbf99d2bb
parentbf58178b2a47da0c540582091b4a6a079f6c8359 (diff)
downloadgsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar.gz
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar.bz2
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar.lz
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar.xz
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.tar.zst
gsoc2013-evolution-86efefd39f4e0b9c5f7eaaee4048ecb52260559e.zip
Bug 468448 - Kill "Hide Read Messages" and "Hide Selected Messages"
Removed the following menu items under View: Hide Selected Messages Hide Read Messages Show Hidden Messages These options are confusing and don't fit with the rest of the mailer design. Hidden messages were tracked by folder in: ~/.evolution/mail/config/hidestate-<<folder-uri>> So by simply not loading those files any more we reveal all previously hidden messages and avoid any risk of lost messages. Also inverted "Hide Deleted Messages" to "Show Deleted Messages".
-rw-r--r--mail/message-list.c358
-rw-r--r--mail/message-list.h18
-rw-r--r--modules/mail/e-mail-shell-content.c4
-rw-r--r--modules/mail/e-mail-shell-view-actions.c105
-rw-r--r--modules/mail/e-mail-shell-view-actions.h10
-rw-r--r--ui/evolution-mail.ui5
6 files changed, 33 insertions, 467 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 652695065f..ca3830b55b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -209,9 +209,6 @@ static gchar *filter_size (gint size);
static void folder_changed (CamelObject *o, gpointer event_data, gpointer user_data);
-static void save_hide_state(MessageList *ml);
-static void load_hide_state(MessageList *ml);
-
/* note: @changes is owned/freed by the caller */
/*static void mail_do_regenerate_messagelist (MessageList *list, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes);*/
static void mail_regen_list(MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes);
@@ -1976,7 +1973,6 @@ void
message_list_save_state (MessageList *ml)
{
save_tree_state (ml);
- save_hide_state (ml);
}
static void
@@ -2309,16 +2305,9 @@ message_list_init (MessageList *message_list)
(GDestroyNotify) NULL,
(GDestroyNotify) e_poolv_destroy);
- message_list->hidden = NULL;
- message_list->hidden_pool = NULL;
- message_list->hide_before = ML_HIDE_NONE_START;
- message_list->hide_after = ML_HIDE_NONE_END;
-
message_list->search = NULL;
message_list->ensure_uid = NULL;
- message_list->hide_lock = g_mutex_new();
-
message_list->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal);
message_list->async_event = mail_async_event_new();
@@ -2495,19 +2484,11 @@ message_list_finalize (GObject *object)
if (message_list->thread_tree)
camel_folder_thread_messages_unref(message_list->thread_tree);
- if (message_list->hidden) {
- g_hash_table_destroy(message_list->hidden);
- e_mempool_destroy(message_list->hidden_pool);
- message_list->hidden = NULL;
- message_list->hidden_pool = NULL;
- }
-
g_free(message_list->search);
g_free(message_list->ensure_uid);
g_free(message_list->frozen_search);
g_free(message_list->cursor_uid);
- g_mutex_free(message_list->hide_lock);
g_mutex_free (message_list->regen_lock);
g_free(message_list->folder_uri);
@@ -3582,7 +3563,6 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
if (message_list->folder != NULL) {
save_tree_state (message_list);
- save_hide_state (message_list);
}
e_tree_memory_freeze(E_TREE_MEMORY(etm));
@@ -3655,7 +3635,6 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
message_list->hidedeleted = hide_deleted && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
message_list->hidejunk = junk_folder && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
- load_hide_state (message_list);
if (message_list->frozen == 0)
mail_regen_list (message_list, message_list->search, NULL, NULL);
}
@@ -3970,229 +3949,6 @@ message_list_ensure_message (MessageList *ml, const gchar *uid)
ml->ensure_uid = g_strdup (uid);
}
-/* returns the number of messages displayable *after* expression hiding has taken place */
-guint
-message_list_length (MessageList *ml)
-{
- return ml->hide_unhidden;
-}
-
-struct _glibsuxcrap {
- guint count;
- CamelFolder *folder;
-};
-
-static void
-glib_crapback(gpointer key, gpointer data, gpointer x)
-{
- struct _glibsuxcrap *y = x;
- CamelMessageInfo *mi;
-
- if (y->count)
- return;
-
- mi = camel_folder_get_message_info(y->folder, key);
- if (mi) {
- y->count++;
- camel_folder_free_message_info(y->folder, mi);
- }
-}
-
-/* returns 0 or 1 depending if there are hidden messages */
-guint
-message_list_hidden(MessageList *ml)
-{
- guint hidden = 0;
-
- MESSAGE_LIST_LOCK (ml, hide_lock);
- if (ml->hidden && ml->folder) {
- /* this is a hack, should probably just maintain the hidden table better */
- struct _glibsuxcrap x = { 0, ml->folder };
- g_hash_table_foreach(ml->hidden, glib_crapback, &x);
- hidden = x.count;
- }
- MESSAGE_LIST_UNLOCK (ml, hide_lock);
-
- return hidden;
-}
-
-/* add a new expression to hide, or set the range.
- @expr: A new search expression - all matching messages will be hidden. May be %NULL.
- @lower: Use ML_HIDE_NONE_START to specify no messages hidden from the start of the list.
- @upper: Use ML_HIDE_NONE_END to specify no message hidden from the end of the list.
-
- For either @upper or @lower, use ML_HIDE_SAME, to keep the previously set hide range.
- If either range is negative, then the range is taken from the end of the available list
- of messages, once other hiding has been performed. Use message_list_length() to find out
- how many messages are available for hiding.
-
- Example: hide_add(ml, NULL, -100, ML_HIDE_NONE_END) -> hide all but the last (most recent)
- 100 messages.
-*/
-void
-message_list_hide_add (MessageList *ml, const gchar *expr, guint lower, guint upper)
-{
- MESSAGE_LIST_LOCK (ml, hide_lock);
-
- if (lower != ML_HIDE_SAME)
- ml->hide_before = lower;
- if (upper != ML_HIDE_SAME)
- ml->hide_after = upper;
-
- MESSAGE_LIST_UNLOCK (ml, hide_lock);
-
- mail_regen_list (ml, ml->search, expr, NULL);
-}
-
-/* hide specific uid's */
-void
-message_list_hide_uids (MessageList *ml, GPtrArray *uids)
-{
- gint i;
- gchar *uid;
-
- /* first see if we need to do any work, if so, then do it all at once */
- for (i = 0; i < uids->len; i++) {
- if (g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i])) {
- MESSAGE_LIST_LOCK (ml, hide_lock);
- if (ml->hidden == NULL) {
- ml->hidden = g_hash_table_new (g_str_hash, g_str_equal);
- ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE);
- }
-
- uid = e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
- g_hash_table_insert (ml->hidden, uid, uid);
- for (; i < uids->len; i++) {
- if (g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i])) {
- uid = e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
- g_hash_table_insert (ml->hidden, uid, uid);
- }
- }
- MESSAGE_LIST_UNLOCK (ml, hide_lock);
- /* save this here incase the user pops up another window, so they are consistent */
- save_hide_state(ml);
- if (ml->frozen == 0)
- mail_regen_list (ml, ml->search, NULL, NULL);
- break;
- }
- }
-}
-
-/* no longer hide any messages */
-void
-message_list_hide_clear (MessageList *ml)
-{
- MESSAGE_LIST_LOCK (ml, hide_lock);
- if (ml->hidden) {
- g_hash_table_destroy (ml->hidden);
- e_mempool_destroy (ml->hidden_pool);
- ml->hidden = NULL;
- ml->hidden_pool = NULL;
- }
- ml->hide_before = ML_HIDE_NONE_START;
- ml->hide_after = ML_HIDE_NONE_END;
- MESSAGE_LIST_UNLOCK (ml, hide_lock);
-
- if (ml->thread_tree) {
- camel_folder_thread_messages_unref(ml->thread_tree);
- ml->thread_tree = NULL;
- }
-
- /* save this here incase the user pops up another window, so they are consistent */
- save_hide_state(ml);
- if (ml->frozen == 0)
- mail_regen_list (ml, ml->search, NULL, NULL);
-}
-
-#define HIDE_STATE_VERSION (1)
-
-/* version 1 file is:
- uintf 1
- uintf hide_before
- uintf hide_after
- string* uids
-*/
-
-static void
-load_hide_state (MessageList *ml)
-{
- gchar *filename;
- FILE *in;
- gint32 version, lower, upper;
-
- MESSAGE_LIST_LOCK(ml, hide_lock);
- if (ml->hidden) {
- g_hash_table_destroy (ml->hidden);
- e_mempool_destroy (ml->hidden_pool);
- ml->hidden = NULL;
- ml->hidden_pool = NULL;
- }
- ml->hide_before = ML_HIDE_NONE_START;
- ml->hide_after = ML_HIDE_NONE_END;
-
- filename = mail_config_folder_to_cachename(ml->folder, "hidestate-");
- in = g_fopen(filename, "rb");
- if (in) {
- camel_file_util_decode_fixed_int32 (in, &version);
- if (version == HIDE_STATE_VERSION) {
- ml->hidden = g_hash_table_new(g_str_hash, g_str_equal);
- ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
- camel_file_util_decode_fixed_int32 (in, &lower);
- ml->hide_before = lower;
- camel_file_util_decode_fixed_int32 (in, &upper);
- ml->hide_after = upper;
- while (!feof(in)) {
- gchar *olduid, *uid;
-
- if (camel_file_util_decode_string (in, &olduid) != -1) {
- uid = e_mempool_strdup(ml->hidden_pool, olduid);
- g_free (olduid);
- g_hash_table_insert(ml->hidden, uid, uid);
- }
- }
- }
- fclose(in);
- }
- g_free(filename);
-
- MESSAGE_LIST_UNLOCK(ml, hide_lock);
-}
-
-static void
-hide_save_1 (gchar *uid, gchar *keydata, FILE *out)
-{
- camel_file_util_encode_string (out, uid);
-}
-
-/* save the hide state. Note that messages are hidden by uid, if the uid's change, then
- this will become invalid, but is easy to reset in the ui */
-static void
-save_hide_state (MessageList *ml)
-{
- gchar *filename;
- FILE *out;
-
- if (ml->folder == NULL)
- return;
-
- MESSAGE_LIST_LOCK(ml, hide_lock);
-
- filename = mail_config_folder_to_cachename(ml->folder, "hidestate-");
- if (ml->hidden == NULL && ml->hide_before == ML_HIDE_NONE_START && ml->hide_after == ML_HIDE_NONE_END) {
- g_unlink(filename);
- } else if ((out = g_fopen (filename, "wb"))) {
- camel_file_util_encode_fixed_int32 (out, HIDE_STATE_VERSION);
- camel_file_util_encode_fixed_int32 (out, ml->hide_before);
- camel_file_util_encode_fixed_int32 (out, ml->hide_after);
- if (ml->hidden)
- g_hash_table_foreach(ml->hidden, (GHFunc)hide_save_1, out);
- fclose(out);
- }
- g_free (filename);
-
- MESSAGE_LIST_UNLOCK(ml, hide_lock);
-}
-
struct sort_column_data {
ETableCol *col;
gboolean ascending;
@@ -4402,7 +4158,7 @@ regen_list_desc (struct _regen_list_msg *m)
static void
regen_list_exec (struct _regen_list_msg *m)
{
- GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL;
+ GPtrArray *uids, *searchuids = NULL;
CamelMessageInfo *info;
ETreePath cursor;
ETree *tree;
@@ -4493,111 +4249,22 @@ regen_list_exec (struct _regen_list_msg *m)
if (camel_exception_is_set (&m->base.ex))
return;
- /* perform hiding */
- if (m->hideexpr && camel_folder_has_search_capability(m->folder)) {
- uidnew = camel_folder_search_by_expression (m->ml->folder, m->hideexpr, &m->base.ex);
- /* well, lets not abort just because this faileld ... */
- camel_exception_clear (&m->base.ex);
-
- if (uidnew) {
- MESSAGE_LIST_LOCK(m->ml, hide_lock);
-
- if (m->ml->hidden == NULL) {
- m->ml->hidden = g_hash_table_new (g_str_hash, g_str_equal);
- m->ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE);
- }
-
- for (i = 0; i < uidnew->len; i++) {
- if (g_hash_table_lookup (m->ml->hidden, uidnew->pdata[i]) == NULL) {
- gchar *uid = e_mempool_strdup (m->ml->hidden_pool, uidnew->pdata[i]);
- g_hash_table_insert (m->ml->hidden, uid, uid);
- }
- }
-
- MESSAGE_LIST_UNLOCK(m->ml, hide_lock);
-
- camel_folder_search_free (m->ml->folder, uidnew);
- }
- }
-
- MESSAGE_LIST_LOCK(m->ml, hide_lock);
-
- m->ml->hide_unhidden = uids->len;
-
- /* what semantics do we want from hide_before, hide_after?
- probably <0 means measure from the end of the list */
-
- /* perform uid hiding */
- if (m->ml->hidden || m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) {
- gint start, end;
- uidnew = g_ptr_array_new ();
-
- /* first, hide matches */
- if (m->ml->hidden) {
- gint subtr = 0;
-
- for (i = 0; i < uids->len; i++) {
- if (g_hash_table_lookup (m->ml->hidden, uids->pdata[i]) == NULL)
- g_ptr_array_add (uidnew, uids->pdata[i]);
- else if (m->last_row >= 0) {
- /* if we are going to hide message above last selected row, then we should
- decrease our last row number, to put cursor on a proper place. */
- ETreePath node = g_hash_table_lookup (m->ml->uid_nodemap, (const gchar *) uids->pdata[i]);
-
- if (node && m->last_row > e_tree_table_adapter_row_of_node (e_tree_get_table_adapter (tree), node))
- subtr ++;
- }
- }
-
- m->last_row -= subtr;
- }
-
- /* then calculate the subrange visible and chop it out */
- m->ml->hide_unhidden = uidnew->len;
-
- if (m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) {
- GPtrArray *uid2 = g_ptr_array_new ();
-
- start = m->ml->hide_before;
- if (start < 0)
- start += m->ml->hide_unhidden;
- end = m->ml->hide_after;
- if (end < 0)
- end += m->ml->hide_unhidden;
-
- start = MAX(start, 0);
- end = MIN(end, uidnew->len);
- for (i = start; i < end; i++) {
- g_ptr_array_add (uid2, uidnew->pdata[i]);
- }
-
- g_ptr_array_free (uidnew, TRUE);
- uidnew = uid2;
- }
- showuids = uidnew;
- } else {
- uidnew = NULL;
- showuids = uids;
- }
-
- MESSAGE_LIST_UNLOCK(m->ml, hide_lock);
-
e_profile_event_emit("list.threaduids", m->folder->full_name, 0);
/* camel_folder_summary_reload_from_db (m->folder->summary, NULL); */
if (!camel_operation_cancel_check(m->base.cancel)) {
/* update/build a new tree */
if (m->dotree) {
- ml_sort_uids_by_tree (m->ml, showuids);
+ ml_sort_uids_by_tree (m->ml, uids);
if (m->tree)
- camel_folder_thread_messages_apply (m->tree, showuids);
+ camel_folder_thread_messages_apply (m->tree, uids);
else
- m->tree = camel_folder_thread_messages_new (m->folder, showuids, m->thread_subject);
+ m->tree = camel_folder_thread_messages_new (m->folder, uids, m->thread_subject);
} else {
- camel_folder_sort_uids (m->ml->folder, showuids);
+ camel_folder_sort_uids (m->ml->folder, uids);
m->summary = g_ptr_array_new ();
- if (showuids->len > camel_folder_summary_cache_size (m->folder->summary) ) {
+ if (uids->len > camel_folder_summary_cache_size (m->folder->summary) ) {
CamelException ex;
camel_exception_init (&ex);
camel_folder_summary_reload_from_db (m->folder->summary, &ex);
@@ -4607,8 +4274,8 @@ regen_list_exec (struct _regen_list_msg *m)
}
}
- for (i = 0; i < showuids->len; i++) {
- info = camel_folder_get_message_info (m->folder, showuids->pdata[i]);
+ for (i = 0; i < uids->len; i++) {
+ info = camel_folder_get_message_info (m->folder, uids->pdata[i]);
if (info)
g_ptr_array_add(m->summary, info);
}
@@ -4617,9 +4284,6 @@ regen_list_exec (struct _regen_list_msg *m)
m->complete = TRUE;
}
- if (uidnew)
- g_ptr_array_free (uidnew, TRUE);
-
if (searchuids)
camel_folder_search_free (m->folder, searchuids);
else
@@ -4720,12 +4384,10 @@ regen_list_done (struct _regen_list_msg *m)
#else
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (m->ml))) {
#endif
- if (message_list_length (m->ml) <= 0) {
+ if (e_tree_row_count (E_TREE (m->ml)) <= 0) {
/* space is used to indicate no search too */
if (m->ml->search && *m->ml->search && strcmp (m->ml->search, " ") != 0)
e_tree_set_info_message (tree, _("No message satisfies your search criteria. Either clear search with Search->Clear menu item or change it."));
- else if (m->ml->hidden)
- e_tree_set_info_message (tree, _("There are only hidden messages in this folder. Use View->Show Hidden Messages to show them."));
else
e_tree_set_info_message (tree, _("There are no messages in this folder."));
} else
@@ -4885,7 +4547,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
camel_folder_thread_messages_ref(m->tree);
}
- if (message_list_length (ml) <= 0) {
+ if (e_tree_row_count (E_TREE (ml)) <= 0) {
#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (GTK_WIDGET (ml))) {
#else
diff --git a/mail/message-list.h b/mail/message-list.h
index c7efc5dc14..a651235cc1 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -106,13 +106,6 @@ struct _MessageList {
GHashTable *normalised_hash;
- /* UID's to hide. Keys in the mempool */
- /* IMPORTANT: You MUST have obtained the hide lock, to operate on this data */
- GHashTable *hidden;
- struct _EMemPool *hidden_pool;
- gint hide_unhidden; /* total length, before hiding */
- gint hide_before, hide_after; /* hide ranges of messages */
-
/* Current search string, or %NULL */
gchar *search;
@@ -147,9 +140,6 @@ struct _MessageList {
/* Row-selection and seen-marking timers */
guint idle_id, seen_id;
- /* locks */
- GMutex *hide_lock; /* for any 'hide' info above */
-
/* list of outstanding regeneration requests */
GList *regen;
GMutex *regen_lock; /* when writing to the regen, guard with this lock too */
@@ -218,14 +208,6 @@ void message_list_copy (MessageList *message_list,
gboolean cut);
void message_list_paste (MessageList *message_list);
guint message_list_length (MessageList *message_list);
-guint message_list_hidden (MessageList *message_list);
-void message_list_hide_add (MessageList *message_list,
- const gchar *expr,
- guint lower,
- guint upper);
-void message_list_hide_uids (MessageList *message_list,
- GPtrArray *uids);
-void message_list_hide_clear (MessageList *message_list);
void message_list_set_threaded (MessageList *message_list,
gboolean threaded);
void message_list_set_threaded_expand_all
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 67d58ce094..7192fdade5 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -448,10 +448,6 @@ mail_shell_content_constructed (GObject *object)
key = "/apps/evolution/mail/display/paned_size";
gconf_bridge_bind_property (bridge, key, object, "vposition");
- object = G_OBJECT (shell_content);
- key = "/apps/evolution/mail/display/show_deleted";
- gconf_bridge_bind_property (bridge, key, object, "show-deleted");
-
/* Message list customizations. */
reader = E_MAIL_READER (shell_content);
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index b3d19fc172..5b6f483706 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -406,53 +406,6 @@ action_mail_global_expunge_cb (GtkAction *action,
}
static void
-action_mail_hide_deleted_cb (GtkToggleAction *action,
- EMailShellView *mail_shell_view)
-{
- GtkWidget *message_list;
- EMailReader *reader;
- gboolean active;
-
- reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
- message_list = e_mail_reader_get_message_list (reader);
-
- active = gtk_toggle_action_get_active (action);
- message_list_set_hidedeleted (MESSAGE_LIST (message_list), active);
-}
-
-static void
-action_mail_hide_read_cb (GtkAction *action,
- EMailShellView *mail_shell_view)
-{
- GtkWidget *message_list;
- EMailReader *reader;
-
- reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
- message_list = e_mail_reader_get_message_list (reader);
-
- message_list_hide_add (
- MESSAGE_LIST (message_list),
- "(match-all (system-flag \"seen\"))",
- ML_HIDE_SAME, ML_HIDE_SAME);
-}
-
-static void
-action_mail_hide_selected_cb (GtkAction *action,
- EMailShellView *mail_shell_view)
-{
- GtkWidget *message_list;
- EMailReader *reader;
- GPtrArray *uids;
-
- reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
- message_list = e_mail_reader_get_message_list (reader);
- uids = e_mail_reader_get_selected_uids (reader);
-
- message_list_hide_uids (MESSAGE_LIST (message_list), uids);
- em_utils_uids_free (uids);
-}
-
-static void
action_mail_label_cb (GtkToggleAction *action,
EMailShellView *mail_shell_view)
{
@@ -607,16 +560,18 @@ action_mail_label_none_cb (GtkAction *action,
}
static void
-action_mail_show_hidden_cb (GtkAction *action,
- EMailShellView *mail_shell_view)
+action_mail_show_deleted_cb (GtkToggleAction *action,
+ EMailShellView *mail_shell_view)
{
GtkWidget *message_list;
EMailReader *reader;
+ gboolean active;
reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
message_list = e_mail_reader_get_message_list (reader);
- message_list_hide_clear (MESSAGE_LIST (message_list));
+ active = gtk_toggle_action_get_active (action);
+ message_list_set_hidedeleted (MESSAGE_LIST (message_list), !active);
}
static void
@@ -992,27 +947,6 @@ static GtkActionEntry mail_entries[] = {
NULL, /* XXX Add a tooltip! */
G_CALLBACK (action_mail_label_none_cb) },
- { "mail-hide-read",
- NULL,
- N_("Hide _Read Messages"),
- NULL,
- N_("Temporarily hide all messages that have already been read"),
- G_CALLBACK (action_mail_hide_read_cb) },
-
- { "mail-hide-selected",
- NULL,
- N_("Hide S_elected Messages"),
- NULL,
- N_("Temporarily hide the selected messages"),
- G_CALLBACK (action_mail_hide_selected_cb) },
-
- { "mail-show-hidden",
- NULL,
- N_("Show Hidde_n Messages"),
- NULL,
- N_("Show messages that have been temporarily hidden"),
- G_CALLBACK (action_mail_show_hidden_cb) },
-
{ "mail-smart-backward",
NULL,
NULL, /* No menu item; key press only */
@@ -1142,15 +1076,6 @@ static EPopupActionEntry mail_popup_entries[] = {
static GtkToggleActionEntry mail_toggle_entries[] = {
- { "mail-hide-deleted",
- NULL,
- N_("Hide _Deleted Messages"),
- NULL,
- N_("Hide deleted messages rather than displaying "
- "them with a line through them"),
- G_CALLBACK (action_mail_hide_deleted_cb),
- TRUE },
-
{ "mail-preview",
NULL,
N_("Show Message _Preview"),
@@ -1159,6 +1084,14 @@ static GtkToggleActionEntry mail_toggle_entries[] = {
NULL, /* Handled by property bindings */
TRUE },
+ { "mail-show-deleted",
+ NULL,
+ N_("Show _Deleted Messages"),
+ NULL,
+ N_("Show deleted messages with a line through them"),
+ G_CALLBACK (action_mail_show_deleted_cb),
+ FALSE },
+
{ "mail-threads-group-by",
NULL,
N_("_Group By Threads"),
@@ -1400,6 +1333,10 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
bridge = gconf_bridge_get ();
+ object = G_OBJECT (ACTION (MAIL_SHOW_DELETED));
+ key = "/apps/evolution/mail/display/show_deleted";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
key = "/apps/evolution/mail/display/layout";
gconf_bridge_bind_property (bridge, key, object, "current-value");
@@ -1438,11 +1375,9 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
ACTION (MAIL_PREVIEW), "active",
ACTION (MAIL_VIEW_VERTICAL), "sensitive");
- /* XXX The boolean sense of the GConf key is the inverse of
- * the menu item, so we have to maintain two properties. */
- e_mutual_binding_new_with_negation (
- mail_shell_content, "show-deleted",
- ACTION (MAIL_HIDE_DELETED), "active");
+ e_mutual_binding_new (
+ ACTION (MAIL_SHOW_DELETED), "active",
+ mail_shell_content, "show-deleted");
/* Keep the sensitivity of "Create Search Folder from Search"
* in sync with "Save Search" so that its only selectable when
diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h
index eb11f46013..34f6e6c8f9 100644
--- a/modules/mail/e-mail-shell-view-actions.h
+++ b/modules/mail/e-mail-shell-view-actions.h
@@ -99,12 +99,6 @@
E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline")
#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted")
-#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \
- E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted")
-#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \
- E_SHELL_WINDOW_ACTION ((window), "mail-hide-read")
-#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \
- E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected")
#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NEW(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-label-new")
#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NONE(window) \
@@ -173,8 +167,8 @@
E_SHELL_WINDOW_ACTION ((window), "mail-select-all")
#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers")
-#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \
- E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_DELETED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-deleted")
#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
index d0c305197a..7c4db78b85 100644
--- a/ui/evolution-mail.ui
+++ b/ui/evolution-mail.ui
@@ -27,10 +27,7 @@
<menuitem action='mail-threads-expand-all'/>
<menuitem action='mail-threads-collapse-all'/>
<separator/>
- <menuitem action='mail-hide-deleted'/>
- <menuitem action='mail-hide-selected'/>
- <menuitem action='mail-hide-read'/>
- <menuitem action='mail-show-hidden'/>
+ <menuitem action='mail-show-deleted'/>
</placeholder>
</menu>
<placeholder name='custom-menus'>