Fix #3014: The icon for folder drafts with hide…
authorRicardo Mones <ricardo@mones.org>
Mon, 3 Oct 2016 13:54:01 +0000 (15:54 +0200)
committerRicardo Mones <ricardo@mones.org>
Mon, 3 Oct 2016 13:54:01 +0000 (15:54 +0200)
…read messages is the same as when not hidden

Fix disables hiding thread/messages options in draft folders,
hence hrm mode icons are not required for them. Values already
set for these options in draft folders are also ignored.

Many thanks to Andrej and Paul for their feedback on this one.

src/folder.c
src/mainwindow.c
src/mainwindow.h

index 902b990db42360689f4ef1160181ee10d2a046ca..18da649d8e66d623074d6e44a4215001f075a957 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifdef HAVE_CONFIG_H
@@ -650,6 +649,11 @@ void folder_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
                                item->last_seen = 0;
                }
        }
+       /* options without meaning in drafts */
+       if (item->stype == F_DRAFT)
+               item->hide_read_msgs =
+                       item->hide_del_msgs =
+                               item->hide_read_threads = FALSE;
 }
 
 XMLTag *folder_item_get_xml(Folder *folder, FolderItem *item)
index 63aca151724bdfe95c053123e9fd7194f18df4f3..9637acb6b4a1312069b93bf546e41ee7e4ef5073 100644 (file)
@@ -3015,6 +3015,10 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
             !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
                UPDATE_STATE(M_NOT_TRASH);
 
+       if (mainwin->summaryview->folder_item
+           && mainwin->summaryview->folder_item->stype != F_DRAFT)
+               UPDATE_STATE(M_NOT_DRAFT);
+
        if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
                UPDATE_STATE(M_ACTIONS_EXIST);
 
@@ -3175,9 +3179,9 @@ do { \
        FILL_TABLE("Menu/View/ThreadView", M_EXEC, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/ExpandThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/CollapseThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST);
+       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST, M_NOT_DRAFT);
        FILL_TABLE("Menu/View/Goto/Prev", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/Next", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevUnread", M_MSG_EXIST);
@@ -3345,7 +3349,7 @@ do { \
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
-       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0 && (state & main_window_get_mask(M_NOT_DRAFT, -1)) != 0);
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
index 678ff2226fddfa97df84e98edf73057b5bc7f6d8..e4763b5da1b620516bfacc36746201bb2b8ef3a8 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifndef __MAINWINDOW_H__
@@ -70,6 +69,7 @@ typedef enum
        M_HIDE_READ_THREADS,
        M_HAVE_RETRIEVABLE_ACCOUNT,
        M_HAVE_ANY_RETRIEVABLE_ACCOUNT,
+       M_NOT_DRAFT,
 
 /* reserved */
     M_MAX_RESERVED