[banshee] [InternetArchive] Lazy-load items' data and GUI
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [InternetArchive] Lazy-load items' data and GUI
- Date: Fri, 29 Jan 2010 02:24:05 +0000 (UTC)
commit d254f4798ba4b5f7474af83ce89331026a47cd6d
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Jan 28 18:23:08 2010 -0800
[InternetArchive] Lazy-load items' data and GUI
.../Banshee.Sources.Gui/LazyLoadSourceContents.cs | 6 ++++-
.../Banshee.InternetArchive/DetailsSource.cs | 21 +++++++++++++++----
.../Banshee.InternetArchive/DetailsView.cs | 12 +++++++---
3 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/LazyLoadSourceContents.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/LazyLoadSourceContents.cs
index d27e81f..390a990 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/LazyLoadSourceContents.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/LazyLoadSourceContents.cs
@@ -37,7 +37,7 @@ namespace Banshee.Sources.Gui
public class LazyLoadSourceContents<T> : ISourceContents, IDisposable where T : ISourceContents
{
private object [] args;
- private ISourceContents actual_contents;
+ private T actual_contents;
private ISourceContents ActualContents {
get {
if (actual_contents == null) {
@@ -75,6 +75,10 @@ namespace Banshee.Sources.Gui
ActualContents.ResetSource ();
}
+ public T Contents {
+ get { return actual_contents; }
+ }
+
public ISource Source {
get { return ActualContents.Source; }
}
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsSource.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsSource.cs
index ba65e86..011e763 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsSource.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsSource.cs
@@ -49,6 +49,7 @@ using Banshee.Playlist;
using Banshee.Preferences;
using Banshee.ServiceStack;
using Banshee.Sources;
+using Banshee.Sources.Gui;
using IA=InternetArchive;
@@ -58,7 +59,7 @@ namespace Banshee.InternetArchive
{
private Item item;
private MemoryTrackListModel track_model;
- private DetailsView gui;
+ private LazyLoadSourceContents<DetailsView> gui;
public Item Item {
get { return item; }
@@ -78,14 +79,24 @@ namespace Banshee.InternetArchive
SetIcon ();
- gui = new DetailsView (this, item);
- Properties.Set<Gtk.Widget> ("Nereid.SourceContents", gui);
+ gui = new LazyLoadSourceContents<DetailsView> (this, item);
+ Properties.Set<ISourceContents> ("Nereid.SourceContents", gui);
+ }
+
+ private bool details_loaded;
+ internal void LoadDetails ()
+ {
+ if (details_loaded) {
+ return;
+ }
+
+ details_loaded = true;
if (item.Details == null) {
SetStatus (Catalog.GetString ("Getting item details from the Internet Archive"), false, true, null);
Load ();
} else {
- gui.UpdateDetails ();
+ gui.Contents.UpdateDetails ();
}
}
@@ -124,7 +135,7 @@ namespace Banshee.InternetArchive
ThreadAssist.ProxyToMain (delegate {
ClearMessages ();
if (item.Details != null) {
- gui.UpdateDetails ();
+ gui.Contents.UpdateDetails ();
}
});
} catch (Exception e) {
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
index 719c445..9ebfe8e 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
@@ -69,16 +69,20 @@ namespace Banshee.InternetArchive
{
this.source = source;
this.item = item;
-
Spacing = 6;
+ source.LoadDetails ();
}
+ private bool gui_built;
public void UpdateDetails ()
{
details = item.Details;
- BuildInfoBox ();
- BuildFilesBox ();
- ShowAll ();
+ if (!gui_built && details != null) {
+ gui_built = true;
+ BuildInfoBox ();
+ BuildFilesBox ();
+ ShowAll ();
+ }
}
#region ISourceContents
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]