Group :: Graphical desktop/GNOME
RPM: notification-daemon
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: notification-daemon-0.7.2-bubble_timeout.patch
Download
Download
From 1e2d7897948149a260c0b544ec41cb0460dcc487 Sun, 4 Sep 2011 19:26:38 +0200
From: Jakub Adam <jakub.adam@ktknet.cz>
Date: Sun, 4 Sep 2011 19:24:12 +0200
Subject: [PATCH] Fix notification bubble timeout
diff --git a/src/nd-bubble.c b/src/nd-bubble.c
index 0587478..d7fcf72 100644
--- a/src/nd-bubble.c
+++ b/src/nd-bubble.c
@@ -395,12 +395,22 @@
static void
add_timeout (NdBubble *bubble)
{
+ int timeout = nd_notification_get_timeout(bubble->priv->notification);
+
+ if (timeout == ND_NOTIFICATION_EXPIRES_DEFAULT) {
+ timeout = TIMEOUT_SEC;
+ }
+
if (bubble->priv->timeout_id != 0) {
g_source_remove (bubble->priv->timeout_id);
+ bubble->priv->timeout_id = 0;
}
- bubble->priv->timeout_id = g_timeout_add_seconds (TIMEOUT_SEC,
- (GSourceFunc)timeout_bubble,
- bubble);
+ if (timeout != ND_NOTIFICATION_EXPIRES_NEVER) {
+ bubble->priv->timeout_id =
+ g_timeout_add_seconds (timeout,
+ (GSourceFunc)timeout_bubble,
+ bubble);
+ }
}
static void
diff --git a/src/nd-notification.c b/src/nd-notification.c
index 05372d0..d7681e7 100644
--- a/src/nd-notification.c
+++ b/src/nd-notification.c
@@ -194,6 +194,8 @@
value); /* steals value */
}
+ notification->timeout = timeout;
+
g_signal_emit (notification, signals[CHANGED], 0);
g_get_current_time (¬ification->update_time);
@@ -330,6 +332,14 @@
return notification->icon;
}
+int
+nd_notification_get_timeout (NdNotification *notification)
+{
+ g_return_val_if_fail (ND_IS_NOTIFICATION (notification), NULL);
+
+ return notification->timeout;
+}
+
static GdkPixbuf *
scale_pixbuf (GdkPixbuf *pixbuf,
diff --git a/src/nd-notification.h b/src/nd-notification.h
index 1505375..1e35612 100644
--- a/src/nd-notification.h
+++ b/src/nd-notification.h
@@ -44,6 +44,9 @@
ND_NOTIFICATION_CLOSED_RESERVED = 4
} NdNotificationClosedReason;
+#define ND_NOTIFICATION_EXPIRES_DEFAULT -1
+#define ND_NOTIFICATION_EXPIRES_NEVER 0
+
GType nd_notification_get_type (void) G_GNUC_CONST;
NdNotification * nd_notification_new (const char *sender);