aboutsummaryrefslogtreecommitdiff
path: root/src/settings-manager.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-12-15 14:32:27 +0000
committerConor Curran <conor.curran@canonical.com>2010-12-15 14:32:27 +0000
commitaaf57407f00aa59df3699794496fd42a731ad7db (patch)
tree62db182817ec8c3de63cd4cb5a4fa53322b69c80 /src/settings-manager.vala
parent57e6249df95fd120eee8ed4013210d359cdeee97 (diff)
downloadayatana-indicator-sound-aaf57407f00aa59df3699794496fd42a731ad7db.tar.gz
ayatana-indicator-sound-aaf57407f00aa59df3699794496fd42a731ad7db.tar.bz2
ayatana-indicator-sound-aaf57407f00aa59df3699794496fd42a731ad7db.zip
settings schema defined and handling code wrote
Diffstat (limited to 'src/settings-manager.vala')
-rw-r--r--src/settings-manager.vala55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/settings-manager.vala b/src/settings-manager.vala
new file mode 100644
index 0000000..9068c05
--- /dev/null
+++ b/src/settings-manager.vala
@@ -0,0 +1,55 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+using Gee;
+
+public class SettingsManager : GLib.Object
+{
+ private Settings settings;
+ public signal void blacklist_updates ( string[] new_blacklist );
+
+ public SettingsManager ( ){
+ }
+ construct{
+ this.settings = new Settings ("com.canonical.indicators.sound");
+ settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
+ this.fetch_entries.begin();
+ }
+
+ public string[] fetch_blacklist()
+ {
+ return this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players"));
+ }
+
+ public string[] fetch_interested()
+ {
+ return this.interested_updates(this.settings.get_strv ("interested-media-players"));
+ }
+
+ public bool add_interested(string app_desktop_name)
+ {
+ string[] already_interested = fetch_interested();
+ already_interested.append ( app_desktop_name );
+ return this.settings.set_strv( already_interested );
+ }
+
+ private on_blacklist_event()
+ {
+ this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players"));
+ }
+} \ No newline at end of file