banshee r3873 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets



Author: abock
Date: Mon May  5 03:35:56 2008
New Revision: 3873
URL: http://svn.gnome.org/viewvc/banshee?rev=3873&view=rev

Log:
2008-05-04  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs: Only
    update the progress if it hasn't changed and if we're already pulsing
    and at 0

    * src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs: Show
    the number of files walked while building the total count so it doesn't
    look like we might have frozen while walking a huge directory tree

    * src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs: Added some
    Rgb uint->cairo color utility functions, make ColorShade preserve alpha

    * src/Libraries/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs: Started working
    on a hot disk usage bar for DAP; very incomplete - run 'make hg' to see



Added:
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs	Mon May  5 03:35:56 2008
@@ -143,6 +143,9 @@
             OnImportFinished ();
         }
         
+        private DateTime last_enqueue_display = DateTime.Now;
+        private static System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo ();
+        
         private void Enqueue (string path)
         {
             if (path_queue.Contains (path)) {
@@ -150,6 +153,16 @@
             }
             
             total_count++;
+            
+            if (DateTime.Now - last_enqueue_display > TimeSpan.FromMilliseconds (400)) {
+                lock (nfi) {
+                    nfi.NumberDecimalDigits = 0;
+                    user_job.Status = String.Format (Catalog.GetString ("Scanning ({0} files)..."), 
+                        total_count.ToString ("N", nfi));
+                    last_enqueue_display = DateTime.Now;
+                }
+            }
+            
             lock (path_queue) {
                 path_queue.Enqueue (path);
             }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs	Mon May  5 03:35:56 2008
@@ -121,13 +121,13 @@
         
 #region IImportSource
         
-    	public abstract string Name { get; }
+        public abstract string Name { get; }
 
-    	public abstract string[] IconNames { get; }
+        public abstract string[] IconNames { get; }
 
-    	public virtual bool CanImport {
-    	    get { return true; }
-    	}
+        public virtual bool CanImport {
+            get { return true; }
+        }
 
         public void Import ()
         {

Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am	Mon May  5 03:35:56 2008
@@ -3,167 +3,167 @@
 LINK = $(REF_BANSHEE_SERVICES)
 
 SOURCES =  \
-    Banshee.Base/RateLimiter.cs \
-    Banshee.Base/ThreadAssist.cs \
-    Banshee.Collection.Database/CachedList.cs \
-    Banshee.Collection.Database/DatabaseAlbumInfo.cs \
-    Banshee.Collection.Database/DatabaseAlbumListModel.cs \
-    Banshee.Collection.Database/DatabaseArtistInfo.cs \
-    Banshee.Collection.Database/DatabaseArtistListModel.cs \
-    Banshee.Collection.Database/DatabaseImportManager.cs \
-    Banshee.Collection.Database/DatabaseTrackInfo.cs \
-    Banshee.Collection.Database/DatabaseTrackListModel.cs \
-    Banshee.Collection.Database/DatabaseTrackModelCache.cs \
-    Banshee.Collection.Database/DatabaseTrackModelProvider.cs \
-    Banshee.Collection.Database/IDatabaseTrackModelCache.cs \
-    Banshee.Collection.Database/IDatabaseTrackModelProvider.cs \
-    Banshee.Collection/AlbumListModel.cs \
-    Banshee.Collection/ArtistListModel.cs \
-    Banshee.Collection/BansheeListModel.cs \
-    Banshee.Collection/ExportableModel.cs \
-    Banshee.Collection/IExportableModel.cs \
-    Banshee.Collection/IHasTrackSelection.cs \
-    Banshee.Collection/ImportEventHandler.cs \
-    Banshee.Collection/ImportManager.cs \
-    Banshee.Collection/MemoryTrackListModel.cs \
-    Banshee.Collection/ModelHelper.cs \
-    Banshee.Collection/SelectAllSelection.cs \
-    Banshee.Collection/TrackListModel.cs \
-    Banshee.Configuration/DatabaseConfigurationClient.cs \
-    Banshee.Database/BansheeDbConnection.cs \
-    Banshee.Database/BansheeDbFormatMigrator.cs \
-    Banshee.Database/BansheeModelCache.cs \
-    Banshee.Database/BansheeModelProvider.cs \
-    Banshee.Equalizer/EqualizerManager.cs \
-    Banshee.Equalizer/EqualizerSetting.cs \
-    Banshee.Equalizer/EqualizerSettingEvent.cs \
-    Banshee.Hardware/HardwareManager.cs \
-    Banshee.Hardware/IBlockDevice.cs \
-    Banshee.Hardware/ICdromDevice.cs \
-    Banshee.Hardware/ICustomDeviceProvider.cs \
-    Banshee.Hardware/IDevice.cs \
-    Banshee.Hardware/IDeviceMediaCapabilities.cs \
-    Banshee.Hardware/IDiscVolume.cs \
-    Banshee.Hardware/IDiskDevice.cs \
-    Banshee.Hardware/IHardwareManager.cs \
-    Banshee.Hardware/IVolume.cs \
-    Banshee.Library/HomeDirectoryImportSource.cs \
-    Banshee.Library/IImportSource.cs \
-    Banshee.Library/ImportSourceManager.cs \
-    Banshee.Library/LibraryImportManager.cs \
-    Banshee.Library/LibraryLocationPreference.cs \
-    Banshee.Library/LibrarySource.cs \
-    Banshee.Library/MusicLibrarySource.cs \
-    Banshee.Library/ThreadPoolImportSource.cs \
-    Banshee.Library/VideoLibrarySource.cs \
-    Banshee.MediaEngine/IAudioCdRipper.cs \
-    Banshee.MediaEngine/IEqualizer.cs \
-    Banshee.MediaEngine/IPlayerEngineService.cs \
-    Banshee.MediaEngine/ITranscoder.cs \
-    Banshee.MediaEngine/NullPlayerEngine.cs \
-    Banshee.MediaEngine/PlayerEngine.cs \
-    Banshee.MediaEngine/PlayerEngineService.cs \
-    Banshee.MediaEngine/PlayerEvent.cs \
-    Banshee.MediaEngine/TranscoderService.cs \
-    Banshee.MediaProfiles/MediaProfileManager.cs \
-    Banshee.MediaProfiles/Pipeline.cs \
-    Banshee.MediaProfiles/PipelineVariable.cs \
-    Banshee.MediaProfiles/Profile.cs \
-    Banshee.MediaProfiles/ProfileConfiguration.cs \
-    Banshee.Metadata.Embedded/EmbeddedMetadataProvider.cs \
-    Banshee.Metadata.Embedded/EmbeddedQueryJob.cs \
-    Banshee.Metadata.MusicBrainz/MusicBrainzMetadataProvider.cs \
-    Banshee.Metadata.MusicBrainz/MusicBrainzQueryJob.cs \
-    Banshee.Metadata.Rhapsody/RhapsodyMetadataProvider.cs \
-    Banshee.Metadata.Rhapsody/RhapsodyQueryJob.cs \
-    Banshee.Metadata/BaseMetadataProvider.cs \
-    Banshee.Metadata/IMetadataLookupJob.cs \
-    Banshee.Metadata/IMetadataProvider.cs \
-    Banshee.Metadata/MetadataService.cs \
-    Banshee.Metadata/MetadataServiceJob.cs \
-    Banshee.Metadata/MetadataSettings.cs \
-    Banshee.Networking/NetworkDetect.cs \
-    Banshee.Networking/NetworkManager.cs \
-    Banshee.PlaybackController/IBasicPlaybackController.cs \
-    Banshee.PlaybackController/ICanonicalPlaybackController.cs \
-    Banshee.PlaybackController/IPlaybackController.cs \
-    Banshee.PlaybackController/IPlaybackControllerExportable.cs \
-    Banshee.PlaybackController/PlaybackControllerDatabaseStack.cs \
-    Banshee.PlaybackController/PlaybackControllerService.cs \
-    Banshee.PlaybackController/PlaybackRepeatMode.cs \
-    Banshee.PlaybackController/PlaybackShuffleMode.cs \
-    Banshee.PlayerMigration/AmarokPlayerImportSource.cs \
-    Banshee.Playlist/AbstractPlaylistSource.cs \
-    Banshee.Playlist/PlaylistFileUtil.cs \
-    Banshee.Playlist/PlaylistSource.cs \
-    Banshee.Playlists.Formats/AsxPlaylistFormat.cs \
-    Banshee.Playlists.Formats/InvalidPlaylistException.cs \
-    Banshee.Playlists.Formats/IPlaylistFormat.cs \
-    Banshee.Playlists.Formats/M3uPlaylistFormat.cs \
-    Banshee.Playlists.Formats/PlaylistFormatBase.cs \
-    Banshee.Playlists.Formats/PlaylistFormatDescription.cs \
-    Banshee.Playlists.Formats/PlaylistParser.cs \
-    Banshee.Playlists.Formats/PlsPlaylistFormat.cs \
-    Banshee.Preferences/Collection.cs \
-    Banshee.Preferences/Page.cs \
-    Banshee.Preferences/Preference.cs \
-    Banshee.Preferences/PreferenceBase.cs \
-    Banshee.Preferences/PreferenceService.cs \
-    Banshee.Preferences/Root.cs \
-    Banshee.Preferences/SchemaPreference.cs \
-    Banshee.Preferences/Section.cs \
-    Banshee.Preferences/VoidPreference.cs \
-    Banshee.Query/AbstractPlaylistQueryValue.cs \
-    Banshee.Query/BansheeQuery.cs \
-    Banshee.Query/NaturalIntegerQueryValue.cs \
-    Banshee.Query/PlaylistQueryValue.cs \
-    Banshee.Query/RatingQueryValue.cs \
-    Banshee.Query/SmartPlaylistQueryValue.cs \
-    Banshee.Query/YearQueryValue.cs \
-    Banshee.ServiceStack/Application.cs \
-    Banshee.ServiceStack/BatchUserJob.cs \
-    Banshee.ServiceStack/Client.cs \
-    Banshee.ServiceStack/DBusServiceManager.cs \
-    Banshee.ServiceStack/IDBusExportable.cs \
-    Banshee.ServiceStack/IDelayedInitializeService.cs \
-    Banshee.ServiceStack/IExtensionService.cs \
-    Banshee.ServiceStack/IInitializeService.cs \
-    Banshee.ServiceStack/InterfaceAction.cs \
-    Banshee.ServiceStack/IRequiredService.cs \
-    Banshee.ServiceStack/IService.cs \
-    Banshee.ServiceStack/IUserJob.cs \
-    Banshee.ServiceStack/ServiceManager.cs \
-    Banshee.ServiceStack/ServiceStartedHandler.cs \
-    Banshee.ServiceStack/TestUserJob.cs \
-    Banshee.ServiceStack/UserJob.cs \
-    Banshee.ServiceStack/UserJobEventHandler.cs \
-    Banshee.ServiceStack/UserJobManager.cs \
-    Banshee.SmartPlaylist/Migrator.cs \
-    Banshee.SmartPlaylist/SmartPlaylistDefinition.cs \
-    Banshee.SmartPlaylist/SmartPlaylistSource.cs \
-    Banshee.Sources/DatabaseSource.cs \
-    Banshee.Sources/DurationStatusFormatters.cs \
-    Banshee.Sources/ErrorSource.cs \
-    Banshee.Sources/IDiskUsageReporter.cs \
-    Banshee.Sources/IDurationAggregator.cs \
-    Banshee.Sources/IFileSizeAggregator.cs \
-    Banshee.Sources/IImportable.cs \
-    Banshee.Sources/ISource.cs \
-    Banshee.Sources/ISourceManager.cs \
-    Banshee.Sources/ITrackModelSource.cs \
-    Banshee.Sources/IUnmapableSource.cs \
-    Banshee.Sources/MessageAction.cs \
-    Banshee.Sources/PrimarySource.cs \
-    Banshee.Sources/Source.cs \
-    Banshee.Sources/SourceManager.cs \
-    Banshee.Sources/SourceMergeType.cs \
-    Banshee.Sources/SourceMessage.cs \
-    Banshee.Streaming/RadioTrackInfo.cs \
-    Banshee.Web/Browser.cs
+	Banshee.Base/RateLimiter.cs \
+	Banshee.Base/ThreadAssist.cs \
+	Banshee.Collection.Database/CachedList.cs \
+	Banshee.Collection.Database/DatabaseAlbumInfo.cs \
+	Banshee.Collection.Database/DatabaseAlbumListModel.cs \
+	Banshee.Collection.Database/DatabaseArtistInfo.cs \
+	Banshee.Collection.Database/DatabaseArtistListModel.cs \
+	Banshee.Collection.Database/DatabaseImportManager.cs \
+	Banshee.Collection.Database/DatabaseTrackInfo.cs \
+	Banshee.Collection.Database/DatabaseTrackListModel.cs \
+	Banshee.Collection.Database/DatabaseTrackModelCache.cs \
+	Banshee.Collection.Database/DatabaseTrackModelProvider.cs \
+	Banshee.Collection.Database/IDatabaseTrackModelCache.cs \
+	Banshee.Collection.Database/IDatabaseTrackModelProvider.cs \
+	Banshee.Collection/AlbumListModel.cs \
+	Banshee.Collection/ArtistListModel.cs \
+	Banshee.Collection/BansheeListModel.cs \
+	Banshee.Collection/ExportableModel.cs \
+	Banshee.Collection/IExportableModel.cs \
+	Banshee.Collection/IHasTrackSelection.cs \
+	Banshee.Collection/ImportEventHandler.cs \
+	Banshee.Collection/ImportManager.cs \
+	Banshee.Collection/MemoryTrackListModel.cs \
+	Banshee.Collection/ModelHelper.cs \
+	Banshee.Collection/SelectAllSelection.cs \
+	Banshee.Collection/TrackListModel.cs \
+	Banshee.Configuration/DatabaseConfigurationClient.cs \
+	Banshee.Database/BansheeDbConnection.cs \
+	Banshee.Database/BansheeDbFormatMigrator.cs \
+	Banshee.Database/BansheeModelCache.cs \
+	Banshee.Database/BansheeModelProvider.cs \
+	Banshee.Equalizer/EqualizerManager.cs \
+	Banshee.Equalizer/EqualizerSetting.cs \
+	Banshee.Equalizer/EqualizerSettingEvent.cs \
+	Banshee.Hardware/HardwareManager.cs \
+	Banshee.Hardware/IBlockDevice.cs \
+	Banshee.Hardware/ICdromDevice.cs \
+	Banshee.Hardware/ICustomDeviceProvider.cs \
+	Banshee.Hardware/IDevice.cs \
+	Banshee.Hardware/IDeviceMediaCapabilities.cs \
+	Banshee.Hardware/IDiscVolume.cs \
+	Banshee.Hardware/IDiskDevice.cs \
+	Banshee.Hardware/IHardwareManager.cs \
+	Banshee.Hardware/IVolume.cs \
+	Banshee.Library/HomeDirectoryImportSource.cs \
+	Banshee.Library/IImportSource.cs \
+	Banshee.Library/ImportSourceManager.cs \
+	Banshee.Library/LibraryImportManager.cs \
+	Banshee.Library/LibraryLocationPreference.cs \
+	Banshee.Library/LibrarySource.cs \
+	Banshee.Library/MusicLibrarySource.cs \
+	Banshee.Library/ThreadPoolImportSource.cs \
+	Banshee.Library/VideoLibrarySource.cs \
+	Banshee.MediaEngine/IAudioCdRipper.cs \
+	Banshee.MediaEngine/IEqualizer.cs \
+	Banshee.MediaEngine/IPlayerEngineService.cs \
+	Banshee.MediaEngine/ITranscoder.cs \
+	Banshee.MediaEngine/NullPlayerEngine.cs \
+	Banshee.MediaEngine/PlayerEngine.cs \
+	Banshee.MediaEngine/PlayerEngineService.cs \
+	Banshee.MediaEngine/PlayerEvent.cs \
+	Banshee.MediaEngine/TranscoderService.cs \
+	Banshee.MediaProfiles/MediaProfileManager.cs \
+	Banshee.MediaProfiles/Pipeline.cs \
+	Banshee.MediaProfiles/PipelineVariable.cs \
+	Banshee.MediaProfiles/Profile.cs \
+	Banshee.MediaProfiles/ProfileConfiguration.cs \
+	Banshee.Metadata.Embedded/EmbeddedMetadataProvider.cs \
+	Banshee.Metadata.Embedded/EmbeddedQueryJob.cs \
+	Banshee.Metadata.MusicBrainz/MusicBrainzMetadataProvider.cs \
+	Banshee.Metadata.MusicBrainz/MusicBrainzQueryJob.cs \
+	Banshee.Metadata.Rhapsody/RhapsodyMetadataProvider.cs \
+	Banshee.Metadata.Rhapsody/RhapsodyQueryJob.cs \
+	Banshee.Metadata/BaseMetadataProvider.cs \
+	Banshee.Metadata/IMetadataLookupJob.cs \
+	Banshee.Metadata/IMetadataProvider.cs \
+	Banshee.Metadata/MetadataService.cs \
+	Banshee.Metadata/MetadataServiceJob.cs \
+	Banshee.Metadata/MetadataSettings.cs \
+	Banshee.Networking/NetworkDetect.cs \
+	Banshee.Networking/NetworkManager.cs \
+	Banshee.PlaybackController/IBasicPlaybackController.cs \
+	Banshee.PlaybackController/ICanonicalPlaybackController.cs \
+	Banshee.PlaybackController/IPlaybackController.cs \
+	Banshee.PlaybackController/IPlaybackControllerExportable.cs \
+	Banshee.PlaybackController/PlaybackControllerDatabaseStack.cs \
+	Banshee.PlaybackController/PlaybackControllerService.cs \
+	Banshee.PlaybackController/PlaybackRepeatMode.cs \
+	Banshee.PlaybackController/PlaybackShuffleMode.cs \
+	Banshee.PlayerMigration/AmarokPlayerImportSource.cs \
+	Banshee.Playlist/AbstractPlaylistSource.cs \
+	Banshee.Playlist/PlaylistFileUtil.cs \
+	Banshee.Playlist/PlaylistSource.cs \
+	Banshee.Playlists.Formats/AsxPlaylistFormat.cs \
+	Banshee.Playlists.Formats/InvalidPlaylistException.cs \
+	Banshee.Playlists.Formats/IPlaylistFormat.cs \
+	Banshee.Playlists.Formats/M3uPlaylistFormat.cs \
+	Banshee.Playlists.Formats/PlaylistFormatBase.cs \
+	Banshee.Playlists.Formats/PlaylistFormatDescription.cs \
+	Banshee.Playlists.Formats/PlaylistParser.cs \
+	Banshee.Playlists.Formats/PlsPlaylistFormat.cs \
+	Banshee.Preferences/Collection.cs \
+	Banshee.Preferences/Page.cs \
+	Banshee.Preferences/Preference.cs \
+	Banshee.Preferences/PreferenceBase.cs \
+	Banshee.Preferences/PreferenceService.cs \
+	Banshee.Preferences/Root.cs \
+	Banshee.Preferences/SchemaPreference.cs \
+	Banshee.Preferences/Section.cs \
+	Banshee.Preferences/VoidPreference.cs \
+	Banshee.Query/AbstractPlaylistQueryValue.cs \
+	Banshee.Query/BansheeQuery.cs \
+	Banshee.Query/NaturalIntegerQueryValue.cs \
+	Banshee.Query/PlaylistQueryValue.cs \
+	Banshee.Query/RatingQueryValue.cs \
+	Banshee.Query/SmartPlaylistQueryValue.cs \
+	Banshee.Query/YearQueryValue.cs \
+	Banshee.ServiceStack/Application.cs \
+	Banshee.ServiceStack/BatchUserJob.cs \
+	Banshee.ServiceStack/Client.cs \
+	Banshee.ServiceStack/DBusServiceManager.cs \
+	Banshee.ServiceStack/IDBusExportable.cs \
+	Banshee.ServiceStack/IDelayedInitializeService.cs \
+	Banshee.ServiceStack/IExtensionService.cs \
+	Banshee.ServiceStack/IInitializeService.cs \
+	Banshee.ServiceStack/InterfaceAction.cs \
+	Banshee.ServiceStack/IRequiredService.cs \
+	Banshee.ServiceStack/IService.cs \
+	Banshee.ServiceStack/IUserJob.cs \
+	Banshee.ServiceStack/ServiceManager.cs \
+	Banshee.ServiceStack/ServiceStartedHandler.cs \
+	Banshee.ServiceStack/TestUserJob.cs \
+	Banshee.ServiceStack/UserJob.cs \
+	Banshee.ServiceStack/UserJobEventHandler.cs \
+	Banshee.ServiceStack/UserJobManager.cs \
+	Banshee.SmartPlaylist/Migrator.cs \
+	Banshee.SmartPlaylist/SmartPlaylistDefinition.cs \
+	Banshee.SmartPlaylist/SmartPlaylistSource.cs \
+	Banshee.Sources/DatabaseSource.cs \
+	Banshee.Sources/DurationStatusFormatters.cs \
+	Banshee.Sources/ErrorSource.cs \
+	Banshee.Sources/IDiskUsageReporter.cs \
+	Banshee.Sources/IDurationAggregator.cs \
+	Banshee.Sources/IFileSizeAggregator.cs \
+	Banshee.Sources/IImportable.cs \
+	Banshee.Sources/ISource.cs \
+	Banshee.Sources/ISourceManager.cs \
+	Banshee.Sources/ITrackModelSource.cs \
+	Banshee.Sources/IUnmapableSource.cs \
+	Banshee.Sources/MessageAction.cs \
+	Banshee.Sources/PrimarySource.cs \
+	Banshee.Sources/Source.cs \
+	Banshee.Sources/SourceManager.cs \
+	Banshee.Sources/SourceMergeType.cs \
+	Banshee.Sources/SourceMessage.cs \
+	Banshee.Streaming/RadioTrackInfo.cs \
+	Banshee.Web/Browser.cs
 
 RESOURCES =  \
-    Banshee.Services.addin.xml \
-    Banshee.Services.addins
+	Banshee.Services.addin.xml \
+	Banshee.Services.addins
 
 module_DATA = Banshee.Services.addins
 

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs	Mon May  5 03:35:56 2008
@@ -194,6 +194,11 @@
             }
             
             cancel_button.Sensitive = job.CanCancel;
+            
+            if (job.Progress == 0 && progress_bounce_id > 0) {
+                return;
+            }
+            
             progress_bar.Fraction = job.Progress;
             
             if (job.Progress == 0.0 && progress_bounce_id == 0) {

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	Mon May  5 03:35:56 2008
@@ -72,6 +72,7 @@
     <File name="Hyena.Query.Gui/QueryDebugger.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.Gui/TestModuleAttribute.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.Gui/TestModuleRunner.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hyena.Widgets/SegmentedBar.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs	Mon May  5 03:35:56 2008
@@ -78,6 +78,20 @@
                 alpha);
         }
         
+        public static Cairo.Color RgbToColor (uint rgbColor)
+        {
+            return RgbaToColor ((rgbColor << 8) | 0x000000ff);
+        }
+        
+        public static Cairo.Color RgbaToColor (uint rgbaColor)
+        {
+            return new Cairo.Color (
+                (byte)(rgbaColor >> 24) / 255.0, 
+                (byte)(rgbaColor >> 16) / 255.0, 
+                (byte)(rgbaColor >> 8) / 255.0, 
+                (byte)(rgbaColor & 0x000000ff) / 255.0);
+        }
+        
         public static bool ColorIsDark (Cairo.Color color)
         {
             double h, s, b;
@@ -181,16 +195,18 @@
             return new Cairo.Color(color_shift[0], color_shift[1], color_shift[2]);
         }
         
-        public static Cairo.Color ColorShade(Cairo.Color @base, double ratio)
+        public static Cairo.Color ColorShade (Cairo.Color @base, double ratio)
         {
             double h, s, b;
             
-            HsbFromColor(@base, out h, out s, out b);
+            HsbFromColor (@base, out h, out s, out b);
             
-            b = Math.Max(Math.Min(b * ratio, 1), 0);
-            s = Math.Max(Math.Min(s * ratio, 1), 0);
+            b = Math.Max (Math.Min (b * ratio, 1), 0);
+            s = Math.Max (Math.Min (s * ratio, 1), 0);
             
-            return ColorFromHsb(h, s, b);
+            Cairo.Color color = ColorFromHsb (h, s, b);
+            color.A = @base.A;
+            return color;
         }
         
         public static Cairo.Color ColorAdjustBrightness(Cairo.Color @base, double br)

Added: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs	Mon May  5 03:35:56 2008
@@ -0,0 +1,285 @@
+//
+// SegmentedBar.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.Collections.Generic;
+
+using Gtk;
+using Cairo;
+
+using Hyena.Gui;
+
+namespace Hyena.Widgets
+{
+    public class SegmentedBar : Widget
+    {
+        public struct Segment
+        {
+            private string title;
+            private double percent;
+            private Cairo.Color color;
+            
+            public Segment (string title, double percent, Cairo.Color color)
+            {
+                this.title = title;
+                this.percent = percent;
+                this.color = color;
+            }
+            
+            public string Title {
+                get { return title; }
+                set { title = value; }
+            }
+            
+            public double Percent {
+                get { return percent; }
+                set { percent = value; }
+            }
+            
+            public Cairo.Color Color {
+                get { return color; }
+                set { color = value; }
+            }
+        }
+        
+        private List<Segment> segments = new List<Segment> ();
+        private int bar_height = 12;
+        
+        private Color remainder_color = CairoExtensions.RgbToColor (0xeeeeee);
+    
+        public SegmentedBar ()
+        {
+            WidgetFlags |= WidgetFlags.NoWindow;
+        }
+        
+        protected override void OnRealized ()
+        {
+            GdkWindow = Parent.GdkWindow;
+            base.OnRealized ();
+        }
+        
+        protected override void OnSizeRequested (ref Requisition requisition)
+        {
+            requisition.Width = 200;
+            requisition.Height = 0;
+        }
+        
+        protected override void OnSizeAllocated (Gdk.Rectangle allocation)
+        {
+            HeightRequest = bar_height * 2;
+            base.OnSizeAllocated (allocation);
+        }
+        
+        public void AddSegmentRgba (string title, double percent, uint rgbaColor)
+        {
+            AddSegment (title, percent, CairoExtensions.RgbaToColor (rgbaColor));
+        }
+        
+        public void AddSegmentRgb (string title, double percent, uint rgbColor)
+        {
+            AddSegment (title, percent, CairoExtensions.RgbToColor (rgbColor));
+        }
+        
+        public void AddSegment (string title, double percent, Color color)
+        {
+            lock (segments) {
+                segments.Add (new Segment (title, percent, color));
+                QueueDraw ();
+            }
+        }
+
+        protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+        {
+            if (evnt.Window != GdkWindow) {
+                return base.OnExposeEvent (evnt);
+            }
+            
+            Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
+            cr.PushGroup ();
+            
+            cr.Operator = Operator.Over;
+            cr.Translate (Allocation.X, Allocation.Y);
+            cr.Rectangle (0, 0, Allocation.Width, 2 * bar_height);
+            cr.Clip ();
+            
+            Pattern bar = RenderBar (Allocation.Width, bar_height);
+            
+            cr.Save ();
+            cr.Source = bar;
+            cr.Paint ();
+            cr.Restore ();
+
+            cr.Save ();
+
+            cr.Rectangle (0, bar_height, Allocation.Width, bar_height);
+            cr.Clip ();
+            
+            Matrix matrix = new Matrix ();
+            matrix.InitScale (1, -1);
+            matrix.Translate (0, -(2 * bar_height) + 1);
+            cr.Transform (matrix);
+            
+            cr.Pattern = bar;
+            
+            LinearGradient mask = new LinearGradient (0, 0, 0, bar_height);
+            
+            mask.AddColorStop (0, new Color (0, 0, 0, 0));
+            mask.AddColorStop (0.25, new Color (0, 0, 0, 0.01));
+            mask.AddColorStop (0.5, new Color (0, 0, 0, 0.125));
+            mask.AddColorStop (0.75, new Color (0, 0, 0, 0.4));
+            mask.AddColorStop (1.0, new Color (0, 0, 0, 0.7));
+            
+            cr.Mask (mask);
+            mask.Destroy ();
+            
+            cr.Restore ();
+            
+            cr.PopGroupToSource ();
+            cr.Paint ();
+            
+            bar.Destroy ();
+            ((IDisposable)cr.Target).Dispose ();
+            ((IDisposable)cr).Dispose ();
+            
+            return true;
+        }
+        
+        private Pattern RenderBar (int w, int h)
+        {
+            ImageSurface s = new ImageSurface (Format.Argb32, w, h);
+            Context cr = new Context (s);
+            RenderBar (cr, w, h, h / 2);
+            Pattern pattern = new Pattern (s);
+            s.Destroy ();
+            ((IDisposable)cr).Dispose ();
+            return pattern;
+        }
+        
+        private void RenderBar (Context cr, int w, int h, int r)
+        {
+            RenderBarSegments (cr, w, h, r);
+            RenderBarStrokes (cr, w, h, r);
+        }
+        
+        private void RenderBarSegments (Context cr, int w, int h, int r)
+        {
+            CairoCorners corners_left = CairoCorners.TopLeft | CairoCorners.BottomLeft;
+            CairoCorners corners_right = CairoCorners.TopRight | CairoCorners.BottomRight;
+            
+            double x = 0;
+            
+            for (int i = 0; i < segments.Count; i++) {
+                LinearGradient grad = MakeSegmentGradient (h, segments[i].Color);
+                double s_w = w * segments[i].Percent;
+                CairoCorners corners = CairoCorners.None;
+                
+                if (i == 0) {
+                    corners |= corners_left;
+                } else if (i == segments.Count - 1 && x + s_w == w) {
+                    corners |= corners_right;
+                }
+                
+                CairoExtensions.RoundedRectangle (cr, x, 0, s_w, h, r, corners);
+                cr.Pattern = grad;
+                cr.Fill ();
+                grad.Destroy ();
+                
+                x += s_w;
+            }
+            
+            if (x < w) {
+                CairoExtensions.RoundedRectangle (cr, x, 0, w - x, h, r, corners_right);
+                cr.Pattern = MakeSegmentGradient (h, remainder_color);
+                cr.Fill ();
+                cr.Pattern.Destroy ();
+            }
+        }
+        
+        private void RenderBarStrokes (Context cr, int w, int h, int r)
+        {
+            LinearGradient stroke = MakeSegmentGradient (h, CairoExtensions.RgbaToColor (0x00000040));
+            LinearGradient seg_sep_light = MakeSegmentGradient (h, CairoExtensions.RgbaToColor (0xffffff20));
+            LinearGradient seg_sep_dark = MakeSegmentGradient (h, CairoExtensions.RgbaToColor (0x00000020));
+            
+            cr.LineWidth = 1;
+            
+            double seg_w = 20;
+            double x = seg_w > r ? seg_w : r;
+            
+            while (x < w - r) {
+                cr.MoveTo (x - 0.5, 1);
+                cr.LineTo (x - 0.5, h - 1);
+                cr.Pattern = seg_sep_light;
+                cr.Stroke ();
+                
+                cr.MoveTo (x + 0.5, 1);
+                cr.LineTo (x + 0.5, h - 1);
+                cr.Pattern = seg_sep_dark;
+                cr.Stroke ();
+                
+                x += seg_w;
+            }
+            
+            CairoExtensions.RoundedRectangle (cr, 0.5, 0.5, w - 1, h - 1, r);
+            cr.Pattern = stroke;
+            cr.Stroke ();
+            
+            stroke.Destroy ();
+            seg_sep_light.Destroy ();
+            seg_sep_dark.Destroy ();
+        }
+        
+        private LinearGradient MakeSegmentGradient (int h, Color color)
+        {
+            LinearGradient grad = new LinearGradient (0, 0, 0, h);
+            grad.AddColorStop (0, CairoExtensions.ColorShade (color, 1.1));
+            grad.AddColorStop (0.35, CairoExtensions.ColorShade (color, 1.2));
+            grad.AddColorStop (1, CairoExtensions.ColorShade (color, 0.8));
+            return grad;
+        }
+    }
+    
+    [TestModule ("Segmented Bar")]
+    internal class SegmentedBarTestModule : Window
+    {
+        private SegmentedBar bar;
+        
+        public SegmentedBarTestModule () : base ("Segmented Bar")
+        {
+            bar = new SegmentedBar ();
+            Add (bar);
+            bar.Show ();
+            BorderWidth = 30;
+            SetDefaultSize (500, -1);
+            
+            bar.AddSegmentRgb ("Audio", 0.20, 0x3465a4);
+            bar.AddSegmentRgb ("Video", 0.55, 0x73d216);
+            bar.AddSegmentRgb ("Other", 0.10, 0xf57900);
+        }
+    }
+}

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	Mon May  5 03:35:56 2008
@@ -64,6 +64,7 @@
 	Hyena.Widgets/MessageBar.cs \
 	Hyena.Widgets/RoundedFrame.cs \
 	Hyena.Widgets/ScrolledWindow.cs \
+	Hyena.Widgets/SegmentedBar.cs \
 	Hyena.Widgets/SmoothScrolledWindow.cs \
 	Hyena.Widgets/WrapLabel.cs
 



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