[banshee] Added a --gconf-base-key (bgo#585546)



commit 109ae6d68cbbcdfb80fecd4e2605d3008de58b8e
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Sat Jun 13 09:23:37 2009 +1000

    Added a --gconf-base-key (bgo#585546)
    
    Together with the --db=NAME option, it allows to run the development version
    in a sand-box.

 .../GConfConfigurationClient.cs                    |   20 ++++++++++++++++----
 src/Clients/Booter/Booter/Entry.cs                 |    1 +
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs b/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
index 09186b3..e3d1cdf 100644
--- a/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
+++ b/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
@@ -39,8 +39,6 @@ namespace Banshee.GnomeBackend
 {
     public class GConfConfigurationClient : IConfigurationClient
     {
-        private static string base_key = "/apps/banshee-1/";
-        
         private GConf.Client client;
         private Dictionary<string, string> key_table = new Dictionary<string, string> ();
         
@@ -58,6 +56,20 @@ namespace Banshee.GnomeBackend
             }
         }
 
+        private static string base_key;
+        private static string BaseKey {
+            get {
+                if (base_key == null) {
+                    base_key = ApplicationContext.CommandLine["gconf-base-key"];
+                    if (!base_key.StartsWith ("/apps/") || !base_key.EndsWith ("/")) {
+                        Log.Debug ("Using default gconf-base-key");
+                        base_key = "/apps/banshee-1/";
+                    }
+                }
+                return base_key;
+            }
+        }
+
         private string CreateKey (string @namespace, string part)
         {
             string hash_key = String.Concat (@namespace, part);
@@ -65,13 +77,13 @@ namespace Banshee.GnomeBackend
                 if (!key_table.ContainsKey (hash_key)) {
                     part = part.Replace ('/', '_');
                     if (@namespace == null) {
-                        key_table.Add (hash_key, String.Concat (base_key, StringUtil.CamelCaseToUnderCase (part)));
+                        key_table.Add (hash_key, String.Concat (BaseKey, StringUtil.CamelCaseToUnderCase (part)));
                     } else if (@namespace.StartsWith ("/")) {
                         key_table.Add (hash_key, String.Concat (@namespace,
                             @namespace.EndsWith ("/") ? String.Empty : "/", StringUtil.CamelCaseToUnderCase (part)));
                     } else {
                         @namespace = @namespace.Replace ('/', '_');
-                        key_table.Add (hash_key, String.Concat (base_key,
+                        key_table.Add (hash_key, String.Concat (BaseKey,
                             StringUtil.CamelCaseToUnderCase (String.Concat (@namespace.Replace (".", "/"), "/", part))
                         ));
                     }
diff --git a/src/Clients/Booter/Booter/Entry.cs b/src/Clients/Booter/Booter/Entry.cs
index e2bc6e8..aa93db9 100644
--- a/src/Clients/Booter/Booter/Entry.cs
+++ b/src/Clients/Booter/Booter/Entry.cs
@@ -202,6 +202,7 @@ namespace Booter
                     new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
                     new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
                     new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
+                    new LayoutOption ("gconf-base-key=KEY", Catalog.GetString ("Specify an alternate key, default is /apps/banshee-1/")),
                     new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " + 
                         "most notably, this will create an alternate Mono.Addins database in the working directory")),
                     new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),



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