[gnome-boxes] notificationbar: Allow tweaking of timeout
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] notificationbar: Allow tweaking of timeout
- Date: Thu, 8 Nov 2012 15:26:31 +0000 (UTC)
commit 496f477aa4f40433e21fe1af4cf9eb8cea0a2afd
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Nov 6 00:35:59 2012 +0100
notificationbar: Allow tweaking of timeout
Currently we just assume that 6 seconds timeout is enough for everyone.
This patch makes it possible to set or even unset the timeout on the
notifications.
https://bugzilla.gnome.org/show_bug.cgi?id=673930
src/notificationbar.vala | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 302a787..93d1f1f 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -2,6 +2,8 @@
using Gtk;
private class Boxes.Notificationbar: GLib.Object {
+ public const int DEFAULT_TIMEOUT = 6;
+
public Clutter.Actor actor { get { return gtk_actor; } }
public delegate void OKFunc ();
@@ -38,12 +40,13 @@ private class Boxes.Notificationbar: GLib.Object {
public void display_for_action (string message,
string action_label,
owned OKFunc action_func,
- owned CancelFunc? ignore_func = null) {
- display (message, MessageType.INFO, action_label, (owned) action_func, (owned) ignore_func);
+ owned CancelFunc? ignore_func = null,
+ int timeout = DEFAULT_TIMEOUT) {
+ display (message, MessageType.INFO, action_label, (owned) action_func, (owned) ignore_func, timeout);
}
- public void display_error (string message) {
- display (message, MessageType.ERROR);
+ public void display_error (string message, int timeout = DEFAULT_TIMEOUT) {
+ display (message, MessageType.ERROR, null, null, null, timeout);
}
public void cancel () {
@@ -61,12 +64,13 @@ private class Boxes.Notificationbar: GLib.Object {
private void display (string message,
MessageType message_type,
- string? ok_label = null,
- owned OKFunc? ok_func = null,
- owned CancelFunc? cancel_func = null) {
+ string? ok_label,
+ owned OKFunc? ok_func,
+ owned CancelFunc? cancel_func,
+ int timeout) {
var notification = new Gd.Notification ();
notification.valign = Gtk.Align.START;
- notification.timeout = 6;
+ notification.timeout = timeout;
active_notifications.prepend (notification);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]