// filter the media treeview public override bool FilterMedia(Media media) { if (selected is AudioCD) return (media is AudioCDMedia); return false; }
// filter the media treeview public override bool FilterMedia(Media media) { PlaylistMedia playlist_media = (media as PlaylistMedia); if (playlist_media == null || playlist_media.Playlist == null) return false; else if (playlist_media.Playlist == selected) return find (playlist_media.Title, playlist_media.Artist, playlist_media.Album); return false; }
// filter the media treeview public override bool FilterMedia(Media media) { FolderMedia folder_media = (media as FolderMedia); if (folder_media == null || folder_media.Folder == null) return false; else if (folder_media.Folder.Visible) return find (folder_media.Title, folder_media.Artist, folder_media.Album); return false; }
// creates the popup public MediaPopup(Media media, Gdk.Pixbuf cover_art) : base(false, 5) { VBox media_info = new VBox (false, 0); HBox controls = new HBox (false, 0); Image image; if (cover_art != null) image = new Image (cover_art); else image = new Image (null, "fuse-noart.png"); Label artist = new Label (); Label title = new Label (); artist.Markup = "<b>" + Utils.ParseMarkup (media.Artist) + "</b>"; title.Markup = Utils.ParseMarkup (media.Title); time.Markup = "<small>0:00 of 0:00</small>"; Button previous = new Button (); Button next = new Button (); previous.Image = new Image (Stock.MediaPrevious, IconSize.Button); next.Image = new Image (Stock.MediaNext, IconSize.Button);; // button events previous.Clicked += previous_clicked; next.Clicked += next_clicked; this.DestroyEvent += destroy_widget; controls.PackStart (previous, false, false, 0); controls.PackStart (time, true, true, 20); controls.PackStart (next, false, false, 0); media_info.PackStart (artist, false, false, 0); media_info.PackStart (title, false, false, 5); media_info.PackStart (controls, false, false, 0); this.BorderWidth = 5; this.PackStart (image, false, false, 0); this.PackStart (media_info, false, false, 0); previous.EnterNotifyEvent += button_enter; previous.LeaveNotifyEvent += button_leave; next.EnterNotifyEvent += button_enter; next.LeaveNotifyEvent += button_leave; Global.Core.Fuse.MediaControls.MediaTimer += media_timer; }
// create the context menu public MediaContextMenu(Media media) : base() { this.media = media; ImageMenuItem play = new ImageMenuItem (Stock.MediaPlay, null); ImageMenuItem edit = new ImageMenuItem (Stock.Edit, null); MenuItem lyrics = new MenuItem ("View Lyrics"); MenuItem info = new MenuItem ("View Artist Info"); MenuItem add_to_playlist = new MenuItem ("Add To Playlist"); play.Activated += play_activated; edit.Activated += edit_activated; lyrics.Activated += lyrics_activated; info.Activated += info_activated; // the "Add To Playlist" menu Menu playlist_menu = new Menu (); add_to_playlist.Submenu = playlist_menu; foreach (object[] row in Global.Core.Library.PlaylistTree.PlaylistStore) { Playlist playlist = (Playlist) row[0]; MenuItem playlist_item = new MenuItem (playlist.Name); playlist_menu.Add (playlist_item); playlist_item.Activated += delegate (object o, EventArgs args) { Global.Core.Library.MediaTree.MediaStore.AddMedia (media.Path, playlist); }; } if (Global.Core.Library.PlaylistTree.PlaylistStore.IterNChildren () == 0) add_to_playlist.Sensitive = false; this.Add (play); this.Add (edit); this.Add (lyrics); this.Add (info); this.Add (new SeparatorMenuItem ()); this.Add (add_to_playlist); }
// the user double clicked on a row in the media library private void tree_activated(object o, RowActivatedArgs args) { TreeIter iter; filter.GetIter (out iter, args.Path); current_media = (Media) filter.GetValue (iter, 0); if (current_media is AudioCDMedia) Global.Core.Fuse.MediaControls.LoadTrack (current_media.TrackNumber, Navigate); else Global.Core.Fuse.MediaControls.LoadMedia (current_media.Path, Navigate); Gdk.Pixbuf cover_art = null; if (current_media is FileMedia) cover_art = Utils.LoadCoverArt ((current_media as FileMedia).Picture); Global.Core.Library.SetCoverArt (cover_art); string artist = Utils.ParseMarkup (current_media.Artist); string title = Utils.ParseMarkup (current_media.TitleOrFilename); Global.Core.Fuse.MediaControls.MediaInfo = string.Format (media_info_format, title, artist); this.QueueDraw (); Global.Core.PopupWidget (new MediaPopup (current_media, cover_art)); Global.Core.Library.InfoBar.LoadMedia (current_media); }
// add media to the store public void AddMedia(Media media) { Application.Invoke (delegate{ TreeIter iter = this.AppendValues (media); media.Iter = iter; }); }
// the actual removing public void RemoveMedia(Media media) { Application.Invoke (delegate{ TreeIter iter = media.Iter; this.Remove (ref iter); }); }
public abstract bool FilterMedia(Media media);