1 |
commit: 7406e86f7bd839404acccf874b2068c496835bd4 |
2 |
Author: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 5 01:30:29 2013 +0000 |
4 |
Commit: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 5 01:32:59 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=7406e86f |
7 |
|
8 |
media-sound/rhythmbox: Update patch |
9 |
|
10 |
--- |
11 |
.../rhythmbox-port-magnatune-to-libsecret.patch | 119 ---- |
12 |
.../files/rhythmbox-port-to-libsecret.patch | 744 +++++++++++++++++--- |
13 |
media-sound/rhythmbox/rhythmbox-9999.ebuild | 9 +- |
14 |
3 files changed, 646 insertions(+), 226 deletions(-) |
15 |
|
16 |
diff --git a/media-sound/rhythmbox/files/rhythmbox-port-magnatune-to-libsecret.patch b/media-sound/rhythmbox/files/rhythmbox-port-magnatune-to-libsecret.patch |
17 |
deleted file mode 100644 |
18 |
index ddff723..0000000 |
19 |
--- a/media-sound/rhythmbox/files/rhythmbox-port-magnatune-to-libsecret.patch |
20 |
+++ /dev/null |
21 |
@@ -1,119 +0,0 @@ |
22 |
-From 937423f0cff334693a68bf9c9d13e3d477c7a969 Mon Sep 17 00:00:00 2001 |
23 |
-From: Nirbheek Chauhan <nirbheek.chauhan@××××××××××××.uk> |
24 |
-Date: Sat, 2 Mar 2013 14:09:26 +0530 |
25 |
-Subject: [PATCH 2/2] magnatune: Port to libsecret |
26 |
- |
27 |
---- |
28 |
-diff --git a/plugins/magnatune/MagnatuneAccount.py b/plugins/magnatune/MagnatuneAccount.py |
29 |
-index f8cf81b..6fdc406 100644 |
30 |
---- a/plugins/magnatune/MagnatuneAccount.py |
31 |
-+++ b/plugins/magnatune/MagnatuneAccount.py |
32 |
-@@ -1,4 +1,5 @@ |
33 |
- # -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*- |
34 |
-+# vim: set sts=0 ts=8 sw=8 tw=0 noet : |
35 |
- # |
36 |
- # Copyright (C) 2012 Jonathan Matthew <jonathan@××××.org> |
37 |
- # |
38 |
-@@ -24,10 +25,17 @@ |
39 |
- # along with this program; if not, write to the Free Software |
40 |
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
41 |
- |
42 |
--from gi.repository import Gio, GnomeKeyring |
43 |
-+from gi.repository import Gio, Secret, SecretUnstable |
44 |
- |
45 |
- __instance = None |
46 |
- |
47 |
-+# We need to be able to fetch passwords stored by libgnome-keyring, so we use |
48 |
-+# a schema with SECRET_SCHEMA_DONT_MATCH_NAME set. |
49 |
-+# See: http://developer.gnome.org/libsecret/unstable/migrating-schemas.html |
50 |
-+MAGNATUNE_SCHEMA = Secret.Schema.new("org.gnome.rhythmbox.plugins.magnatune", |
51 |
-+ Secret.SchemaFlags.DONT_MATCH_NAME, |
52 |
-+ {"rhythmbox-plugin": Secret.SchemaAttributeType.STRING}) |
53 |
-+ |
54 |
- def instance(): |
55 |
- global __instance |
56 |
- if __instance is None: |
57 |
-@@ -36,54 +44,44 @@ def instance(): |
58 |
- |
59 |
- class MagnatuneAccount(object): |
60 |
- def __init__(self): |
61 |
-- self.keyring_item = None |
62 |
- self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune") |
63 |
-- |
64 |
-- self.keyring_attributes = GnomeKeyring.attribute_list_new() |
65 |
-- GnomeKeyring.attribute_list_append_string(self.keyring_attributes, |
66 |
-- "rhythmbox-plugin", |
67 |
-- "magnatune") |
68 |
-- (result, items) = GnomeKeyring.find_items_sync(GnomeKeyring.ItemType.GENERIC_SECRET, |
69 |
-- self.keyring_attributes) |
70 |
-- if result == GnomeKeyring.Result.OK and len(items) != 0: |
71 |
-- (result, item) = GnomeKeyring.item_get_info_sync(None, items[0].item_id) |
72 |
-- if result == GnomeKeyring.Result.OK: |
73 |
-- self.keyring_item = item |
74 |
-- else: |
75 |
-- print "Couldn't get keyring item: " + GnomeKeyring.result_to_message(result) |
76 |
-- else: |
77 |
-- print "couldn't search keyring items: " + GnomeKeyring.result_to_message(result) |
78 |
-+ self.secret = None |
79 |
-+ self.keyring_attributes = {"rhythmbox-plugin": "magnatune"} |
80 |
-+ # Haha. |
81 |
-+ self.secret_service = SecretUnstable.Service.get_sync(SecretUnstable.ServiceFlags.OPEN_SESSION, None) |
82 |
-+ items = self.secret_service.search_sync(MAGNATUNE_SCHEMA, |
83 |
-+ self.keyring_attributes, |
84 |
-+ SecretUnstable.SearchFlags.LOAD_SECRETS, |
85 |
-+ None) |
86 |
-+ if not items: |
87 |
-+ # The Python API doesn't seem to have a way to differentiate between errors and no results. |
88 |
-+ print ("Couldn't find an existing keyring entry") |
89 |
-+ return |
90 |
-+ self.secret = items[0].get_secret().get() |
91 |
- |
92 |
- def get(self): |
93 |
-- if self.keyring_item is None: |
94 |
-+ if self.secret is None: |
95 |
- return ('none', None, None) |
96 |
- |
97 |
- account_type = self.settings['account-type'] |
98 |
- try: |
99 |
-- (username, password) = self.keyring_item.get_secret().split("\n") |
100 |
-+ (username, password) = self.secret.split("\n") |
101 |
- return (account_type, username, password) |
102 |
- except ValueError: |
103 |
- return ('none', None, None) |
104 |
- |
105 |
- def update(self, username, password): |
106 |
- secret = '\n'.join((username, password)) |
107 |
-- if self.keyring_item is not None: |
108 |
-- if secret == self.keyring_item.get_secret(): |
109 |
-- print "account details not changed" |
110 |
-- return |
111 |
-+ if secret == self.secret: |
112 |
-+ print "Account details not changed" |
113 |
-+ return |
114 |
- |
115 |
-- (result, id) = GnomeKeyring.item_create_sync(None, |
116 |
-- GnomeKeyring.ItemType.GENERIC_SECRET, |
117 |
-- "Rhythmbox: Magnatune account information", |
118 |
-- self.keyring_attributes, |
119 |
-- secret, |
120 |
-- True) |
121 |
-- if result == GnomeKeyring.Result.OK: |
122 |
-- if self.keyring_item is None: |
123 |
-- (result, item) = GnomeKeyring.item_get_info_sync(None, id) |
124 |
-- if result == GnomeKeyring.Result.OK: |
125 |
-- self.keyring_item = item |
126 |
-- else: |
127 |
-- print "couldn't fetch keyring itme: " + GnomeKeyring.result_to_message(result) |
128 |
-+ result = Secret.password_store_sync(MAGNATUNE_SCHEMA, |
129 |
-+ self.keyring_attributes, |
130 |
-+ Secret.COLLECTION_DEFAULT, |
131 |
-+ "Rhythmbox: Magnatune account information", |
132 |
-+ secret, None) |
133 |
-+ if not result: |
134 |
-+ print "Couldn't create keyring item!" |
135 |
- else: |
136 |
-- print "couldn't create keyring item: " + GnomeKeyring.result_to_message(result) |
137 |
-+ self.secret = secret |
138 |
--- |
139 |
-1.7.12.4 |
140 |
- |
141 |
|
142 |
diff --git a/media-sound/rhythmbox/files/rhythmbox-port-to-libsecret.patch b/media-sound/rhythmbox/files/rhythmbox-port-to-libsecret.patch |
143 |
index c9255a1..bd0ed8f 100644 |
144 |
--- a/media-sound/rhythmbox/files/rhythmbox-port-to-libsecret.patch |
145 |
+++ b/media-sound/rhythmbox/files/rhythmbox-port-to-libsecret.patch |
146 |
@@ -1,46 +1,78 @@ |
147 |
-From e7880e08bd2eb0b3ea59c8bdb049300712e38993 Mon Sep 17 00:00:00 2001 |
148 |
+From 5f992f68cc96ea0d494f30be4ff5386185fb5c18 Mon Sep 17 00:00:00 2001 |
149 |
From: Nirbheek Chauhan <nirbheek.chauhan@××××××××××××.uk> |
150 |
Date: Wed, 23 Jan 2013 02:29:10 +0530 |
151 |
-Subject: [PATCH] Port audioscrobbler and daap plugins from gnome-keyring to |
152 |
- libsecret |
153 |
+Subject: [PATCH] Port daap and magnatune plugins to libsecret |
154 |
|
155 |
+The Magnatune plugin currently falls back to not saving the password at all if |
156 |
+libsecret isn't found. This fallback code should be removed once libsecret |
157 |
+becomes as prevalent as gnome-keyring was. |
158 |
+ |
159 |
+Audioscrobbler used gnome-keyring for the old API, which no longer works. |
160 |
+Hence, that code was removed. |
161 |
+ |
162 |
+https://bugzilla.gnome.org/show_bug.cgi?id=694981 |
163 |
+ |
164 |
+As a bonus, add cscope.out to .gitignore |
165 |
--- |
166 |
- configure.ac | 41 +++++------ |
167 |
- plugins/audioscrobbler/Makefile.am | 3 +- |
168 |
- .../rb-audioscrobbler-radio-source.c | 46 ++++++------ |
169 |
- plugins/daap/Makefile.am | 6 +- |
170 |
- plugins/daap/rb-daap-source.c | 82 ++++++++++------------ |
171 |
- 5 files changed, 90 insertions(+), 88 deletions(-) |
172 |
+ .gitignore | 1 + |
173 |
+ configure.ac | 40 ++- |
174 |
+ plugins/audioscrobbler/Makefile.am | 1 - |
175 |
+ .../rb-audioscrobbler-radio-source.c | 383 ++------------------- |
176 |
+ .../rb-audioscrobbler-radio-source.h | 3 - |
177 |
+ plugins/daap/Makefile.am | 6 +- |
178 |
+ plugins/daap/rb-daap-source.c | 82 ++--- |
179 |
+ plugins/magnatune/MagnatuneAccount.py | 88 ++--- |
180 |
+ 8 files changed, 143 insertions(+), 461 deletions(-) |
181 |
|
182 |
+diff --git a/.gitignore b/.gitignore |
183 |
+index a0a2751..d27c9c0 100644 |
184 |
+--- a/.gitignore |
185 |
++++ b/.gitignore |
186 |
+@@ -4,6 +4,7 @@ |
187 |
+ .libs |
188 |
+ *.pyc |
189 |
+ *.plugin |
190 |
++cscope.out |
191 |
+ |
192 |
+ autom4te*.cache |
193 |
+ stamp-h |
194 |
diff --git a/configure.ac b/configure.ac |
195 |
-index f739a19..6ff98d6 100644 |
196 |
+index f739a19..58fde4d 100644 |
197 |
--- a/configure.ac |
198 |
+++ b/configure.ac |
199 |
-@@ -223,26 +223,27 @@ fi |
200 |
+@@ -59,6 +59,8 @@ LIBMTP_REQS=0.3.0 |
201 |
+ LIBPEAS_REQS=0.7.3 |
202 |
+ GRILO_REQS=0.2.0 |
203 |
+ LIBXML2_REQS=2.7.8 |
204 |
++# Needed for libsecret commit ddd9bdd2 for the Magnatune plugin |
205 |
++LIBSECRET_REQS=0.14 |
206 |
+ |
207 |
+ LIBNOTIFY_REQS=0.7.0 |
208 |
+ BRASERO_MIN_REQS=2.31.5 |
209 |
+@@ -223,26 +225,28 @@ fi |
210 |
AM_CONDITIONAL(USE_MTP, test x"$use_mtp" = xyes) |
211 |
|
212 |
|
213 |
-dnl gnome-keyring support |
214 |
-- |
215 |
++dnl libsecret keyring support |
216 |
+ |
217 |
-AC_ARG_WITH(gnome-keyring, |
218 |
- AC_HELP_STRING([--with-gnome-keyring], |
219 |
- [Enable gnome-keyring support]),, |
220 |
- with_gnome_keyring=auto) |
221 |
-if test "x$with_gnome_keyring" != "xno"; then |
222 |
-- |
223 |
++AC_ARG_WITH(libsecret, |
224 |
++ AC_HELP_STRING([--with-libsecret], |
225 |
++ [Enable keyring support using libsecret]),, |
226 |
++ with_libsecret=auto) |
227 |
++if test "x$with_libsecret" != "xno"; then |
228 |
+ |
229 |
- PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, have_gnome_keyring=yes, have_gnome_keyring=no) |
230 |
- if test "x$have_gnome_keyring" = "xno" -a "x$with_gnome_keyring" = "xyes"; then |
231 |
- AC_MSG_ERROR([gnome-keyring support explicitly requested but gnome-keyring couldn't be found]) |
232 |
-+dnl libsecret keyring support |
233 |
-+ |
234 |
-+AC_ARG_WITH(keyring, |
235 |
-+ AC_HELP_STRING([--with-keyring], |
236 |
-+ [Enable keyring support using libsecret]),, |
237 |
-+ with_keyring=auto) |
238 |
-+if test "x$with_keyring" != "xno"; then |
239 |
-+ |
240 |
-+ PKG_CHECK_MODULES(LIBSECRET, libsecret-1, have_keyring=yes, have_keyring=no) |
241 |
-+ if test "x$have_keyring" = "xno" -a "x$with_keyring" = "xyes"; then |
242 |
++ PKG_CHECK_MODULES(LIBSECRET, libsecret-1 >= $LIBSECRET_REQS, |
243 |
++ have_libsecret=yes, have_libsecret=no) |
244 |
++ if test "x$have_libsecret" = "xno" -a "x$with_libsecret" = "xyes"; then |
245 |
+ AC_MSG_ERROR([keyring support explicitly requested but libsecret |
246 |
+ could not be found]) |
247 |
fi |
248 |
@@ -49,25 +81,25 @@ index f739a19..6ff98d6 100644 |
249 |
- use_gnome_keyring=yes |
250 |
- AC_SUBST(GNOME_KEYRING_CFLAGS) |
251 |
- AC_SUBST(GNOME_KEYRING_LIBS) |
252 |
-+ if test "x$have_keyring" = "xyes"; then |
253 |
-+ AC_DEFINE(WITH_LIBSECRET, 1, [Define if keyring support is enabled]) |
254 |
-+ use_keyring=yes |
255 |
++ if test "x$have_libsecret" = "xyes"; then |
256 |
++ AC_DEFINE(WITH_LIBSECRET, 1, [Define if libsecret support is enabled]) |
257 |
++ use_libsecret=yes |
258 |
+ AC_SUBST(LIBSECRET_CFLAGS) |
259 |
+ AC_SUBST(LIBSECRET_LIBS) |
260 |
fi |
261 |
fi |
262 |
-AM_CONDITIONAL(USE_GNOME_KEYRING, test x"$use_gnome_keyring" = xyes) |
263 |
-+AM_CONDITIONAL(USE_LIBSECRET, test x"$use_keyring" = xyes) |
264 |
++AM_CONDITIONAL(USE_LIBSECRET, test x"$use_libsecret" = xyes) |
265 |
|
266 |
dnl Database |
267 |
AC_ARG_WITH(database, |
268 |
-@@ -919,10 +920,10 @@ if test x"$with_vala" = xyes; then |
269 |
+@@ -919,10 +923,10 @@ if test x"$with_vala" = xyes; then |
270 |
else |
271 |
AC_MSG_NOTICE([ Vala plugin support disabled]) |
272 |
fi |
273 |
-if test x"$use_gnome_keyring" = xyes; then |
274 |
- AC_MSG_NOTICE([** gnome-keyring support enabled]) |
275 |
-+if test x"$use_keyring" = xyes; then |
276 |
++if test x"$use_libsecret" = xyes; then |
277 |
+ AC_MSG_NOTICE([** Libsecret keyring support enabled]) |
278 |
else |
279 |
- AC_MSG_NOTICE([ gnome-keyring support disabled]) |
280 |
@@ -76,98 +108,467 @@ index f739a19..6ff98d6 100644 |
281 |
if test "x$enable_fm_radio" != xno; then |
282 |
AC_MSG_NOTICE([** FM radio support enabled]) |
283 |
diff --git a/plugins/audioscrobbler/Makefile.am b/plugins/audioscrobbler/Makefile.am |
284 |
-index 913a6b3..c139a34 100644 |
285 |
+index 913a6b3..ca332f1 100644 |
286 |
--- a/plugins/audioscrobbler/Makefile.am |
287 |
+++ b/plugins/audioscrobbler/Makefile.am |
288 |
-@@ -31,6 +31,7 @@ libaudioscrobbler_la_LIBADD = \ |
289 |
- $(top_builddir)/shell/librhythmbox-core.la \ |
290 |
- $(TOTEM_PLPARSER_LIBS) \ |
291 |
- $(JSON_GLIB_LIBS) \ |
292 |
-+ $(LIBSECRET_LIBS) \ |
293 |
- $(RHYTHMBOX_LIBS) |
294 |
- |
295 |
- INCLUDES = \ |
296 |
-@@ -53,7 +54,7 @@ INCLUDES = \ |
297 |
+@@ -53,7 +53,6 @@ INCLUDES = \ |
298 |
$(TOTEM_PLPARSER_CFLAGS) \ |
299 |
$(JSON_GLIB_CFLAGS) \ |
300 |
$(RHYTHMBOX_CFLAGS) \ |
301 |
- $(GNOME_KEYRING_CFLAGS) \ |
302 |
-+ $(LIBSECRET_CFLAGS) \ |
303 |
-D_BSD_SOURCE |
304 |
|
305 |
gtkbuilderdir = $(plugindatadir) |
306 |
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c |
307 |
-index 6f5f3cf..9735537 100644 |
308 |
+index 6f5f3cf..b0ddd52 100644 |
309 |
--- a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c |
310 |
+++ b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c |
311 |
-@@ -35,8 +35,8 @@ |
312 |
+@@ -35,10 +35,6 @@ |
313 |
#include <glib/gi18n.h> |
314 |
#include <glib/gstdio.h> |
315 |
|
316 |
-#ifdef WITH_GNOME_KEYRING |
317 |
-#include <gnome-keyring.h> |
318 |
-+#ifdef WITH_LIBSECRET |
319 |
-+#include <libsecret/secret.h> |
320 |
- #endif |
321 |
- |
322 |
+-#endif |
323 |
+- |
324 |
#include <totem-pl-parser.h> |
325 |
-@@ -1054,28 +1054,33 @@ old_api_shake_hands (RBAudioscrobblerRadioSource *source) |
326 |
- g_free (password_hash); |
327 |
- g_free (msg_url); |
328 |
- } else { |
329 |
+ |
330 |
+ #include "rb-audioscrobbler-radio-source.h" |
331 |
+@@ -170,9 +166,6 @@ struct _RBAudioscrobblerRadioSourcePrivate |
332 |
+ GtkWidget *error_info_bar; |
333 |
+ GtkWidget *error_info_bar_label; |
334 |
+ |
335 |
+- GtkWidget *password_info_bar; |
336 |
+- GtkWidget *password_info_bar_entry; |
337 |
+- |
338 |
+ RBEntryView *track_view; |
339 |
+ RhythmDBQueryModel *track_model; |
340 |
+ |
341 |
+@@ -184,13 +177,6 @@ struct _RBAudioscrobblerRadioSourcePrivate |
342 |
+ RhythmDBEntry *playing_entry; |
343 |
+ |
344 |
+ RBExtDB *art_store; |
345 |
+- |
346 |
+- /* used when streaming radio using old api */ |
347 |
+- char *old_api_password; |
348 |
+- char *old_api_session_id; |
349 |
+- char *old_api_base_url; |
350 |
+- char *old_api_base_path; |
351 |
+- gboolean old_api_is_banned; |
352 |
+ }; |
353 |
+ |
354 |
+ #define RB_AUDIOSCROBBLER_RADIO_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RB_TYPE_AUDIOSCROBBLER_RADIO_SOURCE, RBAudioscrobblerRadioSourcePrivate)) |
355 |
+@@ -225,24 +211,9 @@ static void xspf_entry_parsed (TotemPlParser *parser, |
356 |
+ GHashTable *metadata, |
357 |
+ RBAudioscrobblerRadioSource *source); |
358 |
+ |
359 |
+-/* old api */ |
360 |
+-static void old_api_shake_hands (RBAudioscrobblerRadioSource *source); |
361 |
+-static void old_api_handshake_response_cb (SoupSession *session, |
362 |
+- SoupMessage *msg, |
363 |
+- gpointer user_data); |
364 |
+-static void old_api_tune (RBAudioscrobblerRadioSource *source); |
365 |
+-static void old_api_tune_response_cb (SoupSession *session, |
366 |
+- SoupMessage *msg, |
367 |
+- gpointer user_data); |
368 |
+-static void old_api_fetch_playlist (RBAudioscrobblerRadioSource *source); |
369 |
+- |
370 |
+ /* info bar related things */ |
371 |
+ static void display_error_info_bar (RBAudioscrobblerRadioSource *source, |
372 |
+ const char *message); |
373 |
+-static void display_password_info_bar (RBAudioscrobblerRadioSource *source); |
374 |
+-static void password_info_bar_response_cb (GtkInfoBar *info_bar, |
375 |
+- int response_id, |
376 |
+- RBAudioscrobblerRadioSource *source); |
377 |
+ |
378 |
+ /* RBDisplayPage implementations */ |
379 |
+ static void impl_selected (RBDisplayPage *page); |
380 |
+@@ -413,8 +384,6 @@ rb_audioscrobbler_radio_source_constructed (GObject *object) |
381 |
+ RhythmDB *db; |
382 |
+ GtkWidget *main_vbox; |
383 |
+ GtkWidget *error_info_bar_content_area; |
384 |
+- GtkWidget *password_info_bar_label; |
385 |
+- GtkWidget *password_info_bar_content_area; |
386 |
+ GtkAccelGroup *accel_group; |
387 |
+ RBSourceToolbar *toolbar; |
388 |
+ |
389 |
+@@ -446,23 +415,6 @@ rb_audioscrobbler_radio_source_constructed (GObject *object) |
390 |
+ gtk_container_add (GTK_CONTAINER (error_info_bar_content_area), source->priv->error_info_bar_label); |
391 |
+ gtk_box_pack_start (GTK_BOX (main_vbox), source->priv->error_info_bar, FALSE, FALSE, 0); |
392 |
+ |
393 |
+- /* password info bar */ |
394 |
+- source->priv->password_info_bar = gtk_info_bar_new (); |
395 |
+- password_info_bar_label = gtk_label_new (_("You must enter your password to listen to this station")); |
396 |
+- password_info_bar_content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (source->priv->password_info_bar)); |
397 |
+- gtk_container_add (GTK_CONTAINER (password_info_bar_content_area), password_info_bar_label); |
398 |
+- source->priv->password_info_bar_entry = gtk_entry_new (); |
399 |
+- gtk_entry_set_visibility (GTK_ENTRY (source->priv->password_info_bar_entry), FALSE); |
400 |
+- gtk_info_bar_add_action_widget (GTK_INFO_BAR (source->priv->password_info_bar), |
401 |
+- source->priv->password_info_bar_entry, |
402 |
+- GTK_RESPONSE_NONE); |
403 |
+- gtk_info_bar_add_button (GTK_INFO_BAR (source->priv->password_info_bar), GTK_STOCK_OK, GTK_RESPONSE_OK); |
404 |
+- g_signal_connect (source->priv->password_info_bar, |
405 |
+- "response", |
406 |
+- G_CALLBACK (password_info_bar_response_cb), |
407 |
+- source); |
408 |
+- gtk_box_pack_start (GTK_BOX (main_vbox), source->priv->password_info_bar, FALSE, FALSE, 0); |
409 |
+- |
410 |
+ /* entry view */ |
411 |
+ source->priv->track_view = rb_entry_view_new (db, G_OBJECT (shell_player), FALSE, FALSE); |
412 |
+ rb_entry_view_append_column (source->priv->track_view, RB_ENTRY_VIEW_COL_TITLE, TRUE); |
413 |
+@@ -541,11 +493,6 @@ rb_audioscrobbler_radio_source_finalize (GObject *object) |
414 |
+ g_free (source->priv->session_key); |
415 |
+ g_free (source->priv->station_url); |
416 |
+ |
417 |
+- g_free (source->priv->old_api_password); |
418 |
+- g_free (source->priv->old_api_session_id); |
419 |
+- g_free (source->priv->old_api_base_url); |
420 |
+- g_free (source->priv->old_api_base_path); |
421 |
+- |
422 |
+ G_OBJECT_CLASS (rb_audioscrobbler_radio_source_parent_class)->finalize (object); |
423 |
+ } |
424 |
+ |
425 |
+@@ -691,7 +638,6 @@ tune (RBAudioscrobblerRadioSource *source) |
426 |
+ |
427 |
+ source->priv->is_busy = TRUE; |
428 |
+ gtk_widget_hide (source->priv->error_info_bar); |
429 |
+- gtk_widget_hide (source->priv->password_info_bar); |
430 |
+ |
431 |
+ sig_arg = g_strdup_printf ("api_key%smethodradio.tunesk%sstation%s%s", |
432 |
+ rb_audioscrobbler_service_get_api_key (source->priv->service), |
433 |
+@@ -772,44 +718,38 @@ tune_response_cb (SoupSession *session, |
434 |
+ |
435 |
+ rb_debug ("tune request responded with error: %s", message); |
436 |
+ |
437 |
+- if (code == 4) { |
438 |
+- /* Our API key only allows streaming of radio to subscribers */ |
439 |
+- rb_debug ("attempting to use old API to tune radio"); |
440 |
+- old_api_tune (source); |
441 |
++ /* show appropriate error message */ |
442 |
++ char *error_message = NULL; |
443 |
++ |
444 |
++ if (code == 6) { |
445 |
++ /* Invalid station url */ |
446 |
++ error_message = g_strdup (_("Invalid station URL")); |
447 |
++ } else if (code == 12) { |
448 |
++ /* Subscriber only station */ |
449 |
++ /* Translators: %s is the name of the audioscrobbler service, for example "Last.fm". |
450 |
++ * This message indicates that to listen to this radio station the user needs to be |
451 |
++ * a paying subscriber to the service. */ |
452 |
++ error_message = g_strdup_printf (_("This station is only available to %s subscribers"), |
453 |
++ rb_audioscrobbler_service_get_name (source->priv->service)); |
454 |
++ } else if (code == 20) { |
455 |
++ /* Not enough content */ |
456 |
++ error_message = g_strdup (_("Not enough content to play station")); |
457 |
++ } else if (code == 27) { |
458 |
++ /* Deprecated station */ |
459 |
++ /* Translators: %s is the name of the audioscrobbler service, for example "Last.fm". |
460 |
++ * This message indicates that the service has deprecated this type of station. */ |
461 |
++ error_message = g_strdup_printf (_("%s no longer supports this type of station"), |
462 |
++ rb_audioscrobbler_service_get_name (source->priv->service)); |
463 |
+ } else { |
464 |
+- /* show appropriate error message */ |
465 |
+- char *error_message = NULL; |
466 |
+- |
467 |
+- if (code == 6) { |
468 |
+- /* Invalid station url */ |
469 |
+- error_message = g_strdup (_("Invalid station URL")); |
470 |
+- } else if (code == 12) { |
471 |
+- /* Subscriber only station */ |
472 |
+- /* Translators: %s is the name of the audioscrobbler service, for example "Last.fm". |
473 |
+- * This message indicates that to listen to this radio station the user needs to be |
474 |
+- * a paying subscriber to the service. */ |
475 |
+- error_message = g_strdup_printf (_("This station is only available to %s subscribers"), |
476 |
+- rb_audioscrobbler_service_get_name (source->priv->service)); |
477 |
+- } else if (code == 20) { |
478 |
+- /* Not enough content */ |
479 |
+- error_message = g_strdup (_("Not enough content to play station")); |
480 |
+- } else if (code == 27) { |
481 |
+- /* Deprecated station */ |
482 |
+- /* Translators: %s is the name of the audioscrobbler service, for example "Last.fm". |
483 |
+- * This message indicates that the service has deprecated this type of station. */ |
484 |
+- error_message = g_strdup_printf (_("%s no longer supports this type of station"), |
485 |
+- rb_audioscrobbler_service_get_name (source->priv->service)); |
486 |
+- } else { |
487 |
+- /* Other error */ |
488 |
+- error_message = g_strdup_printf (_("Error tuning station: %i - %s"), code, message); |
489 |
+- } |
490 |
+- |
491 |
+- display_error_info_bar (source, error_message); |
492 |
+- |
493 |
+- g_free (error_message); |
494 |
+- |
495 |
+- source->priv->is_busy = FALSE; |
496 |
++ /* Other error */ |
497 |
++ error_message = g_strdup_printf (_("Error tuning station: %i - %s"), code, message); |
498 |
+ } |
499 |
++ |
500 |
++ display_error_info_bar (source, error_message); |
501 |
++ |
502 |
++ g_free (error_message); |
503 |
++ |
504 |
++ source->priv->is_busy = FALSE; |
505 |
+ } else { |
506 |
+ rb_debug ("unexpected response from tune request: %s", msg->response_body->data); |
507 |
+ display_error_info_bar(source, _("Error tuning station: unexpected response")); |
508 |
+@@ -1030,229 +970,6 @@ xspf_entry_parsed (TotemPlParser *parser, |
509 |
+ } |
510 |
+ |
511 |
+ static void |
512 |
+-old_api_shake_hands (RBAudioscrobblerRadioSource *source) |
513 |
+-{ |
514 |
+- if (source->priv->old_api_password != NULL) { |
515 |
+- char *password_hash; |
516 |
+- char *msg_url; |
517 |
+- SoupMessage *msg; |
518 |
+- |
519 |
+- password_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, source->priv->old_api_password, -1); |
520 |
+- |
521 |
+- msg_url = g_strdup_printf ("%sradio/handshake.php?username=%s&passwordmd5=%s", |
522 |
+- rb_audioscrobbler_service_get_old_radio_api_url (source->priv->service), |
523 |
+- source->priv->username, |
524 |
+- password_hash); |
525 |
+- |
526 |
+- rb_debug ("sending old api handshake request: %s", msg_url); |
527 |
+- msg = soup_message_new ("GET", msg_url); |
528 |
+- soup_session_queue_message (source->priv->soup_session, |
529 |
+- msg, |
530 |
+- old_api_handshake_response_cb, |
531 |
+- source); |
532 |
+- |
533 |
+- g_free (password_hash); |
534 |
+- g_free (msg_url); |
535 |
+- } else { |
536 |
-#ifdef WITH_GNOME_KEYRING |
537 |
- GnomeKeyringResult result; |
538 |
-+#ifdef WITH_LIBSECRET |
539 |
- char *password; |
540 |
-+ GError *error = NULL; |
541 |
- |
542 |
- rb_debug ("attempting to retrieve password from keyring"); |
543 |
+- char *password; |
544 |
+- |
545 |
+- rb_debug ("attempting to retrieve password from keyring"); |
546 |
- result = gnome_keyring_find_password_sync (GNOME_KEYRING_NETWORK_PASSWORD, |
547 |
- &password, |
548 |
- "user", source->priv->username, |
549 |
- "server", rb_audioscrobbler_service_get_name (source->priv->service), |
550 |
- NULL); |
551 |
-+ password = secret_password_lookup_sync (SECRET_SCHEMA_COMPAT_NETWORK, |
552 |
-+ NULL, &error, |
553 |
-+ "user", source->priv->username, |
554 |
-+ "server", rb_audioscrobbler_service_get_name (source->priv->service), |
555 |
-+ NULL); |
556 |
- |
557 |
+- |
558 |
- if (result == GNOME_KEYRING_RESULT_OK) { |
559 |
-+ if (password) { |
560 |
- source->priv->old_api_password = g_strdup (password); |
561 |
- rb_debug ("password found. shaking hands"); |
562 |
- old_api_shake_hands (source); |
563 |
- } else { |
564 |
+- source->priv->old_api_password = g_strdup (password); |
565 |
+- rb_debug ("password found. shaking hands"); |
566 |
+- old_api_shake_hands (source); |
567 |
+- } else { |
568 |
- rb_debug ("no password found"); |
569 |
-+ if (error) { |
570 |
-+ rb_debug ("unable to lookup password: %s", error->message); |
571 |
-+ g_error_free (error); |
572 |
-+ } else { |
573 |
-+ rb_debug ("no password found"); |
574 |
-+ } |
575 |
- #endif |
576 |
- rb_debug ("cannot shake hands. asking user for password"); |
577 |
- display_password_info_bar (source); |
578 |
- source->priv->is_busy = FALSE; |
579 |
+-#endif |
580 |
+- rb_debug ("cannot shake hands. asking user for password"); |
581 |
+- display_password_info_bar (source); |
582 |
+- source->priv->is_busy = FALSE; |
583 |
-#ifdef WITH_GNOME_KEYRING |
584 |
-+#ifdef WITH_LIBSECRET |
585 |
- } |
586 |
- #endif |
587 |
- } |
588 |
-@@ -1277,7 +1282,7 @@ password_info_bar_response_cb (GtkInfoBar *info_bar, |
589 |
- g_free (source->priv->old_api_password); |
590 |
- source->priv->old_api_password = g_strdup (gtk_entry_get_text (GTK_ENTRY (source->priv->password_info_bar_entry))); |
591 |
+- } |
592 |
+-#endif |
593 |
+- } |
594 |
+-} |
595 |
+- |
596 |
+-static void |
597 |
+-old_api_handshake_response_cb (SoupSession *session, |
598 |
+- SoupMessage *msg, |
599 |
+- gpointer user_data) |
600 |
+-{ |
601 |
+- RBAudioscrobblerRadioSource *source; |
602 |
+- |
603 |
+- source = RB_AUDIOSCROBBLER_RADIO_SOURCE (user_data); |
604 |
+- |
605 |
+- if (msg->response_body->data == NULL) { |
606 |
+- g_free (source->priv->old_api_session_id); |
607 |
+- source->priv->old_api_session_id = NULL; |
608 |
+- rb_debug ("handshake failed: no response"); |
609 |
+- display_error_info_bar (source, _("Error tuning station: no response")); |
610 |
+- } else { |
611 |
+- char **pieces; |
612 |
+- int i; |
613 |
+- |
614 |
+- pieces = g_strsplit (msg->response_body->data, "\n", 0); |
615 |
+- for (i = 0; pieces[i] != NULL; i++) { |
616 |
+- gchar **values = g_strsplit (pieces[i], "=", 2); |
617 |
+- |
618 |
+- if (values[0] == NULL) { |
619 |
+- rb_debug ("unexpected response content: %s", pieces[i]); |
620 |
+- } else if (strcmp (values[0], "session") == 0) { |
621 |
+- if (strcmp (values[1], "FAILED") == 0) { |
622 |
+- g_free (source->priv->old_api_session_id); |
623 |
+- source->priv->old_api_session_id = NULL; |
624 |
+- |
625 |
+- rb_debug ("handshake failed: probably bad authentication. asking user for new password"); |
626 |
+- g_free (source->priv->old_api_password); |
627 |
+- source->priv->old_api_password = NULL; |
628 |
+- display_password_info_bar (source); |
629 |
+- } else { |
630 |
+- g_free (source->priv->old_api_session_id); |
631 |
+- source->priv->old_api_session_id = g_strdup (values[1]); |
632 |
+- rb_debug ("session ID: %s", source->priv->old_api_session_id); |
633 |
+- } |
634 |
+- } else if (strcmp (values[0], "base_url") == 0) { |
635 |
+- g_free (source->priv->old_api_base_url); |
636 |
+- source->priv->old_api_base_url = g_strdup (values[1]); |
637 |
+- rb_debug ("base url: %s", source->priv->old_api_base_url); |
638 |
+- } else if (strcmp (values[0], "base_path") == 0) { |
639 |
+- g_free (source->priv->old_api_base_path); |
640 |
+- source->priv->old_api_base_path = g_strdup (values[1]); |
641 |
+- rb_debug ("base path: %s", source->priv->old_api_base_path); |
642 |
+- } else if (strcmp (values[0], "banned") == 0) { |
643 |
+- if (strcmp (values[1], "0") != 0) { |
644 |
+- source->priv->old_api_is_banned = TRUE; |
645 |
+- } else { |
646 |
+- source->priv->old_api_is_banned = FALSE; |
647 |
+- } |
648 |
+- rb_debug ("banned: %i", source->priv->old_api_is_banned); |
649 |
+- } |
650 |
+- |
651 |
+- g_strfreev (values); |
652 |
+- } |
653 |
+- g_strfreev (pieces); |
654 |
+- } |
655 |
+- |
656 |
+- /* if handshake was successful then tune */ |
657 |
+- if (source->priv->old_api_session_id != NULL) { |
658 |
+- old_api_tune (source); |
659 |
+- } else { |
660 |
+- source->priv->is_busy = FALSE; |
661 |
+- } |
662 |
+-} |
663 |
+- |
664 |
+-static void |
665 |
+-old_api_tune (RBAudioscrobblerRadioSource *source) |
666 |
+-{ |
667 |
+- /* get a handshake first if we don't have one */ |
668 |
+- if (source->priv->old_api_session_id == NULL) { |
669 |
+- old_api_shake_hands (source); |
670 |
+- } else { |
671 |
+- char *escaped_station_url; |
672 |
+- char *msg_url; |
673 |
+- SoupMessage *msg; |
674 |
+- |
675 |
+- escaped_station_url = g_uri_escape_string (source->priv->station_url, NULL, FALSE); |
676 |
+- |
677 |
+- msg_url = g_strdup_printf("http://%s%s/adjust.php?session=%s&url=%s", |
678 |
+- source->priv->old_api_base_url, |
679 |
+- source->priv->old_api_base_path, |
680 |
+- source->priv->old_api_session_id, |
681 |
+- escaped_station_url); |
682 |
+- |
683 |
+- rb_debug ("sending old api tune request: %s", msg_url); |
684 |
+- msg = soup_message_new ("GET", msg_url); |
685 |
+- soup_session_queue_message (source->priv->soup_session, |
686 |
+- msg, |
687 |
+- old_api_tune_response_cb, |
688 |
+- source); |
689 |
+- |
690 |
+- g_free (escaped_station_url); |
691 |
+- g_free (msg_url); |
692 |
+- } |
693 |
+-} |
694 |
+- |
695 |
+-static void |
696 |
+-old_api_tune_response_cb (SoupSession *session, |
697 |
+- SoupMessage *msg, |
698 |
+- gpointer user_data) |
699 |
+-{ |
700 |
+- RBAudioscrobblerRadioSource *source; |
701 |
+- |
702 |
+- source = RB_AUDIOSCROBBLER_RADIO_SOURCE (user_data); |
703 |
+- |
704 |
+- if (msg->response_body->data != NULL) { |
705 |
+- char **pieces; |
706 |
+- int i; |
707 |
+- |
708 |
+- pieces = g_strsplit (msg->response_body->data, "\n", 0); |
709 |
+- for (i = 0; pieces[i] != NULL; i++) { |
710 |
+- gchar **values = g_strsplit (pieces[i], "=", 2); |
711 |
+- |
712 |
+- if (values[0] == NULL) { |
713 |
+- rb_debug ("unexpected response from old api tune request: %s", pieces[i]); |
714 |
+- } else if (strcmp (values[0], "response") == 0) { |
715 |
+- if (strcmp (values[1], "OK") == 0) { |
716 |
+- rb_debug ("old api tune request was successful"); |
717 |
+- /* no problems tuning, get the playlist */ |
718 |
+- old_api_fetch_playlist (source); |
719 |
+- } |
720 |
+- } else if (strcmp (values[0], "error") == 0) { |
721 |
+- char *error_message; |
722 |
+- rb_debug ("old api tune request responded with error: %s", pieces[i]); |
723 |
+- |
724 |
+- error_message = g_strdup_printf (_("Error tuning station: %s"), values[1]); |
725 |
+- |
726 |
+- |
727 |
+- g_free (error_message); |
728 |
+- |
729 |
+- source->priv->is_busy = FALSE; |
730 |
+- } |
731 |
+- /* TODO: do something with other information given here */ |
732 |
+- |
733 |
+- g_strfreev (values); |
734 |
+- } |
735 |
+- |
736 |
+- g_strfreev (pieces); |
737 |
+- } else { |
738 |
+- rb_debug ("no response from old api tune request"); |
739 |
+- display_error_info_bar (source, _("Error tuning station: no response")); |
740 |
+- source->priv->is_busy = FALSE; |
741 |
+- } |
742 |
+-} |
743 |
+- |
744 |
+-static void |
745 |
+-old_api_fetch_playlist (RBAudioscrobblerRadioSource *source) |
746 |
+-{ |
747 |
+- char *msg_url; |
748 |
+- SoupMessage *msg; |
749 |
+- |
750 |
+- msg_url = g_strdup_printf("http://%s%s/xspf.php?sk=%s&discovery=%i&desktop=%s", |
751 |
+- source->priv->old_api_base_url, |
752 |
+- source->priv->old_api_base_path, |
753 |
+- source->priv->old_api_session_id, |
754 |
+- 0, |
755 |
+- "1.5"); |
756 |
+- |
757 |
+- rb_debug ("sending old api playlist request: %s", msg_url); |
758 |
+- msg = soup_message_new ("GET", msg_url); |
759 |
+- soup_session_queue_message (source->priv->soup_session, |
760 |
+- msg, |
761 |
+- fetch_playlist_response_cb, |
762 |
+- source); |
763 |
+- |
764 |
+- g_free (msg_url); |
765 |
+-} |
766 |
+- |
767 |
+-static void |
768 |
+ display_error_info_bar (RBAudioscrobblerRadioSource *source, |
769 |
+ const char *message) |
770 |
+ { |
771 |
+@@ -1261,46 +978,6 @@ display_error_info_bar (RBAudioscrobblerRadioSource *source, |
772 |
+ gtk_widget_show_all (source->priv->error_info_bar); |
773 |
+ } |
774 |
|
775 |
+-static void |
776 |
+-display_password_info_bar (RBAudioscrobblerRadioSource *source) |
777 |
+-{ |
778 |
+- gtk_widget_show_all (source->priv->password_info_bar); |
779 |
+-} |
780 |
+- |
781 |
+-static void |
782 |
+-password_info_bar_response_cb (GtkInfoBar *info_bar, |
783 |
+- int response_id, |
784 |
+- RBAudioscrobblerRadioSource *source) |
785 |
+-{ |
786 |
+- gtk_widget_hide (source->priv->password_info_bar); |
787 |
+- |
788 |
+- g_free (source->priv->old_api_password); |
789 |
+- source->priv->old_api_password = g_strdup (gtk_entry_get_text (GTK_ENTRY (source->priv->password_info_bar_entry))); |
790 |
+- |
791 |
-#ifdef WITH_GNOME_KEYRING |
792 |
-+#ifdef WITH_LIBSECRET |
793 |
- /* save the new password */ |
794 |
- char *password_desc; |
795 |
- |
796 |
-@@ -1285,13 +1290,14 @@ password_info_bar_response_cb (GtkInfoBar *info_bar, |
797 |
- rb_audioscrobbler_service_get_name (source->priv->service)); |
798 |
- |
799 |
- rb_debug ("saving password to keyring"); |
800 |
+- /* save the new password */ |
801 |
+- char *password_desc; |
802 |
+- |
803 |
+- password_desc = g_strdup_printf (_("Password for streaming %s radio using the deprecated API"), |
804 |
+- rb_audioscrobbler_service_get_name (source->priv->service)); |
805 |
+- |
806 |
+- rb_debug ("saving password to keyring"); |
807 |
- gnome_keyring_store_password_sync (GNOME_KEYRING_NETWORK_PASSWORD, |
808 |
- GNOME_KEYRING_DEFAULT, |
809 |
- password_desc, |
810 |
@@ -175,17 +576,32 @@ index 6f5f3cf..9735537 100644 |
811 |
- "user", source->priv->username, |
812 |
- "server", rb_audioscrobbler_service_get_name (source->priv->service), |
813 |
- NULL); |
814 |
-+ secret_password_store_sync (SECRET_SCHEMA_COMPAT_NETWORK, |
815 |
-+ NULL, |
816 |
-+ password_desc, |
817 |
-+ source->priv->old_api_password, |
818 |
-+ NULL, NULL, |
819 |
-+ "user", source->priv->username, |
820 |
-+ "server", rb_audioscrobbler_service_get_name (source->priv->service), |
821 |
-+ NULL); |
822 |
- |
823 |
- g_free (password_desc); |
824 |
- #endif |
825 |
+- |
826 |
+- g_free (password_desc); |
827 |
+-#endif |
828 |
+- |
829 |
+- gtk_entry_set_text (GTK_ENTRY (source->priv->password_info_bar_entry), ""); |
830 |
+- |
831 |
+- old_api_shake_hands (source); |
832 |
+-} |
833 |
+- |
834 |
+ static gboolean |
835 |
+ impl_can_remove (RBDisplayPage *page) |
836 |
+ { |
837 |
+diff --git a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.h b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.h |
838 |
+index f38d857..08bb4a0 100644 |
839 |
+--- a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.h |
840 |
++++ b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.h |
841 |
+@@ -86,9 +86,6 @@ RBSource *rb_audioscrobbler_radio_source_new (RBAudioscrobblerProfilePage *paren |
842 |
+ const char *station_name, |
843 |
+ const char *station_url); |
844 |
+ |
845 |
+-void rb_audioscrobbler_radio_source_set_old_api_password (RBAudioscrobblerRadioSource *source, |
846 |
+- const char *password); |
847 |
+- |
848 |
+ G_END_DECLS |
849 |
+ |
850 |
+ #endif /* __RB_AUDIOSCROBBLER_RADIO_SOURCE_H */ |
851 |
diff --git a/plugins/daap/Makefile.am b/plugins/daap/Makefile.am |
852 |
index b950bef..f4bb907 100644 |
853 |
--- a/plugins/daap/Makefile.am |
854 |
@@ -350,6 +766,130 @@ index fb034f9..75e0dc4 100644 |
855 |
#endif |
856 |
} |
857 |
|
858 |
+diff --git a/plugins/magnatune/MagnatuneAccount.py b/plugins/magnatune/MagnatuneAccount.py |
859 |
+index f8cf81b..93b04c9 100644 |
860 |
+--- a/plugins/magnatune/MagnatuneAccount.py |
861 |
++++ b/plugins/magnatune/MagnatuneAccount.py |
862 |
+@@ -1,4 +1,5 @@ |
863 |
+ # -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*- |
864 |
++# vim: set sts=0 ts=8 sw=8 tw=0 noet : |
865 |
+ # |
866 |
+ # Copyright (C) 2012 Jonathan Matthew <jonathan@××××.org> |
867 |
+ # |
868 |
+@@ -24,10 +25,25 @@ |
869 |
+ # along with this program; if not, write to the Free Software |
870 |
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
871 |
+ |
872 |
+-from gi.repository import Gio, GnomeKeyring |
873 |
++from gi.repository import Gio |
874 |
++ |
875 |
++# Till libsecret completely replaces gnome-keyring, we'll fall back to not |
876 |
++# saving the password if libsecret can't be found. This code can be removed later. |
877 |
++try: |
878 |
++ from gi.repository import Secret, SecretUnstable |
879 |
++ # We need to be able to fetch passwords stored by libgnome-keyring, so we use |
880 |
++ # a schema with SECRET_SCHEMA_DONT_MATCH_NAME set. |
881 |
++ # See: http://developer.gnome.org/libsecret/unstable/migrating-schemas.html |
882 |
++ MAGNATUNE_SCHEMA = Secret.Schema.new("org.gnome.rhythmbox.plugins.magnatune", |
883 |
++ Secret.SchemaFlags.DONT_MATCH_NAME, |
884 |
++ {"rhythmbox-plugin": Secret.SchemaAttributeType.STRING}) |
885 |
++except ImportError: |
886 |
++ Secret = None |
887 |
++ print ("You need to install libsecret and its introspection files to store your Magnatune password") |
888 |
+ |
889 |
+ __instance = None |
890 |
+ |
891 |
++ |
892 |
+ def instance(): |
893 |
+ global __instance |
894 |
+ if __instance is None: |
895 |
+@@ -36,54 +52,48 @@ def instance(): |
896 |
+ |
897 |
+ class MagnatuneAccount(object): |
898 |
+ def __init__(self): |
899 |
+- self.keyring_item = None |
900 |
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune") |
901 |
+- |
902 |
+- self.keyring_attributes = GnomeKeyring.attribute_list_new() |
903 |
+- GnomeKeyring.attribute_list_append_string(self.keyring_attributes, |
904 |
+- "rhythmbox-plugin", |
905 |
+- "magnatune") |
906 |
+- (result, items) = GnomeKeyring.find_items_sync(GnomeKeyring.ItemType.GENERIC_SECRET, |
907 |
+- self.keyring_attributes) |
908 |
+- if result == GnomeKeyring.Result.OK and len(items) != 0: |
909 |
+- (result, item) = GnomeKeyring.item_get_info_sync(None, items[0].item_id) |
910 |
+- if result == GnomeKeyring.Result.OK: |
911 |
+- self.keyring_item = item |
912 |
+- else: |
913 |
+- print "Couldn't get keyring item: " + GnomeKeyring.result_to_message(result) |
914 |
+- else: |
915 |
+- print "couldn't search keyring items: " + GnomeKeyring.result_to_message(result) |
916 |
++ self.secret = None |
917 |
++ self.keyring_attributes = {"rhythmbox-plugin": "magnatune"} |
918 |
++ if Secret is None: |
919 |
++ print ("Account details will not be saved because libsecret was not found") |
920 |
++ return |
921 |
++ # Haha. |
922 |
++ self.secret_service = SecretUnstable.Service.get_sync(SecretUnstable.ServiceFlags.OPEN_SESSION, None) |
923 |
++ items = self.secret_service.search_sync(MAGNATUNE_SCHEMA, |
924 |
++ self.keyring_attributes, |
925 |
++ SecretUnstable.SearchFlags.LOAD_SECRETS, |
926 |
++ None) |
927 |
++ if not items: |
928 |
++ # The Python API doesn't seem to have a way to differentiate between errors and no results. |
929 |
++ print ("Couldn't find an existing keyring entry") |
930 |
++ return |
931 |
++ self.secret = items[0].get_secret().get() |
932 |
+ |
933 |
+ def get(self): |
934 |
+- if self.keyring_item is None: |
935 |
++ if self.secret is None: |
936 |
+ return ('none', None, None) |
937 |
+ |
938 |
+ account_type = self.settings['account-type'] |
939 |
+ try: |
940 |
+- (username, password) = self.keyring_item.get_secret().split("\n") |
941 |
++ (username, password) = self.secret.split("\n") |
942 |
+ return (account_type, username, password) |
943 |
+ except ValueError: |
944 |
+ return ('none', None, None) |
945 |
+ |
946 |
+ def update(self, username, password): |
947 |
+ secret = '\n'.join((username, password)) |
948 |
+- if self.keyring_item is not None: |
949 |
+- if secret == self.keyring_item.get_secret(): |
950 |
+- print "account details not changed" |
951 |
+- return |
952 |
+- |
953 |
+- (result, id) = GnomeKeyring.item_create_sync(None, |
954 |
+- GnomeKeyring.ItemType.GENERIC_SECRET, |
955 |
+- "Rhythmbox: Magnatune account information", |
956 |
+- self.keyring_attributes, |
957 |
+- secret, |
958 |
+- True) |
959 |
+- if result == GnomeKeyring.Result.OK: |
960 |
+- if self.keyring_item is None: |
961 |
+- (result, item) = GnomeKeyring.item_get_info_sync(None, id) |
962 |
+- if result == GnomeKeyring.Result.OK: |
963 |
+- self.keyring_item = item |
964 |
+- else: |
965 |
+- print "couldn't fetch keyring itme: " + GnomeKeyring.result_to_message(result) |
966 |
+- else: |
967 |
+- print "couldn't create keyring item: " + GnomeKeyring.result_to_message(result) |
968 |
++ if secret == self.secret: |
969 |
++ print ("Account details not changed") |
970 |
++ return |
971 |
++ self.secret = secret |
972 |
++ if Secret is None: |
973 |
++ print ("Account details were not saved because libsecret was not found") |
974 |
++ return |
975 |
++ result = Secret.password_store_sync(MAGNATUNE_SCHEMA, |
976 |
++ self.keyring_attributes, |
977 |
++ Secret.COLLECTION_DEFAULT, |
978 |
++ "Rhythmbox: Magnatune account information", |
979 |
++ secret, None) |
980 |
++ if not result: |
981 |
++ print ("Couldn't create keyring item!") |
982 |
-- |
983 |
1.7.12.4 |
984 |
|
985 |
|
986 |
diff --git a/media-sound/rhythmbox/rhythmbox-9999.ebuild b/media-sound/rhythmbox/rhythmbox-9999.ebuild |
987 |
index ecb64c2..b66fd8d 100644 |
988 |
--- a/media-sound/rhythmbox/rhythmbox-9999.ebuild |
989 |
+++ b/media-sound/rhythmbox/rhythmbox-9999.ebuild |
990 |
@@ -18,7 +18,7 @@ HOMEPAGE="http://www.rhythmbox.org/" |
991 |
|
992 |
LICENSE="GPL-2" |
993 |
SLOT="0" |
994 |
-IUSE="cdr daap dbus doc keyring html ipod libnotify lirc mtp nsplugin +python |
995 |
+IUSE="cdr daap dbus doc +keyring html ipod libnotify lirc mtp nsplugin +python |
996 |
test +udev upnp-av visualizer webkit zeitgeist" |
997 |
if [[ ${PV} = 9999 ]]; then |
998 |
KEYWORDS="" |
999 |
@@ -58,7 +58,7 @@ COMMON_DEPEND=">=dev-libs/glib-2.32.0:2 |
1000 |
>=net-libs/libdmapsharing-2.9.16:3.0 |
1001 |
>=net-dns/avahi-0.6 |
1002 |
media-plugins/gst-plugins-soup:1.0 ) |
1003 |
- keyring? ( app-crypt/libsecret ) |
1004 |
+ keyring? ( >=app-crypt/libsecret-0.14 ) |
1005 |
html? ( >=net-libs/webkit-gtk-1.3.9:3 ) |
1006 |
libnotify? ( >=x11-libs/libnotify-0.7.0 ) |
1007 |
lirc? ( app-misc/lirc ) |
1008 |
@@ -87,7 +87,7 @@ RDEPEND="${COMMON_DEPEND} |
1009 |
x11-libs/pango[introspection] |
1010 |
|
1011 |
dbus? ( sys-apps/dbus ) |
1012 |
- keyring? ( >=app-crypt/libsecret-0.13[introspection] ) |
1013 |
+ keyring? ( >=app-crypt/libsecret-0.14[introspection] ) |
1014 |
webkit? ( |
1015 |
dev-python/mako |
1016 |
>=net-libs/webkit-gtk-1.3.9:3[introspection] ) ) |
1017 |
@@ -130,7 +130,7 @@ pkg_setup() { |
1018 |
$(use_enable upnp-av grilo) |
1019 |
$(use_with cdr brasero) |
1020 |
$(use_with daap mdns avahi) |
1021 |
- $(use_with keyring) |
1022 |
+ $(use_with keyring libsecret) |
1023 |
$(use_with html webkit) |
1024 |
$(use_with ipod) |
1025 |
$(use_with mtp) |
1026 |
@@ -143,7 +143,6 @@ src_prepare() { |
1027 |
gnome2_src_prepare |
1028 |
# https://bugzilla.gnome.org/show_bug.cgi?id=694981 |
1029 |
epatch "${FILESDIR}/${PN}-port-to-libsecret.patch" |
1030 |
- epatch "${FILESDIR}/${PN}-port-magnatune-to-libsecret.patch" |
1031 |
echo > py-compile |
1032 |
} |