[gnome-boxes] notificationbar: Provide users with Gd.Notification instance
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] notificationbar: Provide users with Gd.Notification instance
- Date: Thu, 8 Nov 2012 15:26:36 +0000 (UTC)
commit c7f92074a933047bf0140ca6125068447c41f60d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Nov 6 00:46:35 2012 +0100
notificationbar: Provide users with Gd.Notification instance
The notification displaying methods now returns the underlying
Gd.Notification instance so that users of this API can do things like
dismissing the displayed notification.
https://bugzilla.gnome.org/show_bug.cgi?id=673930
src/notificationbar.vala | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 93d1f1f..5914254 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -37,16 +37,16 @@ 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,
- int timeout = DEFAULT_TIMEOUT) {
- display (message, MessageType.INFO, action_label, (owned) action_func, (owned) ignore_func, timeout);
+ public Gd.Notification display_for_action (string message,
+ string action_label,
+ owned OKFunc action_func,
+ owned CancelFunc? ignore_func = null,
+ int timeout = DEFAULT_TIMEOUT) {
+ return display (message, MessageType.INFO, action_label, (owned) action_func, (owned) ignore_func, timeout);
}
- public void display_error (string message, int timeout = DEFAULT_TIMEOUT) {
- display (message, MessageType.ERROR, null, null, null, timeout);
+ public Gd.Notification display_error (string message, int timeout = DEFAULT_TIMEOUT) {
+ return display (message, MessageType.ERROR, null, null, null, timeout);
}
public void cancel () {
@@ -62,12 +62,12 @@ private class Boxes.Notificationbar: GLib.Object {
App.app.display_page.add_notification (w);
}
- private void display (string message,
- MessageType message_type,
- string? ok_label,
- owned OKFunc? ok_func,
- owned CancelFunc? cancel_func,
- int timeout) {
+ private Gd.Notification display (string message,
+ MessageType message_type,
+ 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 = timeout;
@@ -107,5 +107,7 @@ private class Boxes.Notificationbar: GLib.Object {
add_notification (notification);
notification.show_all ();
+
+ return notification;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]