@@ -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 > ();
@@ -88,8 +91,19 @@ public class Mail.ConversationList : Gtk.Box {
8891 };
8992
9093 hide_read_switch = new Granite .SwitchModelButton (_(" Hide read conversations" ));
91-
9294 hide_unstarred_switch = new Granite .SwitchModelButton (_(" Hide unstarred conversations" ));
95+ settings.bind (
96+ "hide -read -conversations ",
97+ hide_read_switch ,
98+ "active ",
99+ SettingsBindFlags .DEFAULT | SettingsBindFlags .SET
100+ );
101+ settings.bind (
102+ "hide -unstarred -conversations ",
103+ hide_unstarred_switch ,
104+ "active ",
105+ SettingsBindFlags .DEFAULT | SettingsBindFlags .SET
106+ );
93107
94108 var filter_menu_popover_box = new Gtk .Box (VERTICAL , 0 ) {
95109 margin_bottom = 3 ,
@@ -163,7 +177,7 @@ public class Mail.ConversationList : Gtk.Box {
163177 add (scrolled_window );
164178 add (conversation_action_bar );
165179
166- search_entry.search_changed.connect (() => load_folder.begin ( folder_info_per_account ));
180+ search_entry.search_changed.connect (() => reload_active_folder ( ));
167181
168182 list_box.row_activated.connect ((row ) => {
169183 if (mark_read_timeout_id != 0 ) {
@@ -203,9 +217,15 @@ public class Mail.ConversationList : Gtk.Box {
203217 }
204218 });
205219
206- hide_read_switch.toggled .connect (() => load_folder.begin ( folder_info_per_account ));
220+ hide_read_switch.notify["active"] .connect (() => reload_active_folder ( ));
207221
208- hide_unstarred_switch.toggled.connect (() => load_folder.begin (folder_info_per_account ));
222+ hide_unstarred_switch.notify["active"].connect (() => reload_active_folder ());
223+ }
224+
225+ private void reload_active_folder () {
226+ if (folder_info_per_account != null ) {
227+ load_folder. begin (folder_info_per_account);
228+ }
209229 }
210230
211231 private static void set_thread_flag (Camel .FolderThreadNode ? node , Camel .MessageFlags flag ) {
0 commit comments