aboutsummaryrefslogtreecommitdiff
path: root/src/player-item.vala
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-07-29 11:26:41 -0400
committerKen VanDine <ken.vandine@canonical.com>2010-07-29 11:26:41 -0400
commit986fc648fc6544aaa3bb40a17e1345e0247a4b57 (patch)
treeda2904b0c642c44d65629a9657b550c2c26a7b08 /src/player-item.vala
parent1777ee4291dc792ca3d4df087c8af23cd8458961 (diff)
parent859c48c87009fb12e0acc15fdeb8d69e42247176 (diff)
downloadayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.tar.gz
ayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.tar.bz2
ayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.zip
Import upstream version 0.3.9
Diffstat (limited to 'src/player-item.vala')
-rw-r--r--src/player-item.vala34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/player-item.vala b/src/player-item.vala
index 2952f71..288ac47 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -24,7 +24,8 @@ public class PlayerItem : Dbusmenu.Menuitem
{
public PlayerController owner {get; construct;}
public string item_type { get; construct; }
-
+ private const int EMPTY = -1;
+
public PlayerItem(string type)
{
Object(item_type: type);
@@ -36,17 +37,16 @@ public class PlayerItem : Dbusmenu.Menuitem
public void reset(HashSet<string> attrs){
foreach(string s in attrs){
- debug("attempting to set prop %s to null", s);
- this.property_set(s, null);
- this.property_set_int(s, 0);
+ debug("attempting to set prop %s to EMPTY", s);
+ this.property_set_int(s, EMPTY);
}
}
public void update(HashTable<string, Value?> data, HashSet<string> attributes)
{
debug("PlayerItem::update()");
- if(ensure_valid_updates(data, attributes) == false){
- debug("PlayerItem::Update -> The hashtable update does not contain what we were expecting - just leave it!");
+ if(data == null){
+ debug("PlayerItem::Update -> The hashtable was null - just leave it!");
return;
}
@@ -82,19 +82,21 @@ public class PlayerItem : Dbusmenu.Menuitem
this.property_set_bool(property, v.get_boolean());
}
}
+ if(this.property_get_bool(MENUITEM_PROP_VISIBLE) == false){
+ this.property_set_bool(MENUITEM_PROP_VISIBLE, true);
+ }
}
-
- private static bool ensure_valid_updates(HashTable<string, Value?> data, HashSet<string> attributes)
+
+ public bool populated(HashSet<string> attrs)
{
- if(data == null){
- return false;
+ foreach(string prop in attrs){
+ int value_int = property_get_int(prop);
+ debug("populate - prop %s and value %i", prop, value_int);
+ if(property_get_int(prop) != EMPTY){
+ return true;
+ }
}
- /*if(data.size() < attributes.size){
- warning("update hash was too small for the target");
- return false;
- }*/
- return true;
+ return false;
}
-
}