diff options
| author | Victor Kareh <[email protected]> | 2025-08-29 09:14:41 -0400 |
|---|---|---|
| committer | Luke from DC <[email protected]> | 2025-10-10 02:11:17 +0000 |
| commit | 2dd24f923f4d4f2bbc77314445a6b1b6701b3569 (patch) | |
| tree | d9626b8d46c6c09fa5bb5c3195da2bbd2e3f3a5d /src/daemon/daemon.c | |
| parent | fe37d06ad1987f139d98a7b7e0a22aa96fe7260b (diff) | |
| download | mate-notification-daemon-2dd24f923f4d4f2bbc77314445a6b1b6701b3569.tar.bz2 mate-notification-daemon-2dd24f923f4d4f2bbc77314445a6b1b6701b3569.tar.xz | |
history: Add enable/disable toggle
This helps a bit with privacy. By disabling history, it wipes all
notifications in the D-Bus buffer and prevents further storage. The
history popup is also disabled.
Notification storage resumes when history is enabled.
Note that this just prevents the mate-notifications-daemon from storing
notifications, but it doesn't prevent other processes from capturing
them elsewhere.
Diffstat (limited to 'src/daemon/daemon.c')
| -rw-r--r-- | src/daemon/daemon.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 9889d7c..4d303d7 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -528,6 +528,20 @@ static void on_popup_location_changed(GSettings *settings, gchar *key, NotifyDae } } +static void on_history_enabled_changed(GSettings *settings, gchar *key, NotifyDaemon* daemon) +{ + gboolean history_enabled; + + history_enabled = g_settings_get_boolean(daemon->gsettings, key); + daemon->history_enabled = history_enabled; + + if (!history_enabled && daemon->notification_history) { + /* Wipe the history when disabled to preserve privacy */ + g_queue_free_full(daemon->notification_history, (GDestroyNotify)_history_item_free); + daemon->notification_history = g_queue_new(); + } +} + static void notify_daemon_init(NotifyDaemon* daemon) { gchar *location; @@ -541,6 +555,7 @@ static void notify_daemon_init(NotifyDaemon* daemon) daemon->gsettings = g_settings_new (GSETTINGS_SCHEMA); g_signal_connect (daemon->gsettings, "changed::" GSETTINGS_KEY_POPUP_LOCATION, G_CALLBACK (on_popup_location_changed), daemon); + g_signal_connect (daemon->gsettings, "changed::" GSETTINGS_KEY_HISTORY_ENABLED, G_CALLBACK (on_history_enabled_changed), daemon); location = g_settings_get_string (daemon->gsettings, GSETTINGS_KEY_POPUP_LOCATION); daemon->stack_location = get_stack_location_from_string(location); @@ -1986,7 +2001,7 @@ static void _init_notification_history(NotifyDaemon* daemon) { daemon->notification_history = g_queue_new(); daemon->history_max_items = 100; /* Default max items */ - daemon->history_enabled = TRUE; /* Default enabled */ + daemon->history_enabled = g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_HISTORY_ENABLED); } static void _cleanup_notification_history(NotifyDaemon* daemon) |
