@@ -41,13 +41,16 @@ public class Mail.ConversationList : Gtk.Box {
4141 private Granite . SwitchModelButton hide_unstarred_switch;
4242 private Gtk . MenuButton filter_button;
4343 private Gtk . Stack refresh_stack;
44+ private GLib . Settings settings;
4445
4546 private uint mark_read_timeout_id = 0 ;
4647
4748 construct {
4849 orientation = VERTICAL ;
4950 get_style_context (). add_class (Gtk . STYLE_CLASS_VIEW );
5051
52+ settings = new GLib .Settings (" io.elementary.mail" );
53+
5154 conversations = new Gee .HashMap<string, ConversationItemModel > ();
5255 folders = new Gee .HashMap<string, Camel . Folder > ();
5356 folder_info_flags = new Gee .HashMap<string, Camel . FolderInfoFlags > ();
@@ -87,9 +90,12 @@ public class Mail.ConversationList : Gtk.Box {
8790 valign = Gtk.Align.CENTER
8891 };
8992
90- hide_read_switch = new Granite .SwitchModelButton (_(" Hide read conversations" ));
91-
92- hide_unstarred_switch = new Granite .SwitchModelButton (_(" Hide unstarred conversations" ));
93+ hide_read_switch = new Granite .SwitchModelButton (_(" Hide read conversations" )) {
94+ active = settings.get_boolean ("hide -read -conversations ")
95+ };
96+ hide_unstarred_switch = new Granite .SwitchModelButton (_(" Hide unstarred conversations" )) {
97+ active = settings.get_boolean ("hide -unstarred -conversations ")
98+ };
9399
94100 var filter_menu_popover_box = new Gtk .Box (VERTICAL , 0 ) {
95101 margin_bottom = 3 ,
@@ -163,7 +169,7 @@ public class Mail.ConversationList : Gtk.Box {
163169 add (scrolled_window );
164170 add (conversation_action_bar );
165171
166- search_entry.search_changed.connect (() => load_folder.begin ( folder_info_per_account ));
172+ search_entry.search_changed.connect (() => reload_active_folder ( ));
167173
168174 list_box.row_activated.connect ((row ) => {
169175 if (mark_read_timeout_id != 0 ) {
@@ -203,9 +209,27 @@ public class Mail.ConversationList : Gtk.Box {
203209 }
204210 });
205211
206- hide_read_switch.toggled.connect (() => load_folder.begin (folder_info_per_account ));
212+ hide_read_switch.notify["active"].connect (() => {
213+ if (settings. get_boolean (" hide-read-conversations" ) != hide_read_switch. active) {
214+ settings. set_boolean (" hide-read-conversations" , hide_read_switch. active);
215+ }
216+
217+ reload_active_folder ();
218+ });
207219
208- hide_unstarred_switch.toggled.connect (() => load_folder.begin (folder_info_per_account ));
220+ hide_unstarred_switch.notify["active"].connect (() => {
221+ if (settings. get_boolean (" hide-unstarred-conversations" ) != hide_unstarred_switch. active) {
222+ settings. set_boolean (" hide-unstarred-conversations" , hide_unstarred_switch. active);
223+ }
224+
225+ reload_active_folder ();
226+ });
227+ }
228+
229+ private void reload_active_folder () {
230+ if (folder_info_per_account != null ) {
231+ load_folder. begin (folder_info_per_account);
232+ }
209233 }
210234
211235 private static void set_thread_flag (Camel .FolderThreadNode ? node , Camel .MessageFlags flag ) {
0 commit comments