aboutsummaryrefslogtreecommitdiff
path: root/src/player-item.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-07-27 12:39:51 +0100
committerConor Curran <conor.curran@canonical.com>2010-07-27 12:39:51 +0100
commit91aa6c3f4cdf7fdf3c5b96fa9c24c6ba089c8c42 (patch)
tree2641eef839967e2c6b26f35d24540ed3365a791b /src/player-item.vala
parentc7316aef6047ef29ab71fbcd34d6932fb0e521ad (diff)
downloadayatana-indicator-sound-91aa6c3f4cdf7fdf3c5b96fa9c24c6ba089c8c42.tar.gz
ayatana-indicator-sound-91aa6c3f4cdf7fdf3c5b96fa9c24c6ba089c8c42.tar.bz2
ayatana-indicator-sound-91aa6c3f4cdf7fdf3c5b96fa9c24c6ba089c8c42.zip
tidy ups across the ui
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;
}
-
}