diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2012-03-30 14:08:19 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2012-03-30 14:08:19 -0400 |
commit | 31b5a5a6508535ed1af86919c79d75571f1a65ef (patch) | |
tree | edee2e0c9543f22f13bf3baed30c9f6096c170a9 /src/settings-manager.vala | |
parent | 858d8ee663212c5efa4561b0a2abb9c1d2485c27 (diff) | |
download | ayatana-indicator-sound-31b5a5a6508535ed1af86919c79d75571f1a65ef.tar.gz ayatana-indicator-sound-31b5a5a6508535ed1af86919c79d75571f1a65ef.tar.bz2 ayatana-indicator-sound-31b5a5a6508535ed1af86919c79d75571f1a65ef.zip |
Import upstream version 0.8.5.0
Diffstat (limited to 'src/settings-manager.vala')
-rw-r--r-- | src/settings-manager.vala | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/settings-manager.vala b/src/settings-manager.vala index 034cd03..d57241e 100644 --- a/src/settings-manager.vala +++ b/src/settings-manager.vala @@ -58,27 +58,31 @@ public class SettingsManager : GLib.Object public void remove_interested (string app_desktop_name) { - var already_interested = this.settings.get_strv ("interested-media-players"); - var list = new ArrayList<string>(); + const string key = "interested-media-players"; + var players = new GLib.VariantBuilder (new VariantType ("as")); // array of strings - foreach (var s in already_interested){ - if (s == app_desktop_name) continue; - list.add (s); + foreach (var player in this.settings.get_strv (key)) { + if (player != app_desktop_name) + players.add ("s", player); } - this.settings.set_strv("interested-media-players", - list.to_array()); - this.settings.apply(); + + this.settings.set_value(key, players.end()); + this.settings.apply(); } public void add_interested (string app_desktop_name) { - var already_interested = this.settings.get_strv ("interested-media-players"); - foreach (var s in already_interested){ - if ( s == app_desktop_name ) return; + const string key = "interested-media-players"; + var players = new GLib.VariantBuilder (new VariantType ("as")); // array of strings + + foreach (var player in this.settings.get_strv (key)) { + if (player == app_desktop_name) + return; + players.add ("s", player); } - already_interested += (app_desktop_name); - this.settings.set_strv( "interested-media-players", - already_interested ); + + players.add ("s", app_desktop_name); + this.settings.set_value(key, players.end()); this.settings.apply(); } |