banshee r4499 - in trunk/banshee: . src/Backends/Banshee.Gnome src/Backends/Banshee.Gnome/Banshee.GnomeBackend src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Configuration src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Core/Banshee.Widgets/Banshee.Widgets



Author: gburt
Date: Tue Sep  9 16:46:19 2008
New Revision: 4499
URL: http://svn.gnome.org/viewvc/banshee?rev=4499&view=rev

Log:
2008-09-09  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs: When the
	client is started and if appropriate, pop up a dialog asking if the user
	wants to set Banshee as the default media player.

	* src/Core/Banshee.ThickClient/Makefile.am:
	* src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj:
	* src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs:
	New dialog asking the user if they want to set Banshee as the default, and
	with a checkbox to remember the decision.

	* src/Core/Banshee.Services/Banshee.Services.addin.xml: Add extension
	point for DefaultApplicationHelpers.

	* src/Core/Banshee.Services/Makefile.am:
	* src/Core/Banshee.Services/Banshee.Services.csproj:
	* src/Core/Banshee.Services/Banshee.Configuration/DefaultApplicationHelper.cs:
	New static class that loads DefaultApplicationHelper backends (only one
	for GNOME exists atm), provides a simple API, and contains the
	SchemaEntrys for remembering the users previous choice in the matter.

	* src/Core/Banshee.Widgets/Banshee.Widgets/HigMessageDialog.cs: Add
	a convenience method for adding a custom Button.

	* src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs:
	Handle the namespace already being absolute (starting in '/') by not
	prepending it with /app/banshee-1/.

	* src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml:
	* src/Backends/Banshee.Gnome/Banshee.Gnome.csproj:
	* src/Backends/Banshee.Gnome/Makefile.am:
	* src/Backends/Banshee.Gnome/Banshee.GnomeBackend/DefaultApplicationHelper.cs:
	GNOME specific backend to the DefaultApplicationHelper extension point.
	Sets Banshee as the default handler for several uri schems, for audio
	devices, cds, and media in general.



Added:
   trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/DefaultApplicationHelper.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Configuration/DefaultApplicationHelper.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml
   trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.csproj
   trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
   trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
   trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
   trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/HigMessageDialog.cs

Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml	(original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml	Tue Sep  9 16:46:19 2008
@@ -25,6 +25,10 @@
   <Extension path="/Banshee/Platform/DiscDuplicator">
     <DiscDuplicator class="Banshee.GnomeBackend.DiscDuplicator"/>
   </Extension>
+
+  <Extension path="/Banshee/Platform/DefaultApplicationHelper">
+    <Helper class="Banshee.GnomeBackend.DefaultApplicationHelper"/>
+  </Extension>
   
   <Extension path="/Banshee/NowPlaying/ScreensaverManager">
     <ScreensaverManager class="Banshee.GnomeBackend.GnomeScreensaverManager"/>

Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.csproj
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.csproj	(original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.csproj	Tue Sep  9 16:46:19 2008
@@ -56,6 +56,7 @@
     <Compile Include="Banshee.GnomeBackend\Brasero.cs" />
     <Compile Include="Banshee.GnomeBackend\DiscDuplicator.cs" />
     <Compile Include="Banshee.GnomeBackend\GnomeScreensaverManager.cs" />
+    <Compile Include="Banshee.GnomeBackend\DefaultApplicationHelper.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.Gnome.addin.xml" />

Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/DefaultApplicationHelper.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/DefaultApplicationHelper.cs	Tue Sep  9 16:46:19 2008
@@ -0,0 +1,154 @@
+//
+// DefaultApplicationHelper.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+
+using Hyena;
+
+using Banshee.Configuration;
+
+namespace Banshee.GnomeBackend
+{
+    public class DefaultApplicationHelper : IDefaultHelper
+    {
+        private static string [] uri_schemes = new string [] {
+            "feed", "itpc", "lastfm", "mms", "mmsh",
+            // "cdda",  Not needed because taken care of by setting ourselves as the autoplay_cda_command
+            // Schemes handled by Totem or RB, need testing to ensure we handle
+            // "icy", "icyx",        // ice/shoutcast
+            // "itms",               // iTunes Music Store
+            // "net", "pnm", "uvox", // unknown
+            // "rtp", "rtsp",
+        };
+        
+        private List<IDefaultSchema> schemas = new List<IDefaultSchema> ();
+        private bool? is_default;
+        private string banshee_cmd;
+
+        #region Public API
+        
+        public DefaultApplicationHelper ()
+        {
+            banshee_cmd = Banshee.ServiceStack.Application.InternalName;
+            Add ("/desktop/gnome/applications/media", "needs_term", false);
+            Add ("/desktop/gnome/applications/media", "exec", "{0}");
+
+            Add ("/desktop/gnome/volume_manager", "autoipod", true);
+            Add ("/desktop/gnome/volume_manager", "autoipod_command", "{0}");
+
+            Add ("/desktop/gnome/volume_manager", "autoplay_cda", true);
+            Add ("/desktop/gnome/volume_manager", "autoplay_cda_command", "{0} --device=%d");
+
+            //Add ("/desktop/gnome/volume_manager", "autoplay_dvd", true);
+            //Add ("/desktop/gnome/volume_manager", "autoplay_dvd_command", "{0} --device=%d");
+
+            //Add ("/desktop/gnome/volume_manager", "autoplay_vcd", true);
+            //Add ("/desktop/gnome/volume_manager", "autoplay_vcd_command", "{0} --device=%d");
+            
+            foreach (string uri_scheme in uri_schemes) {
+                Add (String.Format ("/desktop/gnome/url-handlers/{0}", uri_scheme), "command", "{0} \"%s\"");
+                Add (String.Format ("/desktop/gnome/url-handlers/{0}", uri_scheme), "enabled", true);
+                Add (String.Format ("/desktop/gnome/url-handlers/{0}", uri_scheme), "needs_terminal", false);
+            }
+        }
+
+        public bool IsDefault {
+            get {
+                if (is_default == null) {
+                    is_default = true;
+                    foreach (IDefaultSchema schema in schemas) {
+                        is_default &= schema.IsDefault;
+                    }
+                }
+                return is_default.Value;
+            }
+        }
+
+        public void MakeDefault ()
+        {
+            Log.InformationFormat ("Setting Banshee as the default media application and handler for media urls etc in GNOME");            
+            foreach (IDefaultSchema schema in schemas) {
+                schema.MakeDefault ();
+            }
+        }
+
+        #endregion
+
+        #region Private helpers
+
+        private void Add (string ns, string key, string val)
+        {
+            schemas.Add (new SchemaMap<string> (ns, key, String.Format (val, banshee_cmd)));
+        }
+
+        private void Add (string ns, string key, bool val)
+        {
+            schemas.Add (new SchemaMap<bool> (ns, key, val));
+        }
+
+        private interface IDefaultSchema
+        {
+            bool IsDefault { get; }
+            void MakeDefault ();
+        }
+
+        private class SchemaMap<T> : IDefaultSchema
+        {
+            private SchemaEntry<T> schema;
+            private T val;
+            
+            public SchemaMap (string ns, string key, T val)
+            {
+                schema = new SchemaEntry<T> (ns, key, default (T), null, null);
+                this.val = val;
+            }
+
+            public bool IsDefault {
+                get {
+                    T cur_val = schema.Get ();
+                    return cur_val != null && cur_val.Equals (val);
+                }
+            }
+
+            public void MakeDefault ()
+            {
+                if (!IsDefault) {
+                    schema.Set (val);
+                }
+            }
+
+            public override string ToString ()
+            {
+                return schema.Namespace + schema.Key;
+            }
+        }
+
+        #endregion
+    }
+}

Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs	(original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs	Tue Sep  9 16:46:19 2008
@@ -63,11 +63,15 @@
             string hash_key = String.Format ("{0}{1}", @namespace, part);
             lock (((ICollection)key_table).SyncRoot) {
                 if (!key_table.ContainsKey (hash_key)) {
+                    part = part.Replace ('/', '_');
                     if (@namespace == null) {
-                        key_table.Add (hash_key, String.Format ("{0}{1}", base_key, StringUtil.CamelCaseToUnderCase (part.Replace ('/', '_'))));
+                        key_table.Add (hash_key, String.Format ("{0}{1}", base_key, StringUtil.CamelCaseToUnderCase (part)));
+                    } else if (@namespace.StartsWith ("/")) {
+                        key_table.Add (hash_key, String.Format ("{0}{1}{2}", @namespace,
+                            @namespace.EndsWith ("/") ? String.Empty : "/", StringUtil.CamelCaseToUnderCase (part)));
                     } else {
                         key_table.Add (hash_key, String.Format ("{0}{1}",
-                            base_key, StringUtil.CamelCaseToUnderCase (String.Format ("{0}/{1}", @namespace.Replace (".", "/"), part.Replace ('/', '_')))
+                            base_key, StringUtil.CamelCaseToUnderCase (String.Format ("{0}/{1}", @namespace.Replace (".", "/"), part))
                         ));
                     }
                 }

Modified: trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am	(original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am	Tue Sep  9 16:46:19 2008
@@ -5,6 +5,7 @@
 
 SOURCES =  \
 	Banshee.GnomeBackend/Brasero.cs \
+	Banshee.GnomeBackend/DefaultApplicationHelper.cs \
 	Banshee.GnomeBackend/DiscDuplicator.cs \
 	Banshee.GnomeBackend/GConfConfigurationClient.cs \
 	Banshee.GnomeBackend/GnomeScreensaverManager.cs \

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Configuration/DefaultApplicationHelper.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Configuration/DefaultApplicationHelper.cs	Tue Sep  9 16:46:19 2008
@@ -0,0 +1,91 @@
+//
+// DefaultApplicationHelper.cs
+//
+// Authors:
+//   Gabriel Burt <gburt 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 Hyena;
+using Mono.Addins;
+
+using Banshee.Configuration;
+
+namespace Banshee.Configuration
+{
+    public interface IDefaultHelper
+    {
+        bool IsDefault { get; }
+        void MakeDefault ();
+    }
+    
+    public static class DefaultApplicationHelper
+    {
+        public static SchemaEntry<bool> MakeDefaultSchema = new SchemaEntry<bool> ("core", "make_default", true,
+            "Whether to ensure Banshee is the default media player every time it starts", null);
+        
+        public static SchemaEntry<bool> RememberChoiceSchema = new SchemaEntry<bool> ("core", "remember_make_default", false, 
+            "Whether to remember whether to ensure Banshee is the default media player every time it starts", null);
+
+        public static SchemaEntry<bool> EverAskedSchema = new SchemaEntry<bool> ("core", "ever_asked_make_default", false, 
+            "Whether the user has ever responded to whether they'd like to make Banshee the default player", null);
+
+        private static IDefaultHelper helper;
+        private static IDefaultHelper Helper {
+            get {
+                if (helper == null) {
+                    foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/Platform/DefaultApplicationHelper")) {
+                        try {
+                            helper = (IDefaultHelper)node.CreateInstance (typeof (IDefaultHelper));
+                            Log.DebugFormat ("Loaded Default Application Helper: {0}", helper.GetType ().FullName);
+                            break;
+                        } catch (Exception e) {
+                            Log.Exception ("Default Application Helper backend failed to load", e);    
+                        }
+                    }
+                }
+                return helper;
+            }
+        }
+
+        public static bool NeverAsk {
+            get {
+                return EverAskedSchema.Get () && RememberChoiceSchema.Get () && !MakeDefaultSchema.Get ();
+            }
+        }
+
+        public static bool HaveHelper {
+            get { return Helper != null; }
+        }
+
+        public static bool IsDefault {
+            get { return Helper.IsDefault; }
+        }
+
+        public static void MakeDefault ()
+        {
+            Helper.MakeDefault ();
+        }
+    }
+}

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	Tue Sep  9 16:46:19 2008
@@ -40,6 +40,10 @@
   <ExtensionPoint path="/Banshee/Platform/HardwareDeviceProvider">
     <ExtensionNode name="HardwareDeviceProvider"/>
   </ExtensionPoint>
+
+  <ExtensionPoint path="/Banshee/Platform/DefaultApplicationHelper">
+    <ExtensionNode name="Helper"/>
+  </ExtensionPoint>
   
   <ExtensionPoint path="/Banshee/Platform/DiscDuplicator">
     <ExtensionNode name="DiscDuplicator"/>

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj	Tue Sep  9 16:46:19 2008
@@ -227,6 +227,7 @@
     <Compile Include="Banshee.ServiceStack\IRegisterOnDemandService.cs" />
     <Compile Include="Banshee.Web\HttpRequest.cs" />
     <Compile Include="Banshee.Collection.Indexer\CollectionIndexer.cs" />
+    <Compile Include="Banshee.Configuration\DefaultApplicationHelper.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.Services.addin.xml" />

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	Tue Sep  9 16:46:19 2008
@@ -38,6 +38,7 @@
 	Banshee.Collection/SelectAllSelection.cs \
 	Banshee.Collection/TrackListModel.cs \
 	Banshee.Configuration/DatabaseConfigurationClient.cs \
+	Banshee.Configuration/DefaultApplicationHelper.cs \
 	Banshee.Database/BansheeDbConnection.cs \
 	Banshee.Database/BansheeDbFormatMigrator.cs \
 	Banshee.Database/BansheeModelCache.cs \

Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs	Tue Sep  9 16:46:19 2008
@@ -0,0 +1,94 @@
+//
+// DefaultApplicationHelperDialog.cs
+//
+// Authors:
+//   Gabriel Burt <gburt 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.Unix;
+using Gtk;
+using Banshee.Configuration;
+
+namespace Banshee.Gui.Dialogs
+{
+    public class DefaultApplicationHelperDialog : Banshee.Widgets.HigMessageDialog
+    {
+        public static void RunIfAppropriate ()
+        {
+            // Don't need to do anything if we're already the default
+            if (!DefaultApplicationHelper.NeverAsk && !DefaultApplicationHelper.IsDefault) {
+                if (DefaultApplicationHelper.RememberChoiceSchema.Get ()) {
+                    // Not default, but were told to remember 'make default', so just make it default w/o the dialog
+                    DefaultApplicationHelper.MakeDefault ();
+                } else {
+                    Banshee.Gui.Dialogs.DefaultApplicationHelperDialog dialog = new Banshee.Gui.Dialogs.DefaultApplicationHelperDialog ();
+                    try {
+                        if (!DefaultApplicationHelper.EverAskedSchema.Get ()) {
+                            dialog.Remember = true;
+                        }
+                        int resp = dialog.Run ();
+                        DefaultApplicationHelper.RememberChoiceSchema.Set (dialog.Remember);
+                        if (resp == (int)Gtk.ResponseType.Yes) {
+                            DefaultApplicationHelper.MakeDefaultSchema.Set (true);
+                            DefaultApplicationHelper.MakeDefault ();
+                        } else {
+                            DefaultApplicationHelper.MakeDefaultSchema.Set (false);
+                        }
+                        DefaultApplicationHelper.EverAskedSchema.Set (true);
+                    } finally {
+                        dialog.Destroy ();
+                    }
+                }
+            }
+        }
+        
+        private CheckButton remember;
+        private DefaultApplicationHelperDialog () : base (null, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.None,
+                                                         Catalog.GetString ("Make Banshee the default media player?"),
+                                                         Catalog.GetString ("Currently another program is configured as the default media player.  Would you prefer Banshee to be the default?"))
+        {
+            remember = new CheckButton (Catalog.GetString ("Do not ask me this again"));
+            remember.UseUnderline = true;
+            remember.Active = DefaultApplicationHelper.EverAskedSchema.Get ()
+                ? DefaultApplicationHelper.RememberChoiceSchema.Get () : false;
+            remember.Show ();
+
+            Alignment align = new Alignment (0f, 0f, 1f, 1f);
+            align.TopPadding = 6;
+            align.Child = remember;
+            align.Show ();
+            
+            LabelVBox.PackEnd (align, false, false, 0);
+            
+            AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.No, false);
+            AddCustomButton (Catalog.GetString ("Make Banshee the Default"), Gtk.ResponseType.Yes, true).HasFocus = true;
+        }
+
+        public bool Remember {
+            get { return remember.Active; }
+            set { remember.Active = value; }
+        }
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	Tue Sep  9 16:46:19 2008
@@ -266,6 +266,12 @@
             
             Application.PushClient (this);
             Application.Run ();
+
+            if (!Banshee.Configuration.DefaultApplicationHelper.NeverAsk && Banshee.Configuration.DefaultApplicationHelper.HaveHelper) {
+                Application.ClientStarted += delegate {
+                    Banshee.Gui.Dialogs.DefaultApplicationHelperDialog.RunIfAppropriate ();
+                };
+            }
             
             Log.Notify += OnLogNotify;
         }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	Tue Sep  9 16:46:19 2008
@@ -8,6 +8,7 @@
     <OutputType>Library</OutputType>
     <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
     <AssemblyName>Banshee.ThickClient</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -50,7 +51,7 @@
     <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="Mono.Posix" />
-    <Reference Include="Mono.Cairo" />
+    <Reference Include="Mono.Cairo, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
@@ -209,6 +210,7 @@
     <Compile Include="Banshee.Gui.TrackEditor\HelpPage.cs" />
     <Compile Include="Banshee.Gui.TrackEditor\SyncButton.cs" />
     <Compile Include="Banshee.Preferences.Gui\DescriptionLabel.cs" />
+    <Compile Include="Banshee.Gui.Dialogs\DefaultApplicationHelperDialog.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	Tue Sep  9 16:46:19 2008
@@ -36,6 +36,7 @@
 	Banshee.Gui.Dialogs/AboutDialog.cs \
 	Banshee.Gui.Dialogs/BansheeDialog.cs \
 	Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs \
+	Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs \
 	Banshee.Gui.Dialogs/ErrorListDialog.cs \
 	Banshee.Gui.Dialogs/ExtensionManagerDialog.cs \
 	Banshee.Gui.Dialogs/FileChooserDialog.cs \

Modified: trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/HigMessageDialog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/HigMessageDialog.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/HigMessageDialog.cs	Tue Sep  9 16:46:19 2008
@@ -150,16 +150,30 @@
         {
             AddButton (ok_caption, Gtk.ResponseType.Ok, false);
         }
+
+        public Gtk.Button AddCustomButton (string message, Gtk.ResponseType response, bool isDefault)
+        {
+            Gtk.Button button = new Gtk.Button ();
+            button.Label = message;
+            button.CanDefault = true;
+            button.Show ();
+            AddButton (button, response, isDefault);
+            return button;
+        }
         
-        public void AddButton (string stock_id, Gtk.ResponseType response, bool is_default)
+        public void AddButton (string stock_id, Gtk.ResponseType response, bool isDefault)
         {
             Gtk.Button button = new Gtk.Button (stock_id);
             button.CanDefault = true;
             button.Show ();
+            AddButton (button, response, isDefault);
+        }
 
+        private void AddButton (Gtk.Button button, Gtk.ResponseType response, bool isDefault)
+        {
             AddActionWidget (button, response);
 
-            if (is_default) {
+            if (isDefault) {
                 DefaultResponse = response;
                 button.AddAccelerator ("activate",
                                accel_group,



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