[banshee: 1/12] Pull some useful bits out of Banshee into Hyena



commit 54c569fdeeca8e9bd4a3cac1707e6faef706f492
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Jul 21 18:16:09 2009 -0700

    Pull some useful bits out of Banshee into Hyena
    
    Move ApplicationContext, ThreadAssist, GenericToolItem.
    
    Factor out BansheeActionGroup into HyenaActionGroup and
    InterfaceActionService into Hyena.Gui.ActionManager.
    
    Most changes in this commit are from updating calls to ThreadAssist.

 .../Banshee.GStreamer/Banshee.GStreamer/Service.cs |    4 +-
 .../Banshee.Gnome/Banshee.GnomeBackend/Brasero.cs  |    5 +-
 src/Clients/Nereid/Nereid/PlayerInterface.cs       |    9 +-
 src/Core/Banshee.Core/Makefile.am                  |    1 -
 .../Banshee.Collection/BansheeListModel.cs         |    9 +-
 .../Banshee.Collection/FilterListModel.cs          |    3 +-
 .../Banshee.Database/BansheeDbConnection.cs        |    4 +-
 .../Banshee.Hardware/HardwareManager.cs            |    2 +-
 .../Banshee.Library/ThreadPoolImportSource.cs      |    2 +-
 .../Banshee.MediaProfiles/Pipeline.cs              |    1 +
 .../Banshee.Metadata/MetadataService.cs            |    4 +-
 .../PlaylistFormatBase.cs                          |    2 +
 .../Banshee.Playlists.Formats/PlaylistParser.cs    |    2 +
 .../Banshee.Playlists.Formats/PlsPlaylistFormat.cs |    2 +
 .../Banshee.ServiceStack/Application.cs            |    2 +
 .../Banshee.Sources/ErrorSource.cs                 |    5 +-
 .../Banshee.Sources/PrimarySource.cs               |    2 +-
 .../Banshee.Sources/SourceManager.cs               |   10 +-
 src/Core/Banshee.Services/Makefile.am              |    1 -
 .../Banshee.Addins.Gui/AddinView.cs                |    4 +-
 .../Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs   |    5 +-
 .../Banshee.Gui.Widgets/ConnectedMessageBar.cs     |    5 +-
 .../Banshee.Gui.Widgets/UserJobTile.cs             |    2 +-
 .../Banshee.Gui.Widgets/UserJobTileHost.cs         |    8 +-
 .../Banshee.Gui/BansheeActionGroup.cs              |  130 +--------------
 .../Banshee.Gui/BaseClientWindow.cs                |    3 +-
 .../Banshee.Gui/GtkBaseClient.cs                   |    1 +
 .../Banshee.Gui/InterfaceActionService.cs          |  131 +--------------
 .../Banshee.Gui/SourceActions.cs                   |    4 +-
 .../Banshee.Gui/TrackActions.cs                    |    7 +-
 .../Banshee.Library.Gui/ImportDialog.cs            |    8 +-
 .../ProfileConfigurationDialog.cs                  |    2 +
 .../Banshee.Preferences.Gui/WidgetFactory.cs       |    4 +-
 .../Banshee.SmartPlaylist.Gui/Editor.cs            |    1 +
 .../FilteredListSourceContents.cs                  |    5 +-
 .../Banshee.Sources.Gui/SourceComboBox.cs          |    6 +-
 .../Banshee.Sources.Gui/SourceModel.cs             |   10 +-
 .../Banshee.Sources.Gui/SourceView.cs              |   11 +-
 src/Core/Banshee.Widgets/Makefile.am               |    1 -
 src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapActions.cs  |    4 +-
 src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs  |    3 +-
 src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs  |    2 +-
 src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs         |    4 +-
 .../Banshee.Bookmarks/BookmarksService.cs          |    6 +-
 .../Banshee.CoverArt/CoverArtService.cs            |    7 +-
 .../Banshee.Daap/Banshee.Daap/DaapService.cs       |    3 +-
 .../FileSystemQueueSource.cs                       |    4 +-
 .../Banshee.Lastfm.Radio/LastfmSourceContents.cs   |    4 +-
 .../Banshee.Lastfm.Radio/LastfmTrackInfo.cs        |    2 +
 .../Banshee.Lastfm.Radio/StationEditor.cs          |    3 +-
 .../RecommendationPane.cs                          |    2 +-
 .../Banshee.MiniMode/SourceModel.cs                |    4 +-
 .../Banshee.PlayQueue/PlayQueueActions.cs          |    5 +-
 .../Banshee.Podcasting.Gui/PodcastActions.cs       |    3 +-
 src/Libraries/Hyena.Gui/Hyena.Gui/ActionManager.cs |  170 +++++++++++++++++++
 .../Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs        |  175 ++++++++++++++++++++
 .../Hyena.Gui/Hyena.Widgets/GenericToolItem.cs     |   48 ++++++
 src/Libraries/Hyena.Gui/Makefile.am                |    3 +
 src/Libraries/Hyena/Hyena/ApplicationContext.cs    |   78 +++++++++
 src/Libraries/Hyena/Hyena/ThreadAssist.cs          |  110 ++++++++++++
 src/Libraries/Hyena/Makefile.am                    |    2 +
 61 files changed, 725 insertions(+), 335 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
index 1ba8b43..c34635a 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
@@ -53,7 +53,7 @@ namespace Banshee.GStreamer
         
         void IExtensionService.Initialize ()
         {
-            bool debugging = Banshee.Base.ApplicationContext.Debugging;
+            bool debugging = ApplicationContext.Debugging;
             if (debugging) {
                 native_log_handler = new BansheeLogHandler (NativeLogHandler);
             }
@@ -118,7 +118,7 @@ namespace Banshee.GStreamer
         
         private static void OnTestMediaProfile (object o, TestProfileArgs args)
         {
-            bool no_test = Banshee.Base.ApplicationContext.EnvironmentIsSet ("BANSHEE_PROFILES_NO_TEST");
+            bool no_test = ApplicationContext.EnvironmentIsSet ("BANSHEE_PROFILES_NO_TEST");
             bool available = false;
             
             foreach (Pipeline.Process process in args.Profile.Pipeline.GetPendingProcessesById ("gstreamer")) {
diff --git a/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/Brasero.cs b/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/Brasero.cs
index c688a1d..bfbdf46 100644
--- a/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/Brasero.cs
+++ b/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/Brasero.cs
@@ -35,6 +35,7 @@ using Mono.Unix;
 using Gtk;
 
 using Hyena;
+
 using Banshee.Base;
 using Banshee.Collection;
 using Banshee.ServiceStack;
@@ -72,8 +73,8 @@ namespace Banshee.GnomeBackend
             uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
             
             UpdateActions ();
-            uia_service.TrackActions.SelectionChanged += delegate { Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions); };
-            ServiceManager.SourceManager.ActiveSourceChanged += delegate { Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions); };
+            uia_service.TrackActions.SelectionChanged += delegate { ThreadAssist.ProxyToMain (UpdateActions); };
+            ServiceManager.SourceManager.ActiveSourceChanged += delegate { ThreadAssist.ProxyToMain (UpdateActions); };
         }
         
         public void Dispose ()
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 1b95574..051db19 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
 using Hyena.Gui;
 using Hyena.Data;
 using Hyena.Data.Gui;
@@ -281,7 +282,7 @@ namespace Nereid
         private TrackListModel previous_track_model = null;
         private void OnActiveSourceChanged (SourceEventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 Source source = ServiceManager.SourceManager.ActiveSource;
     
                 view_container.SearchSensitive = source != null && source.CanSearch;
@@ -330,7 +331,7 @@ namespace Nereid
         private void OnSourcePropertyChanged (object o, PropertyChangeEventArgs args)
         {
             if (args.PropertyName == "Nereid.SourceContents") {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     UpdateSourceContents (previous_source);
                 });
             }
@@ -392,7 +393,7 @@ namespace Nereid
         private void OnSourceUpdated (SourceEventArgs args)
         {
             if (args.Source == ServiceManager.SourceManager.ActiveSource) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     UpdateSourceInformation ();
                     view_container.Title = args.Source.Name;
                 });
@@ -502,7 +503,7 @@ namespace Nereid
 
         private void HandleTrackModelReloaded (object sender, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (UpdateSourceInformation);
+            ThreadAssist.ProxyToMain (UpdateSourceInformation);
         }
 
         private void UpdateSourceInformation ()
diff --git a/src/Core/Banshee.Core/Makefile.am b/src/Core/Banshee.Core/Makefile.am
index 219235b..7a25f20 100644
--- a/src/Core/Banshee.Core/Makefile.am
+++ b/src/Core/Banshee.Core/Makefile.am
@@ -2,7 +2,6 @@ ASSEMBLY = Banshee.Core
 TARGET = library
 LINK = $(REF_BANSHEE_CORE)
 SOURCES =  \
-	Banshee.Base/ApplicationContext.cs \
 	Banshee.Base/CoverArtSpec.cs \
 	Banshee.Base/FileNamePattern.cs \
 	Banshee.Base/Localization.cs \
diff --git a/src/Core/Banshee.Services/Banshee.Collection/BansheeListModel.cs b/src/Core/Banshee.Services/Banshee.Collection/BansheeListModel.cs
index 896e089..5d6635c 100644
--- a/src/Core/Banshee.Services/Banshee.Collection/BansheeListModel.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection/BansheeListModel.cs
@@ -29,6 +29,7 @@
 
 using System;
 
+using Hyena;
 using Hyena.Data;
 using Hyena.Collections;
 using Banshee.ServiceStack;
@@ -59,16 +60,12 @@ namespace Banshee.Collection
 
         protected override void OnCleared ()
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
-                base.OnCleared ();
-            });
+            ThreadAssist.ProxyToMain (base.OnCleared);
         }
 
         protected override void OnReloaded ()
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
-                base.OnReloaded ();
-            });
+            ThreadAssist.ProxyToMain (base.OnReloaded);
         }
     }
 }
diff --git a/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs b/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs
index 4373105..7c69fd9 100644
--- a/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs
@@ -29,6 +29,7 @@
 using System;
 using System.Collections.Generic;
 
+using Hyena;
 using Hyena.Data;
 using Banshee.ServiceStack;
 
@@ -70,7 +71,7 @@ namespace Banshee.Collection
         
         private void HandleSelectionChanged (object sender, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.SpawnFromMain (ReloadBrowsingModel);
+            ThreadAssist.SpawnFromMain (ReloadBrowsingModel);
         } 
 
         private void ReloadBrowsingModel ()
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
index a51d17f..4def53e 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
@@ -66,9 +66,9 @@ namespace Banshee.Database
             migrator = new BansheeDbFormatMigrator (this);
             configuration = new DatabaseConfigurationClient (this);
             
-            if (Banshee.Base.ApplicationContext.CommandLine.Contains ("debug-sql")) {
+            if (ApplicationContext.CommandLine.Contains ("debug-sql")) {
                 Hyena.Data.Sqlite.HyenaSqliteCommand.LogAll = true;
-                WarnIfCalledFromThread = Banshee.Base.ThreadAssist.MainThread;
+                WarnIfCalledFromThread = ThreadAssist.MainThread;
             }
         }
 
diff --git a/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs b/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
index 6feb20b..539ccb6 100644
--- a/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
+++ b/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
@@ -141,7 +141,7 @@ namespace Banshee.Hardware
 
                     startup_device_command_checked = true;
 
-                    foreach (KeyValuePair<string, string> argument in Banshee.Base.ApplicationContext.CommandLine.Arguments) {
+                    foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
                         startup_device_command = Banshee.Hardware.DeviceCommand.ParseCommandLine (argument.Key, argument.Value);
                         if (startup_device_command != null) {
                             break;
diff --git a/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs b/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
index bc085f1..2731684 100644
--- a/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
+++ b/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
@@ -91,7 +91,7 @@ namespace Banshee.Library
 
         protected void LogError (string path, string msg)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 ErrorSource error_source = ServiceManager.SourceManager.MusicLibrary.ErrorSource;
                 error_source.AddMessage (path, msg);
     
diff --git a/src/Core/Banshee.Services/Banshee.MediaProfiles/Pipeline.cs b/src/Core/Banshee.Services/Banshee.MediaProfiles/Pipeline.cs
index 26c5ee2..386aae6 100644
--- a/src/Core/Banshee.Services/Banshee.MediaProfiles/Pipeline.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaProfiles/Pipeline.cs
@@ -33,6 +33,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
 
+using Hyena;
 using Hyena.SExpEngine;
 using Banshee.Base;
 
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs b/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
index 9210cd0..f9bf155 100644
--- a/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
+++ b/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
@@ -31,6 +31,8 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 
+using Hyena;
+
 using Banshee.Kernel;
 using Banshee.Collection;
 
@@ -142,7 +144,7 @@ namespace Banshee.Metadata
             
             IMetadataLookupJob lookup_job = (IMetadataLookupJob)job;
             if (RemoveJob (lookup_job)) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate { 
+                ThreadAssist.ProxyToMain (delegate { 
                     OnHaveResult (lookup_job.Track, lookup_job.ResultTags); 
                 });
             }
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
index ca0e680..5d911be 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
@@ -30,6 +30,8 @@ using System;
 using System.IO;
 using System.Collections.Generic;
 
+using Hyena;
+
 using Banshee.Base;
 using Banshee.Sources;
 
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
index f4714fd..8e08111 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
@@ -33,6 +33,8 @@ using System.Net;
 using System.Web;
 using System.Collections.Generic;
 
+using Hyena;
+
 using Banshee.Base;
 
 namespace Banshee.Playlists.Formats
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlsPlaylistFormat.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlsPlaylistFormat.cs
index bb6900c..bd54f76 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlsPlaylistFormat.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlsPlaylistFormat.cs
@@ -32,6 +32,8 @@ using System.Collections.Generic;
 
 using Mono.Unix;
 
+using Hyena;
+
 using Banshee.Base;
 using Banshee.Collection;
 using Banshee.Sources;
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
index 67dfcd0..904d79e 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
@@ -32,6 +32,8 @@ using System.Reflection;
 using System.Collections.Generic;
 using Mono.Unix;
 
+using Hyena;
+
 using Banshee.Library;
 using Banshee.Playlist;
 using Banshee.SmartPlaylist;
diff --git a/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs b/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs
index 082db5a..72475eb 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
 
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Data;
 using Hyena.Collections;
 
@@ -60,7 +61,7 @@ namespace Banshee.Sources
         
         private void OnReloaded ()
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 EventHandler handler = Reloaded;
                 if (handler != null) {
                     handler (this, EventArgs.Empty);
@@ -70,7 +71,7 @@ namespace Banshee.Sources
         
         private void OnCleared ()
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 EventHandler handler = Cleared;
                 if (handler != null) {
                     handler (this, EventArgs.Empty);
diff --git a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
index f19049f..714cf40 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
@@ -661,7 +661,7 @@ namespace Banshee.Sources
             if (notify || finished) {
                 OnTracksAdded ();
                 if (finished) {
-                    Banshee.Base.ThreadAssist.ProxyToMain (OnUserNotifyUpdated);
+                    ThreadAssist.ProxyToMain (OnUserNotifyUpdated);
                 }
             }
         }
diff --git a/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs b/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
index 0d2d20b..4538e5b 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
@@ -31,6 +31,8 @@ using System.Collections.Generic;
 
 using Mono.Addins;
 
+using Hyena;
+
 using Banshee.ServiceStack;
 using Banshee.Library;
 
@@ -136,7 +138,7 @@ namespace Banshee.Sources
         
         public void AddSource(Source source, bool isDefault)
         {
-            Banshee.Base.ThreadAssist.AssertInMainThread ();
+            ThreadAssist.AssertInMainThread ();
             if(source == null || ContainsSource (source)) {
                 return;
             }
@@ -218,7 +220,7 @@ namespace Banshee.Sources
                 }
             }
 
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 if(source == active_source) {
                     SetActiveSource(default_source);
                 }
@@ -254,7 +256,7 @@ namespace Banshee.Sources
         
         private void OnSourceUpdated(object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 SourceEventHandler handler = SourceUpdated;
                 if(handler != null) {
                     SourceEventArgs evargs = new SourceEventArgs();
@@ -324,7 +326,7 @@ namespace Banshee.Sources
         
         public void SetActiveSource(Source source, bool notify)
         {
-            Banshee.Base.ThreadAssist.AssertInMainThread ();
+            ThreadAssist.AssertInMainThread ();
             if(source == null || !source.CanActivate || active_source == source) {
                 return;
             }
diff --git a/src/Core/Banshee.Services/Makefile.am b/src/Core/Banshee.Services/Makefile.am
index c36d426..45456a2 100644
--- a/src/Core/Banshee.Services/Makefile.am
+++ b/src/Core/Banshee.Services/Makefile.am
@@ -4,7 +4,6 @@ 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 \
diff --git a/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs b/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
index d2ba6b0..a12c959 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Addins.Gui/AddinView.cs
@@ -30,6 +30,8 @@ using System;
 using System.Collections.Generic;
 using Gtk;
 
+using Hyena;
+
 using Mono.Addins;
 
 namespace Banshee.Addins.Gui
@@ -57,7 +59,7 @@ namespace Banshee.Addins.Gui
             foreach (Addin addin in AddinManager.Registry.GetAddins ()) {
                 if (addin.Name != addin.Id && addin.Description != null && 
                     addin.Description.Category != null && !addin.Description.Category.StartsWith ("required:") &&
-                    (!addin.Description.Category.Contains ("Debug") || Banshee.Base.ApplicationContext.Debugging)) {
+                    (!addin.Description.Category.Contains ("Debug") || ApplicationContext.Debugging)) {
                     AppendAddin (addin);
                 }
             }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs
index dc593bc..6a98a31 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs
@@ -30,6 +30,7 @@ using System;
 using Gtk;
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Jobs;
 
 using Banshee.ServiceStack;
@@ -75,7 +76,7 @@ namespace Banshee.Gui.Dialogs
         private void AddJob(Job job)
         {
             if (job.Has (PriorityHints.DataLossIfStopped)) {
-                Banshee.Base.ThreadAssist.ProxyToMain(delegate {
+                ThreadAssist.ProxyToMain(delegate {
                     TreeIter iter = (ListView.Model as ListStore).Prepend();
                     (ListView.Model as ListStore).SetValue(iter, 0, job.Title);
                     (ListView.Model as ListStore).SetValue(iter, 1, job);
@@ -101,7 +102,7 @@ namespace Banshee.Gui.Dialogs
                 }
                     
                 if(ListView.Model.GetValue(iter, 1) == job) {
-                    Banshee.Base.ThreadAssist.ProxyToMain(delegate {
+                    ThreadAssist.ProxyToMain(delegate {
                         (ListView.Model as ListStore).Remove(ref iter);
                     });
                     break;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedMessageBar.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedMessageBar.cs
index 040c849..126b50f 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedMessageBar.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedMessageBar.cs
@@ -29,11 +29,12 @@
 using System;
 using Gtk;
 
+using Hyena;
 using Hyena.Data;
+using Hyena.Widgets;
+
 using Banshee.Sources;
 using Banshee.ServiceStack;
-
-using Hyena.Widgets;
 using Banshee.Sources.Gui;
 using Banshee.Base;
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
index 1a1eb42..6319f27 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
@@ -30,10 +30,10 @@ using System;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
 using Hyena.Jobs;
 using Hyena.Gui;
 
-using Banshee.Base;
 using Banshee.ServiceStack;
 
 namespace Banshee.Gui.Widgets
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs
index ffc1b05..edcc920 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs
@@ -31,11 +31,11 @@ using System.Collections.Generic;
 
 using Gtk;
 
+using Hyena;
 using Hyena.Jobs;
 using Hyena.Widgets;
 using Hyena.Gui.Theatrics;
 
-using Banshee.Base;
 using Banshee.ServiceStack;
 
 namespace Banshee.Gui.Widgets
@@ -48,7 +48,7 @@ namespace Banshee.Gui.Widgets
         
         public UserJobTileHost () : base (0.0f, 0.0f, 1.0f, 1.0f)
         {
-            Banshee.Base.ThreadAssist.AssertInMainThread ();
+            ThreadAssist.AssertInMainThread ();
             LeftPadding = 4;
             
             box = new AnimatedVBox ();
@@ -81,7 +81,7 @@ namespace Banshee.Gui.Widgets
                 }
                 
                 if ((job.DelayShow && job.Progress < 0.33) || !job.DelayShow) {
-                    Banshee.Base.ThreadAssist.AssertInMainThread ();
+                    ThreadAssist.AssertInMainThread ();
                     UserJobTile tile = new UserJobTile (job);
                     job_tiles.Add (job, tile);
                     job_start_times.Add (job, DateTime.Now);
@@ -114,7 +114,7 @@ namespace Banshee.Gui.Widgets
         {
             lock (this) {
                 if (job_tiles.ContainsKey (job)) {
-                    Banshee.Base.ThreadAssist.AssertInMainThread ();
+                    ThreadAssist.AssertInMainThread ();
                     UserJobTile tile = job_tiles[job];
                     box.Remove (tile);
                     job_tiles.Remove (job);
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
index 003d1ed..e1bbdf5 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
@@ -31,111 +31,30 @@ using System.Collections.Generic;
 
 using Gtk;
 
+using Hyena.Gui;
+
 using Banshee.Base;
 using Banshee.ServiceStack;
 using Banshee.Sources;
 
 namespace Banshee.Gui
 {
-    public class BansheeActionGroup : ActionGroup
+    public class BansheeActionGroup : HyenaActionGroup
     {
         private InterfaceActionService action_service;
         private Dictionary<string, string> labels = new Dictionary<string, string> ();
         private Dictionary<string, string> icons = new Dictionary<string, string> ();
-        private List<uint> ui_merge_ids = new List<uint> ();
-
-        private bool important_by_default = true;
-        protected bool ImportantByDefault {
-            get { return important_by_default; }
-            set { important_by_default = value; }
-        }
 
         public BansheeActionGroup (string name)
             : this (ServiceManager.Get<InterfaceActionService> (), name)
         {
         }
         
-        public BansheeActionGroup (InterfaceActionService action_service, string name) : base (name)
+        public BansheeActionGroup (InterfaceActionService action_service, string name) : base (action_service, name)
         {
             this.action_service = action_service;
         }
 
-        public void AddUiFromFile (string ui_file)
-        {
-            Banshee.Base.ThreadAssist.AssertInMainThread ();
-            ui_merge_ids.Add (Actions.AddUiFromFile (ui_file, System.Reflection.Assembly.GetCallingAssembly ()));
-        }
-
-        public void Register ()
-        {
-            if (Actions.FindActionGroup (this.Name) == null) {
-                Actions.AddActionGroup (this);
-            }
-        }
-
-        public void UnRegister ()
-        {
-            if (Actions.FindActionGroup (this.Name) != null) {
-                Actions.RemoveActionGroup (this);
-            }
-        }
-
-        public override void Dispose ()
-        {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
-                UnRegister ();
-
-                foreach (uint merge_id in ui_merge_ids) {
-                    if (merge_id > 0) {
-                        Actions.UIManager.RemoveUi (merge_id);
-                    }
-                }
-                ui_merge_ids.Clear ();
-
-                base.Dispose ();
-            });
-        }
-
-        public new void Add (params ActionEntry [] action_entries)
-        {
-            if (ImportantByDefault) {
-                AddImportant (action_entries);
-            } else {
-                base.Add (action_entries);
-            }
-        }
-        
-        public void AddImportant (params ActionEntry [] action_entries)
-        {
-            base.Add (action_entries);
-            
-            foreach (ActionEntry entry in action_entries) {
-                this[entry.name].IsImportant = true;
-            }
-        }
-
-        public void AddImportant (params ToggleActionEntry [] action_entries)
-        {
-            base.Add (action_entries);
-            
-            foreach (ToggleActionEntry entry in action_entries) {
-                this[entry.name].IsImportant = true;
-            }
-        }
-        
-        public void Remove (string actionName)
-        {
-            Gtk.Action action = this[actionName];
-            if (action != null) {
-                Remove (action);
-            }
-        }
-
-        public void UpdateActions (bool visible, bool sensitive, params string [] action_names)
-        {
-            UpdateActions (visible, sensitive, null, action_names);
-        }
-
         public void UpdateActions (bool visible, bool sensitive, Source source, params string [] action_names)
         {
             foreach (string name in action_names) {
@@ -143,16 +62,6 @@ namespace Banshee.Gui
             }
         }
 
-        public void UpdateAction (string action_name, bool visible_and_sensitive)
-        {
-            UpdateAction (action_name, visible_and_sensitive, visible_and_sensitive);
-        }
-        
-        public void UpdateAction (string action_name, bool visible, bool sensitive)
-        {
-            UpdateAction (action_name, visible, sensitive, null);
-        }
-
         public void UpdateAction (string action_name, bool visible, bool sensitive, Source source)
         {
             Gtk.Action action = this[action_name];
@@ -181,37 +90,6 @@ namespace Banshee.Gui
             }
         }
         
-        public static void UpdateAction (Gtk.Action action, bool visible_and_sensitive)
-        {
-            UpdateAction (action, visible_and_sensitive, visible_and_sensitive);
-        }
-        
-        public static void UpdateAction (Gtk.Action action, bool visible, bool sensitive)
-        {
-            action.Visible = visible;
-            action.Sensitive = visible && sensitive;
-        }
-        
-        protected void ShowContextMenu (string menu_name)
-        {
-            Gtk.Menu menu = Actions.UIManager.GetWidget (menu_name) as Menu;
-            if (menu == null || menu.Children.Length == 0) {
-                return;
-            }
-
-            int visible_children = 0;
-            foreach (Widget child in menu)
-                if (child.Visible)
-                    visible_children++;
-
-            if (visible_children == 0) {
-                return;
-            }
-
-            menu.Show (); 
-            menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
-        }
-        
         public InterfaceActionService Actions {
             get { return action_service; }
         }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
index eb50427..3cad328 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
@@ -30,7 +30,8 @@ using System;
 using Gtk;
 using Mono.Unix;
 
-using Banshee.Base;
+using Hyena;
+
 using Banshee.ServiceStack;
 using Banshee.MediaEngine;
 using Banshee.Collection;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
index d9ef726..db6821c 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
@@ -108,6 +108,7 @@ namespace Banshee.Gui
             Gtk.Window.DefaultIconName = default_icon_name;
 
             ThreadAssist.InitializeMainThread ();
+            ThreadAssist.ProxyToMainHandler = Banshee.ServiceStack.Application.Invoke;
             
             Gdk.Global.ProgramClass = Application.InternalName;
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
index 71633cd..cf4a5c1 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
@@ -43,10 +43,8 @@ using Banshee.ServiceStack;
 
 namespace Banshee.Gui
 {
-    public class InterfaceActionService : IInitializeService
+    public class InterfaceActionService : Hyena.Gui.ActionManager, IInitializeService
     {
-        private UIManager ui_manager;
-        private Dictionary<string, ActionGroup> action_groups = new Dictionary<string, ActionGroup> ();
         private Dictionary<string, ActionGroup> extension_actions = new Dictionary<string, ActionGroup> ();
 
         private GlobalActions   global_actions;
@@ -58,128 +56,34 @@ namespace Banshee.Gui
         private BansheeActionGroup active_source_actions;
         private uint active_source_uiid = 0;
         
-        public InterfaceActionService ()
+        public InterfaceActionService () : base ()
         {
-            ui_manager = new UIManager ();
-
             ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
         }
 
-        public void Initialize ()
+        public override void Initialize ()
         {
             AddActionGroup (global_actions      = new GlobalActions ());
             AddActionGroup (view_actions        = new ViewActions ());
             AddActionGroup (playback_actions    = new PlaybackActions ());
             AddActionGroup (track_actions       = new TrackActions ());
             AddActionGroup (source_actions      = new SourceActions ());
-            ui_manager.AddUiFromResource ("core-ui-actions-layout.xml");
+            UIManager.AddUiFromResource ("core-ui-actions-layout.xml");
 
             AddinManager.AddExtensionNodeHandler ("/Banshee/ThickClient/ActionGroup", OnExtensionChanged);
         }
 
-        private void InnerAddActionGroup (ActionGroup group)
-        {
-            action_groups.Add (group.Name, group);
-            ui_manager.InsertActionGroup (group, 0);
-        }
-
-        public void AddActionGroup (string name)
-        {
-            lock (this) {
-                if (action_groups.ContainsKey (name)) {
-                    throw new ApplicationException ("Group already exists");
-                }
-                
-                InnerAddActionGroup (new ActionGroup (name));
-            }
-        }
-        
-        public void AddActionGroup (ActionGroup group)
-        {
-            lock (this) {
-                if (action_groups.ContainsKey (group.Name)) {
-                    throw new ApplicationException ("Group already exists");
-                }
-                            
-                InnerAddActionGroup (group);
-            }
-        }
-        
-        public void RemoveActionGroup (string name)
-        {
-            lock (this) {
-                if (action_groups.ContainsKey (name)) {
-                    ActionGroup group = action_groups[name];
-                    ui_manager.RemoveActionGroup (group);
-                    action_groups.Remove (name);                    
-                }
-            }
-        }
-
-        public void RemoveActionGroup (ActionGroup group)
-        {
-            RemoveActionGroup (group.Name);
-        }
-        
-        public ActionGroup FindActionGroup (string actionGroupId)
-        {
-            foreach (ActionGroup group in action_groups.Values) {
-                if (group.Name == actionGroupId) {
-                    return group;
-                }
-            }
-            
-            return null;
-        }
-        
-        public Action FindAction (string actionId)
-        {
-            string [] parts = actionId.Split ('.');
-            
-            if (parts == null || parts.Length < 2) {
-                return null;
-            }
-            
-            string group_name = parts[0];
-            string action_name = parts[1];
-            
-            ActionGroup group = FindActionGroup (group_name);
-            return group == null ? null : group.GetAction (action_name);
-        }
-        
-        public void PopulateToolbarPlaceholder (Toolbar toolbar, string path, Widget item)
-        {
-            PopulateToolbarPlaceholder (toolbar, path, item, false);
-        }
-        
-        public void PopulateToolbarPlaceholder (Toolbar toolbar, string path, Widget item, bool expand)
-        {
-            ToolItem placeholder = (ToolItem)UIManager.GetWidget (path);
-            int position = toolbar.GetItemIndex (placeholder);
-            toolbar.Remove (placeholder);
-            
-            if (item is ToolItem) {
-                ((ToolItem)item).Expand = expand;
-                toolbar.Insert ((ToolItem)item, position);
-            } else {
-                ToolItem container_item = new Banshee.Widgets.GenericToolItem<Widget> (item);
-                container_item.Expand = expand;
-                container_item.Show ();
-                toolbar.Insert (container_item, position);
-            }
-        }
-        
         private void OnActiveSourceChanged (SourceEventArgs args)
         {
             // FIXME: Can't use an anonymous delegate here because of compiler
             // bug in Mono 1.2.6
-            Banshee.Base.ThreadAssist.ProxyToMain (OnActiveSourceChangedGui);
+            ThreadAssist.ProxyToMain (OnActiveSourceChangedGui);
         }
 
         private void OnActiveSourceChangedGui ()
         {
             if (active_source_uiid > 0) {
-                ui_manager.RemoveUi (active_source_uiid);
+                UIManager.RemoveUi (active_source_uiid);
                 active_source_uiid = 0;
             }
                 
@@ -231,29 +135,6 @@ namespace Banshee.Gui
             }
         }
 
-        public uint AddUiFromFileInCurrentAssembly (string ui_file)
-        {
-            return AddUiFromFile (ui_file, Assembly.GetCallingAssembly ());
-        }
-        
-        public uint AddUiFromFile (string ui_file, Assembly assembly)
-        {
-            if (ui_file != null) {
-                using (StreamReader reader = new StreamReader (assembly.GetManifestResourceStream (ui_file))) {
-                    return ui_manager.AddUiFromString (reader.ReadToEnd ());
-                }
-            }
-            return 0;
-        }
-        
-        public Action this[string actionId] {
-            get { return FindAction (actionId); }
-        }
-        
-        public UIManager UIManager {
-            get { return ui_manager; }
-        }
-        
         public GlobalActions GlobalActions {
             get { return global_actions; }
         }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
index b0b0a71..64baf2d 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
@@ -135,7 +135,7 @@ namespace Banshee.Gui
 
         private void HandleActiveSourceChanged (SourceEventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 UpdateActions ();
                 
                 if (last_source != null) {
@@ -155,7 +155,7 @@ namespace Banshee.Gui
         
         private void HandleActiveSourceUpdated (object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 UpdateActions (true);
             });
         }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
index ee5d596..d52260f 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
@@ -31,7 +31,8 @@ using System.Collections.Generic;
 using Mono.Unix;
 using Gtk;
 
-using Banshee.Base;
+using Hyena;
+
 using Banshee.Query;
 using Banshee.Sources;
 using Banshee.Library;
@@ -141,7 +142,7 @@ namespace Banshee.Gui
                 current_source = new_source;
             }
             
-            Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions);
+            ThreadAssist.ProxyToMain (UpdateActions);
         }
 
         private void HandleActionsChanged (object sender, EventArgs args)
@@ -156,7 +157,7 @@ namespace Banshee.Gui
 
         private void HandleSelectionChanged (object sender, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 OnSelectionChanged ();
                 UpdateActions ();
             });
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
index 3a05602..838c63e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
@@ -31,6 +31,8 @@ using System.Collections.Generic;
 using Gtk;
 using Glade;
 
+using Hyena;
+
 using Banshee.Sources;
 using Banshee.ServiceStack;
 using Banshee.Gui;
@@ -162,7 +164,7 @@ namespace Banshee.Library.Gui
         private void OnSourceAdded (SourceAddedArgs args)
         {
             if(args.Source is IImportSource) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     AddSource ((IImportSource)args.Source);
                 });
             }
@@ -171,7 +173,7 @@ namespace Banshee.Library.Gui
         private void OnSourceRemoved (SourceEventArgs args)
         {
             if (args.Source is IImportSource) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     TreeIter iter;
                     if (FindSourceIter (out iter, (IImportSource)args.Source)) {
                         source_model.Remove (ref iter);
@@ -183,7 +185,7 @@ namespace Banshee.Library.Gui
         private void OnSourceUpdated (SourceEventArgs args)
         {
             if (args.Source is IImportSource) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     TreeIter iter;
                     if(FindSourceIter (out iter, (IImportSource)args.Source)) {
                         source_model.SetValue (iter, 1, args.Source.Name);
diff --git a/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs b/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs
index be3e79c..d173ff7 100644
--- a/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs
@@ -32,6 +32,8 @@ using Mono.Unix;
 
 using Gtk;
 
+using Hyena;
+
 using Banshee.MediaProfiles;
 using Banshee.Base;
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs b/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
index 969fcda..f1098ba 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
@@ -30,6 +30,8 @@ using System;
 using System.Reflection;
 using Gtk;
 
+using Hyena;
+
 using Banshee.Preferences;
 
 namespace Banshee.Preferences.Gui
@@ -73,7 +75,7 @@ namespace Banshee.Preferences.Gui
                 }
 
                 preference.Changed += delegate (Root pref) {
-                    Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                    ThreadAssist.ProxyToMain (delegate {
                         pref_widget.Sensitive = pref.Sensitive;
                         pref_widget.Visible = pref.Visible;
                         /*if (label != null) {
diff --git a/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs b/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs
index 84694fe..0b22597 100644
--- a/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs
@@ -5,6 +5,7 @@ using Glade;
 
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Query;
 using Hyena.Query.Gui;
  
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/FilteredListSourceContents.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/FilteredListSourceContents.cs
index 0247862..5dbacfd 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/FilteredListSourceContents.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/FilteredListSourceContents.cs
@@ -35,6 +35,7 @@ using System.Collections.Generic;
 using Gtk;
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Data;
 using Hyena.Data.Gui;
 using Hyena.Widgets;
@@ -132,7 +133,7 @@ namespace Banshee.Sources.Gui
             }
             
             ServiceManager.SourceManager.ActiveSourceChanged += delegate {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     browser_container.Visible = ActiveSourceCanHasBrowser ? BrowserVisible.Get () : false;
                 });
             };
@@ -161,7 +162,7 @@ namespace Banshee.Sources.Gui
             ScrolledWindow window = null;
 
             //if (!Banshee.Base.ApplicationContext.CommandLine.Contains ("no-smooth-scroll")) {
-            if (Banshee.Base.ApplicationContext.CommandLine.Contains ("smooth-scroll")) {
+            if (ApplicationContext.CommandLine.Contains ("smooth-scroll")) {
                 window = new SmoothScrolledWindow ();
             } else {
                 window = new ScrolledWindow ();
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
index af29971..f166aa1 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
@@ -29,6 +29,8 @@
 using System;
 using Gtk;
 
+using Hyena;
+
 using Banshee.ServiceStack;
 using Banshee.Sources;
 
@@ -49,11 +51,11 @@ namespace Banshee.Sources.Gui
             Model = store;
             
             ServiceManager.SourceManager.ActiveSourceChanged += delegate { 
-                Banshee.Base.ThreadAssist.ProxyToMain (UpdateActiveSource);
+                ThreadAssist.ProxyToMain (UpdateActiveSource);
             };
             
             ServiceManager.SourceManager.SourceUpdated += delegate {
-                Banshee.Base.ThreadAssist.ProxyToMain (QueueDraw);                    
+                ThreadAssist.ProxyToMain (QueueDraw);                    
             };
             
             store.Refresh ();
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
index 71e5d6c..a81a9e7 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
@@ -30,6 +30,8 @@ using System;
 using System.Collections.Generic;
 using Gtk;
 
+using Hyena;
+
 using Banshee.Sources;
 using Banshee.ServiceStack;
 
@@ -87,14 +89,14 @@ namespace Banshee.Sources.Gui
         
         private void OnSourceAdded (SourceAddedArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 AddSource (args.Source);
             });
         }
         
         private void OnSourceRemoved (SourceEventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 RemoveSource (args.Source);
             });
         }
@@ -269,14 +271,14 @@ namespace Banshee.Sources.Gui
         
         private void OnSourceChildSourceAdded (SourceEventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 AddSource (args.Source, FindSource (args.Source.Parent));
             });
         }
         
         private void OnSourceChildSourceRemoved (SourceEventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 RemoveSource (args.Source);
             });
         }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
index 66961a4..e41e309 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
@@ -33,6 +33,7 @@ using Gtk;
 using Cairo;
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Gui.Theming;
 using Hyena.Gui.Theatrics;
 
@@ -103,11 +104,11 @@ namespace Banshee.Sources.Gui
         private void ConnectEvents ()
         {
             ServiceManager.SourceManager.ActiveSourceChanged += delegate (SourceEventArgs args) {
-                Banshee.Base.ThreadAssist.ProxyToMain (ResetSelection);
+                ThreadAssist.ProxyToMain (ResetSelection);
             };
             
             ServiceManager.SourceManager.SourceUpdated += delegate (SourceEventArgs args) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     lock (args.Source) {
                         TreeIter iter = store.FindSource (args.Source);
                         if (!TreeIter.Zero.Equals (iter)) {
@@ -119,11 +120,11 @@ namespace Banshee.Sources.Gui
             };
             
             ServiceManager.PlaybackController.NextSourceChanged += delegate {
-                Banshee.Base.ThreadAssist.ProxyToMain (QueueDraw);
+                ThreadAssist.ProxyToMain (QueueDraw);
             };
             
             notify_stage.ActorStep += delegate (Actor<TreeIter> actor) {
-                Banshee.Base.ThreadAssist.AssertInMainThread ();
+                ThreadAssist.AssertInMainThread ();
                 if (!store.IterIsValid (actor.Target)) {
                     return false;
                 }
@@ -337,7 +338,7 @@ namespace Banshee.Sources.Gui
         
         private void OnSourceUserNotifyUpdated (object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 TreeIter iter = store.FindSource ((Source)o);
                 if (iter.Equals (TreeIter.Zero)) {
                     return;
diff --git a/src/Core/Banshee.Widgets/Makefile.am b/src/Core/Banshee.Widgets/Makefile.am
index 185fb50..756b2c5 100644
--- a/src/Core/Banshee.Widgets/Makefile.am
+++ b/src/Core/Banshee.Widgets/Makefile.am
@@ -7,7 +7,6 @@ SOURCES =  \
 	Banshee.Widgets/DateButton.cs \
 	Banshee.Widgets/DictionaryComboBox.cs \
 	Banshee.Widgets/DiscUsageDisplay.cs \
-	Banshee.Widgets/GenericToolItem.cs \
 	Banshee.Widgets/HigMessageDialog.cs \
 	Banshee.Widgets/HoverImageButton.cs \
 	Banshee.Widgets/LinearProgress.cs \
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapActions.cs b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapActions.cs
index dc696b9..6840544 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapActions.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapActions.cs
@@ -30,6 +30,8 @@ using System;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
+
 using Banshee.Dap;
 using Banshee.Gui;
 using Banshee.ServiceStack;
@@ -76,7 +78,7 @@ namespace Banshee.Dap.Gui
 
         private void OnSyncUpdated (DapSync sync)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions);
+            ThreadAssist.ProxyToMain (UpdateActions);
         }
 
         private void UpdateActions ()
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
index d379274..c729704 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
@@ -30,6 +30,7 @@ using System;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
 using Hyena.Gui;
 using Hyena.Widgets;
 
@@ -99,7 +100,7 @@ namespace Banshee.Dap.Gui
         
         private void OnSourceUpdated (object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 try {
                     UpdateUsage ();
                 } catch (Exception e) {
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs b/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
index a3ab143..6327bc9 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
@@ -199,7 +199,7 @@ namespace Banshee.Dap
         internal void Sync ()
         {
             if (Enabled) {
-                Banshee.Base.ThreadAssist.AssertNotInMainThread ();
+                ThreadAssist.AssertNotInMainThread ();
 
                 CalculateSync ();
 
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs b/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
index 2293e79..689490b 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
@@ -272,8 +272,8 @@ namespace Banshee.Dap
 
         public void Sync ()
         {
-            if (Banshee.Base.ThreadAssist.InMainThread) {
-                Banshee.Base.ThreadAssist.SpawnFromMain (delegate {
+            if (ThreadAssist.InMainThread) {
+                ThreadAssist.SpawnFromMain (delegate {
                     sync_limiter.Execute ();
                 });
             } else {
diff --git a/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs b/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
index 21a0605..ebb0a03 100644
--- a/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
+++ b/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using Gtk;
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Data.Sqlite;
 
 using Banshee.Base;
@@ -12,7 +13,6 @@ using Banshee.Collection.Database;
 using Banshee.MediaEngine;
 using Banshee.Gui;
 using Banshee.ServiceStack;
-using Hyena;
 
 namespace Banshee.Bookmarks
 {
@@ -151,7 +151,7 @@ namespace Banshee.Bookmarks
             ImageMenuItem select_item = new ImageMenuItem(bookmark.Name.Replace("_", "__"));
             select_item.Image = new Image(Stock.JumpTo, IconSize.Menu);
             select_item.Activated += delegate {
-                Console.WriteLine ("item delegate, main thread? {0}", Banshee.Base.ThreadAssist.InMainThread);
+                Console.WriteLine ("item delegate, main thread? {0}", ThreadAssist.InMainThread);
                 bookmark.JumpTo();
             };
             bookmark_menu.Append(select_item);
@@ -235,7 +235,7 @@ namespace Banshee.Bookmarks
 
         public Bookmark(int track_id, uint position)
         {
-            Console.WriteLine ("Bookmark, main thread? {0}", Banshee.Base.ThreadAssist.InMainThread);
+            Console.WriteLine ("Bookmark, main thread? {0}", ThreadAssist.InMainThread);
             this.track_id = track_id;
             this.position = position;
             this.created_at = DateTime.Now;
diff --git a/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs b/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs
index 1e57654..3a8258d 100644
--- a/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs
+++ b/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs
@@ -32,6 +32,8 @@ using System.Data;
 using Gtk;
 using Mono.Unix;
 
+using Hyena;
+
 using Banshee.Base;
 using Banshee.Collection;
 using Banshee.Collection.Database;
@@ -43,7 +45,6 @@ using Banshee.Library;
 using Banshee.Metadata;
 using Banshee.Networking;
 using Banshee.Sources;
-using Hyena;
 
 namespace Banshee.CoverArt
 {
@@ -98,7 +99,7 @@ namespace Banshee.CoverArt
         
         private void Initialize ()
         {            
-            Banshee.Base.ThreadAssist.AssertInMainThread ();
+            ThreadAssist.AssertInMainThread ();
             actions = new ActionGroup ("CoverArt");
             
             ActionEntry[] action_list = new ActionEntry [] {
@@ -125,7 +126,7 @@ namespace Banshee.CoverArt
                 return;
             }
 
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 Gtk.Action fetch_action = action_service.GlobalActions["FetchCoverArtAction"];
                 if (fetch_action != null) {
                     action_service.GlobalActions.Remove (fetch_action);
diff --git a/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs b/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
index 1bdd59c..2fff7ce 100644
--- a/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
+++ b/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
@@ -31,7 +31,8 @@ using System.Collections.Generic;
 using Mono.Unix;
 using Daap;
 
-using Banshee.Base;
+using Hyena;
+
 using Banshee.Collection;
 using Banshee.Sources;
 using Banshee.ServiceStack;
diff --git a/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs b/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
index e81e6f7..aeab42d 100644
--- a/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
+++ b/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
@@ -89,7 +89,7 @@ namespace Banshee.FileSystemQueue
             actions_loaded = true;
             
             UpdateActions ();
-            ServiceManager.SourceManager.ActiveSourceChanged += delegate { Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions); };
+            ServiceManager.SourceManager.ActiveSourceChanged += delegate { ThreadAssist.ProxyToMain (UpdateActions); };
             TrackModel.Reloaded += OnTrackModelReloaded;
             
             Reload ();
@@ -140,7 +140,7 @@ namespace Banshee.FileSystemQueue
 
                     importer.Finished += delegate {
                         if (visible) {
-                            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                            ThreadAssist.ProxyToMain (delegate {
                                 TrackInfo current_track = ServiceManager.PlaybackController.CurrentTrack;
                                 // Don't switch to FSQ if the current item is a video
                                 if (current_track == null || !current_track.HasAttribute (TrackMediaAttributes.VideoStream)) {
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
index e43b89f..f78e91b 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
@@ -5,6 +5,8 @@ using System.Collections.Generic;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
+
 using Banshee.Widgets;
 using Banshee.Sources;
 using Banshee.ServiceStack;
@@ -146,7 +148,7 @@ namespace Banshee.Lastfm.Radio
         private void HandleConnectionStateChanged (object sender, ConnectionStateChangedArgs args)
         {
             if (args.State == ConnectionState.Connected) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     if (lastfm != null && lastfm.Account != null) {
                         UpdateForUser (lastfm.Account.UserName);
                     }
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmTrackInfo.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmTrackInfo.cs
index 44e22e7..85ef2c2 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmTrackInfo.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmTrackInfo.cs
@@ -33,6 +33,8 @@ using System.Web;
 
 using Gdk;
 
+using Hyena;
+
 using Banshee.Base;
 using Banshee.Collection;
 using Media.Playlists.Xspf;
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationEditor.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationEditor.cs
index 0533a66..e3aa434 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationEditor.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationEditor.cs
@@ -32,7 +32,8 @@ using Gtk;
 using Glade;
 using Mono.Unix;
 
-using Banshee.Base;
+using Hyena;
+
 using Banshee.Sources;
 using Banshee.Database;
 
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
index a2c2961..8c846f5 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
@@ -269,7 +269,7 @@ namespace Banshee.Lastfm.Recommendations
         private void UpdateForArtist (string artist_name, LastfmData<SimilarArtist> similar_artists, 
             LastfmData<ArtistTopAlbum> top_albums, LastfmData<ArtistTopTrack> top_tracks)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 album_box.Title = String.Format (album_title_format, artist);
                 track_box.Title = String.Format (track_title_format, artist);
                 
diff --git a/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs b/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs
index aa37df8..46450fb 100644
--- a/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs
+++ b/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs
@@ -30,6 +30,8 @@
 using System;
 using Gtk;
 
+using Hyena;
+
 using Banshee.ServiceStack;
 using Banshee.Sources;
 using Banshee.Sources.Gui;
@@ -92,7 +94,7 @@ namespace Banshee.MiniMode
             }
 
             source.ChildSourceAdded += delegate (SourceEventArgs e) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+                ThreadAssist.ProxyToMain (delegate {
                     AddSource(e.Source, AppendNode(iter));
                 });
             };
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueActions.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueActions.cs
index 0b655c1..6f9cb86 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueActions.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueActions.cs
@@ -29,9 +29,10 @@
 using System;
 
 using Mono.Unix;
-
 using Gtk;
 
+using Hyena;
+
 using Banshee.ServiceStack;
 using Banshee.Sources;
 
@@ -109,7 +110,7 @@ namespace Banshee.PlayQueue
 
         private void OnUpdated (object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (UpdateActions);
+            ThreadAssist.ProxyToMain (UpdateActions);
         }
 
         private void UpdateActions ()
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
index 1a137e1..0562046 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
 using Mono.Unix;
 using Gtk;
 
+using Hyena;
 using Migo.Syndication;
 
 using Banshee.Base;
@@ -198,7 +199,7 @@ namespace Banshee.Podcasting.Gui
 
         private void OnSelectionChanged (object o, EventArgs args)
         {
-            Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+            ThreadAssist.ProxyToMain (delegate {
                 UpdateFeedActions ();
                 UpdateItemActions ();
             });
diff --git a/src/Libraries/Hyena.Gui/Hyena.Gui/ActionManager.cs b/src/Libraries/Hyena.Gui/Hyena.Gui/ActionManager.cs
new file mode 100644
index 0000000..1d65bcc
--- /dev/null
+++ b/src/Libraries/Hyena.Gui/Hyena.Gui/ActionManager.cs
@@ -0,0 +1,170 @@
+//
+// ActionManager.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-2007 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.IO;
+using System.Reflection;
+using System.Collections.Generic;
+
+using Gtk;
+using Action = Gtk.Action;
+
+using Hyena;
+
+namespace Hyena.Gui
+{
+    public class ActionManager
+    {
+        private UIManager ui_manager;
+        private Dictionary<string, ActionGroup> action_groups = new Dictionary<string, ActionGroup> ();
+
+        public ActionManager ()
+        {
+            ui_manager = new UIManager ();
+        }
+
+        public virtual void Initialize ()
+        {
+        }
+
+        private void InnerAddActionGroup (ActionGroup group)
+        {
+            action_groups.Add (group.Name, group);
+            ui_manager.InsertActionGroup (group, 0);
+        }
+
+        public void AddActionGroup (string name)
+        {
+            lock (this) {
+                if (action_groups.ContainsKey (name)) {
+                    throw new ApplicationException ("Group already exists");
+                }
+                
+                InnerAddActionGroup (new ActionGroup (name));
+            }
+        }
+        
+        public void AddActionGroup (ActionGroup group)
+        {
+            lock (this) {
+                if (action_groups.ContainsKey (group.Name)) {
+                    throw new ApplicationException ("Group already exists");
+                }
+                            
+                InnerAddActionGroup (group);
+            }
+        }
+        
+        public void RemoveActionGroup (string name)
+        {
+            lock (this) {
+                if (action_groups.ContainsKey (name)) {
+                    ActionGroup group = action_groups[name];
+                    ui_manager.RemoveActionGroup (group);
+                    action_groups.Remove (name);                    
+                }
+            }
+        }
+
+        public void RemoveActionGroup (ActionGroup group)
+        {
+            RemoveActionGroup (group.Name);
+        }
+        
+        public ActionGroup FindActionGroup (string actionGroupId)
+        {
+            foreach (ActionGroup group in action_groups.Values) {
+                if (group.Name == actionGroupId) {
+                    return group;
+                }
+            }
+            
+            return null;
+        }
+        
+        public Gtk.Action FindAction (string actionId)
+        {
+            string [] parts = actionId.Split ('.');
+            
+            if (parts == null || parts.Length < 2) {
+                return null;
+            }
+            
+            string group_name = parts[0];
+            string action_name = parts[1];
+            
+            ActionGroup group = FindActionGroup (group_name);
+            return group == null ? null : group.GetAction (action_name);
+        }
+        
+        public void PopulateToolbarPlaceholder (Toolbar toolbar, string path, Widget item)
+        {
+            PopulateToolbarPlaceholder (toolbar, path, item, false);
+        }
+        
+        public void PopulateToolbarPlaceholder (Toolbar toolbar, string path, Widget item, bool expand)
+        {
+            ToolItem placeholder = (ToolItem)UIManager.GetWidget (path);
+            int position = toolbar.GetItemIndex (placeholder);
+            toolbar.Remove (placeholder);
+            
+            if (item is ToolItem) {
+                ((ToolItem)item).Expand = expand;
+                toolbar.Insert ((ToolItem)item, position);
+            } else {
+                ToolItem container_item = new Hyena.Widgets.GenericToolItem<Widget> (item);
+                container_item.Expand = expand;
+                container_item.Show ();
+                toolbar.Insert (container_item, position);
+            }
+        }
+        
+        public uint AddUiFromFileInCurrentAssembly (string ui_file)
+        {
+            return AddUiFromFile (ui_file, Assembly.GetCallingAssembly ());
+        }
+        
+        public uint AddUiFromFile (string ui_file, Assembly assembly)
+        {
+            if (ui_file != null) {
+                using (StreamReader reader = new StreamReader (assembly.GetManifestResourceStream (ui_file))) {
+                    return ui_manager.AddUiFromString (reader.ReadToEnd ());
+                }
+            }
+            return 0;
+        }
+        
+        public Gtk.Action this[string actionId] {
+            get { return FindAction (actionId); }
+        }
+        
+        public UIManager UIManager {
+            get { return ui_manager; }
+        }
+    }
+}
diff --git a/src/Libraries/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs b/src/Libraries/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs
new file mode 100644
index 0000000..fbbd6e2
--- /dev/null
+++ b/src/Libraries/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs
@@ -0,0 +1,175 @@
+//
+// HyenaActionGroup.cs
+//
+// Author:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2007 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;
+
+namespace Hyena.Gui
+{
+    public class HyenaActionGroup : ActionGroup
+    {
+        private List<uint> ui_merge_ids = new List<uint> ();
+        private ActionManager action_manager;
+
+        private bool important_by_default = true;
+        protected bool ImportantByDefault {
+            get { return important_by_default; }
+            set { important_by_default = value; }
+        }
+
+        public HyenaActionGroup (ActionManager action_manager, string name) : base (name)
+        {
+            this.action_manager = action_manager;
+        }
+        
+        public void AddUiFromFile (string ui_file)
+        {
+            Hyena.ThreadAssist.AssertInMainThread ();
+            ui_merge_ids.Add (ActionManager.AddUiFromFile (ui_file, System.Reflection.Assembly.GetCallingAssembly ()));
+        }
+
+        public void Register ()
+        {
+            if (ActionManager.FindActionGroup (this.Name) == null) {
+                ActionManager.AddActionGroup (this);
+            }
+        }
+
+        public void UnRegister ()
+        {
+            if (ActionManager.FindActionGroup (this.Name) != null) {
+                ActionManager.RemoveActionGroup (this);
+            }
+        }
+
+        public override void Dispose ()
+        {
+            Hyena.ThreadAssist.ProxyToMain (delegate {
+                UnRegister ();
+
+                foreach (uint merge_id in ui_merge_ids) {
+                    if (merge_id > 0) {
+                        ActionManager.UIManager.RemoveUi (merge_id);
+                    }
+                }
+                ui_merge_ids.Clear ();
+
+                base.Dispose ();
+            });
+        }
+
+        public new void Add (params ActionEntry [] action_entries)
+        {
+            if (ImportantByDefault) {
+                AddImportant (action_entries);
+            } else {
+                base.Add (action_entries);
+            }
+        }
+        
+        public void AddImportant (params ActionEntry [] action_entries)
+        {
+            base.Add (action_entries);
+            
+            foreach (ActionEntry entry in action_entries) {
+                this[entry.name].IsImportant = true;
+            }
+        }
+
+        public void AddImportant (params ToggleActionEntry [] action_entries)
+        {
+            base.Add (action_entries);
+            
+            foreach (ToggleActionEntry entry in action_entries) {
+                this[entry.name].IsImportant = true;
+            }
+        }
+        
+        public void Remove (string actionName)
+        {
+            Gtk.Action action = this[actionName];
+            if (action != null) {
+                Remove (action);
+            }
+        }
+
+        public void UpdateActions (bool visible, bool sensitive, params string [] action_names)
+        {
+            foreach (string name in action_names) {
+                UpdateAction (this[name], visible, sensitive);
+            }
+        }
+
+        public void UpdateAction (string action_name, bool visible_and_sensitive)
+        {
+            UpdateAction (this[action_name], visible_and_sensitive, visible_and_sensitive);
+        }
+        
+        public void UpdateAction (string action_name, bool visible, bool sensitive)
+        {
+            UpdateAction (this[action_name], visible, sensitive);
+        }
+
+        public static void UpdateAction (Gtk.Action action, bool visible_and_sensitive)
+        {
+            UpdateAction (action, visible_and_sensitive, visible_and_sensitive);
+        }
+        
+        public static void UpdateAction (Gtk.Action action, bool visible, bool sensitive)
+        {
+            action.Visible = visible;
+            action.Sensitive = visible && sensitive;
+        }
+        
+        protected void ShowContextMenu (string menu_name)
+        {
+            Gtk.Menu menu = ActionManager.UIManager.GetWidget (menu_name) as Menu;
+            if (menu == null || menu.Children.Length == 0) {
+                return;
+            }
+
+            int visible_children = 0;
+            foreach (Widget child in menu)
+                if (child.Visible)
+                    visible_children++;
+
+            if (visible_children == 0) {
+                return;
+            }
+
+            menu.Show (); 
+            menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
+        }
+        
+        public ActionManager ActionManager {
+            get { return action_manager; }
+        }
+    }
+}
diff --git a/src/Libraries/Hyena.Gui/Hyena.Widgets/GenericToolItem.cs b/src/Libraries/Hyena.Gui/Hyena.Widgets/GenericToolItem.cs
new file mode 100644
index 0000000..c89ad25
--- /dev/null
+++ b/src/Libraries/Hyena.Gui/Hyena.Widgets/GenericToolItem.cs
@@ -0,0 +1,48 @@
+//
+// GenericToolItem.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-2007 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 Gtk;
+
+namespace Hyena.Widgets
+{
+    public class GenericToolItem<T> : ToolItem where T : Widget
+    {
+        private T widget;
+        
+        public GenericToolItem (T widget)
+        {
+            this.widget = widget;
+            Add (widget);
+        }
+        
+        public T Widget {
+            get { return widget; }
+        }
+    }
+}
diff --git a/src/Libraries/Hyena.Gui/Makefile.am b/src/Libraries/Hyena.Gui/Makefile.am
index b17a50d..634ef20 100644
--- a/src/Libraries/Hyena.Gui/Makefile.am
+++ b/src/Libraries/Hyena.Gui/Makefile.am
@@ -46,6 +46,8 @@ SOURCES =  \
 	Hyena.Gui/CleanRoomStartup.cs \
 	Hyena.Gui/CompositeUtils.cs \
 	Hyena.Gui/Contrast.cs \
+	Hyena.Gui/ActionManager.cs \
+	Hyena.Gui/HyenaActionGroup.cs \
 	Hyena.Gui/EditableEraseAction.cs \
 	Hyena.Gui/EditableInsertAction.cs \
 	Hyena.Gui/EditableUndoAdapter.cs \
@@ -77,6 +79,7 @@ SOURCES =  \
 	Hyena.Widgets/AnimatedVBox.cs \
 	Hyena.Widgets/AnimatedWidget.cs \
 	Hyena.Widgets/ComplexMenuItem.cs \
+	Hyena.Widgets/GenericToolItem.cs \
 	Hyena.Widgets/ImageButton.cs \
 	Hyena.Widgets/MenuButton.cs \
 	Hyena.Widgets/MessageBar.cs \
diff --git a/src/Libraries/Hyena/Hyena/ApplicationContext.cs b/src/Libraries/Hyena/Hyena/ApplicationContext.cs
new file mode 100644
index 0000000..0cab32b
--- /dev/null
+++ b/src/Libraries/Hyena/Hyena/ApplicationContext.cs
@@ -0,0 +1,78 @@
+//
+// ApplicationContext.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2007 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.CommandLine;
+
+namespace Hyena
+{
+    public delegate void InvokeHandler ();
+
+    public static class ApplicationContext
+    {
+        static ApplicationContext () 
+        {
+            Log.Debugging = Debugging;
+        }
+    
+        private static CommandLineParser command_line = new CommandLineParser ();
+        public static CommandLineParser CommandLine {
+            set { command_line = value; }
+            get { return command_line; }
+        }
+        
+        private static Layout command_line_layout;
+        public static Layout CommandLineLayout {
+            get { return command_line_layout; }
+            set { command_line_layout = value; }
+        }
+        
+        private static bool? debugging = null;
+        public static bool Debugging {
+            get {
+                if (debugging == null) {
+                    debugging = CommandLine.Contains ("debug");
+                    debugging |= CommandLine.Contains ("debug-sql");
+                    debugging |= EnvironmentIsSet ("BANSHEE_DEBUG");
+                }
+                
+                return debugging.Value;
+            }
+        }
+        
+        public static bool EnvironmentIsSet (string env)
+        {
+            return !String.IsNullOrEmpty (Environment.GetEnvironmentVariable (env));
+        }
+        
+        public static System.Globalization.CultureInfo InternalCultureInfo {
+            get { return System.Globalization.CultureInfo.InvariantCulture; }
+        }
+    }
+}
diff --git a/src/Libraries/Hyena/Hyena/ThreadAssist.cs b/src/Libraries/Hyena/Hyena/ThreadAssist.cs
new file mode 100644
index 0000000..93e393a
--- /dev/null
+++ b/src/Libraries/Hyena/Hyena/ThreadAssist.cs
@@ -0,0 +1,110 @@
+//
+// ThreadAssist.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2005-2009 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.Threading;
+
+namespace Hyena
+{
+    public static class ThreadAssist
+    {
+        private static Thread main_thread;
+
+        public static Thread MainThread {
+            get { return main_thread; }
+        }
+
+        public static Action<InvokeHandler> ProxyToMainHandler { get; set; }
+        
+        public static void InitializeMainThread ()
+        {
+            main_thread = Thread.CurrentThread;
+            main_thread.Name = "Main Thread";
+        }
+        
+        public static bool InMainThread {
+            get {
+                if (main_thread == null) {
+                    throw new ApplicationException ("ThreadAssist.InitializeMainThread must be called first");
+                }
+ 
+                return main_thread.Equals (Thread.CurrentThread); 
+            }
+        }
+
+        public static void AssertNotInMainThread ()
+        {
+            if (ApplicationContext.Debugging && InMainThread) {
+                Hyena.Log.Warning ("In GUI thread, will probably block it", System.Environment.StackTrace);
+            }
+        }
+        
+        public static void AssertInMainThread ()
+        {
+            if (ApplicationContext.Debugging && !InMainThread) {
+                Hyena.Log.Warning ("Not in main thread!", System.Environment.StackTrace);
+            }
+        }
+        
+        public static void ProxyToMain (InvokeHandler handler)
+        {
+            if (!InMainThread) {
+                //Banshee.ServiceStack.Application.Invoke (handler);
+                ProxyToMainHandler (handler);
+            } else {
+                handler ();
+            }
+        }
+
+        public static void SpawnFromMain (ThreadStart threadedMethod)
+        {
+            if (InMainThread) {
+                Spawn (threadedMethod, true);
+            } else {
+                threadedMethod ();
+            }
+        }
+        
+        public static Thread Spawn (ThreadStart threadedMethod, bool autoStart)
+        {
+            Thread thread = new Thread (threadedMethod);
+            thread.Name = String.Format ("Spawned: {0}", threadedMethod);
+            thread.IsBackground = true;
+            if (autoStart) {
+                thread.Start ();
+            }
+            return thread;
+        }
+        
+        public static Thread Spawn (ThreadStart threadedMethod)
+        {
+            return Spawn (threadedMethod, true);
+        }
+    }
+}
diff --git a/src/Libraries/Hyena/Makefile.am b/src/Libraries/Hyena/Makefile.am
index a1250f0..087bec0 100644
--- a/src/Libraries/Hyena/Makefile.am
+++ b/src/Libraries/Hyena/Makefile.am
@@ -105,6 +105,7 @@ SOURCES =  \
 	Hyena.SExpEngine/StringFunctionSet.cs \
 	Hyena.SExpEngine/TreeNode.cs \
 	Hyena.SExpEngine/UtilityFunctionSet.cs \
+	Hyena/ApplicationContext.cs \
 	Hyena/ConsoleCrayon.cs \
 	Hyena/CryptoUtil.cs \
 	Hyena/DateTimeUtil.cs \
@@ -113,6 +114,7 @@ SOURCES =  \
 	Hyena/Log.cs \
 	Hyena/PlatformUtil.cs \
 	Hyena/StringUtil.cs \
+	Hyena/ThreadAssist.cs \
 	Hyena/Tests/CryptoUtilTests.cs \
 	Hyena/Tests/StringUtilTests.cs \
 	Hyena/Tests/TestBase.cs \



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