summaryrefslogtreecommitdiff
path: root/src/capplet
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-08-28 15:09:36 -0400
committerLuke from DC <[email protected]>2026-03-22 19:58:20 +0000
commit68663596ba6c6dcd3a2755b257c66e7ed8200c3d (patch)
treea517ae32677e1f8a269be7f8275d278057286409 /src/capplet
parente594a931dd892151d5a889d229cd109849ca10e2 (diff)
downloadmate-notification-daemon-68663596ba6c6dcd3a2755b257c66e7ed8200c3d.tar.bz2
mate-notification-daemon-68663596ba6c6dcd3a2755b257c66e7ed8200c3d.tar.xz
capplet: Add urgency indicators to notification history
Style notification history rows based on urgency. Critical notifications get a red accent bar, low priority notifications are dimmed.
Diffstat (limited to 'src/capplet')
-rw-r--r--src/capplet/mate-notification-applet-history.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/capplet/mate-notification-applet-history.c b/src/capplet/mate-notification-applet-history.c
index 4d762da..5cbafde 100644
--- a/src/capplet/mate-notification-applet-history.c
+++ b/src/capplet/mate-notification-applet-history.c
@@ -80,13 +80,16 @@ popup_destroyed_cb (GtkWidget *popup,
static GtkWidget *
create_notification_row (guint id, const gchar *app_name, const gchar *app_icon,
- const gchar *summary, const gchar *body, gint64 timestamp)
+ const gchar *summary, const gchar *body, gint64 timestamp, guint urgency)
{
GtkWidget *row, *hbox, *icon_image, *content_box;
GtkWidget *title_label, *body_label, *time_label;
GDateTime *dt;
gchar *time_str, *markup;
+ /* Urgency constants matching daemon.h */
+ enum { URGENCY_LOW = 0, URGENCY_NORMAL = 1, URGENCY_CRITICAL = 2 };
+
/* Format timestamp */
dt = g_date_time_new_from_unix_local (timestamp / G_TIME_SPAN_SECOND);
time_str = g_date_time_format (dt, "%H:%M");
@@ -97,6 +100,29 @@ create_notification_row (guint id, const gchar *app_name, const gchar *app_icon,
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
+ const gchar *row_css = NULL;
+
+ switch (urgency) {
+ case URGENCY_CRITICAL:
+ row_css = "row { box-shadow: inset 30px 0 0 0 #CC0000; }";
+ break;
+ case URGENCY_LOW:
+ row_css = "row { opacity: 0.6; }";
+ break;
+ case URGENCY_NORMAL:
+ default:
+ break;
+ }
+
+ /* Apply CSS styling for urgency */
+ if (row_css != NULL) {
+ GtkCssProvider *provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, row_css, -1, NULL);
+ GtkStyleContext *row_context = gtk_widget_get_style_context (row);
+ gtk_style_context_add_provider (row_context, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+ }
+
icon_image = create_notification_icon (app_icon);
content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
@@ -342,7 +368,7 @@ show_notification_history (MateNotificationHistoryContext *context)
&timestamp, &closed_timestamp, &reason, &urgency, &read)) {
notification_count++;
/* Add each notification as a new row in the list */
- GtkWidget *row = create_notification_row (id, app_name, app_icon, summary, body, timestamp);
+ GtkWidget *row = create_notification_row (id, app_name, app_icon, summary, body, timestamp, urgency);
gtk_list_box_insert (GTK_LIST_BOX (list_box), row, -1);
}