aboutsummaryrefslogtreecommitdiff
path: root/src/settings-manager.vala
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-07-12 09:17:03 +0000
committerTarmac <Unknown>2013-07-12 09:17:03 +0000
commit98c77c44a6c374a3fab401eb791ec4e968bf7168 (patch)
treeb81019f0a3b44512a6e033752b901165ff645089 /src/settings-manager.vala
parent1f37b724c2eeb9af4d23de4b28c4ed39f50ed5a0 (diff)
parent9507f278131fc855c03a037cdba1053f958d2987 (diff)
downloadayatana-indicator-sound-98c77c44a6c374a3fab401eb791ec4e968bf7168.tar.gz
ayatana-indicator-sound-98c77c44a6c374a3fab401eb791ec4e968bf7168.tar.bz2
ayatana-indicator-sound-98c77c44a6c374a3fab401eb791ec4e968bf7168.zip
Remove gtk and dbusmenu. Sorry for the big changeset.
I'd appreciate a good deal of testing before merging this into the wild ;). Approved by Charles Kerr, PS Jenkins bot.
Diffstat (limited to 'src/settings-manager.vala')
-rw-r--r--src/settings-manager.vala136
1 files changed, 0 insertions, 136 deletions
diff --git a/src/settings-manager.vala b/src/settings-manager.vala
deleted file mode 100644
index 458ac21..0000000
--- a/src/settings-manager.vala
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-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 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["preferred-media-players"].connect (on_preferred_event);
- }
-
- public string[] fetch_blacklist()
- {
- 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 = fetch_blacklist ();
- var interested = this.settings.get_strv ("interested-media-players");
- var list = new ArrayList<string>();
- foreach(var s in interested){
- if (s == "banshee-1"){
- s = "banshee";
- }
- if (s in list) continue;
- if (s in blacklisted) continue;
- list.add(s);
- }
- return list;
- }
-
- public void clear_list()
- {
- this.settings.reset("interested-media-players");
- }
-
- public void remove_interested (string app_desktop_name)
- {
- 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)
- players.add ("s", player);
- }
-
- this.settings.set_value(key, players.end());
- this.settings.apply();
- }
-
- public void add_interested (string app_desktop_name)
- {
- 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);
- }
-
- players.add ("s", app_desktop_name);
- this.settings.set_value(key, players.end());
- this.settings.apply();
- }
-
- private void on_blacklist_event()
- {
- 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
-/**
- private void reveal_contents()
- {
- var already_interested = this.settings.get_strv ("interested-media-players");
- foreach (var s in already_interested)
- {
- debug ("client %s is in interested array", s);
- }
- var blacklisted = this.settings.get_strv ("blacklisted-media-players");
- foreach (var s in blacklisted)
- {
- debug ("client %s is in blacklisted array", s);
- }
-
- debug ("interested array size = %i", already_interested.length);
- debug ("blacklisted array size = %i", blacklisted.length);
- }
-**/
-}