diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-06-09 12:15:39 +0200 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-06-09 12:15:39 +0200 |
commit | 58627767fbd151587a843fd2397f1c293533664a (patch) | |
tree | b3953dd922e99747e8707dcc5dcda55263366d3d /src/metadata-menu-item.vala | |
parent | bf2c6d9d1f7ac8897c76b8917f4feaeff54816d6 (diff) | |
download | ayatana-indicator-sound-58627767fbd151587a843fd2397f1c293533664a.tar.gz ayatana-indicator-sound-58627767fbd151587a843fd2397f1c293533664a.tar.bz2 ayatana-indicator-sound-58627767fbd151587a843fd2397f1c293533664a.zip |
merged the title and metadata at the backend, now for the tricky UI work@
Diffstat (limited to 'src/metadata-menu-item.vala')
-rw-r--r-- | src/metadata-menu-item.vala | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 741bb9f..599a9c6 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -29,9 +29,9 @@ public class MetadataMenuitem : PlayerItem private static FetchFile fetcher; private string previous_temp_album_art_path; - public MetadataMenuitem() + public MetadataMenuitem (PlayerController parent) { - Object(item_type: MENUITEM_TYPE); + Object(item_type: MENUITEM_TYPE, owner: parent); reset(attributes_format()); } @@ -39,6 +39,9 @@ public class MetadataMenuitem : PlayerItem MetadataMenuitem.clean_album_art_temp_dir(); this.previous_temp_album_art_path = null; this.album_art_cache_dir = MetadataMenuitem.create_album_art_temp_dir(); + this.property_set(MENUITEM_PLAYER_NAME, this.owner.app_info.get_name()); + this.property_set(MENUITEM_PLAYER_ICON, this.owner.icon_name); + this.property_set_bool(MENUITEM_PLAYER_RUNNING, false); } private static void clean_album_art_temp_dir() @@ -135,7 +138,7 @@ public class MetadataMenuitem : PlayerItem PixbufLoader loader = new PixbufLoader (); loader.write (update.data); loader.close (); - Pixbuf icon = loader.get_pixbuf (); + Pixbuf icon = loader.get_pixbuf (); string path = this.album_art_cache_dir.concat("/downloaded-coverart-XXXXXX"); int r = FileUtils.mkstemp(path); if(r != -1){ @@ -152,7 +155,31 @@ public class MetadataMenuitem : PlayerItem e.message); } } + + public override void handle_event (string name, + Variant input_value, + uint timestamp) + { + if(this.owner.current_state == PlayerController.state.OFFLINE) + { + this.owner.instantiate(); + } + else if(this.owner.current_state == PlayerController.state.CONNECTED){ + this.owner.mpris_bridge.expose(); + } + } + public void alter_label (string new_title) + { + if (new_title == null) return; + this.property_set (MENUITEM_PLAYER_NAME, new_title); + } + + public void toggle_active_triangle (bool update) + { + this.property_set_bool (MENUITEM_PLAYER_RUNNING, update); + } + public static HashSet<string> attributes_format() { HashSet<string> attrs = new HashSet<string>(); @@ -160,6 +187,9 @@ public class MetadataMenuitem : PlayerItem attrs.add(MENUITEM_ARTIST); attrs.add(MENUITEM_ALBUM); attrs.add(MENUITEM_ARTURL); + attrs.add(MENUITEM_PLAYER_NAME); + attrs.add(MENUITEM_PLAYER_ICON); + attrs.add(MENUITEM_PLAYER_RUNNING); return attrs; - } + } } |