From 71d315d3abec5b62e43b821232d70262bec92bd1 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 16 Jun 2010 18:19:35 +0100 Subject: metadata being updated dynamically --- src/player-controller.vala | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index dcb428b..4c09c12 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -1,12 +1,35 @@ +/* +This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + + using Dbusmenu; using Gee; public class PlayerController : GLib.Object { + private const int METADATA = 2; private Dbusmenu.Menuitem root_menu; private string name; private bool is_active; private ArrayList custom_items; + private MprisController mpris_adaptor; // TODO: pass in the appropriate position for the menu (to handle multiple players) public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) @@ -16,6 +39,12 @@ public class PlayerController : GLib.Object this.is_active = active; this.custom_items = new ArrayList(); self_construct(); + // Temporary scenario to handle both v1 and v2 of MPRIS. + if(this.name == "Vlc"){ + this.mpris_adaptor = new MprisControllerV2(this.name, this); + }else{ + this.mpris_adaptor = new MprisController(this.name, this); + } } public void vanish() @@ -52,7 +81,13 @@ public class PlayerController : GLib.Object } return true; } - + + public void update_playing_info(HashMap data) + { + debug("PlayerController - update_playing_info"); + MetadataMenuitem item = (MetadataMenuitem)this.custom_items[METADATA]; + item.update(data); + } private static string format_client_name(string client_name) { -- cgit v1.2.3 From 05e82f2c6a8a72aeb3a589b702e5a9f1d68251d9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 17 Jun 2010 16:41:54 +0100 Subject: transport plugged in --- src/player-controller.vala | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 4c09c12..aa72cac 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -18,20 +18,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - using Dbusmenu; using Gee; public class PlayerController : GLib.Object { - private const int METADATA = 2; + private const int METADATA = 2; + private const int TRANSPORT = 3; + private Dbusmenu.Menuitem root_menu; private string name; private bool is_active; private ArrayList custom_items; private MprisController mpris_adaptor; - // TODO: pass in the appropriate position for the menu (to handle multiple players) public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) { this.root_menu = root; @@ -39,12 +39,20 @@ public class PlayerController : GLib.Object this.is_active = active; this.custom_items = new ArrayList(); self_construct(); + // Temporary scenario to handle both v1 and v2 of MPRIS. if(this.name == "Vlc"){ this.mpris_adaptor = new MprisControllerV2(this.name, this); - }else{ + } + else{ this.mpris_adaptor = new MprisController(this.name, this); - } + } + + // TODO subclass dbusmenuMenuitem to something like a playermenuitem + // and use this type to collectively + // control widgets. + TransportMenuitem t = (TransportMenuitem)this.custom_items[TRANSPORT]; + t.set_adaptor(this.mpris_adaptor); } public void vanish() -- cgit v1.2.3