[banshee] [Audiobook] Clean up, mark some strings for i18n



commit d4f36e03e62dc0ab73383fe36040d82851213816
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Fri May 14 15:28:09 2010 -0700

    [Audiobook] Clean up, mark some strings for i18n

 .../Banshee.Audiobook/Banshee.Audiobook/Actions.cs |    7 -
 .../Banshee.Audiobook/AudiobookLibrarySource.cs    |    1 -
 .../Banshee.Audiobook/AudiobookModel.cs            |    1 -
 .../Banshee.Audiobook/BookView.cs                  |  215 +-------------------
 4 files changed, 2 insertions(+), 222 deletions(-)
---
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
index 78407c8..0a8ee0d 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
@@ -58,12 +58,6 @@ namespace Banshee.Audiobook
                     Catalog.GetString ("_Edit Track Information"), "E", null, OnEdit)
             );
 
-            /*AddImportant (
-                new ActionEntry ("VisitInternetArchive", Stock.JumpTo, Catalog.GetString ("Visit Archive.org"), null, null, (o, a) => {
-                    Banshee.Web.Browser.Open ("http://archive.org";);
-                })
-            );*/
-
             AddUiFromFile ("GlobalUI.xml");
 
             Register ();
@@ -97,7 +91,6 @@ namespace Banshee.Audiobook
 
         private void OnEdit (object o, EventArgs a)
         {
-            //var books = library.BooksModel.SelectedItems;
             library.TrackModel.Selection.SelectAll ();
             Actions.TrackActions["TrackEditorAction"].Activate ();
         }
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
index 37803a1..6343cb7 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
@@ -58,7 +58,6 @@ namespace Banshee.Audiobook
             MediaTypes = TrackMediaAttributes.AudioBook;
             NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.Music;
 
-            // FIXME
             Properties.SetStringList ("Icon.Name", "audiobook", "source-library");
             Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
                 <column-controller>
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookModel.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookModel.cs
index 71331ea..6a6fdf7 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookModel.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookModel.cs
@@ -48,7 +48,6 @@ namespace Banshee.Audiobook
         public AudiobookModel (DatabaseSource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid) : base (source, trackModel, connection, uuid)
         {
             Selection = new Hyena.Collections.Selection ();
-            //CalculateUnfilteredCount = true;
             HasSelectAllItem = false;
         }
     }
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/BookView.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/BookView.cs
index 2cc1b52..cbdbc63 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/BookView.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/BookView.cs
@@ -161,7 +161,7 @@ namespace Banshee.Audiobook
 
             var notebook = new Notebook () { WidthRequest = 450, HeightRequest = 600 };
             notebook.ShowBorder = false;
-            notebook.AppendPage (new Label ("...my bookmarks..."), new Label ("Bookmarks"));
+            notebook.AppendPage (new Label ("Bookmark support coming soon!"), new Label (Catalog.GetString ("Bookmarks")));
 
             // Tracks
 
@@ -189,227 +189,16 @@ namespace Banshee.Audiobook
 
             track_list.ColumnController = file_columns;
 
-            notebook.AppendPage (track_sw, new Label ("Tracks"));
+            notebook.AppendPage (track_sw, new Label (Catalog.GetString ("Tracks")));
 
 
             right_box.PackStart (notebook, false, false, 0);
 
             hbox.PackStart (right_box, false, false, 0);
 
-            //var vbox2 = new VBox ();
-            //vbox2.PackStart (vbox, false, false, 0);
-
-            //var sw = new Gtk.ScrolledWindow () { ShadowType = ShadowType.None };
-            //sw.AddWithViewport (vbox2);
-            //(sw.Child as Viewport).ShadowType = ShadowType.None;
-            //frame.Child = sw;
-            //frame.Child = vbox;
-            //frame.ShowAll ();
-
-            /*sw.Child.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
-            sw.Child.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
-            sw.Child.ModifyText (StateType.Normal, Style.Text (StateType.Normal));
-            StyleSet += delegate {
-                sw.Child.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
-                sw.Child.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
-                sw.Child.ModifyText (StateType.Normal, Style.Text (StateType.Normal));
-            };*/
-
-            //Add (frame);
             align.Child = hbox;
             Child = align;
             ShowAll ();
         }
-
-        /*private void BuildFilesBox ()
-        {
-            var vbox = new VBox ();
-            vbox.Spacing = 6;
-
-            var file_list = new BaseTrackListView () {
-                HeaderVisible = true,
-                IsEverReorderable = false
-            };
-
-            var files_model = source.TrackModel as MemoryTrackListModel;
-            var columns = new DefaultColumnController ();
-            columns.TrackColumn.Title = "#";
-            var file_columns = new ColumnController ();
-            file_columns.AddRange (
-                columns.IndicatorColumn,
-                columns.TrackColumn,
-                columns.TitleColumn,
-                columns.DurationColumn,
-                columns.FileSizeColumn
-            );
-
-            foreach (var col in file_columns) {
-                col.Visible = true;
-            }
-
-            var file_sw = new Gtk.ScrolledWindow ();
-            file_sw.Child = file_list;
-
-            var tracks = new List<TrackInfo> ();
-
-            var files = new List<IA.DetailsFile> (details.Files);
-
-            string [] format_blacklist = new string [] { "metadata", "fingerprint", "checksums", "xml", "m3u", "dublin core", "unknown" };
-            var formats = new List<string> ();
-            foreach (var f in files) {
-                var track = new TrackInfo () {
-                    Uri         = new SafeUri (f.Location),
-                    FileSize    = f.Size,
-                    TrackNumber = f.Track,
-                    ArtistName  = f.Creator ?? details.Creator,
-                    AlbumTitle  = item.Title,
-                    TrackTitle  = f.Title,
-                    BitRate     = f.BitRate,
-                    MimeType    = f.Format,
-                    Duration    = f.Length
-                };
-
-                // Fix up duration/track#/title
-                if ((f.Length == TimeSpan.Zero || f.Title == null || f.Track == 0) && !f.Location.Contains ("zip") && !f.Location.EndsWith ("m3u")) {
-                    foreach (var b in files) {
-                        if ((f.Title != null && f.Title == b.Title)
-                                || (f.OriginalFile != null && b.Location != null && b.Location.EndsWith (f.OriginalFile))
-                                || (f.OriginalFile != null && f.OriginalFile == b.OriginalFile)) {
-                            if (track.Duration == TimeSpan.Zero)
-                                track.Duration = b.Length;
-
-                            if (track.TrackTitle == null)
-                                track.TrackTitle = b.Title;
-
-                            if (track.TrackNumber == 0)
-                                track.TrackNumber = b.Track;
-
-                            if (track.Duration != TimeSpan.Zero && track.TrackTitle != null && track.TrackNumber != 0)
-                                break;
-                        }
-                    }
-                }
-
-                track.TrackTitle = track.TrackTitle ?? System.IO.Path.GetFileName (f.Location);
-
-                tracks.Add (track);
-
-                if (f.Format != null && !formats.Contains (f.Format)) {
-                    if (!format_blacklist.Any (fmt => f.Format.ToLower ().Contains (fmt))) {
-                        formats.Add (f.Format);
-                    }
-                }
-            }
-
-            // Order the formats according to the preferences
-            string format_order = String.Format (", {0}, {1}, {2},", HomeSource.VideoTypes.Get (), HomeSource.AudioTypes.Get (), HomeSource.TextTypes.Get ()).ToLower ();
-
-            var sorted_formats = formats.Select (f => new { Format = f, Order = Math.Max (format_order.IndexOf (", " + f.ToLower () + ","), format_order.IndexOf (f.ToLower ())) })
-                                        .OrderBy (o => o.Order == -1 ? Int32.MaxValue : o.Order);
-
-            // See if all the files contain their track #
-            bool all_tracks_have_num_in_title = tracks.All (t => t.TrackNumber == 0 || t.TrackTitle.Contains (t.TrackNumber.ToString ()));
-
-            // Make these columns snugly fix their data
-            if (tracks.Count > 0) {
-                // Mono in openSUSE 11.0 doesn't like this
-                //SetWidth (columns.TrackColumn,    all_tracks_have_num_in_title ? 0 : tracks.Max (f => f.TrackNumber), 0);
-                int max_track = 0;
-                long max_size = 0;
-                foreach (var t in tracks) {
-                    max_track = Math.Max (max_track, t.TrackNumber);
-                    max_size = Math.Max (max_size, t.FileSize);
-                }
-                SetWidth (columns.TrackColumn,    all_tracks_have_num_in_title ? 0 : max_track, 0);
-
-                // Mono in openSUSE 11.0 doesn't like this
-                //SetWidth (columns.FileSizeColumn, tracks.Max (f => f.FileSize), 0);
-                SetWidth (columns.FileSizeColumn, max_size, 0);
-                SetWidth (columns.DurationColumn, tracks.Max (f => f.Duration), TimeSpan.Zero);
-            }
-
-            string max_title = "     ";
-            if (tracks.Count > 0) {
-                var sorted_by_title = files.Where (t => !t.Location.Contains ("zip"))
-                                           .OrderBy (f => f.Title == null ? 0 : f.Title.Length)
-                                           .ToList ();
-                string nine_tenths = sorted_by_title[(int)Math.Floor (.90 * sorted_by_title.Count)].Title ?? "";
-                string max = sorted_by_title[sorted_by_title.Count - 1].Title ?? "";
-                max_title = ((double)max.Length >= (double)(1.6 * (double)nine_tenths.Length)) ? nine_tenths : max;
-            }
-            (columns.TitleColumn.GetCell (0) as ColumnCellText).SetMinMaxStrings (max_title);
-
-            file_list.ColumnController = file_columns;
-            file_list.SetModel (files_model);
-
-            var format_list = ComboBox.NewText ();
-            format_list.RowSeparatorFunc = (model, iter) => {
-                return (string)model.GetValue (iter, 0) == "---";
-            };
-
-            bool have_sep = false;
-            int active_format = 0;
-            foreach (var fmt in sorted_formats) {
-                if (fmt.Order == -1 && !have_sep) {
-                    have_sep = true;
-                    if (format_list.Model.IterNChildren () > 0) {
-                        format_list.AppendText ("---");
-                    }
-                }
-
-                format_list.AppendText (fmt.Format);
-
-                if (active_format == 0 && fmt.Format == item.SelectedFormat) {
-                    active_format = format_list.Model.IterNChildren () - 1;
-                }
-            }
-
-            format_list.Changed += (o, a) => {
-                files_model.Clear ();
-
-                var selected_fmt = format_list.ActiveText;
-                foreach (var track in tracks) {
-                    if (track.MimeType == selected_fmt) {
-                        files_model.Add (track);
-                    }
-                }
-
-                files_model.Reload ();
-
-                item.SelectedFormat = selected_fmt;
-                item.Save ();
-            };
-
-            if (formats.Count > 0) {
-                format_list.Active = active_format;
-            }
-
-            vbox.PackStart (file_sw, true, true, 0);
-            vbox.PackStart (format_list, false, false, 0);
-
-            file_list.SizeAllocated += (o, a) => {
-                int target_list_width = file_list.MaxWidth;
-                if (file_sw.VScrollbar != null && file_sw.VScrollbar.IsMapped) {
-                    target_list_width += file_sw.VScrollbar.Allocation.Width + 2;
-                }
-
-                // Don't let the track list be too wide
-                target_list_width = Math.Min (target_list_width, (int) (0.5 * (double)Allocation.Width));
-
-                if (a.Allocation.Width != target_list_width && target_list_width > 0) {
-                    file_sw.SetSizeRequest (target_list_width, -1);
-                }
-            };
-
-            PackStart (vbox, false, false, 0);
-        }*/
-
-        /*private void SetWidth<T> (Column col, T max, T zero)
-        {
-            (col.GetCell (0) as ColumnCellText).SetMinMaxStrings (max, max);
-            if (zero.Equals (max)) {
-                col.Visible = false;
-            }
-        }*/
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]