private void CreateDefaultColumns() { indicator_column = new Column (null, "indicator", new ColumnCellStatusIndicator (null), 0.05, true, 30, 30); indicator_column.Title = String.Empty; // Visible-by-default column track_column = Create (BansheeQuery.TrackNumberField, 0.10, true, new ColumnCellTrackNumber (null, true)); track_column.Title = String.Empty; // don't show any text in the header for this column, so it can be smaller title_column = CreateText (BansheeQuery.TitleField, 0.25, true); artist_column = CreateText (BansheeQuery.ArtistField, 0.225, true); album_column = CreateText (BansheeQuery.AlbumField, 0.225, true); // Others album_artist_column = CreateText (BansheeQuery.AlbumArtistField, 0.225); genre_column = CreateText (BansheeQuery.GenreField, 0.25); duration_column = Create (BansheeQuery.DurationField, 0.10, true, new ColumnCellDuration (null, true)); year_column = Create (BansheeQuery.YearField, 0.15, false, new ColumnCellPositiveInt (null, true, 4, 4) { CultureFormatted = false }); file_size_column = Create (BansheeQuery.FileSizeField, 0.15, false, new ColumnCellFileSize (null, true)); bpm_column = Create (BansheeQuery.BpmField, 0.10, false, new ColumnCellPositiveInt (null, true, 3, 3)); // Set the property to null on these so that the object passed in is the actual bound TrackInfo track_combined_column = Create (BansheeQuery.TrackNumberField, 0.10, false, new ColumnCellTrackAndCount (null, true)); track_combined_column.Property = null; track_combined_column.Id = "track_and_count"; track_combined_column.Title = Catalog.GetString ("Track #"); track_combined_column.LongTitle = Catalog.GetString ("Track & Count"); disc_combined_column = Create (BansheeQuery.DiscNumberField, 0.10, false, new ColumnCellDiscAndCount (null, true)); disc_combined_column.Property = null; disc_combined_column.Title = Catalog.GetString ("Disc #"); disc_combined_column.LongTitle = Catalog.GetString ("Disc & Count"); ColumnCellPositiveInt br_cell = new ColumnCellPositiveInt (null, true, 3, 4); br_cell.TextFormat = Catalog.GetString ("{0} kbps"); bitrate_column = Create (BansheeQuery.BitRateField, 0.10, false, br_cell); ColumnCellPositiveInt sr_cell = new ColumnCellPositiveInt (null, true, 5, 6); sr_cell.TextFormat = Catalog.GetString ("{0} Hz"); samplerate_column = Create (BansheeQuery.SampleRateField, 0.10, false, sr_cell); ColumnCellPositiveInt bps_cell = new ColumnCellPositiveInt (null, true, 2, 2); bps_cell.TextFormat = Catalog.GetString ("{0} bits"); bitspersample_column= Create (BansheeQuery.BitsPerSampleField, 0.10, false, bps_cell); column_cell_rating = new ColumnCellRating (null, true); rating_column = Create (BansheeQuery.RatingField, 0.15, false, column_cell_rating); score_column = Create (BansheeQuery.ScoreField, 0.15, false, new ColumnCellPositiveInt (null, true, 2, 5)); composer_column = CreateText (BansheeQuery.ComposerField, 0.25); conductor_column = CreateText (BansheeQuery.ConductorField, 0.25); grouping_column = CreateText (BansheeQuery.GroupingField, 0.25); comment_column = CreateText (BansheeQuery.CommentField, 0.25); play_count_column = Create (BansheeQuery.PlayCountField, 0.15, false, new ColumnCellPositiveInt (null, true, 2, 5)); skip_count_column = Create (BansheeQuery.SkipCountField, 0.15, false, new ColumnCellPositiveInt (null, true, 2, 5)); // Construct the URI column specially b/c we want to ellipsize in the middle of the text ColumnCellText uri_cell = new ColumnCellLocation (BansheeQuery.UriField.PropertyName, true); uri_cell.EllipsizeMode = Pango.EllipsizeMode.Start; uri_column = Create (BansheeQuery.UriField, 0.15, false, uri_cell); mime_type_column = CreateText (BansheeQuery.MimeTypeField, 0.15); license_uri_column = Create (BansheeQuery.LicenseUriField, 0.15, false, new ColumnCellCreativeCommons (null, true)); last_played_column = Create (BansheeQuery.LastPlayedField, 0.15, false, new ColumnCellDateTime (null, true)); last_skipped_column = Create (BansheeQuery.LastSkippedField, 0.15, false, new ColumnCellDateTime (null, true)); date_added_column = Create (BansheeQuery.DateAddedField, 0.15, false, new ColumnCellDateTime (null, true)); ServiceStack.ServiceManager.SourceManager.ActiveSourceChanged += HandleActiveSourceChanged; }
public static SortableColumn Create(QueryField field, double width, bool visible, ColumnCell cell) { cell.Property = field.PropertyName; SortableColumn col = new SortableColumn ( field.ShortLabel, cell, width, field.Name, visible ); col.LongTitle = field.Label; col.Field = field; return col; }