aboutsummaryrefslogtreecommitdiff
path: root/src/player-item.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-06-24 14:09:49 +0100
committerConor Curran <conor.curran@canonical.com>2010-06-24 14:09:49 +0100
commit98c55dde34ae7ed062ae22712b998ef4787b14ee (patch)
tree30497e8b64d048b9aa392469c176d0428c6b4bd9 /src/player-item.vala
parenta07a88311d4efbaa8682354c199910a8d96eb0a7 (diff)
downloadayatana-indicator-sound-98c55dde34ae7ed062ae22712b998ef4787b14ee.tar.gz
ayatana-indicator-sound-98c55dde34ae7ed062ae22712b998ef4787b14ee.tar.bz2
ayatana-indicator-sound-98c55dde34ae7ed062ae22712b998ef4787b14ee.zip
record of played application being stored correctly in keyfile
Diffstat (limited to 'src/player-item.vala')
-rw-r--r--src/player-item.vala19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/player-item.vala b/src/player-item.vala
index 09b0e6b..d1cf08c 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -28,17 +28,32 @@ public class PlayerItem : Dbusmenu.Menuitem
{
}
+ private static bool ensure_valid_updates(HashTable<string, Value?> data, HashSet<string> attributes)
+ {
+ if(data == null){
+ return false;
+ }
+ if(data.size() < attributes.size){
+ warning("update hash was too small for the target");
+ return false;
+ }
+ return true;
+ }
+
public void update(HashTable<string, Value?> data, HashSet<string> attributes)
{
debug("PlayerItem::update()");
+ if(ensure_valid_updates(data, attributes) == false){
+ debug("PlayerItem::Update -> update hash is not what we were expecting");
+ return;
+ }
foreach(string property in attributes){
string[] input_keys = property.split("-");
string search_key = input_keys[input_keys.length-1 : input_keys.length][0];
debug("search key = %s", search_key);
-
Value v = data.lookup(search_key);
-
if (v.holds (typeof (string))){
+ debug("with value : %s", v.get_string());
this.property_set(property, this.sanitize_string(v.get_string()));
}
else if (v.holds (typeof (int))){