Merge lp:~dobey/rhythmbox-ubuntuone/url-handler into lp:rhythmbox-ubuntuone

Proposed by dobey on 2012-03-06
Status: Merged
Approved by: dobey on 2012-03-06
Approved revision: 111
Merged at revision: 111
Proposed branch: lp:~dobey/rhythmbox-ubuntuone/url-handler
Merge into: lp:rhythmbox-ubuntuone
Diff against target: 80 lines (+22/-6)
5 files modified
MANIFEST.in (+1/-0)
po/POTFILES.in (+1/-0)
rhythmbox-ubuntuone.desktop.in (+12/-0)
setup.cfg (+1/-1)
ubuntuone/MusicStoreWidget.py (+7/-5)
To merge this branch: bzr merge lp:~dobey/rhythmbox-ubuntuone/url-handler
Reviewer Review Type Date Requested Status
Natalia Bidart 2012-03-06 Approve on 2012-03-06
Eric Casteleijn (community) Approve on 2012-03-06
Review via email: mp+96045@code.launchpad.net

Commit Message

Add a .desktop file for registering rhythmbox as the u1ms:// url handler when rhythmbox-ubuntuone is installed
Fix the url handling API inside the plug-in to align with new Rhythmbox API

Description of the Change

This depends on https://code.launchpad.net/~dobey/libubuntuone/u1ms-load-fixes/+merge/96046 landing, to fully work correctly.

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Shouldn't this be at the same level than the "if callback is not None" guard?

76 + if destroy_data is not None:
77 + destroy_data(callback_data)

review: Needs Information
dobey (dobey) wrote :

Natlia, I don't think so, as passing in destroy_data nd callback_data arguments without a callback makes no sense.

From the documentation:

 * @callback: a callback function to call when complete
 * @data: data to pass to the callback
 * @destroy_data: function to call to destroy the callback data

Eric Casteleijn (thisfred) :
review: Approve
Natalia Bidart (nataliabidart) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MANIFEST.in'
2--- MANIFEST.in 2012-02-02 19:27:36 +0000
3+++ MANIFEST.in 2012-03-06 03:33:18 +0000
4@@ -1,4 +1,5 @@
5 include COPYING COPYING.LIB MANIFEST.in README
6 include run-tests
7+include rhythmbox-ubuntuone.desktop.in
8 recursive-include po *.po POTFILES.in
9 recursive-include ubuntuone *.py *.in
10
11=== modified file 'po/POTFILES.in'
12--- po/POTFILES.in 2012-01-14 01:59:34 +0000
13+++ po/POTFILES.in 2012-03-06 03:33:18 +0000
14@@ -1,3 +1,4 @@
15+rhythmbox-ubuntuone.desktop.in
16 ubuntuone/ubuntuone.py
17 ubuntuone/MusicStoreWidget.py
18 [type: gettext/ini]ubuntuone/ubuntuone.plugin.in
19
20=== added file 'rhythmbox-ubuntuone.desktop.in'
21--- rhythmbox-ubuntuone.desktop.in 1970-01-01 00:00:00 +0000
22+++ rhythmbox-ubuntuone.desktop.in 2012-03-06 03:33:18 +0000
23@@ -0,0 +1,12 @@
24+[Desktop Entry]
25+Name=Ubuntu One Music Store
26+_Comment=Purchase musc on Ubuntu One in Rhythmbox
27+Exec=rhythmbox %U
28+Terminal=false
29+Type=Application
30+Icon=rhythmbox
31+Categories=GNOME;GTK;AudioVideo;
32+MimeType=x-scheme-handler/u1ms
33+StartupNotify=true
34+X-Ubuntu-Gettext-Domain=rhythmbox-ubuntuone
35+NoDisplay=true
36
37=== modified file 'setup.cfg'
38--- setup.cfg 2012-01-14 01:59:34 +0000
39+++ setup.cfg 2012-03-06 03:33:18 +0000
40@@ -1,2 +1,2 @@
41 [build_i18n]
42-desktop_files=[("lib/rhythmbox/plugins/ubuntuone", ("ubuntuone/ubuntuone.plugin.in",))]
43+desktop_files=[("lib/rhythmbox/plugins/ubuntuone", ("ubuntuone/ubuntuone.plugin.in",)), ("share/applications", ("rhythmbox-ubuntuone.desktop.in",))]
44
45=== modified file 'ubuntuone/MusicStoreWidget.py'
46--- ubuntuone/MusicStoreWidget.py 2012-01-31 15:04:32 +0000
47+++ ubuntuone/MusicStoreWidget.py 2012-03-06 03:33:18 +0000
48@@ -99,7 +99,6 @@
49
50 def url_loaded(self, source, url):
51 """A URL is loaded in the plugin"""
52- print "URL loaded:", url
53 if urlparse.urlparse(url)[2] == "https":
54 pass
55 else:
56@@ -233,17 +232,20 @@
57 return 100
58 return 0
59
60- def do_impl_add_uri(self, uri, title, genre):
61+ def do_impl_add_uri(self, uri, title, genre, callback=None,
62+ callback_data=None, destroy_data=None):
63 """Handle a u1ms URL"""
64 if not uri.startswith("u1ms://"):
65- return False
66+ return
67 uri_to_use = uri.replace("u1ms://", "http://")
68- print "Calling u1musicstore plugin with %s" % uri_to_use
69 # pylint: disable=E1101
70 shell = self.get_property("shell")
71 shell.props.display_page_tree.select(self)
72 self.browser.load_store_link(uri_to_use)
73- return True
74+ if callback is not None:
75+ callback(callback_data)
76+ if destroy_data is not None:
77+ destroy_data(callback_data)
78
79 def add_music_store_widget(self):
80 """Display the music store widget in Rhythmbox."""

Subscribers

People subscribed via source and target branches