aboutsummaryrefslogtreecommitdiff
path: root/src/notification.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-29 13:06:58 -0600
committercharles kerr <charlesk@canonical.com>2015-12-29 13:06:58 -0600
commit902abad6836c6de2411d7514f36a106eee9444ed (patch)
treea0ae4438affaf781196f444869cfa24354fd49eb /src/notification.vala
parentf2fc1297ac47b5885ba3b875b9a4e188f12d68a2 (diff)
downloadayatana-indicator-sound-902abad6836c6de2411d7514f36a106eee9444ed.tar.gz
ayatana-indicator-sound-902abad6836c6de2411d7514f36a106eee9444ed.tar.bz2
ayatana-indicator-sound-902abad6836c6de2411d7514f36a106eee9444ed.zip
copyediting: use vala whitespace style in new code
Diffstat (limited to 'src/notification.vala')
-rw-r--r--src/notification.vala50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/notification.vala b/src/notification.vala
index 0c9e5b8..a652536 100644
--- a/src/notification.vala
+++ b/src/notification.vala
@@ -21,60 +21,52 @@ public abstract class IndicatorSound.Notification: Object
{
public bool visible { get; protected set; default = false; }
- public Notification() {
+ public Notification () {
BusWatcher.watch_namespace (GLib.BusType.SESSION,
"org.freedesktop.Notifications",
() => { debug("Notifications name appeared"); },
() => { debug("Notifications name vanshed"); _server_caps = null; });
- _notification = create_notification();
+ _notification = create_notification ();
_notification.closed.connect((n) => {
visible = false;
});
}
- protected abstract Notify.Notification create_notification();
-
- ~Notification() {
- close();
- }
-
- protected async void show_() {
- try {
- GLib.message("calling _notification.show");
- _notification.show ();
- GLib.message("after calling show, n.id is %d", (int)_notification.id);
- visible = true;
- } catch (GLib.Error e) {
- warning ("Unable to show notification: %s", e.message);
- }
- }
-
public void close() {
var n = _notification;
return_if_fail (n != null);
- message("closing id %d", n.id);
if (n.id != 0) {
try {
n.close();
} catch (GLib.Error e) {
- warning("Unable to close notification: %s", e.message);
+ GLib.warning("Unable to close notification: %s", e.message);
}
}
}
- protected bool notify_server_supports(string cap) {
- if (_server_caps == null) {
- GLib.message("getting server caps");
- _server_caps = Notify.get_server_caps();
- GLib.message("got server caps");
+ ~Notification () {
+ close ();
+ }
+
+ protected abstract Notify.Notification create_notification ();
+
+ protected void show_notification () {
+ try {
+ _notification.show ();
+ visible = true;
+ } catch (GLib.Error e) {
+ GLib.warning ("Unable to show notification: %s", e.message);
}
+ }
+
+ protected bool notify_server_supports (string cap) {
+ if (_server_caps == null)
+ _server_caps = Notify.get_server_caps();
- var ret = _server_caps.find_custom(cap, strcmp) != null;
- message("%s --> %d", cap, (int)ret);
- return ret;
+ return _server_caps.find_custom(cap, strcmp) != null;
}
protected Notify.Notification _notification = null;