예제 #1
0
 void IDisposable.Dispose()
 {
     UnsetIcon();
     //UnsetTrackProgress();
     service = null;
     awn     = null;
 }
예제 #2
0
 public MediaPlayer()
 {
     playback_service       = ServiceManager.PlaybackController;
     engine_service         = ServiceManager.PlayerEngine;
     playlist_sources       = new Dictionary <string, AbstractPlaylistSource> ();
     changed_properties     = new Dictionary <string, object> ();
     invalidated_properties = new List <string> ();
 }
        void IExtensionService.Initialize()
        {
            elements_service         = ServiceManager.Get <GtkElementsService> ();
            interface_action_service = ServiceManager.Get <InterfaceActionService> ();
            source_manager           = ServiceManager.SourceManager;
            player = ServiceManager.PlayerEngine;

            if (!ServiceStartup())
            {
                ServiceManager.ServiceStarted += OnServiceStarted;
            }
        }
예제 #4
0
        public MediaPlayer()
        {
            playback_service       = ServiceManager.PlaybackController;
            engine_service         = ServiceManager.PlayerEngine;
            playlist_sources       = new Dictionary <string, AbstractPlaylistSource> ();
            changed_properties     = new Dictionary <string, object> ();
            current_properties     = new Dictionary <string, object> ();
            invalidated_properties = new List <string> ();

            var interface_service = ServiceManager.Get <InterfaceActionService> ();

            fullscreen_action = interface_service.ViewActions["FullScreenAction"] as Gtk.ToggleAction;
        }
예제 #5
0
        protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
        {
            PlayerEngineService player = ServiceManager.PlayerEngine;

            bool control = (evnt.State & Gdk.ModifierType.ShiftMask) != 0;
            bool shift   = (evnt.State & Gdk.ModifierType.ControlMask) != 0;
            bool mod     = control || shift;

            uint fixed_seek = 15000;                                                         // 15 seconds
            uint fast_seek  = player.Length > 0 ? (uint)(player.Length * 0.15) : fixed_seek; // 15% or fixed
            uint slow_seek  = player.Length > 0 ? (uint)(player.Length * 0.05) : fixed_seek; // 5% or fixed

            switch (evnt.Key)
            {
            case Gdk.Key.F11:
            case Gdk.Key.Escape:
                Hide();
                return(true);

            case Gdk.Key.C:
            case Gdk.Key.c:
            case Gdk.Key.V:
            case Gdk.Key.v:
            case Gdk.Key.Return:
            case Gdk.Key.KP_Enter:
            case Gdk.Key.Tab:
                if (controls == null || !controls.Visible)
                {
                    ShowControls();
                }
                else
                {
                    HideControls();
                }
                return(true);

            case Gdk.Key.Right:
            case Gdk.Key.rightarrow:
                player.Position += mod ? fast_seek : slow_seek;
                ShowControls();
                break;

            case Gdk.Key.Left:
            case Gdk.Key.leftarrow:
                player.Position -= mod ? fast_seek : slow_seek;
                ShowControls();
                break;
            }

            return(base.OnKeyPressEvent(evnt));
        }
        void IExtensionService.Initialize()
        {
            try {
                Log.DebugFormat("BansheeAwn. Starting {0}", Application.ActiveClient.ClientId);

                awn = DBus.Bus.Session.GetObject <IAvantWindowNavigator> ("com.google.code.Awn",
                                                                          new DBus.ObjectPath("/com/google/code/Awn"));

                // Dummy call to check that awn is really there
                awn.UnsetTaskIconByName("banshee-dummy");

                service = ServiceManager.PlayerEngine;
                service.ConnectEvent(new PlayerEventHandler(this.OnEventChanged));

                Log.Debug("BansheeAwn - Initialized");
            } catch (Exception ex) {
                Log.Warning("BansheeAwn - Failed loading Awn Extension. ", ex);
                awn = null;
            }
        }
        private void OnServiceStarted(ServiceStartedArgs args)
        {
            if (args.Service is Banshee.Gui.InterfaceActionService)
            {
                interface_action_service = (InterfaceActionService)args.Service;
            }
            else if (args.Service is GtkElementsService)
            {
                elements_service = (GtkElementsService)args.Service;
            }
            else if (args.Service is SourceManager)
            {
                source_manager = ServiceManager.SourceManager;
            }
            else if (args.Service is PlayerEngineService)
            {
                player = ServiceManager.PlayerEngine;
            }

            ServiceStartup();
        }
        public PlaybackControllerService()
        {
            InstantiateStacks();

            player_engine = ServiceManager.PlayerEngine;
            player_engine.PlayWhenIdleRequest += OnPlayerEnginePlayWhenIdleRequest;
            player_engine.ConnectEvent(OnPlayerEvent,
                                       PlayerEvent.EndOfStream |
                                       PlayerEvent.StartOfStream |
                                       PlayerEvent.StateChange |
                                       PlayerEvent.Error,
                                       true);

            ServiceManager.SourceManager.ActiveSourceChanged += delegate {
                ITrackModelSource active_source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
                if (active_source != null && source_auto_set_at == source_set_at && !player_engine.IsPlaying())
                {
                    Source             = active_source;
                    source_auto_set_at = source_set_at;
                }
            };
        }
예제 #9
0
        void IExtensionService.Initialize()
        {
            try
            {
                Log.Debug("BansheeAwn. Starting..." + Banshee.ServiceStack.Application.ActiveClient.ClientId);

                awn = NDesk.DBus.Bus.Session.GetObject <IAvantWindowNavigator> ("com.google.code.Awn",
                                                                                new NDesk.DBus.ObjectPath("/com/google/code/Awn"));
                if (awn == null)
                {
                    throw new NullReferenceException();
                }
                service = ServiceManager.PlayerEngine;

                service.ConnectEvent(new PlayerEventHandler(this.OnEventChanged));

                Log.Debug("BansheeAwn - Initialized");
            }
            catch (Exception ex)
            {
                Log.Debug("BansheeAwn - Failed loading Awn Extension. " + ex.Message);
            }
        }