void IExtensionService.Initialize () { if (!DBusConnection.Enabled) { return; } ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StartOfStream | PlayerEvent.StateChange | PlayerEvent.TrackInfoUpdated | PlayerEvent.Seek | PlayerEvent.Volume); ServiceManager.PlaybackController.RepeatModeChanged += OnRepeatModeChanged; ServiceManager.PlaybackController.ShuffleModeChanged += OnShuffleModeChanged; ServiceManager.SourceManager.SourceAdded += OnSourceCountChanged; ServiceManager.SourceManager.SourceRemoved += OnSourceCountChanged; ServiceManager.SourceManager.SourceUpdated += OnSourceUpdated; ServiceManager.PlaybackController.SourceChanged += OnPlayingSourceChanged; player = new MediaPlayer(); Bus.Session.Register (MediaPlayer.Path, player); if (Bus.Session.RequestName (bus_name) != RequestNameReply.PrimaryOwner) { Hyena.Log.Warning ("MPRIS service couldn't grab bus name"); return; } }
void IExtensionService.Initialize() { if (!DBusConnection.Enabled) { return; } ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StartOfStream | PlayerEvent.StateChange | PlayerEvent.TrackInfoUpdated | PlayerEvent.Seek | PlayerEvent.Volume); ServiceManager.PlaybackController.RepeatModeChanged += OnRepeatModeChanged; ServiceManager.PlaybackController.ShuffleModeChanged += OnShuffleModeChanged; ServiceManager.SourceManager.SourceAdded += OnSourceCountChanged; ServiceManager.SourceManager.SourceRemoved += OnSourceCountChanged; ServiceManager.SourceManager.SourceUpdated += OnSourceUpdated; ServiceManager.PlaybackController.SourceChanged += OnPlayingSourceChanged; var interface_service = ServiceManager.Get<InterfaceActionService> (); var fullscreen_action = interface_service.ViewActions["FullScreenAction"]; if (fullscreen_action != null) { fullscreen_action.Activated += OnFullScreenToggled; } player = new MediaPlayer(); Bus.Session.Register (MediaPlayer.Path, player); if (Bus.Session.RequestName (bus_name) != RequestNameReply.PrimaryOwner) { Hyena.Log.Warning ("MPRIS service couldn't grab bus name"); return; } }