banshee r3642 - in trunk/banshee: . build src/Backends/Banshee.GStreamer src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions src/Extensions/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Resources



Author: abock
Date: Wed Apr  2 00:44:55 2008
New Revision: 3642
URL: http://svn.gnome.org/viewvc/banshee?rev=3642&view=rev

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

    * src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml:
    * src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs:
    Stub an implementation of IAudioCdRipper and expose it as an extension

    * src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs:
    Interface for implementing an audio CD ripping engine

    * src/Core/Banshee.Services/Banshee.Services.addin.xml:
    * src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs:
    Added the AudioCdRipper extension point, rename the PlayerEngine extenion
    point so that there is a common parent node in the path

    * src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs:
    Log extension exceptions

    * src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs:
    Make AddResourceToIconSet public

    * src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs:
    Stubbed an implementation of the AudioCdRipper (engine agnostic)

    * src/Extensions/Banshee.AudioCd/Resources/ActiveSourceUI.xml:
    * src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml:
    * src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
    Implement the UI actions for duplicating and ripping CDs



Added:
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs
   trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs
   trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/
   trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/ActiveSourceUI.xml
   trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml
   trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/cd-action-rip-16.png   (contents, props changed)
   trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/cd-action-rip-22.png   (contents, props changed)
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp
   trunk/banshee/src/Backends/Banshee.GStreamer/Makefile.am
   trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs
   trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp
   trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
   trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am
   trunk/banshee/src/Extensions/Extensions.mds

Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk	(original)
+++ trunk/banshee/build/build.environment.mk	Wed Apr  2 00:44:55 2008
@@ -126,7 +126,7 @@
 REF_BACKEND_HAL = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_DBUS)
 
 # Extensions
-REF_EXTENSION_AUDIOCD = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_MUSICBRAINZ_DEPS)
+REF_EXTENSION_AUDIOCD = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MUSICBRAINZ_DEPS)
 REF_EXTENSION_BOOKMARKS = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_DAAP = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_ICSHARP_ZIP_LIB) $(LINK_MONO_ZEROCONF)
 REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml	Wed Apr  2 00:44:55 2008
@@ -8,8 +8,12 @@
     <Service class="Banshee.GStreamer.Service"/>
   </Extension>
   
-  <Extension path="/Banshee/PlayerEngines/PlayerEngine">
+  <Extension path="/Banshee/MediaEngine/PlayerEngine">
     <PlayerEngine class="Banshee.GStreamer.PlayerEngine"/>
   </Extension>
+  
+  <Extension path="/Banshee/MediaEngine/AudioCdRipper">
+    <AudioCdRipper class="Banshee.GStreamer.AudioCdRipper"/>
+  </Extension>
 
 </Addin>

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp	Wed Apr  2 00:44:55 2008
@@ -12,6 +12,7 @@
     <File name="Banshee.GStreamer.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Banshee.GStreamer/GstErrors.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.GStreamer/Service.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.GStreamer/AudioCdRipper.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />

Added: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs	Wed Apr  2 00:44:55 2008
@@ -0,0 +1,56 @@
+//
+// AudioCdRipper.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 Banshee.Base;
+using Banshee.Collection;
+using Banshee.MediaEngine;
+
+namespace Banshee.GStreamer
+{
+    public class AudioCdRipper : IAudioCdRipper
+    {
+        public void Begin ()
+        {
+        }
+        
+        public void Finish ()
+        {
+        }
+        
+        public void Cancel ()
+        {
+        }
+        
+        public bool RipTrack (TrackInfo track, SafeUri outputUri)
+        {
+            return false;
+        }
+    }
+}

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Makefile.am	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Makefile.am	Wed Apr  2 00:44:55 2008
@@ -2,6 +2,7 @@
 TARGET = library
 LINK = $(REF_BACKEND_GSTREAMER)
 SOURCES =  \
+	Banshee.GStreamer/AudioCdRipper.cs \
 	Banshee.GStreamer/GstErrors.cs \
 	Banshee.GStreamer/PlayerEngine.cs \
 	Banshee.GStreamer/Service.cs

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IAudioCdRipper.cs	Wed Apr  2 00:44:55 2008
@@ -0,0 +1,44 @@
+//
+// IAudioCdRipper.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 Banshee.Base;
+using Banshee.Collection;
+
+namespace Banshee.MediaEngine
+{
+    public interface IAudioCdRipper
+    {
+        void Begin ();
+        void Finish ();
+        void Cancel ();
+        
+        bool RipTrack (TrackInfo track, SafeUri outputUri);
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs	Wed Apr  2 00:44:55 2008
@@ -82,7 +82,7 @@
                 default_engine = engines[0];
             }
             
-            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/PlayerEngines/PlayerEngine")) {
+            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/MediaEngine/PlayerEngine")) {
                 LoadEngine (node);
             }
             

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Wed Apr  2 00:44:55 2008
@@ -145,6 +145,7 @@
                             dispose_services.Push (service);
                         }
                     } catch (Exception e) {
+                        Log.Exception (e.InnerException ?? e);
                         Log.Warning (String.Format ("Extension `{0}' not started: {1}", 
                             service == null ? node.Path : service.GetType ().FullName, e.Message));
                     }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml	Wed Apr  2 00:44:55 2008
@@ -12,9 +12,13 @@
     <ExtensionNode name="ImportSource"/>
   </ExtensionPoint>
 
-  <ExtensionPoint path="/Banshee/PlayerEngines/PlayerEngine">
+  <ExtensionPoint path="/Banshee/MediaEngine/PlayerEngine">
     <ExtensionNode name="PlayerEngine"/>
   </ExtensionPoint>
+  
+  <ExtensionPoint path="/Banshee/MediaEngine/AudioCdRipper">
+    <ExtensionNode name="AudioCdRipper"/>
+  </ExtensionPoint>
 
   <ExtensionPoint path="/Banshee/Platform/HardwareManager">
     <ExtensionNode name="HardwareManager"/>

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	Wed Apr  2 00:44:55 2008
@@ -141,6 +141,7 @@
     <File name="Banshee.Hardware/IDiskDevice.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Hardware/IDiscVolume.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Collection/MemoryTrackListModel.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.MediaEngine/IAudioCdRipper.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/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am	Wed Apr  2 00:44:55 2008
@@ -52,6 +52,7 @@
 	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/NullPlayerEngine.cs \

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs	Wed Apr  2 00:44:55 2008
@@ -71,7 +71,7 @@
             Initialize ();
         }
         
-        private void AddResourceToIconSet (Assembly asm, string stockId, int size, 
+        public void AddResourceToIconSet (Assembly asm, string stockId, int size, 
             IconSize iconSize, IconSet iconSet)
         {
             string resource_name = stockId + "-" + size.ToString () + ".png";

Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp	Wed Apr  2 00:44:55 2008
@@ -13,6 +13,11 @@
     <File name="Banshee.AudioCd/AudioCdSource.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.AudioCd/AudioCdDiscModel.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.AudioCd/AudioCdTrackInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.AudioCd/AudioCdRipper.cs" subtype="Code" buildaction="Compile" />
+    <File name="Resources/ActiveSourceUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/cd-action-rip-16.png" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/cd-action-rip-22.png" subtype="Code" buildaction="EmbedAsResource" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
@@ -20,6 +25,9 @@
     <ProjectReference type="Project" localcopy="True" refto="Hyena" />
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Project" localcopy="True" refto="MusicBrainz" />
+    <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
+    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
   </References>
   <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
     <BuildFilesVar Sync="True" Name="SOURCES" />

Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdRipper.cs	Wed Apr  2 00:44:55 2008
@@ -0,0 +1,65 @@
+//
+// AudioCdRipper.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 Mono.Addins;
+
+using Banshee.Base;
+using Banshee.Collection;
+using Banshee.MediaEngine;
+
+namespace Banshee.AudioCd
+{
+    public class AudioCdRipper
+    {
+        private static bool ripper_extension_queried = false;
+        private static TypeExtensionNode ripper_extension_node = null;
+        
+        public static bool Supported {
+            get { 
+                if (ripper_extension_queried) {
+                    return ripper_extension_node != null;
+                }
+                
+                ripper_extension_queried = true;
+                
+                foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (
+                    "/Banshee/MediaEngine/AudioCdRipper")) {
+                    ripper_extension_node = node;
+                    break;
+                }
+                
+                return ripper_extension_node != null;
+            }
+        }
+        
+        public AudioCdRipper (AudioCdSource source)
+        {
+        }
+    }
+}

Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs	Wed Apr  2 00:44:55 2008
@@ -36,6 +36,9 @@
 using Banshee.Sources;
 using Banshee.Collection;
 
+using Gtk;
+using Banshee.Gui;
+
 namespace Banshee.AudioCd
 {
     public class AudioCdSource : Source, ITrackModelSource, IUnmapableSource, IDurationAggregator, IDisposable
@@ -54,9 +57,7 @@
             disc_model.MetadataQueryFinished += OnMetadataQueryFinished;
             disc_model.LoadModelFromDisc ();
             
-            Properties.SetStringList ("Icon.Name", "media-cdrom", "gnome-dev-cdrom-audio", "source-cd-audio");
-            Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Eject Disc"));
-            Properties.SetString ("UnmapSourceActionIconName", "media-eject");
+            SetupGui ();
         }
         
         public TimeSpan Duration {
@@ -134,6 +135,16 @@
             }
         }
 
+        private void OnImportDisc (object o, EventArgs args)
+        {
+            Hyena.Log.Information ("This feature is not implemented yet.", true);
+        }
+
+        private void OnDuplicateDisc (object o, EventArgs args)
+        {
+            Hyena.Log.Information ("This feature is not implemented yet.", true);
+        }
+
 #region Source Overrides
 
         protected override string TypeUniqueId {
@@ -257,5 +268,88 @@
 
 #endregion
 
+#region GUI/ThickClient
+
+        private bool actions_loaded = false;
+        private static bool stock_icons_registered = false;
+
+        private void SetupGui ()
+        {                                       
+            Properties.SetStringList ("Icon.Name", "media-cdrom", "gnome-dev-cdrom-audio", "source-cd-audio");
+            Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Eject Disc"));
+            Properties.SetString ("UnmapSourceActionIconName", "media-eject");
+            
+            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
+            uia_service.GlobalActions.AddImportant (new ActionEntry [] {
+                new ActionEntry ("RipDiscAction", null,
+                    Catalog.GetString ("Import CD"), null,
+                    Catalog.GetString ("Import this audio CD to the library"),
+                    OnImportDisc)
+            });
+            
+            uia_service.GlobalActions.AddImportant (
+                new ActionEntry ("DuplicateDiscAction", null,
+                    Catalog.GetString ("Duplicate CD"), null,
+                    Catalog.GetString ("Duplicate this audio CD"),
+                    OnDuplicateDisc)
+            );
+            
+            uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+            
+            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
+            Properties.SetString ("GtkActionPath", "/AudioCdContextMenu");
+            
+            actions_loaded = true;
+            
+            if (!stock_icons_registered) {
+                GtkElementsService gtk_service = ServiceManager.Get<GtkElementsService> ();
+                System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly ();
+                Gtk.IconSet icon_set = new Gtk.IconSet ();
+                gtk_service.IconFactory.AddResourceToIconSet (asm, "cd-action-rip", 16, IconSize.Menu, icon_set);
+                gtk_service.IconFactory.AddResourceToIconSet (asm, "cd-action-rip", 22, IconSize.SmallToolbar, icon_set);
+                gtk_service.IconFactory.Add ("cd-action-rip", icon_set);
+                stock_icons_registered = true;
+            }
+            
+            UpdateActions ();
+        }
+        
+        private void UpdateActions ()
+        {
+            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
+            if (uia_service == null) {
+                return;
+            }
+            
+            Gtk.Action rip_action = uia_service.GlobalActions["RipDiscAction"];
+            if (rip_action != null) {
+                string title = disc_model.Title;
+                int max_title_length = 20;
+                title = title.Length > max_title_length 
+                    ? String.Format ("{0}\u2026", title.Substring (0, max_title_length).Trim ())
+                    : title;
+                rip_action.Label = String.Format (Catalog.GetString ("Import \u201f{0}\u201d"), title);
+                rip_action.ShortLabel = Catalog.GetString ("Import CD");
+                rip_action.StockId = "cd-action-rip";
+                rip_action.Sensitive = AudioCdRipper.Supported;
+            }
+            
+            Gtk.Action duplicate_action = uia_service.GlobalActions["DuplicateDiscAction"];
+            if (duplicate_action != null) {
+                duplicate_action.IconName = "media-cdrom";
+            }
+        }
+        
+        protected override void OnUpdated ()
+        {
+            if (actions_loaded) {
+                UpdateActions ();
+            }
+            
+            base.OnUpdated ();
+        }
+        
+#endregion
+
     }
 }

Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am	Wed Apr  2 00:44:55 2008
@@ -5,11 +5,17 @@
 
 SOURCES =  \
 	Banshee.AudioCd/AudioCdDiscModel.cs \
+	Banshee.AudioCd/AudioCdRipper.cs \
 	Banshee.AudioCd/AudioCdService.cs \
 	Banshee.AudioCd/AudioCdSource.cs \
 	Banshee.AudioCd/AudioCdTrackInfo.cs
 
-RESOURCES = Banshee.AudioCd.addin.xml
+RESOURCES =  \
+	Banshee.AudioCd.addin.xml \
+	Resources/ActiveSourceUI.xml \
+	Resources/cd-action-rip-16.png \
+	Resources/cd-action-rip-22.png \
+	Resources/GlobalUI.xml
 
 include $(top_srcdir)/build/build.mk
 

Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/ActiveSourceUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/ActiveSourceUI.xml	Wed Apr  2 00:44:55 2008
@@ -0,0 +1,8 @@
+<ui>
+    <toolbar name="HeaderToolbar">
+        <placeholder name="SourceActions">
+            <toolitem action="DuplicateDiscAction"/>
+            <toolitem action="RipDiscAction"/>
+        </placeholder>
+    </toolbar>
+</ui>

Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml	Wed Apr  2 00:44:55 2008
@@ -0,0 +1,8 @@
+<ui>
+    <popup name="AudioCdContextMenu">
+        <menuitem name="RipDisc" action="RipDiscAction"/>
+        <menuitem name="DuplicateDisc" action="DuplicateDiscAction"/>
+        <separator/>
+        <menuitem name="UnmapSource" action="UnmapSourceAction"/>
+    </popup>
+</ui>

Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/cd-action-rip-16.png
==============================================================================
Binary file. No diff available.

Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/cd-action-rip-22.png
==============================================================================
Binary file. No diff available.

Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds	(original)
+++ trunk/banshee/src/Extensions/Extensions.mds	Wed Apr  2 00:44:55 2008
@@ -31,4 +31,4 @@
     <Entry filename="Banshee.Bookmarks/Banshee.Bookmarks.mdp" />
     <Entry filename="Banshee.AudioCd/Banshee.AudioCd.mdp" />
   </Entries>
-</Combine>
+</Combine>
\ No newline at end of file



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