[banshee: 59/61] [InternetArchive] Remember last format for item
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee: 59/61] [InternetArchive] Remember last format for item
- Date: Tue, 3 Nov 2009 06:32:48 +0000 (UTC)
commit 6c7b686b05299f8581bef1b3be5acd903a75cc15
Author: Gabriel Burt <gabriel burt gmail com>
Date: Mon Nov 2 21:50:45 2009 -0800
[InternetArchive] Remember last format for item
Also add db columns to IaItems to remember which file and where in it
playback last was - not yet hooked up though.
.../Banshee.InternetArchive/DetailsView.cs | 11 +++++-
.../Banshee.InternetArchive/Item.cs | 33 +++++++++++++++----
2 files changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
index bebacb6..bf91d94 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/DetailsView.cs
@@ -195,7 +195,6 @@ namespace Banshee.InternetArchive
// Description
var desc = new Hyena.Widgets.WrapLabel () {
- //Markup = String.Format ("<small>{0}</small>", GLib.Markup.EscapeText (Hyena.StringUtil.RemoveHtml (details.Description)))
Markup = String.Format ("{0}", GLib.Markup.EscapeText (Hyena.StringUtil.RemoveHtml (details.Description)))
};
@@ -475,6 +474,7 @@ namespace Banshee.InternetArchive
};
bool have_sep = false;
+ int active_format = 0;
foreach (var fmt in sorted_formats) {
if (fmt.Order == -1 && !have_sep) {
have_sep = true;
@@ -484,6 +484,10 @@ namespace Banshee.InternetArchive
}
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) => {
@@ -497,10 +501,13 @@ namespace Banshee.InternetArchive
}
files_model.Reload ();
+
+ item.SelectedFormat = selected_fmt;
+ item.Save ();
};
if (formats.Count > 0) {
- format_list.Active = 0;
+ format_list.Active = active_format;
}
vbox.PackStart (file_sw, true, true, 0);
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Item.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Item.cs
index 24f1437..e6b65c2 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Item.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Item.cs
@@ -60,7 +60,7 @@ namespace Banshee.InternetArchive
var item = Provider.FetchFirstMatching ("ID = ?", id);
if (item == null) {
item = new Item (id, title, mediaType);
- Provider.Save (item);
+ item.Save ();
}
return item;
@@ -74,18 +74,27 @@ namespace Banshee.InternetArchive
[DatabaseColumn("ItemId", Constraints = DatabaseColumnConstraints.PrimaryKey)]
private int DbId { get; set; }
- [DatabaseColumn("DetailsJson")]
+ [DatabaseColumn]
private string DetailsJson { get; set; }
- [DatabaseColumn("ID")]
+ [DatabaseColumn]
public string Id { get; private set; }
- [DatabaseColumn("Title")]
+ [DatabaseColumn]
public string Title { get; private set; }
- [DatabaseColumn("MediaType")]
+ [DatabaseColumn]
public string MediaType { get; private set; }
+ [DatabaseColumn]
+ public string SelectedFormat { get; set; }
+
+ [DatabaseColumn]
+ public string BookmarkFile { get; set; }
+
+ [DatabaseColumn]
+ public int BookmarkPosition { get; set; }
+
public IA.Details Details { get; private set; }
public Item () {}
@@ -107,10 +116,15 @@ namespace Banshee.InternetArchive
if (Details == null) {
Details = new IA.Details (Id, DetailsJson);
DetailsJson = Details.Json;
- Provider.Save (this);
+ Save ();
}
}
+ public void Save ()
+ {
+ Provider.Save (this);
+ }
+
private static SqliteModelProvider<Item> provider;
private static SqliteModelProvider<Item> Provider {
get {
@@ -130,7 +144,12 @@ namespace Banshee.InternetArchive
ID TEXT UNIQUE NOT NULL,
Title TEXT NOT NULL,
MediaType TEXT,
- DetailsJson TEXT)"
+ DetailsJson TEXT,
+
+ SelectedFormat TEXT,
+ BookmarkFile TEXT,
+ BookmarkPosition INTEGER DEFAULT 0
+ )"
);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]