diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
commit | 612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (patch) | |
tree | 03ced96344802a4e338eb53d35d1c677f8354460 /src/settings-manager.vala | |
parent | 31b5a5a6508535ed1af86919c79d75571f1a65ef (diff) | |
parent | 2900797204c4446a7f46515364c6aa868a5f4fab (diff) | |
download | ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.gz ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.bz2 ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.zip |
Import upstream version 12.10.0
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 /** |