From f6505dfead05c0e341d7ece63510e621a45e0325 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 3 Dec 2014 09:12:01 -0600 Subject: Remove the sync notification on scroll setting --- data/com.canonical.indicator.sound.gschema.xml | 9 ----- src/service.vala | 47 ++++++++------------------ 2 files changed, 15 insertions(+), 41 deletions(-) diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml index 102a1db..a346c0d 100644 --- a/data/com.canonical.indicator.sound.gschema.xml +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -32,15 +32,6 @@ On start up volume should not be muted. - - true - Initial setting for showing notify-osd notification on scroll volume-change - - When using the mouse scroll-wheel over the indicator-sound icon, the volume changes. - Enabling this setting, every scroll volume-change a notify-osd bubble with the - updated volume value will be shown (if supported by your notification daemon). - - true Whether or not to show the sound indicator in the menu bar. diff --git a/src/service.vala b/src/service.vala index 1a9034b..c74b2eb 100644 --- a/src/service.vala +++ b/src/service.vala @@ -72,14 +72,6 @@ public class IndicatorSound.Service: Object { this.sync_preferred_players (); }); - if (settings.get_boolean ("show-notify-osd-on-scroll")) { - List caps = Notify.get_server_caps (); - if (caps.find_custom ("x-canonical-private-synchronous", strcmp) != null) { - this.notification = new Notify.Notification ("indicator-sound", "", ""); - this.notification.set_hint ("x-canonical-private-synchronous", "indicator-sound"); - } - } - sharedsettings.bind ("allow-amplified-volume", this, "allow-amplified-volume", SettingsBindFlags.GET); } @@ -166,7 +158,6 @@ public class IndicatorSound.Service: Object { uint player_action_update_id; bool mute_blocks_sound; uint sound_was_blocked_timeout_id; - Notify.Notification notification; bool syncing_preferred_players = false; AccountsServiceUser? accounts_service = null; bool export_to_accounts_service = false; @@ -184,29 +175,6 @@ public class IndicatorSound.Service: Object { double v = this.volume_control.volume + volume_step_percentage * delta; this.volume_control.volume = v.clamp (0.0, this.max_volume); - - /* TODO: Don't want to mess up the desktop today, but we should remove this - scrolling change and merge that into volume control's notification */ - if (this.notification != null) { - string icon; - if (v <= 0.0) - icon = "notification-audio-volume-off"; - else if (v <= 0.3) - icon = "notification-audio-volume-low"; - else if (v <= 0.7) - icon = "notification-audio-volume-medium"; - else - icon = "notification-audio-volume-high"; - - this.notification.update ("indicator-sound", "", icon); - this.notification.set_hint ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101)); - try { - this.notification.show (); - } - catch (Error e) { - warning ("unable to show notification: %s", e.message); - } - } } void activate_desktop_settings (SimpleAction action, Variant? param) { @@ -271,7 +239,22 @@ public class IndicatorSound.Service: Object { root_action.set_state (builder.end()); } + /* TODO: Update these if the notification server leaves the bus and restarts */ + private bool check_sync_notification = false; + private bool support_sync_notification = false; + void update_sync_notification () { + if (!check_sync_notification) { + List caps = Notify.get_server_caps (); + if (caps.find_custom ("x-canonical-private-synchronous", strcmp) != null) { + support_sync_notification = true; + } + check_sync_notification = true; + } + + if (!support_sync_notification) + return; + /* Determine Label */ string volume_label = ""; if (volume_control.high_volume) -- cgit v1.2.3