aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/player-controller.vala')
-rw-r--r--src/player-controller.vala66
1 files changed, 8 insertions, 58 deletions
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 33a5b1a..bccf586 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -43,14 +43,11 @@ public class PlayerController : GLib.Object
}
public int current_state = state.OFFLINE;
-
-
+
private Dbusmenu.Menuitem root_menu;
public string name { get; set;}
public ArrayList<PlayerItem> custom_items;
- public Mpris2Controller mpris2_adaptor;
- public MprisController mpris_adaptor;
- public bool mpris2;
+ public MprisBridge mpris_bridge;
public AppInfo? app_info { get; set;}
public int menu_offset { get; set;}
@@ -77,7 +74,6 @@ public class PlayerController : GLib.Object
public void activate()
{
this.establish_mpris_connection();
- //this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true);
}
/*
@@ -104,14 +100,7 @@ public class PlayerController : GLib.Object
debug("establish_mpris_connection - Not ready to connect");
return;
}
- if(this.name == "Vlc"){
- debug("establishing a vlc mpris controller");
- this.mpris2_adaptor = new Mpris2Controller(this);
- this.mpris2 = true;
- }
- else{
- this.mpris_adaptor = new MprisController(this);
- }
+ this.mpris_bridge = new MprisBridge();
this.determine_state();
}
@@ -144,19 +133,12 @@ public class PlayerController : GLib.Object
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("metadata id %i", this.custom_items[widget_order.METADATA].id);
-
- debug("update layout - scrub %s", this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format()).to_string());
+ this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));
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,
true);
-
this.custom_items[widget_order.PLAYLIST].property_set_bool(MENUITEM_PROP_VISIBLE,
true);
}
@@ -223,45 +205,13 @@ public class PlayerController : GLib.Object
// Temporarily we will need to handle to different mpris implemenations
// Do it for now - a couple of weeks should see this messy carry on out of
// the codebase.
- public void set_track_position(double pos)
- {
- if(this.mpris2 == true){
- this.mpris2_adaptor.set_position(pos);
- }
- else{
- this.mpris_adaptor.set_position(pos);
- }
- }
-
- public void transport_update(TransportMenuitem.action update)
- {
- if(this.mpris2 == true){
- this.mpris2_adaptor.transport_event(update);
- }
- else{
- this.mpris_adaptor.transport_event(update);
- }
- }
-
public void determine_state()
{
- if(this.mpris2 == true){
- if(this.mpris2_adaptor.connected() == true){
- debug("yup I'm connected");
- this.update_state(state.CONNECTED);
- }
- else{
- this.update_state(state.DISCONNECTED);
- }
+ if(this.mpris_bridge.connected() == true){
+ this.update_state(state.CONNECTED);
}
else{
- if(this.mpris_adaptor.connected() == true){
- debug("yup I'm connected");
- this.update_state(state.CONNECTED);
- }
- else{
- this.update_state(state.DISCONNECTED);
- }
- }
+ this.update_state(state.DISCONNECTED);
+ }
}
} \ No newline at end of file