diff options
-rw-r--r-- | src/info-notification.vala | 6 | ||||
-rw-r--r-- | src/notification.vala | 19 | ||||
-rw-r--r-- | src/warn-notification.vala | 21 |
3 files changed, 24 insertions, 22 deletions
diff --git a/src/info-notification.vala b/src/info-notification.vala index 2aabcba..76a5992 100644 --- a/src/info-notification.vala +++ b/src/info-notification.vala @@ -22,13 +22,13 @@ using Notify; public class IndicatorSound.InfoNotification: Notification { protected override Notify.Notification create_notification () { - return new Notify.Notification(_("Volume"), "", "audio-volume-muted"); + return new Notify.Notification (_("Volume"), "", "audio-volume-muted"); } public void show (VolumeControl.ActiveOutput active_output, double volume, bool is_high_volume) { - if (!notify_server_supports("x-canonical-private-synchronous")) + if (!notify_server_supports ("x-canonical-private-synchronous")) return; /* Determine Label */ @@ -45,7 +45,7 @@ public class IndicatorSound.InfoNotification: Notification n.set_hint ("x-canonical-private-synchronous", "true"); n.set_hint ("x-canonical-value-bar-tint", is_high_volume ? "true" : "false"); n.set_hint ("value", ((int32)((volume * 100.0) + 0.5)).clamp(0, 100)); - show_notification(); + show_notification (); } private static string get_notification_label (VolumeControl.ActiveOutput active_output) { diff --git a/src/notification.vala b/src/notification.vala index 0fa91ef..3a3060f 100644 --- a/src/notification.vala +++ b/src/notification.vala @@ -20,24 +20,25 @@ public abstract class IndicatorSound.Notification: Object { public Notification () { - BusWatcher.watch_namespace (GLib.BusType.SESSION, - "org.freedesktop.Notifications", - () => { debug("Notifications name appeared"); }, - () => { debug("Notifications name vanshed"); _server_caps = null; }); + BusWatcher.watch_namespace ( + GLib.BusType.SESSION, + "org.freedesktop.Notifications", + () => { debug ("Notifications name appeared"); }, + () => { debug ("Notifications name vanshed"); _server_caps = null; }); _notification = create_notification (); } - public void close() { + public void close () { var n = _notification; return_if_fail (n != null); if (n.id != 0) { try { - n.close(); + n.close (); } catch (GLib.Error e) { - GLib.warning("Unable to close notification: %s", e.message); + GLib.warning ("Unable to close notification: %s", e.message); } } } @@ -58,9 +59,9 @@ public abstract class IndicatorSound.Notification: Object protected bool notify_server_supports (string cap) { if (_server_caps == null) - _server_caps = Notify.get_server_caps(); + _server_caps = Notify.get_server_caps (); - return _server_caps.find_custom(cap, strcmp) != null; + return _server_caps.find_custom (cap, strcmp) != null; } protected Notify.Notification _notification = null; diff --git a/src/warn-notification.vala b/src/warn-notification.vala index 9175bb6..17129aa 100644 --- a/src/warn-notification.vala +++ b/src/warn-notification.vala @@ -24,32 +24,33 @@ public class IndicatorSound.WarnNotification: Notification OK } - public signal void user_responded (WarnNotification.Response response); + public signal void user_responded (Response response); protected override Notify.Notification create_notification () { - var n = new Notify.Notification(_("Volume"), - _("High volume can damage your hearing."), - "audio-volume-high"); + var n = new Notify.Notification ( + _("Volume"), + _("High volume can damage your hearing."), + "audio-volume-high"); n.set_hint ("x-canonical-non-shaped-icon", "true"); n.set_hint ("x-canonical-snap-decisions", "true"); n.set_hint ("x-canonical-private-affirmative-tint", "true"); - n.closed.connect((n) => { - n.clear_actions(); + n.closed.connect ((n) => { + n.clear_actions (); }); return n; } public bool show () { - if (!notify_server_supports("actions")) + if (!notify_server_supports ("actions")) return false; - _notification.clear_actions(); + _notification.clear_actions (); _notification.add_action ("ok", _("OK"), (n, a) => { - user_responded(Response.OK); + user_responded (Response.OK); }); _notification.add_action ("cancel", _("Cancel"), (n, a) => { - user_responded(Response.CANCEL); + user_responded (Response.CANCEL); }); show_notification(); |