public override void Dispose()
        {
            if (cover != null)
            {
                cover.Dispose();
                cover = null;
            }

            base.Dispose();
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (cover != null)
                {
                    cover.Dispose();
                    cover = null;
                }
            }

            base.Dispose(disposing);
        }
        private void BuildWidgets()
        {
            var hbox = new HBox()
            {
                Spacing = 12
            };

            // Left box - cover art, title, etc
            var left_box = new VBox()
            {
                BorderWidth = 12, Spacing = 12
            };

            // Cover art
            cover = new BookCover(this)
            {
                WidthRequest  = 256,
                HeightRequest = 256
            };

            var editable_cover = CoverArtEditor.For(
                cover, (x, y) => true,
                () => library.TrackModel[0],
                UpdateCover
                );

            // Title
            title_label = new WrapLabel();

            resume_button = new ImageButton("", null, IconSize.LargeToolbar);
            resume_button.ImageWidget.Stock  = Stock.MediaPlay;
            resume_button.LabelWidget.Xalign = 0;
            resume_button.Spacing            = 6;

            // FIXME the left padding on this is not right
            rating_entry = new RatingEntry()
            {
                AlwaysShowEmptyStars = true,
                HasFrame             = false
            };
            var rating = new HBox();

            rating.PackStart(rating_entry, false, false, 0);

            // Packing
            left_box.PackStart(editable_cover, false, false, 0);
            left_box.PackStart(title_label, false, false, 0);
            left_box.PackStart(resume_button, false, false, 0);
            //left_box.PackStart (rating, false, false,  0);

            hbox.PackStart(left_box, false, false, 0);

            // Right box - track list
            track_list = new BaseTrackListView()
            {
                HeaderVisible     = true,
                IsEverReorderable = false
            };

            var columns      = new DefaultColumnController();
            var file_columns = new ColumnController();
            var disc_column  = DefaultColumnController.Create(
                BansheeQuery.DiscNumberField, 0.02, false, new ColumnCellPositiveInt(null, false, 2, 2));

            file_columns.AddRange(
                columns.IndicatorColumn,
                disc_column,
                columns.TitleColumn,
                columns.DurationColumn
                );
            file_columns.SortColumn = columns.DiscNumberAndCountColumn;

            foreach (var col in file_columns)
            {
                col.Visible = true;
            }

            var track_sw = new Gtk.ScrolledWindow()
            {
                Child      = track_list,
                ShadowType = ShadowType.None
            };

            track_list.ColumnController = file_columns;

            hbox.PackEnd(track_sw, true, true, 0);

            Child = hbox;
        }