aboutsummaryrefslogtreecommitdiff
path: root/src/settings-manager.vala
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2012-03-30 10:45:03 -0400
committerPackage Import Robot <package-import@ubuntu.com>2012-03-30 10:45:03 -0400
commit01d561bf282f03825ca22533f66d72ba44fd85a9 (patch)
treeedee2e0c9543f22f13bf3baed30c9f6096c170a9 /src/settings-manager.vala
parent2e2e1a5d8571b6a75de63ad771be172251a874a3 (diff)
parent31b5a5a6508535ed1af86919c79d75571f1a65ef (diff)
downloadayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.tar.gz
ayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.tar.bz2
ayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.zip
Import upstream version 0.8.5.0
Diffstat (limited to 'src/settings-manager.vala')
-rw-r--r--src/settings-manager.vala32
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();
}