Exemplo n.º 1
0
        private void BuildHeader()
        {
            Table header = new Table(3, 3, false);

            header.ColumnSpacing = 5;

            header_image_frame = new Frame();

            header_image           = new Image();
            header_image.IconName  = "media-optical";
            header_image.PixelSize = 64;

            header_image_frame.Add(
                CoverArtEditor.For(header_image,
                                   (x, y) => true,
                                   () => CurrentTrack,
                                   () => LoadCoverArt(CurrentTrack)
                                   )
                );

            header.Attach(header_image_frame, 0, 1, 0, 3,
                          AttachOptions.Fill, AttachOptions.Expand, 0, 0);

            AddHeaderRow(header, 0, Catalog.GetString("Title:"), out header_title_label);
            AddHeaderRow(header, 1, Catalog.GetString("Artist:"), out header_artist_label);
            AddHeaderRow(header, 2, Catalog.GetString("Album:"), out header_album_label);

            header.ShowAll();
            main_vbox.PackStart(header, false, false, 0);
        }
Exemplo n.º 2
0
 public static Widget GetEditable(TrackInfoDisplay display)
 {
     return(CoverArtEditor.For(display,
                               (x, y) => display.IsWithinCoverart(x, y),
                               () => display.CurrentTrack,
                               () => {}
                               ));
 }
        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;
        }
        private void BuildWindow()
        {
            VBox.Spacing = 12;
            main_box     = VBox;

            var save_button = new Button("gtk-save")
            {
                CanDefault = true
            };

            name_entry          = new Entry();
            name_entry.Text     = feed.Title;
            name_entry.Changed += delegate {
                save_button.Sensitive = !String.IsNullOrEmpty(name_entry.Text);
            };

            subscribed_check = new CheckButton(Catalog.GetString("Check periodically for new episodes"))
            {
                TooltipText = Catalog.GetString("If checked, Banshee will check every hour to see if this podcast has new episodes")
            };

            download_check = new CheckButton(Catalog.GetString("Download new episodes"));
            DownloadPref   = feed.AutoDownload;

            archive_check = new CheckButton(Catalog.GetString("Archive all episodes except the newest one"));
            MaxItemCount  = (int)feed.MaxItemCount;

            subscribed_check.Toggled += delegate {
                download_check.Sensitive = archive_check.Sensitive = subscribed_check.Active;
            };
            subscribed_check.Active  = feed.IsSubscribed;
            download_check.Sensitive = archive_check.Sensitive = subscribed_check.Active;

            var last_updated_text = new Label(feed.LastDownloadTime.ToString("f"))
            {
                Justify = Justification.Left,
                Xalign  = 0f
            };

            var feed_url_text = new Label()
            {
                Text       = feed.Url.ToString(),
                Wrap       = false,
                Selectable = true,
                Xalign     = 0f,
                Justify    = Justification.Left,
                Ellipsize  = Pango.EllipsizeMode.End
            };

            string description_string = String.IsNullOrEmpty(feed.Description) ?
                                        Catalog.GetString("No description available") :
                                        feed.Description;

            var header_box = new HBox()
            {
                Spacing = 6
            };

            header_image_frame = new Frame();
            header_image       = new Image();
            LoadCoverArt(fake_track);
            header_image_frame.Add(
                CoverArtEditor.For(header_image,
                                   (x, y) => true,
                                   () => fake_track,
                                   () => LoadCoverArt(fake_track)
                                   )
                );
            header_box.PackStart(header_image_frame, false, false, 0);

            var table = new Hyena.Widgets.SimpleTable <int> ();

            table.XOptions[0] = AttachOptions.Fill;
            table.XOptions[1] = AttachOptions.Expand | AttachOptions.Fill;
            table.AddRow(0, HeaderLabel(Catalog.GetString("Name:")), name_entry);
            table.AddRow(1, HeaderLabel(Catalog.GetString("Website:")),
                         new Gtk.Alignment(0f, 0f, 0f, 0f)
            {
                Child = new LinkButton(feed.Link, Catalog.GetString("Visit"))
                {
                    Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Button)
                }
            });
            header_box.PackStart(table, true, true, 0);

            main_box.PackStart(header_box, false, false, 0);

            Add(Catalog.GetString("Subscription Options"), subscribed_check, download_check, archive_check);

            var details = new Banshee.Gui.TrackEditor.StatisticsPage();

            details.AddItem(Catalog.GetString("Feed URL:"), feed_url_text.Text);
            details.AddItem(Catalog.GetString("Last Refreshed:"), last_updated_text.Text);
            details.AddItem(Catalog.GetString("Description:"), description_string, true);
            details.AddItem(Catalog.GetString("Category:"), feed.Category);
            details.AddItem(Catalog.GetString("Keywords:"), feed.Keywords);
            details.AddItem(Catalog.GetString("Copyright:"), feed.Copyright);
            details.HeightRequest = 120;
            Add(true, Catalog.GetString("Details"), details);

            AddActionWidget(new Button("gtk-cancel")
            {
                CanDefault = true
            }, ResponseType.Cancel);
            AddActionWidget(save_button, ResponseType.Ok);
        }