banshee r4453 - in trunk/banshee: . src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor src/Libraries/Hyena.Gui/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets src/Libraries/Hyena/Hyena



Author: abock
Date: Wed Sep  3 15:25:08 2008
New Revision: 4453
URL: http://svn.gnome.org/viewvc/banshee?rev=4453&view=rev

Log:
008-09-03  Aaron Bockover  <abock gnome org>

    Merged branches/banshee/abock/@4403 to trunk (the hot new track editor,
    but it's still not complete and is disabled by default right now)



Added:
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/
      - copied from r4452, /branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/CachedList.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DurationStatusFormatters.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDuration.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
   trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
   trunk/banshee/src/Libraries/Hyena/Hyena/StringUtil.cs

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	Wed Sep  3 15:25:08 2008
@@ -28,6 +28,7 @@
 
 using System;
 using System.IO;
+using System.Reflection;
 using System.Collections.Generic;
 using Mono.Unix;
 
@@ -40,6 +41,15 @@
 {
     public class TrackInfo : CacheableItem, ITrackInfo
     {
+        public class ExportableAttribute : Attribute
+        {
+            private string export_name;
+            public string ExportName {
+                get { return export_name; }
+                set { export_name = value; }
+            }
+        }
+    
         public delegate bool IsPlayingHandler (TrackInfo track);
         public static IsPlayingHandler IsPlayingMethod;
             
@@ -130,64 +140,77 @@
             get { return (IsPlayingMethod != null) ? IsPlayingMethod (this) : false; }
         }
 
+        [Exportable (ExportName = "URI")]
         public virtual SafeUri Uri {
             get { return uri; }
             set { uri = value; }
         }
 
+        [Exportable]
         public SafeUri MoreInfoUri {
             get { return more_info_uri; }
             set { more_info_uri = value; }
         }
 
+        [Exportable]
         public virtual string MimeType {
             get { return mimetype; }
             set { mimetype = value; }
         }
 
+        [Exportable]
         public virtual long FileSize {
             get { return filesize; }
             set { filesize = value; }
         }
 
+        [Exportable (ExportName = "artist")]
         public virtual string ArtistName {
             get { return artist_name; }
             set { artist_name = value; }
         }
 
+        [Exportable (ExportName = "album")]
         public virtual string AlbumTitle {
             get { return album_title; }
             set { album_title = value; }
         }
 
+        [Exportable]
         public virtual string AlbumArtist {
             get { return album_artist ?? (IsCompilation ? Catalog.GetString ("Various Artists") : ArtistName); }
             set { album_artist = value; }
         }
         
+        [Exportable]
         public virtual bool IsCompilation {
             get { return is_compilation; }
             set { is_compilation = value; }
         }
 
+        [Exportable (ExportName = "name")]
         public virtual string TrackTitle {
             get { return track_title; }
             set { track_title = value; }
         }
         
+        [Exportable]
         public virtual string MusicBrainzId {
             get { return musicbrainz_id; }
             set { musicbrainz_id = value; }
         }
         
+        [Exportable]
         public virtual string ArtistMusicBrainzId {
             get { return null; }
         }
         
+        [Exportable]
         public virtual string AlbumMusicBrainzId {
             get { return null; }
         }
         
+        [Exportable]
         public virtual DateTime ReleaseDate {
             get { return release_date; }
             set { release_date = value; }
@@ -229,111 +252,131 @@
             } 
         }     
         
-        
         public virtual string ArtworkId { 
             get { return CoverArtSpec.CreateArtistAlbumId (AlbumArtist, AlbumTitle); }
         }
 
+        [Exportable]
         public virtual string Genre {
             get { return genre; }
             set { genre = value; }
         }
 
+        [Exportable]
         public virtual int TrackNumber {
             get { return track_number; }
             set { track_number = value; }
         }
 
+        [Exportable]
         public virtual int TrackCount {
             get { return TrackNumber > track_count ? TrackNumber : track_count; }
             set { track_count = value; }
         }
 
+        [Exportable]
         public virtual int DiscNumber {
             get { return disc_number; }
             set { disc_number = value; }
         }
-
+        
+        [Exportable]
         public virtual int DiscCount {
             get { return DiscNumber > disc_count ? DiscNumber : disc_count; }
             set { disc_count = value; }
         }
 
+        [Exportable]
         public virtual int Year {
             get { return year; }
             set { year = value; }
         }
 
+        [Exportable]
         public virtual string Composer {
             get { return composer; }
             set { composer = value; }
         }
 
+        [Exportable]
         public virtual string Conductor {
             get { return conductor; }
             set { conductor = value; }
         }
-
+        
+        [Exportable]
         public virtual string Grouping {
             get { return grouping; }
             set { grouping = value; }
         }
-
+        
+        [Exportable]
         public virtual string Copyright {
             get { return copyright; }
             set { copyright = value; }
         }
 
+        [Exportable]        
         public virtual string LicenseUri {
             get { return license_uri; }
             set { license_uri = value; }
         }
 
+        [Exportable]
         public virtual string Comment {
             get { return comment; }
             set { comment = value; }
         }
 
+        [Exportable]
         public virtual int Rating {
             get { return rating; }
             set { rating = value; }
         }
         
+        [Exportable]
         public virtual int Bpm {
             get { return bpm; }
             set { bpm = value; }
         }
 
+        [Exportable]
         public virtual int BitRate {
             get { return bit_rate; }
             set { bit_rate = value; }
         }
 
+        [Exportable]
         public virtual int PlayCount {
             get { return play_count; }
             set { play_count = value; }
         }
 
+        [Exportable]
         public virtual int SkipCount {
             get { return skip_count; }
             set { skip_count = value; }
         }
 
+        [Exportable (ExportName = "length")]
         public virtual TimeSpan Duration {
             get { return duration; }
             set { duration = value; }
         }
         
+        [Exportable]
         public virtual DateTime DateAdded {
             get { return date_added; }
             set { date_added = value; }
         }
 
+        [Exportable]
         public virtual DateTime LastPlayed {
             get { return last_played; }
             set { last_played = value; }
         }
 
+        [Exportable]
         public virtual DateTime LastSkipped {
             get { return last_skipped; }
             set { last_skipped = value; }
@@ -377,6 +420,8 @@
         }
 
         private TrackMediaAttributes media_attributes = TrackMediaAttributes.Default;
+        
+        [Exportable]
         public virtual TrackMediaAttributes MediaAttributes {
             get { return media_attributes; }
             set { media_attributes = value; }
@@ -398,25 +443,62 @@
                 return Catalog.GetString ("Item");
             }
         }
+        
+        public static void ExportableMerge (TrackInfo source, TrackInfo dest)
+        {
+            foreach (PropertyInfo property in typeof (TrackInfo).GetProperties (BindingFlags.Public | BindingFlags.Instance)) {
+                try {
+                    object [] exportable_attrs = property.GetCustomAttributes (typeof (TrackInfo.ExportableAttribute), true);
+                    if (exportable_attrs != null && exportable_attrs.Length > 0 && property.CanWrite) {
+                        property.SetValue (dest, property.GetValue (source, null), null);
+                    }
+                } catch (Exception e) {
+                    Log.Exception (e);
+                }
+            }
+        }
 
         // Generates a{sv} of self according to http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces#.22Metadata.22
         public IDictionary<string, object> GenerateExportable ()
         {
             Dictionary<string, object> dict = new Dictionary<string, object> ();
             
-            // Properties specified by the XMMS2 player spec
-            dict.Add ("URI", Uri == null ? String.Empty : Uri.AbsoluteUri);
-            dict.Add ("length", Duration.TotalSeconds);
-            dict.Add ("name", TrackTitle);
-            dict.Add ("artist", ArtistName);
-            dict.Add ("album", AlbumTitle);
-            
-            // Our own
-            dict.Add ("track-number", TrackNumber);
-            dict.Add ("track-count", TrackCount);
-            dict.Add ("disc", DiscNumber);
-            dict.Add ("year", year);
-            dict.Add ("rating", rating);
+            foreach (PropertyInfo property in GetType ().GetProperties (BindingFlags.Public | BindingFlags.Instance)) {
+                object [] exportable_attrs = property.GetCustomAttributes (typeof (TrackInfo.ExportableAttribute), true);
+                if (exportable_attrs == null || exportable_attrs.Length == 0) {
+                    continue;
+                }
+                
+                string export_name = ((ExportableAttribute)exportable_attrs[0]).ExportName
+                    ?? StringUtil.CamelCaseToUnderCase (property.Name, '-');
+                
+                object value = property.GetValue (this, null);
+                if (String.IsNullOrEmpty (export_name) || value == null) {
+                    continue;
+                }
+                
+                if (value is TimeSpan) {
+                    value = ((TimeSpan)value).TotalSeconds;
+                } else if (value is DateTime) {
+                    DateTime date = (DateTime)value;
+                    value = date == DateTime.MinValue ? 0l : DateTimeUtil.ToTimeT (date);
+                } else if (value is SafeUri) {
+                    value = ((SafeUri)value).AbsoluteUri;
+                } else if (value is TrackMediaAttributes) {
+                    value = value.ToString ();
+                } else if (!(
+                    value is ushort || value is short || 
+                    value is uint || value is int ||
+                    value is ulong || value is long ||
+                    value is float || value is double ||
+                    value is bool || value is string)) {
+                    Log.WarningFormat ("Invalid property in {0} marked as [Exportable]: ({1} is a {2})", 
+                        property.DeclaringType, property.Name, value.GetType ());
+                    continue;
+                }
+                
+                dict.Add (export_name, value);
+            }
             
             return dict;
         }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/CachedList.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/CachedList.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/CachedList.cs	Wed Sep  3 15:25:08 2008
@@ -98,13 +98,17 @@
         {
             ServiceManager.DbConnection.Execute ("DELETE FROM CoreCache WHERE ModelId = ?", CacheId);
         }
+        
+        public T this[int index] {
+            get { return cache.GetValue (index); }
+        }
 
         public long CacheId {
             get { return cache.CacheId; }
         }
 
-        public long Count {
-            get { return cache.Count; }
+        public int Count {
+            get { return (int)cache.Count; }
         }
 
         public IEnumerator<T> GetEnumerator ()

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DurationStatusFormatters.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DurationStatusFormatters.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DurationStatusFormatters.cs	Wed Sep  3 15:25:08 2008
@@ -88,7 +88,11 @@
                 builder.AppendFormat ("{0}:", span.Hours);
             }
             
-            builder.AppendFormat ("{0:00}:{1:00}", span.Minutes, span.Seconds);
+            if (span.TotalHours < 1 || span.TotalMinutes < 1) {
+                builder.AppendFormat ("{0}:{1:00}", span.Minutes, span.Seconds);
+            } else {
+                builder.AppendFormat ("{0:00}:{1:00}", span.Minutes, span.Seconds);
+            }
         }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDuration.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDuration.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDuration.cs	Wed Sep  3 15:25:08 2008
@@ -34,6 +34,8 @@
 {
     public class ColumnCellDuration : ColumnCellText
     {
+        private System.Text.StringBuilder builder = new System.Text.StringBuilder ();
+    
         public ColumnCellDuration (string property, bool expand) : base (property, expand)
         {
             Alignment = Pango.Alignment.Right;
@@ -50,12 +52,13 @@
                 //int seconds = (int)Math.Round(((TimeSpan)BoundObject).TotalSeconds);
                 int seconds = (int) ((TimeSpan)BoundObject).TotalSeconds;
                 
-                if (seconds == 0)
+                if (seconds == 0) {
                     return String.Empty;
+                }
                 
-                return seconds >= 3600 ? 
-                    String.Format ("{0}:{1:00}:{2:00}", seconds / 3600, (seconds / 60) % 60, seconds % 60) :
-                    String.Format ("{0}:{1:00}", seconds / 60, seconds % 60);
+                builder.Remove (0, builder.Length);
+                Banshee.Sources.DurationStatusFormatters.ConfusingPreciseFormatter (builder, TimeSpan.FromSeconds (seconds));
+                return builder.ToString ();
             }
         }
     }

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 Sep  3 15:25:08 2008
@@ -279,8 +279,9 @@
                 
                 if (handler != null) {
                     handler ();
-                } else {
-                    new TrackEditor (current_source.TrackModel.SelectedItems);
+                } else {  
+                    new Banshee.Gui.Dialogs.TrackEditor (current_source.TrackModel.SelectedItems);
+                    // Banshee.Gui.TrackEditor.TrackEditorDialog.RunEdit (current_source.TrackModel);
                 }
             }
         }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml	Wed Sep  3 15:25:08 2008
@@ -12,12 +12,24 @@
     <Addin id="Banshee.Services" version="1.0" />
   </Dependencies>
 
+  <!-- Internal Extensions -->
+  
   <Extension path="/Banshee/Library/ImportSource">
     <ImportSource class="Banshee.Library.Gui.FolderImportSource"/>
     <ImportSource class="Banshee.Library.Gui.PhotoFolderImportSource"/>
     <ImportSource class="Banshee.Library.Gui.FileImportSource"/>
   </Extension>
-
+  
+  <Extension path="/Banshee/Gui/TrackEditor/NotebookPage">
+    <TrackEditorPage class="Banshee.Gui.TrackEditor.BasicTrackDetailsPage"/>
+    <TrackEditorPage class="Banshee.Gui.TrackEditor.ExtraTrackDetailsPage"/>
+    <!--<TrackEditorPage class="Banshee.Gui.TrackEditor.LyricsPage"/>-->
+    <TrackEditorPage class="Banshee.Gui.TrackEditor.StatisticsPage"/>
+    <TrackEditorPage class="Banshee.Gui.TrackEditor.HelpPage"/>
+  </Extension>
+  
+  <!-- Exported Extension Points -->
+  
   <ExtensionPoint path="/Banshee/ThickClient/ActionGroup">
     <Description>Defines a new GTK+ action group, possibly in conjunction with a Source extension.</Description>
     <ExtensionNode name="ActionGroup"/>
@@ -28,4 +40,9 @@
     <ExtensionNode name="SourceView"/>
   </ExtensionPoint>
   
+  <ExtensionPoint path="/Banshee/Gui/TrackEditor/NotebookPage">
+    <Description>Defines a new notebook page for the track editor.</Description>
+    <ExtensionNode name="TrackEditorPage"/>
+  </ExtensionPoint>
+  
 </Addin>

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	Wed Sep  3 15:25:08 2008
@@ -120,6 +120,28 @@
     <File name="Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Library.Gui/PhotoFolderImportSource.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Gui.Widgets/LargeTrackInfoDisplay.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/TrackEditorDialog.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/ITrackEditorPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/EditorUtilities.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/TitleEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/RangeEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/RatingEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/TextViewEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/FieldPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/TextEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/SpinButtonEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/LyricsPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/EditorTrackInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/IEditorField.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/FieldOptions.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/GenreEntry.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/StatisticsPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/EditorMode.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/PageType.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/HelpPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/SyncButton.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	Wed Sep  3 15:25:08 2008
@@ -47,6 +47,28 @@
 	Banshee.Gui.DragDrop/DragDropList.cs \
 	Banshee.Gui.DragDrop/DragDropTarget.cs \
 	Banshee.Gui.DragDrop/DragDropUtilities.cs \
+	Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs \
+	Banshee.Gui.TrackEditor/EditorMode.cs \
+	Banshee.Gui.TrackEditor/EditorTrackInfo.cs \
+	Banshee.Gui.TrackEditor/EditorUtilities.cs \
+	Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs \
+	Banshee.Gui.TrackEditor/FieldOptions.cs \
+	Banshee.Gui.TrackEditor/FieldPage.cs \
+	Banshee.Gui.TrackEditor/GenreEntry.cs \
+	Banshee.Gui.TrackEditor/HelpPage.cs \
+	Banshee.Gui.TrackEditor/IEditorField.cs \
+	Banshee.Gui.TrackEditor/ITrackEditorPage.cs \
+	Banshee.Gui.TrackEditor/LyricsPage.cs \
+	Banshee.Gui.TrackEditor/PageType.cs \
+	Banshee.Gui.TrackEditor/RangeEntry.cs \
+	Banshee.Gui.TrackEditor/RatingEntry.cs \
+	Banshee.Gui.TrackEditor/SpinButtonEntry.cs \
+	Banshee.Gui.TrackEditor/StatisticsPage.cs \
+	Banshee.Gui.TrackEditor/SyncButton.cs \
+	Banshee.Gui.TrackEditor/TextEntry.cs \
+	Banshee.Gui.TrackEditor/TextViewEntry.cs \
+	Banshee.Gui.TrackEditor/TitleEntry.cs \
+	Banshee.Gui.TrackEditor/TrackEditorDialog.cs \
 	Banshee.Gui.Widgets/ArtworkPopup.cs \
 	Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs \
 	Banshee.Gui.Widgets/ConnectedMessageBar.cs \

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	Wed Sep  3 15:25:08 2008
@@ -114,6 +114,11 @@
             Gdk.Colormap.System.AllocColor (ref color, true, true);
             return color;
         }
-
+        
+        public static T StyleGetProperty<T> (Widget widget, string property, T default_value)
+        {
+            object result = widget.StyleGetProperty (property);
+            return result != null && result.GetType () == typeof (T) ? (T)result : default_value;
+        }
     }
 }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs	Wed Sep  3 15:25:08 2008
@@ -168,6 +168,8 @@
             event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
             event_window.UserData = Handle;
             
+            Style = Gtk.Rc.GetStyleByPaths (Settings, "*.GtkEntry", "*.GtkEntry", GType);
+            
             base.OnRealized ();
         }
          
@@ -176,7 +178,7 @@
             WidgetFlags &= ~WidgetFlags.Realized;
             
             event_window.UserData = IntPtr.Zero;
-            event_window.Destroy ();
+            Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
             event_window = null;
             
             base.OnUnrealized ();
@@ -193,7 +195,7 @@
             WidgetFlags &= ~WidgetFlags.Mapped;
             event_window.Hide ();
         }
-        
+
         private bool changing_style;
         protected override void OnStyleSet (Style previous_style)
         {
@@ -201,11 +203,11 @@
                 return;
             }
             
+            base.OnStyleSet (previous_style);
+            
             changing_style = true;
             focus_width = (int)StyleGetProperty ("focus-line-width");
             interior_focus = (bool)StyleGetProperty ("interior-focus");
-            
-            ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
             changing_style = false;
         }
         
@@ -245,15 +247,16 @@
             }
             
             if (HasFrame) {
-                int y_mid = (Allocation.Height - renderer.Height) / 2;
-                Gtk.Style.PaintFlatBox (Style, GdkWindow, StateType.Normal, ShadowType.None, evnt.Area, this, "entry", 
+                int y_mid = (int)Math.Round ((Allocation.Height - renderer.Height) / 2.0);
+                Gtk.Style.PaintFlatBox (Style, GdkWindow, State, ShadowType.None, evnt.Area, this, "entry", 
                     Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
-                Gtk.Style.PaintShadow (Style, GdkWindow, StateType.Normal, ShadowType.In,
+                Gtk.Style.PaintShadow (Style, GdkWindow, State, ShadowType.In,
                     evnt.Area, this, "entry", Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
             }
             
             Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow);
-            renderer.Render (cr, Allocation, CairoExtensions.GdkColorToCairoColor (Style.Foreground (State)), 
+            renderer.Render (cr, Allocation, 
+                CairoExtensions.GdkColorToCairoColor (HasFrame ? Style.Text (State) : Style.Foreground (State)), 
                 AlwaysShowEmptyStars || (PreviewOnHover && hover_value >= renderer.MinRating), hover_value,
                 State == StateType.Insensitive ? 1 : 0.90, 
                 State == StateType.Insensitive ? 1 : 0.65, 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena/StringUtil.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena/StringUtil.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena/StringUtil.cs	Wed Sep  3 15:25:08 2008
@@ -63,6 +63,11 @@
         
         public static string CamelCaseToUnderCase (string s)
         {
+            return CamelCaseToUnderCase (s, '_');
+        }
+        
+        public static string CamelCaseToUnderCase (string s, char underscore)
+        {
             if (String.IsNullOrEmpty (s)) {
                 return null;
             }
@@ -77,7 +82,7 @@
 
                 undercase.Append (tokens[i].ToLower ());
                 if (i < tokens.Length - 2) {
-                    undercase.Append ('_');
+                    undercase.Append (underscore);
                 }
             }
             



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]