private void OnSourceAdded(SourceAddedArgs args)
 {
     if (args.Source is MusicLibrarySource) {
         music_library = args.Source as MusicLibrarySource;
     }
     SetupSourceContents ();
 }
        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;
        }
        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.
        }
        public bool SetSource(ISource source)
        {
            if ((source as MusicLibrarySource) == null) {
                return false;
            }
            if ((source as MusicLibrarySource)==this.source) {
                SelectAllTracks ();
                return true;
            } else {
                ResetSource ();
            }

            this.source = (source as MusicLibrarySource);
            this.source.TrackModel.Selection.Clear (false);
            this.source.TracksAdded += HandleTracksAdded;
            this.source.TracksDeleted += HandleTracksDeleted;

            foreach (IFilterListModel list_model in this.source.CurrentFilters) {
                list_model.Clear (); //clear selections, we need all albums!!
                if (list_model is FilterListModel<AlbumInfo>) {
                    external_filter = list_model as FilterListModel<AlbumInfo>;
                    break;
                }
            }

            main_view.SetModel (TrackModel);
            FilterView.SetModel (external_filter);

            return true;
        }
 public void ResetSource()
 {
     if (source!=null) {
         source.TracksAdded -= HandleTracksAdded;
         source.TracksDeleted -= HandleTracksDeleted;
         source = null;
     }
     TrackView.SetModel (null);
     FilterView.SetModel (null);
 }
Пример #6
0
 public void ResetSource ()
 {
     source = null;
 }
Пример #7
0
 public bool SetSource (ISource source)
 {
     this.source = source as MusicLibrarySource;
     return this.source != null;
 }