From 0f5d5ee7a541aeea9a4dcd6d20a64ea0158b0a52 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 12 Aug 2015 09:25:42 -0500 Subject: copyediting: in new code, use unowned strings where practical, slightly better comments, more consistent method names --- src/service.vala | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 8da44da..f1c37a8 100644 --- a/src/service.vala +++ b/src/service.vala @@ -318,23 +318,26 @@ public class IndicatorSound.Service: Object { if (notify_server_supports_sync && !block_info_notifications) { /* Determine Label */ - string volume_label = ""; - if (loud) { - volume_label = _("High volume can damage your hearing."); - } + unowned string volume_label = loud + ? _("High volume can damage your hearing.") + : ""; /* Choose an icon */ - string icon = ""; - if (loud) - icon = "audio-volume-high"; - else if (volume_control.volume.volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume_control.volume.volume <= 0.3) - icon = "audio-volume-low"; - else if (volume_control.volume.volume <= 0.7) - icon = "audio-volume-medium"; - else + unowned string icon; + if (loud) { icon = "audio-volume-high"; + } else { + var volume = volume_control.volume.volume; + + if (volume <= 0.0) + icon = "audio-volume-muted"; + else if (volume <= 0.3) + icon = "audio-volume-low"; + else if (volume <= 0.7) + icon = "audio-volume-medium"; + else + icon = "audio-volume-high"; + } /* Reset the notification */ var n = this.info_notification; @@ -634,7 +637,7 @@ public class IndicatorSound.Service: Object { } private void clamp_to_high_soon() { - const uint interval_msec = 200; /* arbitrary, but works */ + const uint interval_msec = 200; if (_clamp_to_high_timeout == 0) _clamp_to_high_timeout = Timeout.add(interval_msec, clamp_to_high_idle); } -- cgit v1.2.3