Exemple #1
0
        protected override void OnShown()
        {
            var vbox = new VBox();

            var views_pane = new HPaned();

            PersistentPaneController.Control(views_pane, SourceViewWidth);
            _view_container = new ViewContainer();

            _source_view = new SourceView();

            var source_scroll = new ScrolledWindow();

            _view_container.Content = _composite = new SimpleListSourceContents();

            var toolbar = _Toolbar();

            _status = _Statusbar();

            source_scroll.Add(_source_view);

            _source_box = new VBox();
            _source_box.PackStart(source_scroll, true, true, 0);
            _source_box.PackEnd(_cover_art, false, false, 0);

            views_pane.Pack1(_source_box, true, true);
            views_pane.Pack2(_view_container, true, true);

            vbox.PackStart(_status, false, false, 0);
            vbox.PackStart(views_pane, true, true, 0);
            vbox.PackStart(toolbar, false, false, 0);

            Add(vbox);

            foreach (var _ in _ready)
            {
                _();
            }

            _ready.Clear();

            _composite.Widget.Show();
            _view_container.Show();
            _source_view.Show();
            source_scroll.Show();
            _source_box.Show();

            CoverArt();

            _status.Show();
            views_pane.Show();
            toolbar.Show();

            vbox.Show();

            ConnectEvents();

            base.OnShown();
        }
Exemple #2
0
        private void UpdateSourceContents(Source source)
        {
            if (source == null)
            {
                return;
            }

            // Connect the source models to the views if possible
            ISourceContents contents = source.GetProperty <ISourceContents> ("Nereid.SourceContents",
                                                                             source.GetInheritedProperty <bool> ("Nereid.SourceContentsPropagate"));

            view_container.ClearHeaderWidget();
            view_container.ClearFooter();

            if (contents != null)
            {
                if (view_container.Content != contents)
                {
                    view_container.Content = contents;
                }
                view_container.Content.SetSource(source);
                view_container.Show();
            }
            else if (source is ITrackModelSource)
            {
                view_container.Content = composite_view;
                view_container.Content.SetSource(source);
                view_container.Show();
            }
            else if (source is Hyena.Data.IObjectListModel)
            {
                if (object_view == null)
                {
                    object_view = new ObjectListSourceContents();
                }

                view_container.Content = object_view;
                view_container.Content.SetSource(source);
                view_container.Show();
            }
            else
            {
                view_container.Hide();
            }

            // Associate the view with the model
            if (view_container.Visible && view_container.Content is ITrackModelSourceContents)
            {
                ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
                source.Properties.Set <IListView <TrackInfo> >  ("Track.IListView", track_content.TrackView);
            }

            var title_widget = source.Properties.Get <Widget> ("Nereid.SourceContents.TitleWidget");

            if (title_widget != null)
            {
                Hyena.Log.WarningFormat("Nereid.SourceContents.TitleWidget is no longer used (from {0})", source.Name);
            }

            Widget header_widget = null;

            if (source.Properties.Contains("Nereid.SourceContents.HeaderWidget"))
            {
                header_widget = source.Properties.Get <Widget> ("Nereid.SourceContents.HeaderWidget");
            }

            if (header_widget != null)
            {
                view_container.SetHeaderWidget(header_widget);
            }

            Widget footer_widget = null;

            if (source.Properties.Contains("Nereid.SourceContents.FooterWidget"))
            {
                footer_widget = source.Properties.Get <Widget> ("Nereid.SourceContents.FooterWidget");
            }

            if (footer_widget != null)
            {
                view_container.SetFooter(footer_widget);
            }
        }
Exemple #3
0
        private void UpdateSourceContents(Source source)
        {
            if (source == null)
            {
                return;
            }

            // Connect the source models to the views if possible
            ISourceContents contents = source.GetProperty <ISourceContents> ("Nereid.SourceContents",
                                                                             source.GetInheritedProperty <bool> ("Nereid.SourceContentsPropagate"));

            bool remove_margins = false;

            view_container.ClearFooter();

            if (contents != null)
            {
                if (view_container.Content != contents)
                {
                    view_container.Content = contents;
                }
                view_container.Content.SetSource(source);
                view_container.Show();

                remove_margins = contents is Cubano.NowPlaying.NowPlayingInterface ||
                                 contents.GetType().FullName == "Banshee.NowPlaying.NowPlayingInterface";
            }
            else if (source is ITrackModelSource)
            {
                view_container.Content = composite_view;
                view_container.Content.SetSource(source);
                view_container.Show();
            }
            else if (source is Hyena.Data.IObjectListModel)
            {
                if (object_view == null)
                {
                    object_view = new ObjectListSourceContents();
                }

                view_container.Content = object_view;
                view_container.Content.SetSource(source);
                view_container.Show();
            }
            else
            {
                view_container.Hide();
            }

            // Associate the view with the model
            if (view_container.Visible && view_container.Content is ITrackModelSourceContents)
            {
                ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
                source.Properties.Set <IListView <TrackInfo> >  ("Track.IListView", track_content.TrackView);
            }

            header.Visible = source.Properties.Contains("Nereid.SourceContents.HeaderVisible") ?
                             source.Properties.Get <bool> ("Nereid.SourceContents.HeaderVisible") : true;

            Widget footer_widget = null;

            if (source.Properties.Contains("Nereid.SourceContents.FooterWidget"))
            {
                footer_widget = source.Properties.Get <Widget> ("Nereid.SourceContents.FooterWidget");
            }

            if (footer_widget != null)
            {
                view_container.SetFooter(footer_widget);
            }

            ConfigureMargins(remove_margins);
        }
        /// <summary>
        /// The Widget of the source contents of this source
        /// </summary>
        /// <returns>
        /// A <see cref="Widget"/>
        /// </returns>
        public Widget GetWidget()
        {
            ISourceContents source_contents = Properties.Get <ISourceContents> ("Nereid.SourceContents");

            return(source_contents.Widget);
        }