Merge lp:~sil/libubuntuone/send-play-signal into lp:libubuntuone

Proposed by Stuart Langridge
Status: Merged
Approved by: Elliot Murphy
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~sil/libubuntuone/send-play-signal
Merge into: lp:libubuntuone
Diff against target: 97 lines (+37/-2)
4 files modified
data/Makefile.am (+2/-1)
data/u1-songs-clickable.js (+10/-0)
libubuntuone/u1-music-store.c (+24/-1)
libubuntuone/u1-music-store.h (+1/-0)
To merge this branch: bzr merge lp:~sil/libubuntuone/send-play-signal
Reviewer Review Type Date Requested Status
Elliot Murphy (community) Approve
Review via email: mp+19480@code.launchpad.net

Commit message

Inject JavaScript to allow clicking a song on the library page; when clicked, emit a signal with the song path

To post a comment you must log in.
Revision history for this message
Stuart Langridge (sil) wrote :

Inject JavaScript to allow clicking a song on the library page; when clicked, emit a signal with the song path

Revision history for this message
Elliot Murphy (statik) :
review: Approve
Revision history for this message
Elliot Murphy (statik) wrote :

The attempt to merge lp:~sil/libubuntuone/send-play-signal into lp:libubuntuone failed.Below is the output from the failed tests.

make: *** No rule to make target `distcheck'. Stop.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/Makefile.am'
2--- data/Makefile.am 2010-01-28 15:46:48 +0000
3+++ data/Makefile.am 2010-02-17 12:59:14 +0000
4@@ -1,6 +1,7 @@
5 jsdir = $(U1_JAVASCRIPT_DIR)
6 js_DATA = \
7 u1-library-override.js \
8- u1-preview.js
9+ u1-preview.js \
10+ u1-songs-clickable.js
11
12 EXTRA_DIST = $(js_DATA)
13
14=== added file 'data/u1-songs-clickable.js'
15--- data/u1-songs-clickable.js 1970-01-01 00:00:00 +0000
16+++ data/u1-songs-clickable.js 2010-02-17 12:59:14 +0000
17@@ -0,0 +1,10 @@
18+(function(){
19+ var songs = document.querySelectorAll("#downloads li div.metadata");
20+ for (var i=0; i<songs.length; i++) {
21+ songs[i].onclick = function(){
22+ var dp = this.parentNode.getAttribute("data-path")
23+ window.status = "u1playlibrary:::" + dp;
24+ return false;
25+ }
26+ }
27+})()
28
29=== modified file 'libubuntuone/u1-music-store.c'
30--- libubuntuone/u1-music-store.c 2010-02-15 15:50:53 +0000
31+++ libubuntuone/u1-music-store.c 2010-02-17 12:59:14 +0000
32@@ -50,6 +50,7 @@
33
34 enum {
35 PREVIEW_MP3_SIGNAL,
36+ PLAY_LIBRARY_SIGNAL,
37 LAST_SIGNAL
38 };
39
40@@ -88,6 +89,15 @@
41 _u1_marshal_VOID__STRING_STRING,
42 G_TYPE_NONE, 2,
43 G_TYPE_STRING, G_TYPE_STRING);
44+ u1_music_store_signals[PLAY_LIBRARY_SIGNAL] = g_signal_new ("play-library",
45+ G_TYPE_FROM_CLASS (klass),
46+ (GSignalFlags) G_SIGNAL_RUN_LAST,
47+ G_STRUCT_OFFSET (U1MusicStoreClass, play_library),
48+ NULL,
49+ NULL,
50+ _u1_marshal_VOID__STRING_STRING,
51+ G_TYPE_NONE, 1,
52+ G_TYPE_STRING);
53 object_class->finalize = u1_music_store_finalize;
54 }
55
56@@ -412,8 +422,12 @@
57
58 /* If the URL just loaded is the library page, update download status */
59 tmp_url = g_strdup_printf ("%s%s", music_store->priv->base_url, U1_LIBRARY_URL);
60- if (g_str_has_prefix (webkit_web_view_get_uri (web_view), tmp_url))
61+ if (g_str_has_prefix (webkit_web_view_get_uri (web_view), tmp_url)) {
62 update_status_in_library_page (web_view, frame);
63+ /* Inject JavaScript to make songs clickable */
64+ execute_script (web_view, "u1-songs-clickable.js", NULL);
65+
66+ }
67
68 g_free (tmp_url);
69 }
70@@ -432,6 +446,15 @@
71 g_strfreev (args);
72 }
73 }
74+ if (g_str_has_prefix (text, "u1playlibrary:::")) {
75+ gchar **args;
76+
77+ args = g_strsplit (text, ":::", 2);
78+ if (args != NULL) {
79+ g_signal_emit (music_store, u1_music_store_signals[PLAY_LIBRARY_SIGNAL], 0, args[1]);
80+ g_strfreev (args);
81+ }
82+ }
83 }
84
85 static gboolean
86
87=== modified file 'libubuntuone/u1-music-store.h'
88--- libubuntuone/u1-music-store.h 2009-12-21 13:09:23 +0000
89+++ libubuntuone/u1-music-store.h 2010-02-17 12:59:14 +0000
90@@ -45,6 +45,7 @@
91
92 /* Signals */
93 void (* preview_mp3) (U1MusicStore *music_store, const gchar *url, const gchar *title);
94+ void (* play_library) (U1MusicStore *music_store, const gchar *path);
95 } U1MusicStoreClass;
96
97 GType u1_music_store_get_type (void);

Subscribers

People subscribed via source and target branches