aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.vala
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-07-22 21:04:26 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-07-22 21:04:26 +0200
commit1777ee4291dc792ca3d4df087c8af23cd8458961 (patch)
tree101cc9ea1b424973a7c43cd7ce7bb9c4f9ac66aa /src/player-controller.vala
parentf6ffb190261dfdbbf55e90b63c1cd06f03037e35 (diff)
parentc7316aef6047ef29ab71fbcd34d6932fb0e521ad (diff)
downloadayatana-indicator-sound-1777ee4291dc792ca3d4df087c8af23cd8458961.tar.gz
ayatana-indicator-sound-1777ee4291dc792ca3d4df087c8af23cd8458961.tar.bz2
ayatana-indicator-sound-1777ee4291dc792ca3d4df087c8af23cd8458961.zip
Import upstream version 0.3.8
Diffstat (limited to 'src/player-controller.vala')
-rw-r--r--src/player-controller.vala42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/player-controller.vala b/src/player-controller.vala
index d272d14..f824d6f 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -23,8 +23,15 @@ using Gee;
public class PlayerController : GLib.Object
{
- public const int METADATA = 2;
- private const int TRANSPORT = 3;
+ public const int WIDGET_QUANTITY = 5;
+
+ public static enum widget_order{
+ SEPARATOR,
+ TITLE,
+ METADATA,
+ SCRUB,
+ TRANSPORT
+ }
public enum state{
OFFLINE,
@@ -51,22 +58,22 @@ public class PlayerController : GLib.Object
this.custom_items = new ArrayList<PlayerItem>();
this.update_state(initial_state);
this.menu_offset = offset;
- debug("offset = %i", offset);
construct_widgets();
establish_mpris_connection();
- update_layout();
+ this.update_layout();
}
public void update_state(state new_state)
{
debug("update_state - player controller %s : new state %i", this.name, new_state);
this.current_state = new_state;
+ //this.update_layout();
}
public void activate()
{
this.establish_mpris_connection();
- this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true);
+ this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true);
}
/*
@@ -119,22 +126,24 @@ public class PlayerController : GLib.Object
}
}
- private void update_layout()
+ public void update_layout()
{
bool visibility = true;
- if(this.current_state != state.CONNECTED){
+ 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[TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
- this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
+ 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(this.mpris_adaptor == null){
- warning("Why is the mpris object null");
+ if(visibility == false){
+ warning("Update layout of client %s is setting widgets to invisibile!", this.name);
}
}
-
-
+
private void construct_widgets()
{
// Separator item
@@ -147,11 +156,16 @@ public class PlayerController : GLib.Object
// Metadata item
MetadataMenuitem metadata_item = new MetadataMenuitem();
this.custom_items.add(metadata_item);
-
+
+ // Scrub item
+ ScrubMenuitem scrub_item = new ScrubMenuitem(this);
+ this.custom_items.add(scrub_item);
+
// Transport item
TransportMenuitem transport_item = new TransportMenuitem(this);
this.custom_items.add(transport_item);
+
foreach(PlayerItem item in this.custom_items){
root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item));
}