Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow turning off keeping notifications accross reboots #284

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/io.elementary.wingpanel.notifications.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
<summary>The expanded state of the headers</summary>
<description>The expanded state of the headers</description>
</key>
<key name="keep-notifications" type="b">
<default>true</default>
<summary>Keep notifications</summary>
<description>Whether to keep new notifications between sessions</description>
</key>
</schema>
</schemalist>
6 changes: 5 additions & 1 deletion src/Widgets/NotificationsList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ public class Notifications.NotificationsList : Gtk.ListBox {

private HashTable<string, int> table;

private GLib.Settings notify_settings;

construct {
app_entries = new Gee.HashMap<string, AppEntry> ();
table = new HashTable<string, int> (str_hash, str_equal);
notify_settings = new GLib.Settings ("io.elementary.wingpanel.notifications");

var placeholder = new Gtk.Label (_("No Notifications")) {
margin_top = 24,
Expand All @@ -53,6 +56,7 @@ public class Notifications.NotificationsList : Gtk.ListBox {

public async void add_entry (Notification notification, bool add_to_session = true) {
var entry = new NotificationEntry (notification);
var write_file = notify_settings.get_boolean ( "keep-notifications");

if (app_entries[notification.desktop_id] != null) {
var app_entry = app_entries[notification.desktop_id];
Expand Down Expand Up @@ -80,7 +84,7 @@ public class Notifications.NotificationsList : Gtk.ListBox {
yield;

if (add_to_session) { // If notification was obtained from session do not write it back
Session.get_instance ().add_notification (notification);
Session.get_instance ().add_notification (notification, write_file);
}
}

Expand Down