diff options
author | Conor Curran <conor.curran@canonical.com> | 2012-06-21 17:45:16 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2012-06-21 17:45:16 +0100 |
commit | dcde0e28f8cd4d674ba744fad1779f6e9f91eb6e (patch) | |
tree | 4619435c7c550a397401751e60503dab36bef8ea /src/settings-manager.vala | |
parent | 5f9a9b8b0ba50dcb5f47233df9e7123ed37501ad (diff) | |
download | ayatana-indicator-sound-dcde0e28f8cd4d674ba744fad1779f6e9f91eb6e.tar.gz ayatana-indicator-sound-dcde0e28f8cd4d674ba744fad1779f6e9f91eb6e.tar.bz2 ayatana-indicator-sound-dcde0e28f8cd4d674ba744fad1779f6e9f91eb6e.zip |
manually merge of lp:~victored/indicator-sound/lp-1014955
Diffstat (limited to 'src/settings-manager.vala')
-rw-r--r-- | src/settings-manager.vala | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/settings-manager.vala b/src/settings-manager.vala index d57241e..458ac21 100644 --- a/src/settings-manager.vala +++ b/src/settings-manager.vala @@ -22,12 +22,14 @@ public class SettingsManager : GLib.Object { private Settings settings; public signal void blacklist_updates ( string[] new_blacklist ); + public signal void preferred_updates (Gee.ArrayList<string> new_preferred); public SettingsManager ( ){ } construct{ this.settings = new Settings ("com.canonical.indicator.sound"); - this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event); + this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event); + this.settings.changed["preferred-media-players"].connect (on_preferred_event); } public string[] fetch_blacklist() @@ -35,9 +37,24 @@ public class SettingsManager : GLib.Object return this.settings.get_strv ("blacklisted-media-players"); } + public ArrayList<string> fetch_preferred() + { + var list = new ArrayList<string>(); + + var preferred = this.settings.get_strv ("preferred-media-players"); + var interested = fetch_interested (); + + foreach (var s in preferred) { + if (!(s in list) && interested.contains (s)) + list.add (s); + } + + return list; + } + public ArrayList<string> fetch_interested() { - var blacklisted = this.settings.get_strv ("blacklisted-media-players"); + var blacklisted = fetch_blacklist (); var interested = this.settings.get_strv ("interested-media-players"); var list = new ArrayList<string>(); foreach(var s in interested){ @@ -91,6 +108,11 @@ public class SettingsManager : GLib.Object this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players")); } + private void on_preferred_event() + { + this.preferred_updates (this.fetch_preferred()); + } + // Convenient debug method inorder to provide visability over // the contents of both interested and blacklisted containers in its gsettings /** |