[rhythmbox] audioscrobbler: store Last.fm username in gconf, for other plugins' use



commit d561335267cde84ad14b235aaf871ca61115ba66
Author: Jamie Nicol <jamie thenicols net>
Date:   Tue Aug 17 16:23:17 2010 +0100

    audioscrobbler: store Last.fm username in gconf, for other plugins' use

 lib/rb-preferences.h                               |    2 --
 plugins/audioscrobbler/rb-audioscrobbler-account.c |   10 ++++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/lib/rb-preferences.h b/lib/rb-preferences.h
index a123aab..3dfd131 100644
--- a/lib/rb-preferences.h
+++ b/lib/rb-preferences.h
@@ -54,8 +54,6 @@ G_BEGIN_DECLS
 #define CONF_STATE_BURN_DEVICE	CONF_PREFIX "/state/burn_device"
 
 #define CONF_AUDIOSCROBBLER_USERNAME CONF_PREFIX "/audioscrobbler/username"
-#define CONF_AUDIOSCROBBLER_PASSWORD CONF_PREFIX "/audioscrobbler/password"
-#define CONF_AUDIOSCROBBLER_URL      CONF_PREFIX "/audioscrobbler/scrobbler_url"
 
 #define CONF_DAAP_ENABLE_SHARING   CONF_PREFIX "/sharing/enable_sharing"
 #define CONF_DAAP_SHARE_NAME       CONF_PREFIX "/sharing/share_name"
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-account.c b/plugins/audioscrobbler/rb-audioscrobbler-account.c
index ed2d178..519d44b 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-account.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-account.c
@@ -38,7 +38,9 @@
 #include "rb-builder-helpers.h"
 #include "rb-debug.h"
 #include "rb-file-helpers.h"
+#include "rb-preferences.h"
 #include "rb-util.h"
+#include "eel-gconf-extensions.h"
 
 #define SESSION_SETTINGS_FILE "sessions"
 #define SESSION_KEY_REQUEST_TIMEOUT 5
@@ -394,6 +396,14 @@ save_session_settings (RBAudioscrobblerAccount *account)
 		g_key_file_remove_group (key_file, service_name, NULL);
 	}
 
+	/* If Last.fm, set the username in gconf to allow other plugins,
+	 * such as cover art and context pane, to make use of it.
+	 */
+	if (strcmp (service_name, "Last.fm") == 0) {
+		eel_gconf_set_string (CONF_AUDIOSCROBBLER_USERNAME,
+		                      account->priv->username != NULL ? account->priv->username : "");
+	}
+
 	g_free (service_name);
 
 	data = g_key_file_to_data (key_file, &data_length, NULL);



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