summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-08-29 09:14:41 -0400
committerLuke from DC <[email protected]>2025-10-10 02:11:17 +0000
commit2dd24f923f4d4f2bbc77314445a6b1b6701b3569 (patch)
treed9626b8d46c6c09fa5bb5c3195da2bbd2e3f3a5d
parentfe37d06ad1987f139d98a7b7e0a22aa96fe7260b (diff)
downloadmate-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.
-rw-r--r--data/org.mate.NotificationDaemon.gschema.xml.in5
-rw-r--r--src/capplet/mate-notification-applet-history.c6
-rw-r--r--src/capplet/mate-notification-properties.c3
-rw-r--r--src/capplet/mate-notification-properties.ui16
-rw-r--r--src/common/constants.h1
-rw-r--r--src/daemon/daemon.c17
6 files changed, 47 insertions, 1 deletions
diff --git a/data/org.mate.NotificationDaemon.gschema.xml.in b/data/org.mate.NotificationDaemon.gschema.xml.in
index a0c6cf8..80beac4 100644
--- a/data/org.mate.NotificationDaemon.gschema.xml.in
+++ b/data/org.mate.NotificationDaemon.gschema.xml.in
@@ -46,5 +46,10 @@
<summary>Show countdown</summary>
<description>Show countdown timer for all non-persistent notifications. If false, only show it for those waiting for user actions.</description>
</key>
+ <key name="history-enabled" type="b">
+ <default>true</default>
+ <summary>Enable notification history</summary>
+ <description>When enabled, notifications are stored in history for later viewing. When disabled, no notification history is kept for privacy. Note: This only controls MATE's notification daemon storage; other applications may still have access to notifications through system logs or other means.</description>
+ </key>
</schema>
</schemalist>
diff --git a/src/capplet/mate-notification-applet-history.c b/src/capplet/mate-notification-applet-history.c
index cca03d6..ce38a6f 100644
--- a/src/capplet/mate-notification-applet-history.c
+++ b/src/capplet/mate-notification-applet-history.c
@@ -245,6 +245,12 @@ show_notification_history (MateNotificationHistoryContext *context)
return;
}
+ /* Check if history is enabled */
+ if (context->settings && !g_settings_get_boolean (context->settings, GSETTINGS_KEY_HISTORY_ENABLED)) {
+ g_warning ("Cannot show history: history is disabled for privacy");
+ return;
+ }
+
/* If popup already exists, destroy it (basically toggle off) */
if (context->history_popup) {
gtk_widget_destroy (context->history_popup);
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index adbbb6b..f81dd2c 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -44,6 +44,7 @@ typedef struct {
GtkWidget* preview_button;
GtkWidget* active_checkbox;
GtkWidget* dnd_checkbox;
+ GtkWidget* history_checkbox;
GtkWidget* monitor_label;
GtkWidget* timeout_spin;
GtkWidget* persistence_checkbox;
@@ -496,6 +497,7 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di
dialog->theme_combo = GTK_WIDGET(gtk_builder_get_object(builder, "theme_combo"));
dialog->active_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "use_active_check"));
dialog->dnd_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "do_not_disturb_check"));
+ dialog->history_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "history_enabled_check"));
dialog->monitor_label = GTK_WIDGET(gtk_builder_get_object(builder, "monitor_label"));
dialog->timeout_spin = GTK_WIDGET(gtk_builder_get_object(builder, "timeout_spin"));
dialog->persistence_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "enable_persistence_check"));
@@ -510,6 +512,7 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di
g_settings_bind (dialog->gsettings, GSETTINGS_KEY_USE_ACTIVE_MONITOR, dialog->active_checkbox, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (dialog->gsettings, GSETTINGS_KEY_DO_NOT_DISTURB, dialog->dnd_checkbox, "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (dialog->gsettings, GSETTINGS_KEY_HISTORY_ENABLED, dialog->history_checkbox, "active", G_SETTINGS_BIND_DEFAULT);
GtkAdjustment *timeout_adjustment = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(dialog->timeout_spin));
g_settings_bind (dialog->gsettings, GSETTINGS_KEY_DEFAULT_TIMEOUT, timeout_adjustment, "value", G_SETTINGS_BIND_DEFAULT);
diff --git a/src/capplet/mate-notification-properties.ui b/src/capplet/mate-notification-properties.ui
index 49bc4c8..9b461bf 100644
--- a/src/capplet/mate-notification-properties.ui
+++ b/src/capplet/mate-notification-properties.ui
@@ -218,6 +218,22 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="history_enabled_check">
+ <property name="label" translatable="yes">Enable Notification History</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="draw_indicator">True</property>
+ <property name="tooltip_text" translatable="yes">When enabled, notifications are stored for later viewing. When disabled, no notification history is kept for privacy. Note: This only controls MATE's notification storage; system logs may still contain notification data.</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/src/common/constants.h b/src/common/constants.h
index 93bb20a..1a81977 100644
--- a/src/common/constants.h
+++ b/src/common/constants.h
@@ -31,6 +31,7 @@
#define GSETTINGS_KEY_DEFAULT_TIMEOUT "default-timeout"
#define GSETTINGS_KEY_ENABLE_PERSISTENCE "enable-persistence"
#define GSETTINGS_KEY_SHOW_COUNTDOWN "show-countdown"
+#define GSETTINGS_KEY_HISTORY_ENABLED "history-enabled"
#define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications"
#define NOTIFICATION_BUS_PATH "/org/freedesktop/Notifications"
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)