summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-08-20 22:49:42 -0400
committerVictor Kareh <[email protected]>2025-08-20 23:09:04 -0400
commit7d92991c7bc863bd675db403f83b094f93a7a3ff (patch)
tree05ee7fb0c0d456564939d523483d5f0e8c880535
parent3adfad8097615f179f7c96f27ccd8ed7f9ba5a15 (diff)
downloadmate-notification-daemon-notification-spec-v1.3.tar.bz2
mate-notification-daemon-notification-spec-v1.3.tar.xz
capplet: Add timeout and persistence controlsnotification-spec-v1.3
Add new UI elements to configure default timeout, allow persistent notifications, and to display countdown on all notification messages.
-rw-r--r--src/capplet/mate-notification-properties.c11
-rw-r--r--src/capplet/mate-notification-properties.ui120
-rw-r--r--src/common/constants.h3
3 files changed, 134 insertions, 0 deletions
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 @@
<property name="can_focus">False</property>
<property name="icon_name">window-close</property>
</object>
+ <object class="GtkAdjustment" id="timeout_adjustment">
+ <property name="lower">0</property>
+ <property name="upper">300000</property>
+ <property name="value">7000</property>
+ <property name="step_increment">1000</property>
+ <property name="page_increment">5000</property>
+ </object>
<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
@@ -232,6 +239,119 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">_Timeout (ms):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">timeout_spin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="timeout_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">timeout_adjustment</property>
+ <property name="climb_rate">1000</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="value">7000</property>
+ <property name="tooltip_text" translatable="yes">Default timeout for notifications in milliseconds. Use 0 for no timeout (persistent).</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="enable_persistence_check">
+ <property name="label" translatable="yes">Allow Persistent Notifications</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">Allow applications to create notifications that don't disappear automatically</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_countdown_check">
+ <property name="label" translatable="yes">Show Countdown Timer</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">Show countdown timer on all timed notifications (not just those with actions)</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Timeout &amp; Behavior</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
<action-widgets>
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"