[rhythmbox] audioscrobbler: fix problems with enabling/disabling scrobbling
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] audioscrobbler: fix problems with enabling/disabling scrobbling
- Date: Tue, 21 Sep 2010 10:49:56 +0000 (UTC)
commit c67af3f930d63b8b6fd14f2bdcb3566ba5531aa2
Author: Jamie Nicol <jamie thenicols net>
Date: Sat Jun 26 22:15:07 2010 +0100
audioscrobbler: fix problems with enabling/disabling scrobbling
ensure scrobbler object is created on startup if it should be, and
ensure that the gconf callback is removed when source is disposed
.../rb-audioscrobbler-profile-source.c | 21 ++++++++++++++++++-
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-source.c b/plugins/audioscrobbler/rb-audioscrobbler-profile-source.c
index cacd862..fe1896f 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-source.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-source.c
@@ -291,8 +291,20 @@ rb_audioscrobbler_profile_source_constructed (GObject *object)
eel_gconf_notification_add (scrobbling_enabled_conf_key,
(GConfClientNotifyFunc) rb_audioscrobbler_profile_source_scrobbling_enabled_changed_cb,
source);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (source->priv->scrobbling_enabled_check),
- eel_gconf_get_boolean (scrobbling_enabled_conf_key));
+ if (eel_gconf_get_boolean (scrobbling_enabled_conf_key)) {
+ source->priv->audioscrobbler =
+ rb_audioscrobbler_new (source->priv->service,
+ RB_SHELL_PLAYER (rb_shell_get_player (shell)));
+ rb_audioscrobbler_set_authentication_details (source->priv->audioscrobbler,
+ rb_audioscrobbler_account_get_username (source->priv->account),
+ rb_audioscrobbler_account_get_session_key (source->priv->account));
+ g_signal_connect (source->priv->audioscrobbler,
+ "authentication-error",
+ (GCallback)rb_audioscrobbler_profile_source_scrobbler_authentication_error_cb,
+ source);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (source->priv->scrobbling_enabled_check),
+ TRUE);
+ }
g_object_unref (shell);
g_free (scrobbling_enabled_conf_key);
@@ -325,6 +337,11 @@ rb_audioscrobbler_profile_source_dispose (GObject* object)
source->priv->user = NULL;
}
+ if (source->priv->scrobbling_enabled_notification_id != 0) {
+ eel_gconf_notification_remove (source->priv->scrobbling_enabled_notification_id);
+ source->priv->scrobbling_enabled_notification_id = 0;
+ }
+
G_OBJECT_CLASS (rb_audioscrobbler_profile_source_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]