Merge lp:~dobey/rhythmbox-ubuntuone/oh-a-store into lp:rhythmbox-ubuntuone

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 108
Merged at revision: 107
Proposed branch: lp:~dobey/rhythmbox-ubuntuone/oh-a-store
Merge into: lp:rhythmbox-ubuntuone
Diff against target: 132 lines (+22/-25)
3 files modified
setup.py (+0/-1)
ubuntuone/MusicStoreWidget.py (+16/-18)
ubuntuone/ubuntuone.py (+6/-6)
To merge this branch: bzr merge lp:~dobey/rhythmbox-ubuntuone/oh-a-store
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+90551@code.launchpad.net

Commit message

Use the new UbuntuOneUI library for a gtk+ 3.0 based plug-in

Description of the change

This is a fully working Ubuntu One plug-in for Rhythmbox 3.0. It requires lp:~dobey/libubuntuone/split-ui-lib to work. To test you can do the following, inside a branch of lp:~dobey/rhythmbox-ubuntuone/oh-a-store:

bzr branch lp:~dobey/libubuntuone/split-ui-lib
(cd split-ui-lib && ./autogen.sh && make U1_JAVASCRIPT_DIR=`pwd`/data)
./setup.py build
mkdir -p ~/.local/share/rhythmbox/plugins
cp -a ubuntuone ~/.local/share/rhythmbox/plugins
cp build/lib/rhythmbox/plugins/ubuntuone/ubuntuone.plugin ~/.local/share/rhythmbox/plugins/ubuntuone/
LD_PRELOAD=`pwd`/split-ui-lib/libubuntuoneui/.libs/libubuntuoneui-3.0.so.1.0.0 GI_TYPELIB_PATH=`pwd`/split-ui-lib/libubuntuoneui rhythmbox

Then enable the plug-in in Edit->Plugins in rhythmbox, and Ubuntu One should appear in the tree on the left. Once you click on it, you should see the music store come up.

Note: For some reason, the MP3 warning comes up regardless of whether MP3s are playable. I am not sure why this is, but will debug it later, and simply consider it a bug that needs to be fixed before 12.04 freeze. I will open a bug on it.

To post a comment you must log in.
108. By dobey

Add a FIXME? re: source.delete_thyself() which no longer exists

Revision history for this message
Manuel de la Peña (mandel) wrote :

Got it working.

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2012-01-19 15:22:32 +0000
+++ setup.py 2012-01-31 15:07:52 +0000
@@ -18,4 +18,3 @@
18 'ubuntuone/MusicStoreWidget.py',18 'ubuntuone/MusicStoreWidget.py',
19 ])],19 ])],
20 )20 )
21
2221
=== modified file 'ubuntuone/MusicStoreWidget.py'
--- ubuntuone/MusicStoreWidget.py 2012-01-12 21:34:43 +0000
+++ ubuntuone/MusicStoreWidget.py 2012-01-31 15:07:52 +0000
@@ -19,23 +19,19 @@
19import stat19import stat
20import urlparse20import urlparse
2121
22# pylint: disable=E061122# pylint: disable=E0611,F0401
23from gi.repository import Gio, GObject, Gtk, RB23from gi.repository import Gio, GObject, Gtk, RB
24# pylint: enable=E061124from gi.repository.UbuntuOneUI import MusicStore as U1MusicStore
25# pylint: enable=E0611,F0401
2526
26from dirspec import basedir27from dirspec import basedir
27from gettext import lgettext as _28from gettext import lgettext as _
28#from ubuntuone.gtkwidgets import MusicStore as U1MusicStore29
2930gettext.bindtextdomain("rhythmbox-ubuntuone", "/usr/share/locale")
30gettext.bindtextdomain("rhythmbox-ubuntuone-music-store", "/usr/share/locale")31gettext.textdomain("rhythmbox-ubuntuone")
31gettext.textdomain("rhythmbox-ubuntuone-music-store")32
3233MUSIC_STORE_WIDGET = U1MusicStore()
33MUSIC_STORE_WIDGET = Gtk.EventBox() # keep this around for later
34U1LIBRARYPATH = MUSIC_STORE_WIDGET.get_library_location()34U1LIBRARYPATH = MUSIC_STORE_WIDGET.get_library_location()
35RB_LIBRARY_LOCATIONS = "/apps/rhythmbox/library_locations"
36PARTNER_LIST = "canonical-partner-maverick.list"
37SOURCES_DIR = "/etc/apt/sources.list.d/"
38PLUGIN_PACKAGENAME = "gstreamer0.10-fluendo-plugins-mp3-partner"
3935
4036
41class U1EntryType(RB.RhythmDBEntryType):37class U1EntryType(RB.RhythmDBEntryType):
@@ -66,10 +62,10 @@
66 def activate(self, shell):62 def activate(self, shell):
67 """Plugin startup."""63 """Plugin startup."""
68 self.db = shell.get_property("db")64 self.db = shell.get_property("db")
69 group = RB.rb_display_page_group_get_by_id("stores")65 group = RB.DisplayPageGroup.get_by_id("stores")
7066
71 icon = Gtk.IconTheme.get_default().load_icon(67 icon = Gtk.IconTheme.get_default().load_icon(
72 "ubuntuone", Gtk.IconSize.lookup(Gtk.IconSize.MENU)[0], 0)68 "ubuntuone", 24, 0)
7369
74 self.db.register_entry_type(self.entry_type)70 self.db.register_entry_type(self.entry_type)
7571
@@ -93,7 +89,9 @@
93 def deactivate(self, shell):89 def deactivate(self, shell):
94 """Plugin shutdown."""90 """Plugin shutdown."""
95 # remove source91 # remove source
96 self.source.delete_thyself()92 # FIXME?: This API changed, but doesn't seem entirely necessary.
93 # It's not entirely clear which API to use for this now.
94 #self.source.delete_thyself()
97 # delete held references95 # delete held references
98 del self.db96 del self.db
99 del self.source97 del self.source
@@ -122,7 +120,7 @@
122 library_path = os.path.join(self.u1_library_symlink, subpath)120 library_path = os.path.join(self.u1_library_symlink, subpath)
123 # convert path to URI. Don't use urllib for this; Python and121 # convert path to URI. Don't use urllib for this; Python and
124 # glib escape URLs differently. gio does it the glib way.122 # glib escape URLs differently. gio does it the glib way.
125 library_uri = Gio.File(library_path).get_uri()123 library_uri = Gio.File.new_for_path(library_path).get_uri()
126 return library_uri124 return library_uri
127125
128 def download_finished(self, source, path):126 def download_finished(self, source, path):
@@ -198,7 +196,7 @@
198 """A Rhythmbox source widget for the U1 Music Store."""196 """A Rhythmbox source widget for the U1 Music Store."""
199 # gproperties required so that rb.Source is instantiable197 # gproperties required so that rb.Source is instantiable
200 __gproperties__ = {198 __gproperties__ = {
201 'plugin': (RB.Plugin, 'plugin', 'plugin',199 'plugin': (GObject.GObject, 'plugin', 'plugin',
202 GObject.PARAM_WRITABLE | GObject.PARAM_CONSTRUCT_ONLY),200 GObject.PARAM_WRITABLE | GObject.PARAM_CONSTRUCT_ONLY),
203 }201 }
204 # we have the preview-mp3 signal; we receive it from the widget, and202 # we have the preview-mp3 signal; we receive it from the widget, and
@@ -286,7 +284,7 @@
286 def re_emit_urlloaded(self, widget, url):284 def re_emit_urlloaded(self, widget, url):
287 """Handle the url-loaded signal and re-emit it."""285 """Handle the url-loaded signal and re-emit it."""
288 # pylint: disable=E1101286 # pylint: disable=E1101
289 self.signal_emit_by_name("url-loaded", url)287 self.emit("url-loaded", url)
290288
291 def do_set_property(self, prop, value):289 def do_set_property(self, prop, value):
292 """Allow property settings to handle the plug-in call."""290 """Allow property settings to handle the plug-in call."""
293291
=== modified file 'ubuntuone/ubuntuone.py'
--- ubuntuone/ubuntuone.py 2012-01-14 01:59:34 +0000
+++ ubuntuone/ubuntuone.py 2012-01-31 15:07:52 +0000
@@ -20,9 +20,9 @@
20from gi.repository import Gio, GLib, GObject, Peas20from gi.repository import Gio, GLib, GObject, Peas
21# pylint: enable=E061121# pylint: enable=E0611
2222
23# We aren't actually providing a music store widget at the moment,23# pylint: disable=W0403
24# as libu1 needs to be ported to gtk3 first. We may add it back later.24from MusicStoreWidget import U1MusicStoreWidget
25#from MusicStoreWidget import U1MusicStoreWidget25# pylint: enable=W0403
2626
2727
28class UbuntuOnePlugin (GObject.GObject, Peas.Activatable):28class UbuntuOnePlugin (GObject.GObject, Peas.Activatable):
@@ -43,7 +43,7 @@
43 self.rdbconf.connect('changed::locations', self._locations_changed)43 self.rdbconf.connect('changed::locations', self._locations_changed)
4444
45 # The Music Store itself45 # The Music Store itself
46 #self.music_store_widget = U1MusicStoreWidget(plugin=self)46 self.music_store_widget = U1MusicStoreWidget(plugin=self)
4747
48 def _locations_changed(self, *args, **kwargs):48 def _locations_changed(self, *args, **kwargs):
49 """Handle the locations setting being changed."""49 """Handle the locations setting being changed."""
@@ -56,8 +56,8 @@
56 """Plug-in startup."""56 """Plug-in startup."""
57 # Add the Ubuntu One purchased music directory if not already added57 # Add the Ubuntu One purchased music directory if not already added
58 self._locations_changed()58 self._locations_changed()
59 #self.music_store_widget.activate(shell)59 self.music_store_widget.activate(self.object)
6060
61 def do_deactivate(self):61 def do_deactivate(self):
62 """Plug-in shutdown."""62 """Plug-in shutdown."""
63 #self.music_store_widget.deactivate(shell)63 self.music_store_widget.deactivate(self.object)

Subscribers

People subscribed via source and target branches