public PlayQueueSource() : base(Catalog.GetString("Play Queue"), null) { BindToDatabase(); TypeUniqueId = DbId.ToString(); Initialize(); AfterInitialized(); Order = 20; Properties.SetString("Icon.Name", "source-playlist"); Properties.SetString("RemoveTracksActionLabel", Catalog.GetString("Remove From Play Queue")); DatabaseTrackModel.ForcedSortQuery = "CorePlaylistEntries.ViewOrder ASC, CorePlaylistEntries.EntryID ASC"; DatabaseTrackModel.CanReorder = true; ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent); ServiceManager.PlaybackController.TrackStarted += OnTrackStarted; // TODO change this Gtk.Action code so that the actions can be removed. And so this // class doesn't depend on Gtk/ThickClient. actions = new PlayQueueActions(this); Properties.SetString("ActiveSourceUIResource", "ActiveSourceUI.xml"); Properties.SetString("GtkActionPath", "/PlayQueueContextMenu"); // TODO listen to all primary sources, and handle transient primary sources ServiceManager.SourceManager.MusicLibrary.TracksChanged += HandleTracksChanged; ServiceManager.SourceManager.MusicLibrary.TracksDeleted += HandleTracksDeleted; ServiceManager.SourceManager.VideoLibrary.TracksChanged += HandleTracksChanged; ServiceManager.SourceManager.VideoLibrary.TracksDeleted += HandleTracksDeleted; populate_from = ServiceManager.SourceManager.Sources.FirstOrDefault( source => source.Name == populate_from_name) as DatabaseSource; if (populate_from != null) { populate_from.Reload(); } TrackModel.Reloaded += HandleReloaded; int saved_offset = DatabaseConfigurationClient.Client.Get(CurrentOffsetSchema, CurrentOffsetSchema.Get()); Offset = Math.Min( saved_offset, ServiceManager.DbConnection.Query <long> (@" SELECT MAX(ViewOrder) + 1 FROM CorePlaylistEntries WHERE PlaylistID = ?", DbId)); ServiceManager.SourceManager.AddSource(this); }
public PlayQueueSource () : base (Catalog.GetString ("Play Queue"), null) { BindToDatabase (); TypeUniqueId = DbId.ToString (); Initialize (); AfterInitialized (); Order = 20; Properties.SetString ("Icon.Name", "source-playlist"); Properties.SetString ("RemoveTracksActionLabel", Catalog.GetString ("Remove From Play Queue")); DatabaseTrackModel.ForcedSortQuery = "CorePlaylistEntries.ViewOrder ASC, CorePlaylistEntries.EntryID ASC"; DatabaseTrackModel.CanReorder = true; ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent); ServiceManager.PlaybackController.TrackStarted += OnTrackStarted; // TODO change this Gtk.Action code so that the actions can be removed. And so this // class doesn't depend on Gtk/ThickClient. actions = new PlayQueueActions (this); Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml"); Properties.SetString ("GtkActionPath", "/PlayQueueContextMenu"); // TODO listen to all primary sources, and handle transient primary sources ServiceManager.SourceManager.MusicLibrary.TracksChanged += HandleTracksChanged; ServiceManager.SourceManager.MusicLibrary.TracksDeleted += HandleTracksDeleted; ServiceManager.SourceManager.VideoLibrary.TracksChanged += HandleTracksChanged; ServiceManager.SourceManager.VideoLibrary.TracksDeleted += HandleTracksDeleted; populate_from = ServiceManager.SourceManager.Sources.FirstOrDefault ( source => source.Name == populate_from_name) as DatabaseSource; if (populate_from != null) { populate_from.Reload (); } TrackModel.Reloaded += HandleReloaded; int saved_offset = DatabaseConfigurationClient.Client.Get (CurrentOffsetSchema, CurrentOffsetSchema.Get ()); Offset = Math.Min ( saved_offset, ServiceManager.DbConnection.Query<long> (@" SELECT MAX(ViewOrder) + 1 FROM CorePlaylistEntries WHERE PlaylistID = ?", DbId)); ServiceManager.SourceManager.AddSource (this); }