banshee r3806 - in trunk/banshee: . src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Core/Banshee.Configuration.Schema src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3806 - in trunk/banshee: . src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Core/Banshee.Configuration.Schema src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Gui
- Date: Tue, 22 Apr 2008 23:05:44 +0100 (BST)
Author: abock
Date: Tue Apr 22 22:05:44 2008
New Revision: 3806
URL: http://svn.gnome.org/viewvc/banshee?rev=3806&view=rev
Log:
2008-04-22 Aaron Bockover <abock gnome org>
* src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs:
* src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs:
Added a enableErrorCorrection argument to the Begin method
* src/Core/Banshee.Core/Banshee.Configuration.Schema/ImportSchema.cs:
Removed the error correction schema
* src/Core/Banshee.Services/Banshee.Preferences/Collection.cs: Added remove
* src/Core/Banshee.Services/Banshee.Preferences/Preference.cs:
* src/Core/Banshee.Services/Banshee.Preferences/Root.cs:
* src/Core/Banshee.Services/Banshee.Preferences/SchemaPreference.cs:
Added Description property and ctor overrides
* src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/PreferencesDialog.cs:
Removed crap
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs:
Set tooltips
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs:
Pass the schema value ot Begin
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs:
Add the first preference for audio CD support
* src/Libraries/Hyena.Gui/Hyena.Gui/TooltipSetter.cs: A new awesome
tooltip wrapper that will either use the old Gtk.Tooltips API or the new
Gtk.Widget.TooltipText property, depending on what is available
Added:
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/TooltipSetter.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration.Schema/ImportSchema.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Preference.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Root.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SchemaPreference.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/PreferencesDialog.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs (original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs Tue Apr 22 22:05:44 2008
@@ -57,7 +57,7 @@
public event AudioCdRipperTrackFinishedHandler TrackFinished;
public event AudioCdRipperErrorHandler Error;
- public void Begin (string device)
+ public void Begin (string device, bool enableErrorCorrection)
{
try {
Profile profile = ServiceManager.MediaProfileManager.GetConfiguredActiveProfile ("cd-importing");
@@ -77,7 +77,7 @@
}
try {
- int paranoia_mode = ImportSchema.AudioCDErrorCorrection.Get (false) ? 255 : 0;
+ int paranoia_mode = enableErrorCorrection ? 255 : 0;
handle = new HandleRef (this, br_new (device, paranoia_mode, encoder_pipeline));
progress_handler = new RipperProgressHandler (OnNativeProgress);
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration.Schema/ImportSchema.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration.Schema/ImportSchema.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration.Schema/ImportSchema.cs Tue Apr 22 22:05:44 2008
@@ -33,13 +33,6 @@
{
public static class ImportSchema
{
- public static readonly SchemaEntry<bool> AudioCDErrorCorrection = new SchemaEntry<bool>(
- "import", "audio_cd_error_correction",
- false,
- "Enable error correction",
- "When importing an audio CD, enable error correction (paranoia mode)"
- );
-
public static readonly SchemaEntry<bool> ShowInitialImportDialog = new SchemaEntry<bool>(
"import", "show_initial_import_dialog",
true,
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs Tue Apr 22 22:05:44 2008
@@ -43,7 +43,7 @@
event AudioCdRipperTrackFinishedHandler TrackFinished;
event AudioCdRipperErrorHandler Error;
- void Begin (string device);
+ void Begin (string device, bool enableErrorCorrection);
void Finish ();
void Cancel ();
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs Tue Apr 22 22:05:44 2008
@@ -103,9 +103,11 @@
list.Add (item);
}
- bool ICollection<T>.Remove (T item)
+ public bool Remove (T item)
{
- return list.Remove (item);
+ lock (this) {
+ return list.Remove (item);
+ }
}
void ICollection<T>.Clear ()
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Preference.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Preference.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Preference.cs Tue Apr 22 22:05:44 2008
@@ -34,14 +34,19 @@
{
private T value;
- public Preference (string id, string name) : this (id, name, default (T))
+ public Preference (string id, string name) : this (id, name, null)
{
}
- public Preference (string id, string name, T value)
+ public Preference (string id, string name, string description) : this (id, name, description, default (T))
+ {
+ }
+
+ public Preference (string id, string name, string description, T value)
{
Id = id;
Name = name;
+ Description = description;
this.value = value;
}
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 Tue Apr 22 22:05:44 2008
@@ -34,6 +34,7 @@
{
private string id;
private string name;
+ private string description;
private int order;
private bool sensitive;
private bool visible;
@@ -54,6 +55,11 @@
set { name = value; }
}
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
public int Order {
get { return order; }
set { order = value; }
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SchemaPreference.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SchemaPreference.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SchemaPreference.cs Tue Apr 22 22:05:44 2008
@@ -36,7 +36,11 @@
{
private SchemaEntry<T> schema;
- public SchemaPreference (SchemaEntry<T> schema, string name) : base (schema.Key, name)
+ public SchemaPreference (SchemaEntry<T> schema, string name) : this (schema, name, null)
+ {
+ }
+
+ public SchemaPreference (SchemaEntry<T> schema, string name, string description) : base (schema.Key, name, description)
{
this.schema = schema;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/PreferencesDialog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/PreferencesDialog.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/PreferencesDialog.cs Tue Apr 22 22:05:44 2008
@@ -50,7 +50,6 @@
[Widget] private Button library_reset;
[Widget] private CheckButton copy_on_import;
[Widget] private CheckButton write_metadata;
- [Widget] private CheckButton error_correction;
[Widget] private Table organization_table;
private Tooltips tips = new Tooltips();
@@ -148,7 +147,6 @@
copy_on_import.Active = LibrarySchema.CopyOnImport.Get();
write_metadata.Active = LibrarySchema.WriteMetadata.Get();
- error_correction.Active = ImportSchema.AudioCDErrorCorrection.Get();
}
private void ConnectEvents()
@@ -170,10 +168,6 @@
LibrarySchema.WriteMetadata.Set(write_metadata.Active);
};
- error_correction.Toggled += delegate {
- ImportSchema.AudioCDErrorCorrection.Set(error_correction.Active);
- };
-
folder_box.Changed += OnFolderFileChanged;
file_box.Changed += OnFolderFileChanged;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs Tue Apr 22 22:05:44 2008
@@ -29,12 +29,15 @@
using System;
using Gtk;
+using Hyena.Gui;
using Banshee.Preferences;
namespace Banshee.Preferences.Gui
{
public class SectionBox : Table
{
+ private object tp_host;
+
public SectionBox (Section section) : base (1, 2, false)
{
ColumnSpacing = 10;
@@ -55,8 +58,10 @@
uint start_row = NRows;
uint start_col = 0;
+ Widget label = null;
+
if (!(widget is CheckButton) && preference.ShowLabel) {
- AttachLabel (preference.Name, start_row);
+ label = AttachLabel (preference.Name, start_row);
start_col++;
}
@@ -64,12 +69,23 @@
Attach (widget, start_col, 2, start_row, start_row + 1,
AttachOptions.Expand | AttachOptions.Fill,
AttachOptions.Expand | AttachOptions.Fill, 0, 0);
+
+ if (!String.IsNullOrEmpty (preference.Description)) {
+ if (tp_host == null) {
+ tp_host = TooltipSetter.CreateHost ();
+ }
+
+ TooltipSetter.Set (tp_host, widget, preference.Description);
+ if (label != null) {
+ TooltipSetter.Set (tp_host, label, preference.Description);
+ }
+ }
}
- private void AttachLabel (string text, uint start_row)
+ private Label AttachLabel (string text, uint start_row)
{
if (String.IsNullOrEmpty (text)) {
- return;
+ return null;
}
Label label = new Label (String.Format ("{0}:", text));
@@ -80,6 +96,8 @@
Attach (label, 0, 1, start_row, start_row + 1,
AttachOptions.Fill,
AttachOptions.Expand | AttachOptions.Fill, 0, 0);
+
+ return label;
}
}
}
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs Tue Apr 22 22:05:44 2008
@@ -128,7 +128,7 @@
}
}
- ripper.Begin (source.DiscModel.Volume.DeviceNode);
+ ripper.Begin (source.DiscModel.Volume.DeviceNode, AudioCdService.ErrorCorrection.Get ());
RipNextTrack ();
}
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs Tue Apr 22 22:05:44 2008
@@ -28,9 +28,13 @@
using System;
using System.Collections.Generic;
+using Mono.Unix;
using Hyena;
+
using Banshee.ServiceStack;
+using Banshee.Configuration;
+using Banshee.Preferences;
using Banshee.Hardware;
namespace Banshee.AudioCd
@@ -38,6 +42,7 @@
public class AudioCdService : IExtensionService, IDisposable
{
private Dictionary<string, AudioCdSource> sources;
+ private Section pref_section;
public AudioCdService ()
{
@@ -46,6 +51,8 @@
public void Initialize ()
{
lock (this) {
+ InstallPreferences ();
+
sources = new Dictionary<string, AudioCdSource> ();
foreach (ICdromDevice device in ServiceManager.HardwareManager.GetAllCdromDevices ()) {
@@ -60,6 +67,8 @@
public void Dispose ()
{
lock (this) {
+ UninstallPreferences ();
+
ServiceManager.HardwareManager.DeviceAdded -= OnHardwareDeviceAdded;
ServiceManager.HardwareManager.DeviceRemoved -= OnHardwareDeviceRemoved;
@@ -125,6 +134,38 @@
}
}
+ private void InstallPreferences ()
+ {
+ PreferenceService service = ServiceManager.Get<PreferenceService> ();
+ if (service == null) {
+ return;
+ }
+
+ pref_section = service["general"].Add (new Section ("audio-cd", Catalog.GetString ("Audio CD Importing"), 20));
+ pref_section.Add (new SchemaPreference<bool> (ErrorCorrection,
+ Catalog.GetString ("Use error correction when importing"),
+ Catalog.GetString ("Error correction tries to work around problem areas on a disc, such " +
+ "as surface scratches, but will slow down importing substantially.")));
+ }
+
+ private void UninstallPreferences ()
+ {
+ PreferenceService service = ServiceManager.Get<PreferenceService> ();
+ if (service == null || pref_section == null) {
+ return;
+ }
+
+ service["general"].Remove (pref_section);
+ pref_section = null;
+ }
+
+ public static readonly SchemaEntry<bool> ErrorCorrection = new SchemaEntry<bool> (
+ "import", "audio_cd_error_correction",
+ false,
+ "Enable error correction",
+ "When importing an audio CD, enable error correction (paranoia mode)"
+ );
+
string IService.ServiceName {
get { return "AudioCdService"; }
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp Tue Apr 22 22:05:44 2008
@@ -68,6 +68,7 @@
<File name="Hyena.Widgets/MenuButton.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Gui/CompositeUtils.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Widgets/TextViewLabel.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena.Gui/TooltipSetter.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Added: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/TooltipSetter.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/TooltipSetter.cs Tue Apr 22 22:05:44 2008
@@ -0,0 +1,87 @@
+//
+// TooltipSetter.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+
+using Gtk;
+
+namespace Hyena.Gui
+{
+ public static class TooltipSetter
+ {
+ private static Type host_type;
+ private static MethodInfo host_set_tip_method;
+ private static PropertyInfo tooltip_text_property;
+ private static bool reflected;
+
+ public static object CreateHost ()
+ {
+ if (tooltip_text_property != null) {
+ return null;
+ }
+
+ Type type = reflected ? null : typeof (Widget);
+
+ if (type != null) {
+ tooltip_text_property = type.GetProperty ("TooltipText", BindingFlags.Instance | BindingFlags.Public);
+ if (tooltip_text_property != null) {
+ reflected = true;
+ return null;
+ }
+ }
+
+ if (host_set_tip_method == null && !reflected) {
+ reflected = true;
+ host_type = Type.GetType (String.Format ("Gtk.Tooltips, {0}", type.Assembly.FullName));
+ if (type == null) {
+ return null;
+ }
+
+ host_set_tip_method = host_type.GetMethod ("SetTip", BindingFlags.Instance |
+ BindingFlags.Public | BindingFlags.InvokeMethod);
+ if (host_set_tip_method == null) {
+ return null;
+ }
+ }
+
+ return host_set_tip_method != null ? Activator.CreateInstance (host_type) : null;
+ }
+
+ public static void Set (object host, Widget widget, string textTip)
+ {
+ if (tooltip_text_property != null) {
+ tooltip_text_property.SetValue (widget, textTip, null);
+ } else if (host != null && host_set_tip_method != null) {
+ host_set_tip_method.Invoke (host, new object [] { widget, textTip, null });
+ } else {
+ throw new ApplicationException ("You must call TooltipSetter.CreateHost before calling TooltipSetter.Set");
+ }
+ }
+ }
+}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am Tue Apr 22 22:05:44 2008
@@ -39,6 +39,7 @@
Hyena.Gui/GtkUtilities.cs \
Hyena.Gui/PangoCairoHelper.cs \
Hyena.Gui/ShadingTestWindow.cs \
+ Hyena.Gui/TooltipSetter.cs \
Hyena.Query.Gui/DateQueryValueEntry.cs \
Hyena.Query.Gui/FileSizeQueryValueEntry.cs \
Hyena.Query.Gui/IntegerQueryValueEntry.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]