diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-12-15 14:32:27 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-12-15 14:32:27 +0000 |
commit | aaf57407f00aa59df3699794496fd42a731ad7db (patch) | |
tree | 62db182817ec8c3de63cd4cb5a4fa53322b69c80 /src | |
parent | 57e6249df95fd120eee8ed4013210d359cdeee97 (diff) | |
download | ayatana-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')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/music-player-bridge.vala | 10 | ||||
-rw-r--r-- | src/settings-manager.vala | 55 | ||||
-rw-r--r-- | src/sound-service-dbus.c | 1 |
4 files changed, 64 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 1c381f5..5ef9ef0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ music_bridge_VALASOURCES = \ mpris2-watcher.vala \ mpris2-controller.vala \ player-item.vala \ - familiar-players-db.vala \ + settings-manager.vala \ fetch-file.vala diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 51ecc4c..6a45d0c 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -23,6 +23,7 @@ using GLib; public class MusicPlayerBridge : GLib.Object { + private SettingsManager settings_manager; private Dbusmenu.Menuitem root_menu; private HashMap<string, PlayerController> registered_clients; private Mpris2Watcher watcher; @@ -35,9 +36,14 @@ public class MusicPlayerBridge : GLib.Object construct{ this.registered_clients = new HashMap<string, PlayerController> (); - this.settings = new Settings("com.canonical.indicators.sound"); + this.settings_manager = new SettingsManager(); + this.settings_manager.connect.blacklist_updates (on_blacklist_update); } + private void on_black_list_updated ( string[] blacklist ) + { + debug("some blacklist update"); + } /*private void try_to_add_inactive_familiar_clients(){ foreach(string app in this.playersDB.records()){ @@ -143,7 +149,7 @@ public class MusicPlayerBridge : GLib.Object GLib.AppInfo app_info = info as GLib.AppInfo; return app_info; } - + private static string? fetch_icon_name(string desktop_path) { KeyFile desktop_keyfile = new KeyFile (); 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 diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index d553285..0760247 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -42,7 +42,6 @@ struct _SoundServiceDbusPrivate { gboolean sink_availability; }; - /* Signals */ enum { SINK_INPUT_WHILE_MUTED, |