aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.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-controller.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-controller.vala')
-rw-r--r--src/player-controller.vala42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/player-controller.vala b/src/player-controller.vala
index f824d6f..7ba2a70 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -56,7 +56,7 @@ public class PlayerController : GLib.Object
this.root_menu = root;
this.name = format_client_name(client_name.strip());
this.custom_items = new ArrayList<PlayerItem>();
- this.update_state(initial_state);
+ this.current_state = initial_state;
this.menu_offset = offset;
construct_widgets();
establish_mpris_connection();
@@ -67,7 +67,7 @@ public class PlayerController : GLib.Object
{
debug("update_state - player controller %s : new state %i", this.name, new_state);
this.current_state = new_state;
- //this.update_layout();
+ this.update_layout();
}
public void activate()
@@ -108,7 +108,7 @@ public class PlayerController : GLib.Object
else{
this.mpris_adaptor = new MprisController(this);
}
-
+ // TODO refactor
if(this.mpris_adaptor.connected() == true){
debug("yup I'm connected");
this.update_state(state.CONNECTED);
@@ -116,7 +116,6 @@ public class PlayerController : GLib.Object
else{
this.update_state(state.DISCONNECTED);
}
- this.update_layout();
}
public void vanish()
@@ -127,21 +126,28 @@ public class PlayerController : GLib.Object
}
public void update_layout()
- {
- bool visibility = true;
- MetadataMenuitem meta_item = this.custom_items[widget_order.METADATA] as MetadataMenuitem;
- if(this.current_state != state.CONNECTED /*||
- meta_item.not_populated()*/){
- visibility = false;
- }
- debug("about the set the visibility on both the transport and metadata widget to %s", visibility.to_string());
- this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
- this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
- this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
- // DEBUG
- if(visibility == false){
- warning("Update layout of client %s is setting widgets to invisibile!", this.name);
+ {
+ if(this.current_state != state.CONNECTED){
+ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,
+ false);
+ this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE,
+ false);
+ this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,
+ false);
+ return;
}
+
+ debug("update layout - metadata %s", this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()).to_string());
+ this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,
+ this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));
+ debug("update layout - scrub %s", this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format()).to_string());
+ this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE,
+ this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format()));
+
+
+ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,
+ this.current_state == state.CONNECTED);
+
}
private void construct_widgets()