aboutsummaryrefslogtreecommitdiff
path: root/src/player-item.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-07-27 16:23:31 +0100
committerConor Curran <conor.curran@canonical.com>2010-07-27 16:23:31 +0100
commited4b8a59464b94aabf311d6ba7654c243d1218f4 (patch)
tree075bc2504e749a71dc52540adffd027547fe315a /src/player-item.vala
parentc7316aef6047ef29ab71fbcd34d6932fb0e521ad (diff)
parent694340cf4123edee2d3c22173c1ac855a6b187f7 (diff)
downloadayatana-indicator-sound-ed4b8a59464b94aabf311d6ba7654c243d1218f4.tar.gz
ayatana-indicator-sound-ed4b8a59464b94aabf311d6ba7654c243d1218f4.tar.bz2
ayatana-indicator-sound-ed4b8a59464b94aabf311d6ba7654c243d1218f4.zip
ui fixes merged
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;
}
-
}