コード例 #1
0
        public BaseClientWindow(string title, string configNameSpace, int defaultWidth, int defaultHeight) : base(title)
        {
            elements_service = ServiceManager.Get <GtkElementsService> ();
            action_service   = ServiceManager.Get <InterfaceActionService> ();

            ConfigureWindow();

            window_controller = new PersistentWindowController(this, configNameSpace, defaultWidth, defaultHeight, WindowPersistOptions.All);
            window_controller.Restore();

            elements_service.PrimaryWindow = this;

            AddAccelGroup(action_service.UIManager.AccelGroup);

            InitializeWindow();

            try {
                if (System.IO.File.Exists(accel_map_file))
                {
                    Gtk.AccelMap.Load(accel_map_file);
                }
            } catch (Exception e) {
                Hyena.Log.Exception("Failed to load custom AccelMap", e);
            }
        }
コード例 #2
0
ファイル: BaseClientWindow.cs プロジェクト: dufoli/banshee
        public BaseClientWindow(string title, WindowConfiguration windowConfiguration)
            : base(title)
        {
            elements_service = ServiceManager.Get<GtkElementsService> ();
            action_service = ServiceManager.Get<InterfaceActionService> ();

            ConfigureWindow ();

            window_controller = new PersistentWindowController (this, windowConfiguration, WindowPersistOptions.All);
            window_controller.Restore ();

            elements_service.PrimaryWindow = this;

            AddAccelGroup (action_service.UIManager.AccelGroup);

            InitializeWindow ();

            try {
                if (System.IO.File.Exists (accel_map_file)) {
                    Gtk.AccelMap.Load (accel_map_file);
                }
            } catch (Exception e) {
                Hyena.Log.Exception ("Failed to load custom AccelMap", e);
            }
        }
コード例 #3
0
ファイル: FullscreenControls.cs プロジェクト: knocte/banshee
 public FullscreenControls(Window toplevel, InterfaceActionService actionService)
     : base(toplevel, 1)
 {
     action_service = actionService;
     AddAccelGroup (action_service.UIManager.AccelGroup);
     BuildInterface ();
 }
コード例 #4
0
        void IExtensionService.Initialize ()
        {
            elements_service = ServiceManager.Get<GtkElementsService> ();
            interface_action_service = ServiceManager.Get<InterfaceActionService> ();

            if (!ServiceStartup ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            }
        }
コード例 #5
0
ファイル: FullscreenWindow.cs プロジェクト: gclark916/banshee
        public FullscreenWindow (Window parent) : base (WindowType.Toplevel)
        {
            Title = parent.Title;
            AppPaintable = true;

            this.parent = parent;
            this.action_service = ServiceManager.Get<InterfaceActionService> ();

            AddAccelGroup (action_service.UIManager.AccelGroup);

            SetupWidget ();
        }
コード例 #6
0
ファイル: NextButton.cs プロジェクト: haugjan/banshee-hacks
        public NextButton(InterfaceActionService actionService, bool withRepeatActions)
        {
            with_repeat_actions = withRepeatActions;
            shuffle_actions = actionService.PlaybackActions.ShuffleActions;

            button = actionService.PlaybackActions["NextAction"].CreateToolItem ();
            var menu = shuffle_actions.CreateMenu (with_repeat_actions);
            Construct (button, menu, true);

            TooltipText = actionService.PlaybackActions["NextAction"].Tooltip;

            shuffle_actions.Changed += OnActionsChanged;
        }
コード例 #7
0
ファイル: MediaPanelService.cs プロジェクト: knocte/banshee
        public void Dispose()
        {
            if (view_menu != null && menu_item != null) {
                view_menu.Remove (menu_item);
            }

            if (panel != null) {
                panel.Dispose ();
                panel = null;
            }

            interface_action_service = null;
            elements_service = null;
        }
コード例 #8
0
ファイル: MeeGoService.cs プロジェクト: fatman2021/gnome-apps
        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 ();
        }
コード例 #9
0
        public LircPlugin()
        {
            actions = new ActionGroup("Lirc");
            ctrl = new ActionMapper(new BansheeController());
            actions.Add(new ActionEntry[] {
                new ActionEntry("LircAction", null, "_Lirc", null,
                                "Configure the Lirc Addin", null),
                new ActionEntry("LircConfigureAction", Stock.Properties, "_Configure",
                                null, "Configure the Lirc addin", OnConfigurePlugin),
            });

            action_service = ServiceManager.Get<InterfaceActionService>("InterfaceActionService");

            action_service.UIManager.InsertActionGroup(actions, 0);
            action_service.UIManager.AddUiFromResource("Ui.xml");
        }
コード例 #10
0
        void IExtensionService.Initialize ()
        {
            if (!ServiceManager.DbConnection.TableExists ("CoverArtDownloads")) {
                ServiceManager.DbConnection.Execute (@"
                    CREATE TABLE CoverArtDownloads (
                        AlbumID     INTEGER UNIQUE,
                        Downloaded  BOOLEAN,
                        LastAttempt INTEGER NOT NULL
                    )");
            }

            action_service = ServiceManager.Get<InterfaceActionService> ();

            if (!ServiceStartup ()) {
                ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
            }
        }
コード例 #11
0
        public PlaybackRepeatActions(InterfaceActionService actionService) : base(actionService, "PlaybackRepeat")
        {
            actionService.AddActionGroup(this);

            Add(new ActionEntry [] {
                new ActionEntry("RepeatMenuAction", null,
                                Catalog.GetString("Repeat"), null,
                                Catalog.GetString("Repeat"), null)
            });

            Add(new RadioActionEntry [] {
                new RadioActionEntry("RepeatNoneAction", null,
                                     Catalog.GetString("Repeat _Off"), null,
                                     Catalog.GetString("Do not repeat playlist"),
                                     (int)PlaybackRepeatMode.None),

                new RadioActionEntry("RepeatAllAction", null,
                                     Catalog.GetString("Repeat _All"), null,
                                     Catalog.GetString("Play all songs before repeating playlist"),
                                     (int)PlaybackRepeatMode.RepeatAll),

                new RadioActionEntry("RepeatSingleAction", null,
                                     Catalog.GetString("Repeat Singl_e"), null,
                                     Catalog.GetString("Repeat the current playing song"),
                                     (int)PlaybackRepeatMode.RepeatSingle)
            }, 0, OnActionChanged);

            this["RepeatNoneAction"].IconName   = "media-repeat-none";
            this["RepeatAllAction"].IconName    = "media-repeat-all";
            this["RepeatSingleAction"].IconName = "media-repeat-single";

            ServiceManager.PlaybackController.RepeatModeChanged += OnRepeatModeChanged;
            ServiceManager.PlaybackController.SourceChanged     += OnPlaybackSourceChanged;

            Gtk.Action action = this[ConfigIdToActionName(RepeatMode.Get())];
            if (action is RadioAction)
            {
                active_action = (RadioAction)action;
            }
            else
            {
                Active = (RadioAction)this["RepeatNoneAction"];
            }

            Active.Activate();
        }
コード例 #12
0
        public PlaybackShuffleActions(InterfaceActionService actionService, PlaybackActions playbackActions)
            : base(actionService, "PlaybackShuffle")
        {
            playback_actions = playbackActions;
            Actions.AddActionGroup(this);

            Add(new ActionEntry [] {
                new ActionEntry("ShuffleMenuAction", null,
                                Catalog.GetString("Shuffle"), null,
                                Catalog.GetString("Shuffle"), null)
            });

            ServiceManager.PlaybackController.ShuffleModeChanged += OnShuffleModeChanged;
            ServiceManager.PlaybackController.SourceChanged      += OnPlaybackSourceChanged;

            SetShuffler(Banshee.Collection.Database.Shuffler.Playback);
        }
コード例 #13
0
        void IExtensionService.Initialize()
        {
            action_service = ServiceManager.Get<InterfaceActionService> ();

            viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as MenuItem).Submenu as Menu;
            menuItem = new MenuItem (Catalog.GetString ("_Mini Mode"));
            menuItem.Activated += delegate {
                if (mini_mode == null) {
                    mini_mode = new MiniMode (ServiceManager.Get<GtkElementsService> ().PrimaryWindow);
                }

                ServiceManager.Get<GtkElementsService> ().PrimaryWindow = mini_mode;
                mini_mode.Enable ();
            };
            viewMenu.Insert (menuItem, 2);
            menuItem.Show ();
        }
コード例 #14
0
ファイル: AppIndicatorService.cs プロジェクト: h0rm/No.Noise
        void IExtensionService.Initialize ()
        {
            elements_service = ServiceManager.Get<GtkElementsService> ();
            interface_action_service = ServiceManager.Get<InterfaceActionService> ();

            var notif_addin = AddinManager.Registry.GetAddin("Banshee.NotificationArea");

            if (notif_addin != null && notif_addin.Enabled) {
                Log.Debug("NotificationArea conflicts with ApplicationIndicator, disabling NotificationArea");
                notif_addin.Enabled = false;
            }

            AddinManager.AddinLoaded += OnAddinLoaded;

            if (!ServiceStartup ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            }
        }
コード例 #15
0
        public PlaybackSubtitleActions(InterfaceActionService actionService)
            : base(actionService, "PlaybackSubtitle")
        {
            Actions.AddActionGroup(this);

            Add(new ActionEntry [] {
                new ActionEntry("SubtitleMenuAction", null,
                                Catalog.GetString("Subtitle"), null,
                                Catalog.GetString("Subtitle"), null),
                new ActionEntry("LoadSubtitleAction", null,
                                Catalog.GetString("Load File..."), null,
                                Catalog.GetString("Load subtitle file"), OnLoadSubtitleAction)
            });

            this["SubtitleMenuAction"].Sensitive = true;

            ServiceManager.PlaybackController.TrackStarted += OnPlaybackTrackStarted;

            //TODO: Set default sub
        }
コード例 #16
0
        public void DelayedInitialize()
        {
            if (instance != null)
                throw new InvalidOperationException ("A MiragePlugin instance is already in use");

            Init ();

            action_service = ServiceManager.Get<InterfaceActionService> ();

            TrackAnalysis.Init ();
            MigrateLegacyDb ();
            DistanceCalculator.Init ();

            InstallInterfaceActions ();

            if (!ServiceStartup ()) {
                ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
            }

            instance = this;
        }
コード例 #17
0
        private BookmarkUI()
        {
            action_service = ServiceManager.Get <InterfaceActionService> ();

            actions = new BansheeActionGroup("Bookmarks");

            actions.Add(new ActionEntry [] {
                new ActionEntry("BookmarksAction", null,
                                Catalog.GetString("_Bookmarks"), null,
                                null, null),
                new ActionEntry("BookmarksAddAction", Stock.Add,
                                Catalog.GetString("_Add Bookmark"), "<control>D",
                                Catalog.GetString("Bookmark the Position in the Current Track"),
                                HandleNewBookmark)
            });

            actions.AddUiFromFile("BookmarksMenu.xml");
            actions.Register();

            bookmark_item = action_service.UIManager.GetWidget("/MainMenu/ToolsMenu/Bookmarks") as ImageMenuItem;
            new_item      = action_service.UIManager.GetWidget("/MainMenu/ToolsMenu/Bookmarks/Add") as ImageMenuItem;

            bookmark_menu           = bookmark_item.Submenu as Menu;
            bookmark_item.Selected += HandleMenuShown;

            remove_item           = new ImageMenuItem(Catalog.GetString("_Remove Bookmark"));
            remove_item.Sensitive = false;
            remove_item.Image     = new Image(Stock.Remove, IconSize.Menu);

            remove_item.Submenu = remove_menu = new Menu();
            bookmark_menu.Append(remove_item);

            actions["BookmarksAction"].Activated += (o, a) => {
                if (!loaded)
                {
                    LoadBookmarks();
                    loaded = true;
                }
            };
        }
コード例 #18
0
        protected BaseClientWindow(string title, WindowConfiguration windowConfiguration)
            : base(title)
        {
            elements_service = ServiceManager.Get<GtkElementsService> ();
            action_service = ServiceManager.Get<InterfaceActionService> ();

            ConfigureWindow (windowConfiguration);

            elements_service.PrimaryWindow = this;

            AddAccelGroup (action_service.UIManager.AccelGroup);

            InitializeWindow ();

            try {
                if (System.IO.File.Exists (accel_map_file)) {
                    Gtk.AccelMap.Load (accel_map_file);
                }
            } catch (Exception e) {
                Log.Error ("Failed to load custom AccelMap", e);
            }
        }
コード例 #19
0
ファイル: BookmarkUI.cs プロジェクト: petejohanson/banshee
        private BookmarkUI ()
        {
            action_service = ServiceManager.Get<InterfaceActionService> ();

            actions = new BansheeActionGroup ("Bookmarks");

            actions.Add (new ActionEntry [] {
                new ActionEntry ("BookmarksAction", null,
                                  Catalog.GetString ("_Bookmarks"), null,
                                  null, null),
                new ActionEntry ("BookmarksAddAction", Stock.Add,
                                  Catalog.GetString ("_Add Bookmark"), "<control>D",
                                  Catalog.GetString ("Bookmark the Position in the Current Track"),
                                  HandleNewBookmark)
            });

            actions.AddUiFromFile ("BookmarksMenu.xml");
            actions.Register ();

            bookmark_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks") as ImageMenuItem;
            new_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks/Add") as ImageMenuItem;

            bookmark_menu = bookmark_item.Submenu as Menu;
            bookmark_item.Selected += HandleMenuShown;

            remove_item = new ImageMenuItem (Catalog.GetString ("_Remove Bookmark"));
            remove_item.Sensitive = false;
            remove_item.Image = new Image (Stock.Remove, IconSize.Menu);

            remove_item.Submenu = remove_menu = new Menu ();
            bookmark_menu.Append (remove_item);

            actions["BookmarksAction"].Activated += (o, a) => {
                if (!loaded) {
                    LoadBookmarks ();
                    loaded = true;
                }
            };
        }
コード例 #20
0
        protected BaseClientWindow(string title, WindowConfiguration windowConfiguration) : base(title)
        {
            elements_service = ServiceManager.Get <GtkElementsService> ();
            action_service   = ServiceManager.Get <InterfaceActionService> ();

            ConfigureWindow(windowConfiguration);

            elements_service.PrimaryWindow = this;

            AddAccelGroup(action_service.UIManager.AccelGroup);

            InitializeWindow();

            try {
                if (System.IO.File.Exists(accel_map_file))
                {
                    Gtk.AccelMap.Load(accel_map_file);
                }
            } catch (Exception e) {
                Log.Error("Failed to load custom AccelMap", e);
            }
        }
コード例 #21
0
        void IExtensionService.Initialize()
        {
            Log.Debug("Initializing Alarm Plugin");

            AlarmClockService.alarm_service = this;
            ThreadStart alarmThreadStart = new ThreadStart (AlarmClockService.DoWait);
            alarm_thread = new Thread (alarmThreadStart);
            alarm_thread.Start ();

            action_service = ServiceManager.Get<InterfaceActionService> ("InterfaceActionService");

            actions = new ActionGroup ("AlarmClock");

            actions.Add (new ActionEntry [] {
                new ActionEntry ("AlarmClockAction", null,
                    Catalog.GetString ("Alarm Clock"), null,
                    null, null),

                new ActionEntry ("SetSleepTimerAction", null,
                    Catalog.GetString ("Sleep Timer..."), null,
                    Catalog.GetString ("Set the sleep timer value"), OnSetSleepTimer),

                new ActionEntry ("SetAlarmAction", null,
                    Catalog.GetString ("Alarm..."), null,
                    Catalog.GetString ("Set the alarm time"), OnSetAlarm),

                new ActionEntry ("AlarmClockConfigureAction", Stock.Properties,
                    Catalog.GetString ("_Configure..."), null,
                    Catalog.GetString ("Configure the Alarm Clock plugin"), OnConfigure)
            });

            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_manager_id = action_service.UIManager.AddUiFromResource ("AlarmMenu.xml");
        }
コード例 #22
0
        private bool SetupInterfaceActions()
        {
            action_service = ServiceManager.Get<InterfaceActionService> ();

            if (action_service.FindActionGroup ("ClutterFlowView") == null) {
                clutterflow_actions = new ActionGroup ("ClutterFlowView");

                ToggleActionEntry [] tae = new ToggleActionEntry [] { new ToggleActionEntry ("ClutterFlowVisibleAction", null,
                    AddinManager.CurrentLocalizer.GetString ("Show ClutterFlow Browser"), null,
                    AddinManager.CurrentLocalizer.GetString ("Show or hide the ClutterFlow browser"),
                    null, ClutterFlowSchemas.ShowClutterFlow.Get ()) };
                clutterflow_actions.Add (tae);

                action_service.AddActionGroup (clutterflow_actions);
                ui_manager_id = action_service.UIManager.AddUiFromString (menu_xml);
            }

            source_manager.ActiveSourceChanged += HandleActiveSourceChanged;

            BrowserAction.Activated += OnToggleBrowser;
            CfBrowsAction.Activated += OnToggleClutterFlow;

            return true;
        }
コード例 #23
0
        void IExtensionService.Initialize()
        {
            Marshaller.Init ();
            has_karaoke = Marshaller.CheckGstPlugin ("audiokaraoke");
            Hyena.Log.Debug ("[Karaoke] GstPlugin audiokaraoke" + (has_karaoke ? "" : " not") + " found");
            if (!has_karaoke) {
                Hyena.Log.Warning ("[Karaoke] audiokaraoke is not available, please install gstreamer-good-plugins");
                return;
            }

            action_service = ServiceManager.Get<InterfaceActionService> ();
            actions = new Gtk.ActionGroup ("Karaoke");

            actions.Add (new Gtk.ActionEntry[] { new Gtk.ActionEntry ("KaraokeAction", null,
                             AddinManager.CurrentLocalizer.GetString ("_Karaoke"), null, null, null),
                             new Gtk.ActionEntry ("KaraokeConfigureAction", Gtk.Stock.Properties,
                                 AddinManager.CurrentLocalizer.GetString ("_Configure"), null,
                                 AddinManager.CurrentLocalizer.GetString ("Configure the Karaoke extension"), OnConfigure) });

            Gdk.Pixbuf icon = new Gdk.Pixbuf (System.Reflection.Assembly.GetExecutingAssembly ()
                                              .GetManifestResourceStream ("microphone.png"));

            Gtk.IconSet iconset = new Gtk.IconSet (icon);
            Gtk.IconFactory iconfactory = new Gtk.IconFactory ();
            iconfactory.Add ("microphone", iconset);
            iconfactory.AddDefault ();

            actions.Add (new Gtk.ToggleActionEntry[] { new Gtk.ToggleActionEntry ("KaraokeEnableAction", "microphone",
                             AddinManager.CurrentLocalizer.GetString ("_Activate Karaoke mode"), null,
                             AddinManager.CurrentLocalizer.GetString ("Activate Karaoke mode"),
                             OnActivateKaraoke, karaoke_enabled) });

            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_menu_id = action_service.UIManager.AddUiFromResource ("KaraokeMenu.xml");
            ui_button_id = action_service.UIManager.AddUiFromResource ("KaraokeButton.xml");
        }
コード例 #24
0
        private void OnServiceStarted(ServiceStartedArgs args)
        {
            if (args.Service is Banshee.Preferences.PreferenceService) {
                preference_service = (PreferenceService)args.Service;
                SetupPreferences ();
            } else if (args.Service is Banshee.Gui.InterfaceActionService) {
                action_service = (InterfaceActionService)args.Service;
                SetupInterfaceActions ();
            }

            if (!(preference_service==null || action_service==null)) {
                ServiceManager.ServiceStarted -= OnServiceStarted;
                if (!SetupSourceContents ()) {
                    source_manager.SourceAdded += OnSourceAdded;
                }
            }
        }
コード例 #25
0
        private void RemoveClutterFlow()
        {
            Clutter.Threads.Enter ();
            music_library.Properties.Remove ("Nereid.SourceContents");
            Clutter.Threads.Leave ();
            clutter_flow_contents.Dispose ();
            clutter_flow_contents = null;

            source_manager.ActiveSourceChanged -= HandleActiveSourceChanged;
            BrowserAction.Activated -= OnToggleBrowser;
            BrowserAction.Active = ClutterFlowSchemas.OldShowBrowser.Get ();
            CfBrowsAction.Activated -= OnToggleClutterFlow;
            CfBrowsAction.Visible = false;

            action_service.RemoveActionGroup ("ClutterFlowView");
            action_service.UIManager.RemoveUi (ui_manager_id);
            clutterflow_actions = null;
            cfbrows_action = null;

            preference_service = null;
            source_manager = null;
            music_library = null;
            action_service = null;
            browser_action = null;
            cfbrows_action = null;
        }
        /// <summary>
        /// Initialize the service, creating the Recorder object, connecting events and adding GUI elements
        /// </summary>
        void IExtensionService.Initialize()
        {
            recorder = new Recorder ();
            active_encoder = recorder.SetActiveEncoder (active_encoder);

            ServiceManager.PlaybackController.TrackStarted += delegate {
                if (recording) {
                    StartRecording ();
                }
            };

            ServiceManager.PlaybackController.Stopped += delegate {
                if (recording) {
                    StopRecording ();
                }
            };

            ServiceManager.PlayerEngine.ConnectEvent (OnEndOfStream, PlayerEvent.EndOfStream);
            ServiceManager.PlayerEngine.ConnectEvent (OnStateChange, PlayerEvent.StateChange);
            ServiceManager.PlayerEngine.ConnectEvent (OnMetadata, PlayerEvent.TrackInfoUpdated);
            ServiceManager.SourceManager.ActiveSourceChanged += OnSourceChanged;

            action_service = ServiceManager.Get<InterfaceActionService> ();
            actions = new ActionGroup ("Streamrecorder");

            actions.Add (new ActionEntry[] { new ActionEntry ("StreamrecorderAction", null,
                             AddinManager.CurrentLocalizer.GetString ("_Streamrecorder"), null, null, null),
                             new ActionEntry ("StreamrecorderConfigureAction", Stock.Properties,
                                 AddinManager.CurrentLocalizer.GetString ("_Configure"), null,
                                 AddinManager.CurrentLocalizer.GetString ("Configure the Streamrecorder plugin"), OnConfigure) });

            actions.Add (new ToggleActionEntry[] { new ToggleActionEntry ("StreamrecorderEnableAction", Stock.MediaRecord,
                             AddinManager.CurrentLocalizer.GetString ("_Activate streamrecorder"), null,
                             AddinManager.CurrentLocalizer.GetString ("Activate streamrecorder process"),
                             OnActivateStreamrecorder, recording) });

            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_menu_id = action_service.UIManager.AddUiFromResource ("StreamrecorderMenu.xml");
        }
コード例 #27
0
        void IExtensionService.Initialize()
        {
            ClutterHelper.Init ();

            preference_service = ServiceManager.Get<PreferenceService> ();
            action_service = ServiceManager.Get<InterfaceActionService> ();

            source_manager = ServiceManager.SourceManager;
            music_library = source_manager.MusicLibrary;

            if (!SetupPreferences () || !SetupInterfaceActions ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            } else if (!SetupSourceContents ()) {
                source_manager.SourceAdded += OnSourceAdded;
            }

            //--> TODO Banshee.ServiceStack.Application. register Exit event to close threads etc.
        }
コード例 #28
0
ファイル: MeeGoService.cs プロジェクト: fatman2021/gnome-apps
        public void Dispose ()
        {
            if (panel != null) {
                panel.Dispose ();
                panel = null;
            }

            interface_action_service = null;
            elements_service = null;
        }
コード例 #29
0
        void IExtensionService.Initialize()
        {
            Hyena.Log.Debug ("Initializing LCD service");

            action_service = ServiceManager.Get<InterfaceActionService> ();
            actions = new ActionGroup ("LCD");
            actions.Add (new ActionEntry [] {
                new ActionEntry ("LCDAction", null,
                    AddinManager.CurrentLocalizer.GetString ("LCD"), null,
                    null, null),
                new ActionEntry ("LCDConfigureAction", Stock.Properties,
                    AddinManager.CurrentLocalizer.GetString ("_Configure..."), null,
                    AddinManager.CurrentLocalizer.GetString ("Configure the LCD plugin"), OnConfigure)
            });
            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_manager_id = action_service.UIManager.AddUiFromResource ("LCDMenu.xml");

            ScreensCreate();

            lcdclient = new LCDClient(Host, Port);
            lcdclient.Connected += OnConnected;
            parser = new LCDParser();
            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.Iterate |
                PlayerEvent.StartOfStream |
                PlayerEvent.EndOfStream |
                PlayerEvent.TrackInfoUpdated |
                PlayerEvent.StateChange);
        }
コード例 #30
0
        void IExtensionService.Initialize()
        {
            /*
             * if SavedOrTried = 0, try and download the art
             * if SavedOrTried = 1, we have tried this session
             * if SavedOrTried = 2, art is already in folder
             * if SavedOrTired = 3, we were successful in writing art to folder
             */
            if (!ServiceManager.DbConnection.TableExists ("AlbumArtWriter")) {
                ServiceManager.DbConnection.Execute (@"
                        CREATE TABLE AlbumArtWriter (
                            AlbumID     INTEGER UNIQUE,
                            SavedOrTried INTEGER
                        )");
            DatabaseConfigurationClient.Client.Set<int>("AlbumArtWriter", "Version", 1);
            }
            if (DatabaseConfigurationClient.Client.Get<int> ("AlbumArtWriter", "Version", 0) < 2) {
                ServiceManager.DbConnection.Execute (@"ALTER TABLE AlbumArtWriter ADD COLUMN LastUpdated INTEGER");
                DatabaseConfigurationClient.Client.Set<int>("AlbumArtWriter", "Version", 2);
            }
            if (!ServiceStartup ()) {
                ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
            }

            action_service = ServiceManager.Get<InterfaceActionService> ();

            actions = new ActionGroup ("AlbumArtWriter");

            actions.Add (new ActionEntry [] {
                new ActionEntry ("AlbumArtWriterAction", null,
                    AddinManager.CurrentLocalizer.GetString ("Album Art Writer"), null,
                    null, null),
                new ActionEntry ("AlbumArtWriterConfigureAction", Stock.Properties,
                    AddinManager.CurrentLocalizer.GetString ("_Configure..."), null,
                    AddinManager.CurrentLocalizer.GetString ("Configure the Album Art Writer plugin"), OnConfigure),
                new ActionEntry ("AlbumArtWriterForceAction", Stock.Refresh,
                    AddinManager.CurrentLocalizer.GetString ("Force Copy"), null,
                    AddinManager.CurrentLocalizer.GetString ("Force Recopy of all Album Art"), onForce)
            });

            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_manager_id = action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
        }
コード例 #31
0
        void IExtensionService.Initialize ()
        {
            account = LastfmCore.Account;

            if (account.UserName == null) {
                account.UserName = LastUserSchema.Get ();
                account.SessionKey = LastSessionKeySchema.Get ();
                account.ScrobbleUrl = LastScrobbleUrlSchema.Get ();
            }

            if (LastfmCore.UserAgent == null) {
                LastfmCore.UserAgent = Banshee.Web.Browser.UserAgent;
            }

            Browser.Open = Banshee.Web.Browser.Open;

            queue = new Queue ();
            LastfmCore.AudioscrobblerQueue = queue;
            connection = LastfmCore.Audioscrobbler;

            // Initialize with a reasonable value in case we miss the first StartOfStream event
            song_start_time = DateTime.Now;

            Network network = ServiceManager.Get<Network> ();
            connection.UpdateNetworkState (network.Connected);
            network.StateChanged += HandleNetworkStateChanged;

            // Update the Visit action menu item if we update our account info
            LastfmCore.Account.Updated += delegate (object o, EventArgs args) {
                actions["AudioscrobblerVisitAction"].Sensitive = String.IsNullOrEmpty (LastfmCore.Account.UserName);
            };

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.StartOfStream |
                PlayerEvent.EndOfStream |
                PlayerEvent.Seek |
                PlayerEvent.Iterate);

            action_service = ServiceManager.Get<InterfaceActionService> ();
            InterfaceInitialize ();
        }
コード例 #32
0
        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;
            }

            ServiceStartup ();
        }
コード例 #33
0
ファイル: SoundMenuService.cs プロジェクト: knocte/banshee
        public void Dispose()
        {
            if (current_nf != null) {
                try {
                    current_nf.Close ();
                } catch {}
            }

            UninstallPreferences ();

            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);

            elements_service.PrimaryWindowClose = null;

            interface_action_service.UIManager.RemoveUi (ui_manager_id);
            Gtk.Action close_action = interface_action_service.GlobalActions["CloseAction"];
            if (close_action != null) {
                interface_action_service.GlobalActions.Remove (close_action);
            }
            interface_action_service.GlobalActions.UpdateAction ("QuitAction", true);

            AddinManager.AddinLoaded -= OnAddinLoaded;

            sound_menu = null;
            elements_service = null;
            interface_action_service = null;
        }
コード例 #34
0
ファイル: AppIndicatorService.cs プロジェクト: h0rm/No.Noise
        public void Dispose ()
        {
            if (disposed) {
                return;
            }

            if (current_nf != null) {
                try {
                    current_nf.Close ();
                } catch {}
            }

            // Hide the AppIndicator before disposing
            indicator.Status = Status.Passive;
            indicator.Dispose();
            indicator = null;

            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);

            elements_service.PrimaryWindowClose = null;

            Gtk.Action close_action = interface_action_service.GlobalActions["CloseAction"];
            if (close_action != null) {
                interface_action_service.GlobalActions.Remove (close_action);
            }

            if (ui_manager_id >= 0) {
                interface_action_service.RemoveActionGroup ("AppIndicator");
                interface_action_service.UIManager.RemoveUi ((uint)ui_manager_id);
                ui_manager_id = -1;
            }

            elements_service = null;
            interface_action_service = null;

            AddinManager.AddinLoaded -= OnAddinLoaded;

            disposed = true;
        }
コード例 #35
0
        public void Dispose()
        {
            if (disposed) {
                return;
            }

            if (current_nf != null) {
                try {
                    current_nf.Close ();
                } catch {}
            }

            if (notif_area != null) {
                notif_area.Dispose ();
                notif_area = null;
            }

            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);

            elements_service.PrimaryWindowClose = null;

            Gtk.Action close_action = interface_action_service.GlobalActions["CloseAction"];
            if (close_action != null) {
                interface_action_service.GlobalActions.Remove (close_action);
            }

            if (ui_manager_id >= 0) {
                interface_action_service.RemoveActionGroup ("NotificationArea");
                interface_action_service.UIManager.RemoveUi ((uint)ui_manager_id);
                ui_manager_id = -1;
            }

            actions = null;
            elements_service = null;
            interface_action_service = null;

            disposed = true;
        }
コード例 #36
0
 public BansheeActionGroup(InterfaceActionService action_service, string name) : base(name)
 {
     this.action_service = action_service;
 }
        public void InterfaceInitialize()
        {
            uia_service = ServiceManager.Get<InterfaceActionService> ();

            actions = new ActionGroup ("LastfmFingerprint");

            actions.Add (new ActionEntry [] {
                new ActionEntry ("FingerprintAction", null,
                    AddinManager.CurrentLocalizer.GetString ("Get Information From Track Fingerprint"), null,
                    AddinManager.CurrentLocalizer.GetString ("Get track information from last.fm acoustic fingerprint"),
                    OnGetTagFromFingerprint)
            });

            //TODO icon of fingerprint
            //Gtk.Action action = uia_service.TrackActions["FingerprintAction"];
            //action.IconName = "fingerprint";

            uia_service.UIManager.InsertActionGroup (actions, 0);
            ui_manager_id = uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");

            UpdateActions ();
            ServiceManager.SourceManager.ActiveSourceChanged += HandleActiveSourceChanged;
        }
コード例 #38
0
        public PlaybackShuffleActions(InterfaceActionService actionService, PlaybackActions playbackActions)
            : base(actionService, "PlaybackShuffle")
        {
            playback_actions = playbackActions;
            Actions.AddActionGroup(this);

            Add(new ActionEntry [] {
                new ActionEntry("ShuffleMenuAction", null,
                                Catalog.GetString("Shuffle"), null,
                                Catalog.GetString("Shuffle"), null)
            });

            Add(new RadioActionEntry [] {
                new RadioActionEntry("ShuffleOffAction", null,
                                     Catalog.GetString("Shuffle _Off"), null,
                                     Catalog.GetString("Do not shuffle playlist"),
                                     (int)PlaybackShuffleMode.Linear),

                new RadioActionEntry("ShuffleSongAction", null,
                                     Catalog.GetString("Shuffle by _Song"), null,
                                     Catalog.GetString("Play songs randomly from the playlist"),
                                     (int)PlaybackShuffleMode.Song),

                new RadioActionEntry("ShuffleArtistAction", null,
                                     Catalog.GetString("Shuffle by A_rtist"), null,
                                     Catalog.GetString("Play all songs by an artist, then randomly choose another artist"),
                                     (int)PlaybackShuffleMode.Artist),

                new RadioActionEntry("ShuffleAlbumAction", null,
                                     Catalog.GetString("Shuffle by A_lbum"), null,
                                     Catalog.GetString("Play all songs from an album, then randomly choose another album"),
                                     (int)PlaybackShuffleMode.Album),

                new RadioActionEntry("ShuffleRatingAction", null,
                                     Catalog.GetString("Shuffle by _Rating"), null,
                                     Catalog.GetString("Play songs randomly, prefer higher rated songs"),
                                     (int)PlaybackShuffleMode.Rating),

                new RadioActionEntry("ShuffleScoreAction", null,
                                     Catalog.GetString("Shuffle by S_core"), null,
                                     Catalog.GetString("Play songs randomly, prefer higher scored songs"),
                                     (int)PlaybackShuffleMode.Score)
            }, 0, OnActionChanged);

            this["ShuffleOffAction"].StockId     = Gtk.Stock.MediaNext;
            this["ShuffleSongAction"].IconName   = "media-playlist-shuffle";
            this["ShuffleArtistAction"].IconName = "media-playlist-shuffle";
            this["ShuffleAlbumAction"].IconName  = "media-playlist-shuffle";
            this["ShuffleRatingAction"].IconName = "media-playlist-shuffle";
            this["ShuffleScoreAction"].IconName  = "media-playlist-shuffle";

            ServiceManager.PlaybackController.ShuffleModeChanged += OnShuffleModeChanged;
            ServiceManager.PlaybackController.SourceChanged      += OnPlaybackSourceChanged;

            Gtk.Action action = this[ConfigIdToActionName(ShuffleMode.Get())];
            if (action is RadioAction)
            {
                active_action = (RadioAction)action;
            }
            else
            {
                Active = (RadioAction)this["ShuffleOffAction"];
            }

            Active.Activate();
        }