banshee r4161 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.InternetRadio src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4161 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.InternetRadio src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Tue, 17 Jun 2008 23:13:14 +0000 (UTC)
Author: abock
Date: Tue Jun 17 23:13:14 2008
New Revision: 4161
URL: http://svn.gnome.org/viewvc/banshee?rev=4161&view=rev
Log:
2008-06-17 Aaron Bockover <abock gnome org>
* src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/RadioColumnController.cs:
Removed in favor of the XML column controller stuff I completely forgot
that I had implemented
* src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/InternetRadioSource.cs:
Implement the column controller in XML
* src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs:
Get action labels and icons through source inheritance
* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: Allow the
track properties action to have its settings overridden
* src/Core/Banshee.Services/Banshee.Sources/Source.cs: Gabe implemented
GetInheritedProperty that will look for a given property in the
source chain, walking up to the parent
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs:
Fixes to ensure that the view will still work if there are no
adjustments (not packed in a scrolled window) or no model is set
Removed:
trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/RadioColumnController.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio.mdp
trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/InternetRadioSource.cs
trunk/banshee/src/Extensions/Banshee.InternetRadio/Makefile.am
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs Tue Jun 17 23:13:14 2008
@@ -231,6 +231,15 @@
}
}
+ public T GetInheritedProperty<T> (string name)
+ {
+ return Properties.Contains (name)
+ ? Properties.Get<T> (name)
+ : Parent != null
+ ? Parent.GetInheritedProperty<T> (name)
+ : default (T);
+ }
+
#endregion
#region Protected Methods
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs Tue Jun 17 23:13:14 2008
@@ -108,12 +108,12 @@
// If this source has a label property for this action, override the current label, otherwise reset it
// to the original label
- string label = source.Properties.GetString (String.Format ("{0}Label", action_name)) ?? labels[action_name];
+ string label = source.GetInheritedProperty<string> (String.Format ("{0}Label", action_name)) ?? labels[action_name];
action.Label = label;
// If this source has an icon property for this action, override the current icon, othewise reset it
// to the original icon
- string icon = source.Properties.GetString (String.Format ("{0}IconName", action_name)) ?? icons[action_name];
+ string icon = source.GetInheritedProperty<string> (String.Format ("{0}IconName", action_name)) ?? icons[action_name];
if (!String.IsNullOrEmpty (icon)) {
action.IconName = icon;
}
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 Tue Jun 17 23:13:14 2008
@@ -225,7 +225,7 @@
UpdateAction ("DeleteTracksFromDriveAction", is_track_source && track_source.CanDeleteTracks, has_selection, source);
UpdateAction ("RemoveTracksFromLibraryAction", source.Parent is LibrarySource, has_selection, null);
- UpdateAction ("TrackPropertiesAction", in_database, has_selection, null);
+ UpdateAction ("TrackPropertiesAction", in_database, has_selection, source);
UpdateAction ("RateTracksAction", in_database, has_selection, null);
UpdateAction ("AddToPlaylistAction", in_database && primary_source != null && primary_source.SupportsPlaylists, has_selection, null);
@@ -275,7 +275,7 @@
if (current_source != null) {
Source source = current_source as Source;
InvokeHandler handler = source != null
- ? source.Properties.Get<InvokeHandler> ("TrackPropertiesHandler")
+ ? source.GetInheritedProperty<InvokeHandler> ("TrackPropertiesActionHandler")
: null;
if (handler != null) {
Modified: trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio.mdp (original)
+++ trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio.mdp Tue Jun 17 23:13:14 2008
@@ -1,4 +1,4 @@
-<Project name="Banshee.InternetRadio" fileversion="2.0" UseParentDirectoryAsNamespace="True" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+<Project name="Banshee.InternetRadio" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.InternetRadio" />
@@ -13,7 +13,6 @@
<File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
<File name="Banshee.InternetRadio/InternetRadioSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.InternetRadio/StationEditor.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.InternetRadio/RadioColumnController.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.InternetRadio/XspfMigrator.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
@@ -33,4 +32,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
-</Project>
\ No newline at end of file
+</Project>
Modified: trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/InternetRadioSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/InternetRadioSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.InternetRadio/Banshee.InternetRadio/InternetRadioSource.cs Tue Jun 17 23:13:14 2008
@@ -41,6 +41,7 @@
using Banshee.Configuration;
using Banshee.Gui;
+using Banshee.Sources.Gui;
namespace Banshee.InternetRadio
{
@@ -51,6 +52,7 @@
}
private uint ui_id;
+ // private InternetRadioSourceContents source_contents;
public InternetRadioSource () : base (Catalog.GetString ("Radio"),
Catalog.GetString ("Radio"), "internet-radio", 220)
@@ -73,9 +75,11 @@
Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
Properties.SetString ("GtkActionPath", "/InternetRadioContextMenu");
- Properties.Set<RadioColumnController> ("TrackView.ColumnController", new RadioColumnController ());
- Properties.SetString ("TrackPropertiesLabel", Catalog.GetString ("Edit Station"));
- Properties.Set<InvokeHandler> ("TrackPropertiesHandler", delegate {
+ // source_contents = new InternetRadioSourceContents ();
+ // Properties.Set<ISourceContents> ("Nereid.SourceContents", source_contents);
+
+ Properties.SetString ("TrackPropertiesActionLabel", Catalog.GetString ("Edit Station"));
+ Properties.Set<InvokeHandler> ("TrackPropertiesActionHandler", delegate {
if (TrackModel.SelectedItems == null || TrackModel.SelectedItems.Count <= 0) {
return;
}
@@ -89,6 +93,37 @@
}
});
+ Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
+ <column-controller>
+ <!--<column modify-default=""IndicatorColumn"">
+ <renderer type=""Banshee.Podcasting.Gui.ColumnCellPodcastStatusIndicator"" />
+ </column>-->
+ <add-default column=""IndicatorColumn"" />
+ <add-default column=""GenreColumn"" />
+ <column modify-default=""GenreColumn"">
+ <visible>true</visible>
+ </column>
+ <add-default column=""TitleColumn"" />
+ <add-default column=""ArtistColumn"" />
+ <column modify-default=""ArtistColumn"">
+ <title>{0}</title>
+ </column>
+ <add-default column=""CommentColumn"" />
+ <column modify-default=""CommentColumn"">
+ <title>{1}</title>
+ </column>
+ <add-default column=""RatingColumn"" />
+ <add-default column=""PlayCountColumn"" />
+ <add-default column=""LastPlayedColumn"" />
+ <add-default column=""LastSkippedColumn"" />
+ <add-default column=""DateAddedColumn"" />
+ <add-default column=""UriColumn"" />
+ <sort-column direction=""asc"">genre</sort-column>
+ </column-controller>",
+ Catalog.GetString ("Creator"),
+ Catalog.GetString ("Description")
+ ));
+
ServiceManager.PlayerEngine.TrackIntercept += OnPlayerEngineTrackIntercept;
TrackEqualHandler = delegate (DatabaseTrackInfo a, TrackInfo b) {
Modified: trunk/banshee/src/Extensions/Banshee.InternetRadio/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.InternetRadio/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.InternetRadio/Makefile.am Tue Jun 17 23:13:14 2008
@@ -5,7 +5,6 @@
SOURCES = \
Banshee.InternetRadio/InternetRadioSource.cs \
- Banshee.InternetRadio/RadioColumnController.cs \
Banshee.InternetRadio/StationEditor.cs \
Banshee.InternetRadio/XspfMigrator.cs
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs Tue Jun 17 23:13:14 2008
@@ -166,7 +166,7 @@
private bool OnDragVScrollTimeout ()
{
- ScrollTo (vadjustment.Value + (drag_scroll_velocity * drag_scroll_velocity_max));
+ ScrollTo (VadjustmentValue + (drag_scroll_velocity * drag_scroll_velocity_max));
DragReorderUpdateRow ();
return true;
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs Tue Jun 17 23:13:14 2008
@@ -329,7 +329,7 @@
return null;
}
- x += (int)hadjustment.Value;
+ x += HadjustmentValue;
for (int i = 0; i < column_cache.Length - 1; i++) {
if (x >= column_cache[i].ResizeX1 - 2 &&
@@ -348,7 +348,7 @@
return null;
}
- x += (int)hadjustment.Value;
+ x += HadjustmentValue;
foreach (CachedColumn column in column_cache) {
if (x >= column.X1 && x <= column.X2) {
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs Tue Jun 17 23:13:14 2008
@@ -56,12 +56,24 @@
get { return model.Selection; }
}
+ private int HadjustmentValue {
+ get { return hadjustment == null ? 0 : (int)hadjustment.Value; }
+ }
+
+ private int VadjustmentValue {
+ get { return vadjustment == null ? 0 : (int)vadjustment.Value; }
+ }
+
public event RowActivatedHandler<T> RowActivated;
#region Row/Selection, Keyboard/Mouse Interaction
private bool KeyboardScroll (Gdk.ModifierType modifier, int relative_row, bool align_y)
{
+ if (Model == null) {
+ return true;
+ }
+
int row_limit;
if (relative_row < 0) {
if (Selection.FocusedIndex == -1) {
@@ -103,12 +115,12 @@
// Scroll if needed
double y_at_row = GetYAtRow (row_index);
if (align_y) {
- if (y_at_row < vadjustment.Value) {
+ if (y_at_row < VadjustmentValue) {
ScrollTo (y_at_row);
- } else if ((y_at_row + RowHeight) > (vadjustment.Value + vadjustment.PageSize)) {
+ } else if (vadjustment != null && (y_at_row + RowHeight) > (vadjustment.Value + vadjustment.PageSize)) {
ScrollTo (y_at_row + RowHeight - (vadjustment.PageSize));
}
- } else {
+ } else if (vadjustment != null) {
ScrollTo (vadjustment.Value + ((row_index - Selection.FocusedIndex) * RowHeight));
}
@@ -152,13 +164,13 @@
case Gdk.Key.Page_Up:
case Gdk.Key.KP_Page_Up:
- handled = KeyboardScroll (press.State,
+ handled = vadjustment != null && KeyboardScroll (press.State,
(int)(-vadjustment.PageIncrement / (double)RowHeight), false);
break;
case Gdk.Key.Page_Down:
case Gdk.Key.KP_Page_Down:
- handled = KeyboardScroll (press.State,
+ handled = vadjustment != null && KeyboardScroll (press.State,
(int)(vadjustment.PageIncrement / (double)RowHeight), false);
break;
@@ -208,8 +220,8 @@
Gdk.Rectangle icell_area;
bool redraw = ProxyEventToCell (evnt, press, out icell, out icell_area);
- int xoffset = (int)hadjustment.Value;
- int yoffset = (int)vadjustment.Value;
+ int xoffset = HadjustmentValue;
+ int yoffset = VadjustmentValue;
if (last_icell_area != icell_area) {
if (last_icell != null && last_icell.PointerLeaveEvent ()) {
@@ -231,6 +243,10 @@
icell = null;
icell_area = Gdk.Rectangle.Zero;
+ if (Model == null) {
+ return false;
+ }
+
int evnt_x;
int evnt_y;
@@ -273,7 +289,7 @@
// Turn the view-absolute coordinates into cell-relative coordinates
x -= cached_column.X1;
- int page_offset = (int)vadjustment.Value % RowHeight;
+ int page_offset = VadjustmentValue % RowHeight;
y = (y + page_offset) % RowHeight;
// Bind the row to the cell and then send it a synthesized input event
@@ -332,7 +348,7 @@
pressed_column_index = column_c.Index;
pressed_column_x_start = x;
pressed_column_x_offset = pressed_column_x_start - column_c.X1;
- pressed_column_x_start_hadjustment = (int)hadjustment.Value;
+ pressed_column_x_start_hadjustment = HadjustmentValue;
}
}
@@ -341,6 +357,10 @@
private bool OnListButtonPressEvent (Gdk.EventButton evnt)
{
+ if (Model == null) {
+ return true;
+ }
+
int y = (int)evnt.Y - list_interaction_alloc.Y;
GrabFocus ();
@@ -455,6 +475,10 @@
private bool OnListButtonRelease (Gdk.EventButton evnt)
{
+ if (Model == null) {
+ return true;
+ }
+
int y = (int)evnt.Y - list_interaction_alloc.Y;
GrabFocus ();
@@ -546,7 +570,7 @@
}
}
- pressed_column_x_drag = x - pressed_column_x_offset - (pressed_column_x_start_hadjustment - (int)hadjustment.Value);
+ pressed_column_x_drag = x - pressed_column_x_offset - (pressed_column_x_start_hadjustment - HadjustmentValue);
QueueDraw ();
return true;
@@ -554,7 +578,7 @@
private bool OnDragHScrollTimeout ()
{
- ScrollTo (hadjustment, hadjustment.Value + (drag_scroll_velocity * drag_scroll_velocity_max));
+ ScrollTo (hadjustment, HadjustmentValue + (drag_scroll_velocity * drag_scroll_velocity_max));
OnMotionNotifyEvent (pressed_column_x);
return true;
}
@@ -594,8 +618,8 @@
return -1;
}
- int page_offset = (int)vadjustment.Value % RowHeight;
- int first_row = (int)vadjustment.Value / RowHeight;
+ int page_offset = VadjustmentValue % RowHeight;
+ int first_row = VadjustmentValue / RowHeight;
int row_offset = (y + page_offset) / RowHeight;
return first_row + row_offset;
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs Tue Jun 17 23:13:14 2008
@@ -90,7 +90,9 @@
CenterOn (Selection.Ranges[0].Start);
}
} else {
- ScrollTo (vadjustment.Value);
+ if (vadjustment != null) {
+ ScrollTo (vadjustment.Value);
+ }
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs Tue Jun 17 23:13:14 2008
@@ -84,8 +84,12 @@
if (header_visible && column_controller != null) {
PaintHeader (damage);
}
+
Theme.DrawFrameBorder (cairo_context, Allocation);
- PaintRows(damage);
+ if (Model != null) {
+ PaintRows(damage);
+ }
+
PaintDraggingColumn (damage);
((IDisposable)cairo_context.Target).Dispose ();
@@ -117,13 +121,13 @@
continue;
}
- cell_area.X = column_cache[ci].X1 + Theme.TotalBorderWidth + header_rendering_alloc.X - (int)hadjustment.Value;
+ cell_area.X = column_cache[ci].X1 + Theme.TotalBorderWidth + header_rendering_alloc.X - HadjustmentValue;
cell_area.Width = column_cache[ci].Width;
PaintHeaderCell (cell_area, ci, false);
}
if (pressed_column_is_dragging && pressed_column_index >= 0) {
- cell_area.X = pressed_column_x_drag + Allocation.X - (int)hadjustment.Value;
+ cell_area.X = pressed_column_x_drag + Allocation.X - HadjustmentValue;
cell_area.Width = column_cache[pressed_column_index].Width;
PaintHeaderCell (cell_area, pressed_column_index, true);
}
@@ -174,7 +178,7 @@
if (sort_column_index != -1 && (!pressed_column_is_dragging || pressed_column_index != sort_column_index)) {
CachedColumn col = column_cache[sort_column_index];
Theme.DrawRowRule (cairo_context,
- list_rendering_alloc.X + col.X1 - (int)hadjustment.Value,
+ list_rendering_alloc.X + col.X1 - HadjustmentValue,
header_rendering_alloc.Bottom + Theme.BorderWidth,
col.Width, list_rendering_alloc.Height + Theme.InnerBorderWidth * 2);
}
@@ -186,7 +190,7 @@
cell_context.Clip = clip;
cell_context.TextAsForeground = false;
- int vadjustment_value = (int)vadjustment.Value;
+ int vadjustment_value = VadjustmentValue;
int first_row = vadjustment_value / RowHeight;
int last_row = Math.Min (model.Count, first_row + RowsInView);
int offset = list_rendering_alloc.Y - vadjustment_value % RowHeight;
@@ -194,7 +198,7 @@
Rectangle selected_focus_alloc = Rectangle.Zero;
Rectangle single_list_alloc = new Rectangle ();
- single_list_alloc.X = list_rendering_alloc.X - (int)(hadjustment.Value);
+ single_list_alloc.X = list_rendering_alloc.X - HadjustmentValue;
single_list_alloc.Y = offset;
single_list_alloc.Width = list_rendering_alloc.Width;
single_list_alloc.Height = RowHeight;
@@ -340,7 +344,7 @@
CachedColumn column = column_cache[pressed_column_index];
- int x = pressed_column_x_drag + Allocation.X + 1 - (int)hadjustment.Value;
+ int x = pressed_column_x_drag + Allocation.X + 1 - HadjustmentValue;
Cairo.Color fill_color = Theme.Colors.GetWidgetColor (GtkColorClass.Base, StateType.Normal);
fill_color.A = 0.45;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]