[sound-juicer] Use the musicbrainz_server gconf key



commit 1cd23a55273ba994fe58b1bfeda1c65773e51938
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Aug 2 15:14:01 2009 -0400

    Use the musicbrainz_server gconf key
    
    Update the musicbrainz3 metadata backend to use the musicbrainz_server
    gconf key, if set (as the old musicbrainz backend does).

 libjuicer/sj-metadata-musicbrainz3.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libjuicer/sj-metadata-musicbrainz3.c b/libjuicer/sj-metadata-musicbrainz3.c
index 2f785fa..785b4a2 100644
--- a/libjuicer/sj-metadata-musicbrainz3.c
+++ b/libjuicer/sj-metadata-musicbrainz3.c
@@ -44,6 +44,7 @@
 		field = g_strdup (buffer);					\
 }
 
+#define GCONF_MUSICBRAINZ_SERVER "/apps/sound-juicer/musicbrainz_server"
 #define GCONF_PROXY_USE_PROXY "/system/http_proxy/use_http_proxy"
 #define GCONF_PROXY_HOST "/system/http_proxy/host"
 #define GCONF_PROXY_PORT "/system/http_proxy/port"
@@ -302,14 +303,24 @@ static void
 sj_metadata_musicbrainz3_init (SjMetadataMusicbrainz3 *self)
 {
   GConfClient *gconf_client;
+  gchar *server_name;
+
   SjMetadataMusicbrainz3Private *priv;
 
   priv = GET_PRIVATE (self);
 
-  priv->mb = mb_webservice_new();
+  priv->mb = mb_webservice_new ();
 
   gconf_client = gconf_client_get_default ();
 
+  server_name = gconf_client_get_string (gconf_client, GCONF_MUSICBRAINZ_SERVER, NULL);
+
+  if (server_name && strcmp (server_name, "") != 0) {
+    mb_webservice_set_host (priv->mb, server_name);
+  }
+
+  g_free (server_name);
+
   /* Set the HTTP proxy */
   if (gconf_client_get_bool (gconf_client, GCONF_PROXY_USE_PROXY, NULL)) {
     char *proxy_host;



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