From 7d92991c7bc863bd675db403f83b094f93a7a3ff Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Wed, 20 Aug 2025 22:49:42 -0400 Subject: capplet: Add timeout and persistence controls Add new UI elements to configure default timeout, allow persistent notifications, and to display countdown on all notification messages. --- src/capplet/mate-notification-properties.c | 11 +++ src/capplet/mate-notification-properties.ui | 120 ++++++++++++++++++++++++++++ src/common/constants.h | 3 + 3 files changed, 134 insertions(+) (limited to 'src') diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c index d8a5eab..adbbb6b 100644 --- a/src/capplet/mate-notification-properties.c +++ b/src/capplet/mate-notification-properties.c @@ -45,6 +45,9 @@ typedef struct { GtkWidget* active_checkbox; GtkWidget* dnd_checkbox; GtkWidget* monitor_label; + GtkWidget* timeout_spin; + GtkWidget* persistence_checkbox; + GtkWidget* countdown_checkbox; NotifyNotification* preview1; NotifyNotification* preview2; @@ -494,6 +497,9 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di 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->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")); + dialog->countdown_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "show_countdown_check")); g_object_unref (builder); @@ -505,6 +511,11 @@ 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); + 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); + g_settings_bind (dialog->gsettings, GSETTINGS_KEY_ENABLE_PERSISTENCE, dialog->persistence_checkbox, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (dialog->gsettings, GSETTINGS_KEY_SHOW_COUNTDOWN, dialog->countdown_checkbox, "active", G_SETTINGS_BIND_DEFAULT); + notification_properties_dialog_setup_themes (dialog); notification_properties_dialog_setup_positions (dialog); notification_properties_dialog_setup_monitors (dialog); diff --git a/src/capplet/mate-notification-properties.ui b/src/capplet/mate-notification-properties.ui index d6dbfac..49bc4c8 100644 --- a/src/capplet/mate-notification-properties.ui +++ b/src/capplet/mate-notification-properties.ui @@ -12,6 +12,13 @@ False window-close + + 0 + 300000 + 7000 + 1000 + 5000 + False 12 @@ -232,6 +239,119 @@ 1 + + + True + False + 0 + none + + + True + False + + + True + False + 6 + vertical + 6 + + + True + False + 6 + 12 + + + True + False + start + _Timeout (ms): + True + timeout_spin + + + 0 + 0 + + + + + True + True + timeout_adjustment + 1000 + 0 + True + 7000 + Default timeout for notifications in milliseconds. Use 0 for no timeout (persistent). + + + 1 + 0 + + + + + False + True + 0 + + + + + Allow Persistent Notifications + True + True + False + start + True + Allow applications to create notifications that don't disappear automatically + + + False + True + 1 + + + + + Show Countdown Timer + True + True + False + start + True + Show countdown timer on all timed notifications (not just those with actions) + + + False + True + 2 + + + + + + + + + True + False + Timeout & Behavior + + + + + + + + False + True + 2 + + diff --git a/src/common/constants.h b/src/common/constants.h index d2894da..93bb20a 100644 --- a/src/common/constants.h +++ b/src/common/constants.h @@ -28,6 +28,9 @@ #define GSETTINGS_KEY_POPUP_LOCATION "popup-location" #define GSETTINGS_KEY_SOUND_ENABLED "sound-enabled" #define GSETTINGS_KEY_USE_ACTIVE_MONITOR "use-active-monitor" +#define GSETTINGS_KEY_DEFAULT_TIMEOUT "default-timeout" +#define GSETTINGS_KEY_ENABLE_PERSISTENCE "enable-persistence" +#define GSETTINGS_KEY_SHOW_COUNTDOWN "show-countdown" #define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications" #define NOTIFICATION_BUS_PATH "/org/freedesktop/Notifications" -- cgit v1.2.1