[rhythmbox] magnatune: don't use libsecret if it's not new enough
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] magnatune: don't use libsecret if it's not new enough
- Date: Wed, 27 Mar 2013 13:31:28 +0000 (UTC)
commit aa375173c1ebcf0ab1dd1f29a0a82757ba541152
Author: Jonathan Matthew <jonathan d14n org>
Date: Wed Mar 27 23:30:42 2013 +1000
magnatune: don't use libsecret if it's not new enough
plugins/magnatune/MagnatuneAccount.py | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/plugins/magnatune/MagnatuneAccount.py b/plugins/magnatune/MagnatuneAccount.py
index 93b04c9..16b9f43 100644
--- a/plugins/magnatune/MagnatuneAccount.py
+++ b/plugins/magnatune/MagnatuneAccount.py
@@ -27,18 +27,24 @@
from gi.repository import Gio
-# Till libsecret completely replaces gnome-keyring, we'll fall back to not
-# saving the password if libsecret can't be found. This code can be removed later.
-try:
- from gi.repository import Secret, SecretUnstable
- # We need to be able to fetch passwords stored by libgnome-keyring, so we use
- # a schema with SECRET_SCHEMA_DONT_MATCH_NAME set.
- # See: http://developer.gnome.org/libsecret/unstable/migrating-schemas.html
- MAGNATUNE_SCHEMA = Secret.Schema.new("org.gnome.rhythmbox.plugins.magnatune",
- Secret.SchemaFlags.DONT_MATCH_NAME,
- {"rhythmbox-plugin": Secret.SchemaAttributeType.STRING})
-except ImportError:
- Secret = None
+# if libsecret isn't new enough, this will crash
+from rb import rbconfig
+Secret = None
+if rbconfig.libsecret_enabled:
+ # Till libsecret completely replaces gnome-keyring, we'll fall back to not
+ # saving the password if libsecret can't be found. This code can be removed later.
+ try:
+ from gi.repository import Secret, SecretUnstable
+ # We need to be able to fetch passwords stored by libgnome-keyring, so we use
+ # a schema with SECRET_SCHEMA_DONT_MATCH_NAME set.
+ # See: http://developer.gnome.org/libsecret/unstable/migrating-schemas.html
+ MAGNATUNE_SCHEMA = Secret.Schema.new("org.gnome.rhythmbox.plugins.magnatune",
+ Secret.SchemaFlags.DONT_MATCH_NAME,
+ {"rhythmbox-plugin":
Secret.SchemaAttributeType.STRING})
+ except ImportError:
+ pass
+
+if Secret is None:
print ("You need to install libsecret and its introspection files to store your Magnatune password")
__instance = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]