banshee r5140 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Dap/Banshee.Dap/Banshee.Dap
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r5140 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Dap/Banshee.Dap/Banshee.Dap
- Date: Thu, 19 Mar 2009 00:36:09 +0000 (UTC)
Author: gburt
Date: Thu Mar 19 00:36:09 2009
New Revision: 5140
URL: http://svn.gnome.org/viewvc/banshee?rev=5140&view=rev
Log:
2009-03-18 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Preferences/Root.cs:
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs:
Handle the Name/ShortDescription of a pref changing.
* src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs: Update the Name of
each library sync option when we recaculate the sync, showing the # items
to add and remove.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Root.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Root.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Root.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Root.cs Thu Mar 19 00:36:09 2009
@@ -66,12 +66,18 @@
public string Name {
get { return name; }
- set { name = value; }
+ set {
+ name = value;
+ OnChanged ();
+ }
}
public string Description {
get { return description; }
- set { description = value; }
+ set {
+ description = value;
+ OnChanged ();
+ }
}
public int Order {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs Thu Mar 19 00:36:09 2009
@@ -471,6 +471,9 @@
Log.WarningFormat ("Cannot delete all tracks from {0} via primary source {1}", source, this);
return;
}
+
+ if (source.Count < 1)
+ return;
ThreadAssist.SpawnFromMain (delegate {
CachedList<DatabaseTrackInfo> list = CachedList<DatabaseTrackInfo>.CreateFromModel (source.DatabaseTrackModel);
@@ -480,7 +483,7 @@
protected override void DeleteSelectedTracks (DatabaseTrackListModel model)
{
- if (model == null) {
+ if (model == null || model.Count < 1) {
return;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs Thu Mar 19 00:36:09 2009
@@ -50,31 +50,45 @@
private static Widget GetWidget (PreferenceBase preference, Type type)
{
+ Widget pref_widget = null;
Widget widget = null;
if (type == typeof (bool)) {
- widget = new PreferenceCheckButton (preference);
+ pref_widget = new PreferenceCheckButton (preference);
} else if (type == typeof (string)) {
- widget = new PreferenceEntry (preference);
+ pref_widget = new PreferenceEntry (preference);
}
- if (widget != null) {
- preference.Changed += delegate (Root pref) {
- widget.Sensitive = pref.Sensitive;
- widget.Visible = pref.Visible;
- };
-
- widget.Sensitive = preference.Sensitive;
- widget.Visible = preference.Visible;
+ if (pref_widget != null) {
+ pref_widget.Sensitive = preference.Sensitive;
+ pref_widget.Visible = preference.Visible;
+ DescriptionLabel label = null;
if (preference.ShowDescription) {
VBox box = new VBox ();
- box.PackStart (widget, false, false, 0);
- new DescriptionLabel (preference.Description).PackInto (box, false);
+ box.PackStart (pref_widget, false, false, 0);
+ label = new DescriptionLabel (preference.Description);
+ label.Visible = !String.IsNullOrEmpty (preference.Description);
+ label.PackInto (box, false);
widget = box;
}
+
+ preference.Changed += delegate (Root pref) {
+ Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+ pref_widget.Sensitive = pref.Sensitive;
+ pref_widget.Visible = pref.Visible;
+ /*if (label != null) {
+ label.Text = pref.Description;
+ label.Visible = !String.IsNullOrEmpty (preference.Description);
+ }*/
+
+ if (pref_widget is PreferenceCheckButton) {
+ (pref_widget as PreferenceCheckButton).Label = pref.Name;
+ }
+ });
+ };
}
- return widget;
+ return widget ?? pref_widget;
}
public static Widget GetMnemonicWidget (PreferenceBase preference)
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs Thu Mar 19 00:36:09 2009
@@ -52,6 +52,7 @@
private string conf_ns;
private SchemaEntry<bool> enabled, sync_entire_library;
private SchemaEntry<string[]> playlist_ids;
+ private SchemaPreference<bool> enabled_pref;
private SmartPlaylistSource sync_src, to_add, to_remove;
private Section library_prefs_section;
@@ -129,7 +130,9 @@
"If sync_entire_library is false, this contains a list of playlist ids specifically to sync", "");
library_prefs_section = new Section (String.Format ("{0} sync", library.Name), library.Name, 0);
- library_prefs_section.Add<bool> (enabled);
+ enabled_pref = library_prefs_section.Add<bool> (enabled);
+ enabled_pref.ShowDescription = true;
+ enabled_pref.ShowLabel = false;
}
private void BuildSyncLists ()
@@ -182,6 +185,9 @@
sync_src.RefreshAndReload ();
to_add.RefreshAndReload ();
to_remove.RefreshAndReload ();
+ enabled_pref.Name = String.Format ("{0} ({1})",
+ enabled.ShortDescription,
+ String.Format (Catalog.GetString ("{0} to add, {1} to remove"), to_add.Count, to_remove.Count));
}
public override string ToString ()
@@ -194,17 +200,11 @@
{
if (Enabled) {
Banshee.Base.ThreadAssist.AssertNotInMainThread ();
- if (to_remove.Count > 0) {
- //Log.DebugFormat ("deleting items for {0} - {1} items; to_remove is smartplaylist {2}, with cachid {3}", library.Name, to_remove.Count, to_remove.DbId, to_remove.DatabaseTrackModel.CacheId);
- sync.Dap.DeleteAllTracks (to_remove);
- }
- if (to_add.Count > 0) {
- sync.Dap.AddAllTracks (to_add);
- }
+ sync.Dap.DeleteAllTracks (to_remove);
+ sync.Dap.AddAllTracks (to_add);
if (library.SupportsPlaylists && sync.Dap.SupportsPlaylists) {
-
// Now create the playlists, taking snapshots of smart playlists and saving them
// as normal playlists
IList<AbstractPlaylistSource> playlists = GetSyncPlaylists ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]