banshee r3196 - in trunk/banshee: . src/Backends/Banshee.Gnome/Banshee.Gnome src/Core/Banshee.Core src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Hyena src/Core/Hyena.Gui/Hyena.Data.Gui src/Core/Hyena.Gui/Hyena.Data.Gui/ListView src/Core/Hyena/Hyena
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3196 - in trunk/banshee: . src/Backends/Banshee.Gnome/Banshee.Gnome src/Core/Banshee.Core src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Hyena src/Core/Hyena.Gui/Hyena.Data.Gui src/Core/Hyena.Gui/Hyena.Data.Gui/ListView src/Core/Hyena/Hyena
- Date: Sat, 9 Feb 2008 23:41:31 +0000 (GMT)
Author: abock
Date: Sat Feb 9 23:41:30 2008
New Revision: 3196
URL: http://svn.gnome.org/viewvc/banshee?rev=3196&view=rev
Log:
2008-02-09 Aaron Bockover <abock gnome org>
This commit adds initial support to load/save the column settings in
the track list; it is not yet complete, also it adds a popup menu for
the columns, but it's not done yet and doesn't work
* src/Core/Hyena/Hyena/StringUtil.cs:
* src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs:
* src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs:
* src/Core/Banshee.Core/Banshee.Base/StringUtil.cs: Moved StringUtil
into Hyena
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/PersistentColumnController.cs:
A wrapper around ColumnController that loads and saves through
Banshee.Configuration
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs:
Use PersistentColumnController to load and save settings
* src/Core/Hyena.Gui/Hyena.Data.Gui/Column.cs: Added an Id property
* src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs: Added IndexOf
and EnableColumnMenu
* src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs: Added
a popup menu for selecting which columns are visible
* src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
Fixed reordering logic to work with columns which aren't visible
and added right click on the header
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/PersistentColumnController.cs
trunk/banshee/src/Core/Hyena/Hyena/StringUtil.cs
- copied, changed from r3191, /trunk/banshee/src/Core/Banshee.Core/Banshee.Base/StringUtil.cs
Removed:
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/StringUtil.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp
trunk/banshee/src/Core/Banshee.Core/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/Column.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
trunk/banshee/src/Core/Hyena/Hyena.mdp
trunk/banshee/src/Core/Hyena/Makefile.am
Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs (original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs Sat Feb 9 23:41:30 2008
@@ -31,6 +31,7 @@
using System.Collections.Generic;
using GConf;
+using Hyena;
using Banshee.Base;
using Banshee.Configuration;
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs Sat Feb 9 23:41:30 2008
@@ -31,6 +31,7 @@
using System.Collections.Generic;
using Mono.Unix;
+using Hyena;
using Hyena.Data;
using Banshee.Base;
using Banshee.Streaming;
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp Sat Feb 9 23:41:30 2008
@@ -18,7 +18,6 @@
<File name="Banshee.Base/Paths.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/SafeUri.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/UriList.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Base/Utilities.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/AlbumInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/ArtistInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/ITrackInfo.cs" subtype="Code" buildaction="Compile" />
@@ -41,7 +40,6 @@
<File name="Banshee.Collection/IBasicTrackInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration.Schema/ImportSchema.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration.Schema/LibrarySchema.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Base/StringUtil.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/Log.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/ProductInformation.cs" subtype="Code" buildaction="Compile" />
<File name="Resources/contributors.xml" subtype="Code" buildaction="EmbedAsResource" />
Modified: trunk/banshee/src/Core/Banshee.Core/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Core/Makefile.am Sat Feb 9 23:41:30 2008
@@ -13,9 +13,7 @@
Banshee.Base/ProductInformation.cs \
Banshee.Base/Resource.cs \
Banshee.Base/SafeUri.cs \
- Banshee.Base/StringUtil.cs \
Banshee.Base/UriList.cs \
- Banshee.Base/Utilities.cs \
Banshee.Collection/AlbumInfo.cs \
Banshee.Collection/ArtistInfo.cs \
Banshee.Collection/FileTrackInfo.cs \
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/PersistentColumnController.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/PersistentColumnController.cs Sat Feb 9 23:41:30 2008
@@ -0,0 +1,108 @@
+//
+// PersistentColumnController.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 Hyena.Data.Gui;
+using Banshee.Configuration;
+
+namespace Banshee.Collection.Gui
+{
+ public class PersistentColumnController : ColumnController
+ {
+ private string root_namespace;
+ private bool loaded = false;
+
+ public PersistentColumnController (string rootNamespace) : base ()
+ {
+ if (String.IsNullOrEmpty (rootNamespace)) {
+ throw new ArgumentException ("Argument must not be null or empty", "rootNamespace");
+ }
+
+ root_namespace = rootNamespace;
+ }
+
+ public void Load ()
+ {
+ lock (this) {
+ foreach (Column column in this) {
+ if (column.Id != null) {
+ column.Visible = ConfigurationClient.Get<bool> (MakeNamespace (column.Id),
+ "visible", column.Visible);
+ }
+ }
+
+ Columns.Sort (delegate (Column a, Column b) {
+ int a_order = a.Id == null ? -1 : ConfigurationClient.Get<int> (MakeNamespace (a.Id), "order", 1);
+ int b_order = b.Id == null ? -1 : ConfigurationClient.Get<int> (MakeNamespace (b.Id), "order", 1);
+ return a_order.CompareTo (b_order);
+ });
+
+ loaded = true;
+ }
+
+ OnUpdated ();
+ }
+
+ public void Save ()
+ {
+ lock (this) {
+ for (int i = 0; i < Count; i++) {
+ if (Columns[i].Id != null) {
+ Save (Columns[i], i);
+ }
+ }
+ }
+ }
+
+ private void Save (Column column, int index)
+ {
+ string @namespace = MakeNamespace (column.Id);
+ ConfigurationClient.Set<int> (@namespace, "order", index);
+ ConfigurationClient.Set<bool> (@namespace, "visible", column.Visible);
+ }
+
+ protected override void OnUpdated ()
+ {
+ if (loaded) {
+ Save ();
+ }
+
+ base.OnUpdated ();
+ }
+
+ private string MakeNamespace (string name)
+ {
+ return String.Format ("{0}.{1}", root_namespace, name);
+ }
+
+ public override bool EnableColumnMenu {
+ get { return true; }
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs Sat Feb 9 23:41:30 2008
@@ -4,7 +4,7 @@
// Author:
// Aaron Bockover <abockover novell com>
//
-// Copyright (C) 2007 Novell, Inc.
+// Copyright (C) 2007-2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -41,35 +41,37 @@
{
public class TrackListView : ListView<TrackInfo>
{
- private ColumnController column_controller;
+ private PersistentColumnController column_controller;
- public TrackListView() : base()
+ public TrackListView () : base ()
{
- column_controller = new ColumnController();
+ column_controller = new PersistentColumnController ("track_view_columns");
- column_controller.AddRange(
- new Column(null, "indicator", new ColumnCellPlaybackIndicator(null), 0.05),
- new SortableColumn("Track", new ColumnCellTrackNumber("TrackNumber", true), 0.10, "Track"),
- new SortableColumn("Artist", new ColumnCellText("ArtistName", true), 0.225, "Artist"),
- new SortableColumn("Album", new ColumnCellText("AlbumTitle", true), 0.225, "Album"),
- new SortableColumn("Title", new ColumnCellText("TrackTitle", true), 0.25, "Title"),
- new SortableColumn("Duration", new ColumnCellDuration("Duration", true), 0.15, "Duration"),
- new SortableColumn("Year", new ColumnCellText("Year", true), 0.15, "Year"),
- new SortableColumn("Play Count", new ColumnCellText("PlayCount", true), 0.15, "PlayCount"),
- new SortableColumn("Skip Count", new ColumnCellText("SkipCount", true), 0.15, "SkipCount"),
- //new SortableColumn("Rating", new RatingColumnCell(null, true), 0.15, "Rating"),
- new SortableColumn("Last Played", new ColumnCellDateTime("LastPlayed", true), 0.15, "LastPlayedStamp"),
- new SortableColumn("Added", new ColumnCellDateTime("DateAdded", true), 0.15, "DateAddedStamp"),
- new SortableColumn("Location", new ColumnCellText("Uri", true), 0.15, "Uri")
+ column_controller.AddRange (
+ new Column (null, "indicator", new ColumnCellPlaybackIndicator (null), 0.05),
+ new SortableColumn ("Track", new ColumnCellTrackNumber ("TrackNumber", true), 0.10, "Track"),
+ new SortableColumn ("Artist", new ColumnCellText ("ArtistName", true), 0.225, "Artist"),
+ new SortableColumn ("Album", new ColumnCellText ("AlbumTitle", true), 0.225, "Album"),
+ new SortableColumn ("Title", new ColumnCellText ("TrackTitle", true), 0.25, "Title"),
+ new SortableColumn ("Duration", new ColumnCellDuration ("Duration", true), 0.15, "Duration"),
+ new SortableColumn ("Year", new ColumnCellText ("Year", true), 0.15, "Year"),
+ new SortableColumn ("Play Count", new ColumnCellText ("PlayCount", true), 0.15, "PlayCount"),
+ new SortableColumn ("Skip Count", new ColumnCellText ("SkipCount", true), 0.15, "SkipCount"),
+ //new SortableColumn ("Rating", new RatingColumnCell (null, true), 0.15, "Rating"),
+ new SortableColumn ("Last Played", new ColumnCellDateTime ("LastPlayed", true), 0.15, "LastPlayedStamp"),
+ new SortableColumn ("Added", new ColumnCellDateTime ("DateAdded", true), 0.15, "DateAddedStamp"),
+ new SortableColumn ("Location", new ColumnCellText ("Uri", true), 0.15, "Uri")
);
+ column_controller.Load ();
+
ColumnController = DefaultColumnController;
RulesHint = true;
ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
if (ServiceManager.Contains ("GtkElementsService")) {
- ServiceManager.Get<Banshee.Gui.GtkElementsService> ("GtkElementsService").ThemeChanged += delegate {
+ ServiceManager.Get<Banshee.Gui.GtkElementsService> ().ThemeChanged += delegate {
foreach (Column column in column_controller) {
if (column.HeaderCell != null) {
column.HeaderCell.NotifyThemeChange ();
@@ -87,7 +89,7 @@
protected override bool OnPopupMenu ()
{
- ServiceManager.Get<InterfaceActionService> ("InterfaceActionService").TrackActions["TrackContextMenuAction"].Activate ();
+ ServiceManager.Get<InterfaceActionService> ().TrackActions["TrackContextMenuAction"].Activate ();
return true;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp Sat Feb 9 23:41:30 2008
@@ -85,6 +85,7 @@
<File name="Banshee.Query.Gui/RatingQueryValueEntry.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query.Gui/PlaylistQueryValueEntry.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.SmartPlaylist.Gui/Editor.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Collection.Gui/PersistentColumnController.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Sat Feb 9 23:41:30 2008
@@ -19,6 +19,7 @@
Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs \
Banshee.Collection.Gui/ColumnCellTrackNumber.cs \
Banshee.Collection.Gui/CompositeTrackListView.cs \
+ Banshee.Collection.Gui/PersistentColumnController.cs \
Banshee.Collection.Gui/TrackListView.cs \
Banshee.Equalizer.Gui/EqualizerBandScale.cs \
Banshee.Equalizer.Gui/EqualizerLevelsBox.cs \
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/Column.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/Column.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/Column.cs Sat Feb 9 23:41:30 2008
@@ -31,6 +31,7 @@
using System.Collections.Generic;
using Gtk;
+using Hyena;
using Hyena.Data;
namespace Hyena.Data.Gui
@@ -134,5 +135,9 @@
}
}
}
+
+ public string Id {
+ get { return StringUtil.CamelCaseToUnderCase (GetCell (0).Property); }
+ }
}
}
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs Sat Feb 9 23:41:30 2008
@@ -36,6 +36,10 @@
{
private List<Column> columns = new List<Column> ();
+ protected List<Column> Columns {
+ get { return columns; }
+ }
+
public event EventHandler Updated;
protected virtual void OnUpdated ()
@@ -121,6 +125,13 @@
return columns.GetEnumerator ();
}
+ public int IndexOf (Column column)
+ {
+ lock (this) {
+ return columns.IndexOf (column);
+ }
+ }
+
public Column this[int index] {
get { return columns[index]; }
}
@@ -128,5 +139,9 @@
public int Count {
get { return columns.Count; }
}
+
+ public virtual bool EnableColumnMenu {
+ get { return false; }
+ }
}
}
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs Sat Feb 9 23:41:30 2008
@@ -27,6 +27,7 @@
//
using System;
+using Mono.Unix;
using Gtk;
namespace Hyena.Data.Gui
@@ -124,6 +125,63 @@
QueueDraw ();
}
+ protected virtual void OnColumnRightClicked (Column clickedColumn, int x, int y)
+ {
+ Menu menu = new Menu ();
+
+ if (clickedColumn.Id != null) { // FIXME: Also restrict if the column vis can't be changed
+ MenuItem hide_item = new MenuItem (String.Format (Catalog.GetString ("Hide {0}"), clickedColumn.Title));
+ hide_item.Data.Add ("column", clickedColumn);
+ hide_item.Data.Add ("hide", true);
+ hide_item.Activated += OnColumnMenuItemActivated;
+ menu.Append (hide_item);
+ menu.Append (new SeparatorMenuItem ());
+ }
+
+ foreach (Column column in ColumnController) {
+ if (column.Id == null) {
+ continue;
+ }
+
+ CheckMenuItem item = new CheckMenuItem (column.Title);
+ item.Active = column.Visible;
+ item.Data.Add ("column", column);
+ item.Activated += OnColumnMenuItemActivated;
+ menu.Append (item);
+ }
+
+ menu.ShowAll ();
+ menu.Popup (null, null, delegate (Menu popup, out int pos_x, out int pos_y, out bool push_in) {
+ int win_x, win_y;
+ header_window.GetOrigin (out win_x, out win_y);
+ pos_x = win_x + x;
+ pos_y = win_y + y;
+ push_in = true;
+ }, 3, Gtk.Global.CurrentEventTime);
+ }
+
+ private void OnColumnMenuItemActivated (object o, EventArgs args)
+ {
+ MenuItem item = (MenuItem)o;
+ CheckMenuItem toggle_item = item as CheckMenuItem;
+ Column column = null;
+
+ if (item.Data.Contains ("column")) {
+ column = item.Data["column"] as Column;
+ }
+
+ if (column == null) {
+ return;
+ }
+
+ if (item.Data.Contains ("hide")) {
+ column.Visible = false;
+ return;
+ } else if (toggle_item != null) {
+ column.Visible = toggle_item.Active;
+ }
+ }
+
private void ResizeColumn (double x)
{
CachedColumn resizing_column = column_cache[resizing_column_index];
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs Sat Feb 9 23:41:30 2008
@@ -198,6 +198,16 @@
HasFocus = true;
if (press.Window == header_window) {
+ if (press.Button == 3 && ColumnController.EnableColumnMenu) {
+ Column menu_column = GetColumnAt ((int)press.X);
+ if (menu_column != null) {
+ OnColumnRightClicked (menu_column, (int)press.X, (int)press.Y);
+ }
+ return true;
+ } else if (press.Button != 1) {
+ return true;
+ }
+
Gtk.Drag.SourceUnset (this);
Column column = GetColumnForResizeHandle ((int)press.X);
@@ -356,7 +366,9 @@
}
if (reorder) {
- ColumnController.Reorder (pressed_column_index, swap_column_c.Index);
+ int actual_pressed_index = ColumnController.IndexOf (column_cache[pressed_column_index].Column);
+ int actual_swap_index = ColumnController.IndexOf (swap_column_c.Column);
+ ColumnController.Reorder (actual_pressed_index, actual_swap_index);
pressed_column_index = swap_column_c.Index;
RegenerateColumnCache ();
}
Modified: trunk/banshee/src/Core/Hyena/Hyena.mdp
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.mdp (original)
+++ trunk/banshee/src/Core/Hyena/Hyena.mdp Sat Feb 9 23:41:30 2008
@@ -74,6 +74,7 @@
<File name="Hyena.Data/ArrayModelCache.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Data/DictionaryModelCache.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Query/AliasedObjectSet.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena/StringUtil.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Copied: trunk/banshee/src/Core/Hyena/Hyena/StringUtil.cs (from r3191, /trunk/banshee/src/Core/Banshee.Core/Banshee.Base/StringUtil.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.Core/Banshee.Base/StringUtil.cs (original)
+++ trunk/banshee/src/Core/Hyena/Hyena/StringUtil.cs Sat Feb 9 23:41:30 2008
@@ -1,42 +1,42 @@
-/***************************************************************************
- * StringUtil.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
+//
+// StringUtil.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-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.
+//
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.Globalization;
using System.Text.RegularExpressions;
-namespace Banshee.Base
+namespace Hyena
{
public static class StringUtil
{
private static CompareOptions compare_options =
- CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth;
+ CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace |
+ CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth;
public static int RelaxedIndexOf (string haystack, string needle)
{
@@ -62,6 +62,10 @@
public static string CamelCaseToUnderCase (string s)
{
+ if (String.IsNullOrEmpty (s)) {
+ return null;
+ }
+
string undercase = String.Empty;
string [] tokens = Regex.Split (s, "([A-Z]{1}[a-z]+)");
Modified: trunk/banshee/src/Core/Hyena/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Hyena/Makefile.am (original)
+++ trunk/banshee/src/Core/Hyena/Makefile.am Sat Feb 9 23:41:30 2008
@@ -65,6 +65,7 @@
Hyena.SExpEngine/TreeNode.cs \
Hyena.SExpEngine/UtilityFunctionSet.cs \
Hyena/IUndoAction.cs \
+ Hyena/StringUtil.cs \
Hyena/Timer.cs \
Hyena/UndoManager.cs \
Hyena/Utilities.cs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]