aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-06-21 19:36:21 +0100
committerConor Curran <conor.curran@canonical.com>2010-06-21 19:36:21 +0100
commit6e001f4e0606bce9d3eb070df97d44a7b10081c5 (patch)
tree74373818cebb4d313b7d6d7988b104e8e2ff85c5 /src
parent7be2c7248a0b29ea74e8e36db405d5974995a57b (diff)
downloadayatana-indicator-sound-6e001f4e0606bce9d3eb070df97d44a7b10081c5.tar.gz
ayatana-indicator-sound-6e001f4e0606bce9d3eb070df97d44a7b10081c5.tar.bz2
ayatana-indicator-sound-6e001f4e0606bce9d3eb070df97d44a7b10081c5.zip
wip
Diffstat (limited to 'src')
-rw-r--r--src/common-defs.h2
-rw-r--r--src/metadata-menu-item.vala13
-rw-r--r--src/mpris-controller.vala13
-rw-r--r--src/player-controller.vala17
-rw-r--r--src/player-item.vala32
-rw-r--r--src/transport-menu-item.vala8
6 files changed, 50 insertions, 35 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index 1e53e07..c12d9c1 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -33,4 +33,4 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist"
#define DBUSMENU_METADATA_MENUITEM_TEXT_TITLE "x-canonical-metadata-text-title"
#define DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM "x-canonical-metadata-text-album"
-#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-image"
+#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-arturl"
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index 5464074..8d626ca 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -33,19 +33,8 @@ public class MetadataMenuitem : PlayerItem
results.set(MENUITEM_TEXT_TITLE, typeof(string));
results.set(MENUITEM_TEXT_ARTIST, typeof(string));
results.set(MENUITEM_TEXT_ALBUM, typeof(string));
- results.set(MENUITEM_TEXT_ARTURL, typeof(string));
+ results.set(MENUITEM_ARTURL, typeof(string));
return results;
}
-
- public static HashMap<string, string> format_updates(HashMap<string, Value?> data)
- {
- HashMap<string,string> results = new HashMap<string, string>();
-
- results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip());
- results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip());
- results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string));
- results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string));
- return results;
- }
} \ No newline at end of file
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index 98473ad..c71662a 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -44,17 +44,18 @@ public class MprisController : GLib.Object
this.mpris_player = this.connection.get_object ("org.mpris.".concat(name.down()) , "/Player", mpris_interface);
this.mpris_player.TrackChange += onTrackChange;
this.mpris_player.StatusChange += onStatusChange;
- this.controller.update_playing_info(get_track_data());
+ //this.controller.update_playing_info(get_track_data());
}
- public HashMap<string, string> get_track_data()
- {
- return format_metadata(this.mpris_player.GetMetadata());
- }
+ //public HashMap<string, string> get_track_data()
+ //{
+ //return format_metadata(this.mpris_player.GetMetadata());
+ //}
private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht)
{
- this.controller.update_playing_info(MetadataMenuitem.format_updates(ht));
+ this.controller.custom_items[this.controller.METADATA].update(ht,
+ MetadataMenuitem.attributes_format());
}
/**
diff --git a/src/player-controller.vala b/src/player-controller.vala
index ef1e130..862bb29 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -23,13 +23,13 @@ using Gee;
public class PlayerController : GLib.Object
{
- private const int METADATA = 2;
+ public const int METADATA = 2;
private const int TRANSPORT = 3;
private Dbusmenu.Menuitem root_menu;
private string name;
private bool is_active;
- private ArrayList<PlayerItem> custom_items;
+ public ArrayList<PlayerItem> custom_items;
private MprisController mpris_adaptor;
public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active)
@@ -47,7 +47,6 @@ public class PlayerController : GLib.Object
else{
this.mpris_adaptor = new MprisController(this.name, this);
}
-
this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor);
}
@@ -81,12 +80,12 @@ public class PlayerController : GLib.Object
return true;
}
- public void update_playing_info(HashMap<string, string> data)
- {
- debug("PlayerController - update_playing_info");
- MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem;
- item.update(data);
- }
+ //public void update_playing_info(HashMap<string, string> data)
+ //{
+ // debug("PlayerController - update_playing_info");
+ // MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem;
+ // item.update(data, MetadataMenuitem.attributes_format());
+ //}
private static string format_client_name(string client_name)
{
diff --git a/src/player-item.vala b/src/player-item.vala
index 10dedc2..ee09074 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -29,11 +29,26 @@ public class PlayerItem : Dbusmenu.Menuitem
{
}
- public void update(HashMap<string, Value?> data, Type type)
+ public void update(HashTable<string, Value?> data, HashMap<string, Type> attributes)
{
debug("PlayerItem::update()");
- HashMap<string, Type> attributes = type.attributes_format();
- foreach(var property in data){
+ foreach(var property in attributes){
+ //debug("property value = %s", attributes.get(property.key).name());
+ GLib.Object obj = GLib.Object.new(attributes.get(property.key));
+ debug("bang line");
+ Type t = obj.get_type();
+ if(t.is_a(typeof(string)) == true){
+ debug("obj is a string !!! we can tell -halla fucking lula!");
+ }
+ //string[] input_keys = property.key.split("-");
+ //string search_key = input_keys[input_keys.length-1 : input_keys.length][0];
+ //debug("key parsed from properties is %s", search_key);
+ //debug("and the bloody type should be %s", property.value.name());
+ //var input_value = data.lookup(search_key) as property.value.name();
+ //foreach(var s in input_keys){
+ // debug("string = %s", s);
+ //}
+ //string[] st = input_keys[input_keys.length-1 : input_keys.length];
//property.value as attributes.get(property.key)
//this.property_set(property.key, );
}
@@ -44,6 +59,17 @@ public class PlayerItem : Dbusmenu.Menuitem
this.mpris_adaptor = adaptor;
}
+ public static HashMap<string, string> format_updates(HashTable<string,Value?> ht)
+ {
+ HashMap<string,string> results = new HashMap<string, string>();
+ //HashMap<string, Type> attrs = attributes_format();
+ //results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip());
+ //results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip());
+ //results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string));
+ //results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string));
+ return results;
+ }
+
// Bespoke constructors for player items
// Title item
public static PlayerItem new_title_item(dynamic string name)
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index 7dc1c7f..bfa81d3 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -34,10 +34,10 @@ public class TransportMenuitem : PlayerItem
debug("transport on the vala side");
}
- public override void update(HashMap<string, string> data)
- {
- debug("TransportMenuitem::update()");
- }
+ //public override void update(HashMap<string, string> data)
+ //{
+ // debug("TransportMenuitem::update()");
+ //}
public override void handle_event(string name, GLib.Value input_value, uint timestamp)
{