From 91aa6c3f4cdf7fdf3c5b96fa9c24c6ba089c8c42 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 27 Jul 2010 12:39:51 +0100 Subject: tidy ups across the ui --- src/player-controller.vala | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'src/player-controller.vala') 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(); - 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() -- cgit v1.2.3 From 06e8e90161cec524e5a875aa709b96d5489ae91a Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 28 Jul 2010 18:20:04 +0100 Subject: playlist mock up landed --- src/player-controller.vala | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 7ba2a70..2fa9dd2 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,14 +23,15 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 6; public static enum widget_order{ SEPARATOR, TITLE, METADATA, SCRUB, - TRANSPORT + TRANSPORT, + PLAYLIST } public enum state{ @@ -133,6 +134,8 @@ public class PlayerController : GLib.Object 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); + this.custom_items[widget_order.PLAYLIST].property_set_bool(MENUITEM_PROP_VISIBLE, false); return; } @@ -146,8 +149,10 @@ public class PlayerController : GLib.Object this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, - this.current_state == state.CONNECTED); - + true); + + this.custom_items[widget_order.PLAYLIST].property_set_bool(MENUITEM_PROP_VISIBLE, + true); } private void construct_widgets() @@ -170,12 +175,34 @@ public class PlayerController : GLib.Object // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); - + + this.custom_items.add(create_playlist()); foreach(PlayerItem item in this.custom_items){ root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); } } + + private PlayerItem create_playlist() + { + PlayerItem playlist_root = new PlayerItem(CLIENT_TYPES_DEFAULT); + playlist_root.property_set(MENUITEM_PROP_LABEL, "Choose Playlist"); + + PlayerItem subentry_1 = new PlayerItem(CLIENT_TYPES_DEFAULT); + subentry_1.property_set(MENUITEM_PROP_LABEL, "90's Warp"); + + PlayerItem subentry_2 = new PlayerItem(CLIENT_TYPES_DEFAULT); + subentry_2.property_set(MENUITEM_PROP_LABEL, "Rune Grammafon 00's"); + + PlayerItem subentry_3 = new PlayerItem(CLIENT_TYPES_DEFAULT); + subentry_3.property_set(MENUITEM_PROP_LABEL, "Kranky pics"); + + playlist_root.child_append(subentry_1); + playlist_root.child_append(subentry_2); + playlist_root.child_append(subentry_3); + + return playlist_root; + } private static string format_client_name(string client_name) { -- cgit v1.2.3 From a100dc24a2eb10a1f63be5391b97700032a16111 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 29 Jul 2010 13:19:00 +0100 Subject: tweaked the spacing and the transport bar dimensions - getting very close to sign off --- src/player-controller.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 2fa9dd2..fc5ca9b 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -189,13 +189,13 @@ public class PlayerController : GLib.Object playlist_root.property_set(MENUITEM_PROP_LABEL, "Choose Playlist"); PlayerItem subentry_1 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_1.property_set(MENUITEM_PROP_LABEL, "90's Warp"); + subentry_1.property_set(MENUITEM_PROP_LABEL, "Raster-noton selection"); PlayerItem subentry_2 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_2.property_set(MENUITEM_PROP_LABEL, "Rune Grammafon 00's"); + subentry_2.property_set(MENUITEM_PROP_LABEL, "Rune Grammofon selection"); PlayerItem subentry_3 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_3.property_set(MENUITEM_PROP_LABEL, "Kranky pics"); + subentry_3.property_set(MENUITEM_PROP_LABEL, "Kranky selection"); playlist_root.child_append(subentry_1); playlist_root.child_append(subentry_2); -- cgit v1.2.3