[banshee/gio-hardware] Stubbed Amazon MP3 store preferences class



commit 1b9109d3c5edb95e8db3318d3d1c09f121b60483
Author: Aaron Bockover <abockover novell com>
Date:   Mon Jul 19 13:15:20 2010 -0400

    Stubbed Amazon MP3 store preferences class

 .../Banshee.AmazonMp3.Store/StoreSource.cs         |   13 ++++-
 .../StoreSourcePreferences.cs                      |   69 ++++++++++++++++++++
 src/Extensions/Banshee.AmazonMp3.Store/Makefile.am |    4 +-
 3 files changed, 83 insertions(+), 3 deletions(-)
---
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSource.cs b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSource.cs
index 2aa3f24..766f8e3 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSource.cs
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSource.cs
@@ -31,13 +31,24 @@ using Hyena;
 
 namespace Banshee.AmazonMp3.Store
 {
-    public class StoreSource : Banshee.WebSource.WebSource
+    public class StoreSource : Banshee.WebSource.WebSource, IDisposable
     {
+        private StoreSourcePreferences preferences;
+
         public StoreSource () : base (Catalog.GetString ("Amazon MP3 Store"), 150, "amazon-mp3-store")
         {
+            preferences = new StoreSourcePreferences (this);
             Properties.SetString ("Icon.Name", "amazon-mp3-store-source");
         }
 
+        public void Dispose ()
+        {
+            if (preferences != null) {
+                preferences.Dispose ();
+                preferences = null;
+            }
+        }
+
         protected override Banshee.WebSource.WebBrowserShell GetWidget ()
         {
             return new StoreWebBrowserShell (new StoreView ());
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSourcePreferences.cs b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSourcePreferences.cs
new file mode 100644
index 0000000..34ea66d
--- /dev/null
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSourcePreferences.cs
@@ -0,0 +1,69 @@
+// 
+// StoreSourcePreferences.cs
+// 
+// Author:
+//   Aaron Bockover <abockover novell com>
+// 
+// Copyright 2010 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.ServiceStack;
+using Banshee.Preferences;
+
+namespace Banshee.AmazonMp3.Store
+{
+    public class StoreSourcePreferences : IDisposable
+    {
+       // private StoreSource source;
+        private SourcePage source_page;
+
+        public StoreSourcePreferences (StoreSource source)
+        {
+            var service = ServiceManager.Get<PreferenceService> ();
+            if (service == null) {
+                return;
+            }
+
+          //  this.source = source;
+
+            service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;
+            source_page = new SourcePage (source);
+        }
+
+        public void Dispose ()
+        {
+            var service = ServiceManager.Get<PreferenceService> ();
+            if (service == null || source_page == null) {
+                return;
+            }
+
+            service.InstallWidgetAdapters -= OnPreferencesServiceInstallWidgetAdapters;
+            source_page.Dispose ();
+            source_page = null;
+        }
+
+        private void OnPreferencesServiceInstallWidgetAdapters (object sender, EventArgs args)
+        {
+        }
+    }
+}
+
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am b/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
index ec43ba5..0435529 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
@@ -5,11 +5,11 @@ INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
 
 SOURCES =  \
 	Banshee.AmazonMp3.Store/StoreSource.cs \
+	Banshee.AmazonMp3.Store/StoreSourcePreferences.cs \
 	Banshee.AmazonMp3.Store/StoreView.cs \
 	Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs
 
-RESOURCES =  \
-	Banshee.AmazonMp3.Store.addin.xml
+RESOURCES = Banshee.AmazonMp3.Store.addin.xml
 
 if HAVE_LIBWEBKIT
 include $(top_srcdir)/build/build.mk



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