Merge lp:~dobey/libubuntuone/u1ms-load-fixes into lp:libubuntuone

Proposed by dobey on 2012-03-06
Status: Merged
Approved by: dobey on 2012-03-06
Approved revision: 147
Merged at revision: 147
Proposed branch: lp:~dobey/libubuntuone/u1ms-load-fixes
Merge into: lp:libubuntuone
Diff against target: 95 lines (+13/-13)
1 file modified
libubuntuoneui/u1-music-store.c (+13/-13)
To merge this branch: bzr merge lp:~dobey/libubuntuone/u1ms-load-fixes
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve on 2012-03-06
Natalia Bidart 2012-03-06 Approve on 2012-03-06
Review via email: mp+96046@code.launchpad.net

Commit message

Add a delay to the initial main store page loading, to avoid a race
Move progress bar creation, and notify signal connect, to avoid racing
Avoid an unneeded second call to get the URI from webkit in nav request

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

Looks good!

review: Approve
Eric Casteleijn (thisfred) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntuoneui/u1-music-store.c'
2--- libubuntuoneui/u1-music-store.c 2012-01-27 17:09:25 +0000
3+++ libubuntuoneui/u1-music-store.c 2012-03-06 03:47:21 +0000
4@@ -544,12 +544,13 @@
5 music_store->priv->watched_downloads = NULL;
6 }
7
8+ network_uri = webkit_network_request_get_uri (request);
9+
10 /* Capture URLs we're interested in */
11- parsed_uri = soup_uri_new (webkit_network_request_get_uri (request));
12+ parsed_uri = soup_uri_new (network_uri);
13 if (parsed_uri == NULL)
14 return FALSE;
15
16- network_uri = webkit_network_request_get_uri (request);
17 if (network_uri != NULL && g_str_has_prefix (network_uri, U1_NOT_REGISTERED_URL)) {
18 fire_authentication (music_store, request, policy_decision);
19 } else if (g_str_has_prefix (parsed_uri->path, "/auth/login") &&
20@@ -561,7 +562,6 @@
21 fire_authentication (music_store, request, policy_decision);
22 } else if (g_strrstr (parsed_uri->path, "library.aspx") != NULL ||
23 g_str_has_prefix (parsed_uri->path, "/music/store/library")) {
24- //g_str_has_prefix (webkit_network_request_get_uri (request), "https://one.ubuntu.com/music/store/library")) {
25 const gchar *library_override;
26
27 /* If the URL being loaded is the 7d library page, and we have a library
28@@ -1222,9 +1222,6 @@
29 folder_info = syncdaemon_daemon_get_folder_info (music_store->priv->syncdaemon, u1_music_store_get_library_location (music_store));
30 music_store->priv->folder_subscribed = syncdaemon_folder_info_get_subscribed (folder_info);
31
32- g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "notify",
33- G_CALLBACK (viewer_property_changed_cb), music_store);
34-
35 /* Rescan the purchased music folder */
36 _u1_music_store_rescan_purchased_folder (music_store);
37
38@@ -1266,6 +1263,9 @@
39
40 music_store->priv->base_url = g_strdup (url_to_use);
41
42+ /* Create a hidden progress bar */
43+ music_store->priv->progress = gtk_progress_bar_new ();
44+
45 /* Create web viewer object */
46 music_store->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
47 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (music_store->priv->scroll),
48@@ -1303,6 +1303,9 @@
49 g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "load-error",
50 G_CALLBACK (load_error_cb), music_store);
51
52+ g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "notify",
53+ G_CALLBACK (viewer_property_changed_cb), music_store);
54+
55 /* Show a temp view when loading the initial store page */
56 load_internal_html_page (WEBKIT_WEB_VIEW (music_store->priv->web_viewer),
57 U1_CONNECTING_PAGE, NULL);
58@@ -1344,9 +1347,6 @@
59 g_signal_connect (G_OBJECT (music_store->priv->subscribe_btn), "clicked",
60 G_CALLBACK (subscribe_purchased_folder), music_store);
61
62- /* Create a hidden progress bar */
63- music_store->priv->progress = gtk_progress_bar_new ();
64-
65 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->alertbar, FALSE, FALSE, 6);
66 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->scroll, TRUE, TRUE, 0);
67 gtk_box_pack_end (GTK_BOX (music_store), music_store->priv->progress, FALSE, FALSE, 0);
68@@ -1356,7 +1356,7 @@
69 music_store);
70
71 /* And load the real store in the background */
72- music_store->priv->idle_cb = g_idle_add ((GSourceFunc) load_real_store_cb, music_store);
73+ music_store->priv->idle_cb = g_timeout_add_seconds (2, (GSourceFunc) load_real_store_cb, music_store);
74
75 }
76
77@@ -1416,15 +1416,15 @@
78 g_return_if_fail (U1_IS_MUSIC_STORE (music_store));
79 g_return_if_fail (url != NULL);
80
81- /* Stop any currently pending or active page loads first */
82- webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (music_store->priv->web_viewer));
83-
84 /* If the load_real_store callback is set up, disable it first */
85 if (music_store->priv->idle_cb > 0) {
86 g_source_remove (music_store->priv->idle_cb);
87 music_store->priv->idle_cb = 0;
88 }
89
90+ /* Stop any currently pending or active page loads first */
91+ webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (music_store->priv->web_viewer));
92+
93 quoted_url = g_uri_escape_string (url, NULL, FALSE);
94 real_url = g_strdup_printf ("%s%s?forward_on_to_url=%s",
95 music_store->priv->base_url,

Subscribers

People subscribed via source and target branches