Skip to content

Commit 212bc8c

Browse files
lobredanirabbit
andauthored
Persist conversation list filter switches (#1033)
Co-authored-by: Danielle Foré <[email protected]>
1 parent 8417c92 commit 212bc8c

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

data/gschemas.compiled

976 Bytes
Binary file not shown.

data/io.elementary.mail.gschema.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
<summary>Whether to always load remote images without prompting</summary>
3333
<description>Whether to always load remote images without prompting</description>
3434
</key>
35+
<key name="hide-read-conversations" type="b">
36+
<default>false</default>
37+
<summary>Whether to hide read conversations in the list</summary>
38+
<description>Stores the last used state of the “Hide read conversations” filter</description>
39+
</key>
40+
<key name="hide-unstarred-conversations" type="b">
41+
<default>false</default>
42+
<summary>Whether to hide unstarred conversations in the list</summary>
43+
<description>Stores the last used state of the “Hide unstarred conversations” filter</description>
44+
</key>
3545
<key name="remote-images-whitelist" type="as">
3646
<default>[]</default>
3747
<summary>A list of sender addresses for which remote images will be automatically loaded</summary>
@@ -51,4 +61,3 @@
5161
</key>
5262
</schema>
5363
</schemalist>
54-

src/ConversationList/ConversationList.vala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public class Mail.ConversationList : Gtk.Box {
8888
};
8989

9090
hide_read_switch = new Granite.SwitchModelButton (_("Hide read conversations"));
91-
9291
hide_unstarred_switch = new Granite.SwitchModelButton (_("Hide unstarred conversations"));
9392

9493
var filter_menu_popover_box = new Gtk.Box (VERTICAL, 0) {
@@ -203,8 +202,11 @@ public class Mail.ConversationList : Gtk.Box {
203202
}
204203
});
205204

206-
hide_read_switch.toggled.connect (() => load_folder.begin (folder_info_per_account));
205+
var settings = new GLib.Settings ("io.elementary.mail");
206+
settings.bind ("hide-read-conversations", hide_read_switch, "active", DEFAULT);
207+
settings.bind ("hide-unstarred-conversations", hide_unstarred_switch, "active", DEFAULT);
207208

209+
hide_read_switch.toggled.connect (() => load_folder.begin (folder_info_per_account));
208210
hide_unstarred_switch.toggled.connect (() => load_folder.begin (folder_info_per_account));
209211
}
210212

@@ -222,7 +224,7 @@ public class Mail.ConversationList : Gtk.Box {
222224
}
223225
}
224226

225-
public async void load_folder (Gee.Map<Backend.Account, Camel.FolderInfo?> folder_info_per_account) {
227+
public async void load_folder (Gee.Map<Backend.Account, Camel.FolderInfo?> folder_info_per_account) requires (folder_info_per_account != null) {
226228
lock (this.folder_info_per_account) {
227229
this.folder_info_per_account = folder_info_per_account;
228230
}

0 commit comments

Comments
 (0)