banshee r3945 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/Hyena.Gui/Hyena.Data.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3945 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/Hyena.Gui/Hyena.Data.Gui
- Date: Wed, 21 May 2008 22:36:07 +0000 (UTC)
Author: abock
Date: Wed May 21 22:36:06 2008
New Revision: 3945
URL: http://svn.gnome.org/viewvc/banshee?rev=3945&view=rev
Log:
2008-05-21 Aaron Bockover <abock gnome org>
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs:
Added an EnabledCount property
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
Added a check box column to control the RipEnabled property on each CD
track; when the EnabledCount on the model is zero, disable the rip action
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdTrackInfo.cs:
When RipEnabled is set or unset, increment or decrement the EnabledCount
on the model if the value actually changes
* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: NRE protection
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs: Do not layout
text if it's null or empty
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdTrackInfo.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs Wed May 21 22:36:06 2008
@@ -128,7 +128,7 @@
private ITrackModelSource current_source;
private void HandleActiveSourceChanged (SourceEventArgs args)
{
- if (current_source != null) {
+ if (current_source != null && current_source.TrackModel != null) {
current_source.TrackModel.Selection.Changed -= HandleSelectionChanged;
current_source = null;
}
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs Wed May 21 22:36:06 2008
@@ -48,6 +48,7 @@
public event EventHandler MetadataQueryStarted;
public event EventHandler MetadataQueryFinished;
+ public event EventHandler EnabledCountChanged;
private bool metadata_query_success;
private DateTime metadata_query_start_time;
@@ -90,6 +91,8 @@
duration += track.Duration;
}
+ EnabledCount = Count;
+
Reload ();
ThreadPool.QueueUserWorkItem (LoadDiscMetadata, mb_disc);
@@ -201,6 +204,14 @@
});
}
+ private void OnEnabledCountChanged ()
+ {
+ EventHandler handler = EnabledCountChanged;
+ if (handler != null) {
+ handler (this, EventArgs.Empty);
+ }
+ }
+
private ICdromDevice Drive {
get { return Volume == null ? null : (Volume.Parent as ICdromDevice); }
}
@@ -233,8 +244,13 @@
get { return disc_title; }
}
- public int TrackCount {
- get { return 0; }
+ private int enabled_count;
+ public int EnabledCount {
+ get { return enabled_count; }
+ internal set {
+ enabled_count = value;
+ OnEnabledCountChanged ();
+ }
}
}
}
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs Wed May 21 22:36:06 2008
@@ -53,8 +53,18 @@
this.service = service;
this.disc_model = discModel;
+ Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
+ <column-controller>
+ <column>
+ <renderer type=""Hyena.Data.Gui.ColumnCellCheckBox"" property=""RipEnabled""/>
+ </column>
+ <add-all-defaults />
+ </column-controller>
+ "));
+
disc_model.MetadataQueryStarted += OnMetadataQueryStarted;
disc_model.MetadataQueryFinished += OnMetadataQueryFinished;
+ disc_model.EnabledCountChanged += OnEnabledCountChanged;
disc_model.LoadModelFromDisc ();
SetupGui ();
@@ -87,6 +97,7 @@
ClearMessages ();
disc_model.MetadataQueryStarted -= OnMetadataQueryStarted;
disc_model.MetadataQueryFinished -= OnMetadataQueryFinished;
+ disc_model.EnabledCountChanged -= OnEnabledCountChanged;
service = null;
disc_model = null;
}
@@ -95,6 +106,11 @@
get { return disc_model; }
}
+ private void OnEnabledCountChanged (object o, EventArgs args)
+ {
+ UpdateActions ();
+ }
+
private void OnMetadataQueryStarted (object o, EventArgs args)
{
if (query_message != null) {
@@ -391,7 +407,7 @@
rip_action.Label = String.Format (Catalog.GetString ("Import \u201f{0}\u201d"), title);
rip_action.ShortLabel = Catalog.GetString ("Import CD");
rip_action.IconName = "media-import-audio-cd";
- rip_action.Sensitive = AudioCdRipper.Supported;
+ rip_action.Sensitive = AudioCdRipper.Supported && disc_model.EnabledCount > 0;
}
Gtk.Action duplicate_action = uia_service.GlobalActions["DuplicateDiscAction"];
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdTrackInfo.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdTrackInfo.cs Wed May 21 22:36:06 2008
@@ -100,7 +100,14 @@
private bool rip_enabled = true;
public bool RipEnabled {
get { return rip_enabled; }
- set { rip_enabled = value; }
+ set {
+ if (rip_enabled == value) {
+ return;
+ }
+
+ rip_enabled = value;
+ model.EnabledCount += rip_enabled ? 1 : -1;
+ }
}
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs Wed May 21 22:36:06 2008
@@ -51,12 +51,17 @@
public override void Render (CellContext context, StateType state, double cellWidth, double cellHeight)
{
+ string text = Text;
+ if (String.IsNullOrEmpty (text)) {
+ return;
+ }
+
context.Layout.Width = (int)((cellWidth - 8) * Pango.Scale.PangoScale);
context.Layout.FontDescription.Weight = font_weight;
context.Layout.Ellipsize = EllipsizeMode;
context.Layout.Alignment = alignment;
- context.Layout.SetText (Text);
+ context.Layout.SetText (text);
context.Layout.GetPixelSize (out text_width, out text_height);
context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]