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

Proposed by dobey
Status: Merged
Approved by: dobey
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
Natalia Bidart (community) Approve
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.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libubuntuoneui/u1-music-store.c'
--- libubuntuoneui/u1-music-store.c 2012-01-27 17:09:25 +0000
+++ libubuntuoneui/u1-music-store.c 2012-03-06 03:47:21 +0000
@@ -544,12 +544,13 @@
544 music_store->priv->watched_downloads = NULL;544 music_store->priv->watched_downloads = NULL;
545 }545 }
546546
547 network_uri = webkit_network_request_get_uri (request);
548
547 /* Capture URLs we're interested in */549 /* Capture URLs we're interested in */
548 parsed_uri = soup_uri_new (webkit_network_request_get_uri (request));550 parsed_uri = soup_uri_new (network_uri);
549 if (parsed_uri == NULL)551 if (parsed_uri == NULL)
550 return FALSE;552 return FALSE;
551553
552 network_uri = webkit_network_request_get_uri (request);
553 if (network_uri != NULL && g_str_has_prefix (network_uri, U1_NOT_REGISTERED_URL)) {554 if (network_uri != NULL && g_str_has_prefix (network_uri, U1_NOT_REGISTERED_URL)) {
554 fire_authentication (music_store, request, policy_decision);555 fire_authentication (music_store, request, policy_decision);
555 } else if (g_str_has_prefix (parsed_uri->path, "/auth/login") &&556 } else if (g_str_has_prefix (parsed_uri->path, "/auth/login") &&
@@ -561,7 +562,6 @@
561 fire_authentication (music_store, request, policy_decision);562 fire_authentication (music_store, request, policy_decision);
562 } else if (g_strrstr (parsed_uri->path, "library.aspx") != NULL ||563 } else if (g_strrstr (parsed_uri->path, "library.aspx") != NULL ||
563 g_str_has_prefix (parsed_uri->path, "/music/store/library")) {564 g_str_has_prefix (parsed_uri->path, "/music/store/library")) {
564 //g_str_has_prefix (webkit_network_request_get_uri (request), "https://one.ubuntu.com/music/store/library")) {
565 const gchar *library_override;565 const gchar *library_override;
566566
567 /* If the URL being loaded is the 7d library page, and we have a library567 /* If the URL being loaded is the 7d library page, and we have a library
@@ -1222,9 +1222,6 @@
1222 folder_info = syncdaemon_daemon_get_folder_info (music_store->priv->syncdaemon, u1_music_store_get_library_location (music_store));1222 folder_info = syncdaemon_daemon_get_folder_info (music_store->priv->syncdaemon, u1_music_store_get_library_location (music_store));
1223 music_store->priv->folder_subscribed = syncdaemon_folder_info_get_subscribed (folder_info);1223 music_store->priv->folder_subscribed = syncdaemon_folder_info_get_subscribed (folder_info);
12241224
1225 g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "notify",
1226 G_CALLBACK (viewer_property_changed_cb), music_store);
1227
1228 /* Rescan the purchased music folder */1225 /* Rescan the purchased music folder */
1229 _u1_music_store_rescan_purchased_folder (music_store);1226 _u1_music_store_rescan_purchased_folder (music_store);
12301227
@@ -1266,6 +1263,9 @@
12661263
1267 music_store->priv->base_url = g_strdup (url_to_use);1264 music_store->priv->base_url = g_strdup (url_to_use);
12681265
1266 /* Create a hidden progress bar */
1267 music_store->priv->progress = gtk_progress_bar_new ();
1268
1269 /* Create web viewer object */1269 /* Create web viewer object */
1270 music_store->priv->scroll = gtk_scrolled_window_new (NULL, NULL);1270 music_store->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
1271 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (music_store->priv->scroll),1271 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (music_store->priv->scroll),
@@ -1303,6 +1303,9 @@
1303 g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "load-error",1303 g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "load-error",
1304 G_CALLBACK (load_error_cb), music_store);1304 G_CALLBACK (load_error_cb), music_store);
13051305
1306 g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "notify",
1307 G_CALLBACK (viewer_property_changed_cb), music_store);
1308
1306 /* Show a temp view when loading the initial store page */1309 /* Show a temp view when loading the initial store page */
1307 load_internal_html_page (WEBKIT_WEB_VIEW (music_store->priv->web_viewer), 1310 load_internal_html_page (WEBKIT_WEB_VIEW (music_store->priv->web_viewer),
1308 U1_CONNECTING_PAGE, NULL);1311 U1_CONNECTING_PAGE, NULL);
@@ -1344,9 +1347,6 @@
1344 g_signal_connect (G_OBJECT (music_store->priv->subscribe_btn), "clicked",1347 g_signal_connect (G_OBJECT (music_store->priv->subscribe_btn), "clicked",
1345 G_CALLBACK (subscribe_purchased_folder), music_store);1348 G_CALLBACK (subscribe_purchased_folder), music_store);
13461349
1347 /* Create a hidden progress bar */
1348 music_store->priv->progress = gtk_progress_bar_new ();
1349
1350 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->alertbar, FALSE, FALSE, 6);1350 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->alertbar, FALSE, FALSE, 6);
1351 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->scroll, TRUE, TRUE, 0);1351 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->scroll, TRUE, TRUE, 0);
1352 gtk_box_pack_end (GTK_BOX (music_store), music_store->priv->progress, FALSE, FALSE, 0);1352 gtk_box_pack_end (GTK_BOX (music_store), music_store->priv->progress, FALSE, FALSE, 0);
@@ -1356,7 +1356,7 @@
1356 music_store);1356 music_store);
13571357
1358 /* And load the real store in the background */1358 /* And load the real store in the background */
1359 music_store->priv->idle_cb = g_idle_add ((GSourceFunc) load_real_store_cb, music_store);1359 music_store->priv->idle_cb = g_timeout_add_seconds (2, (GSourceFunc) load_real_store_cb, music_store);
13601360
1361}1361}
13621362
@@ -1416,15 +1416,15 @@
1416 g_return_if_fail (U1_IS_MUSIC_STORE (music_store));1416 g_return_if_fail (U1_IS_MUSIC_STORE (music_store));
1417 g_return_if_fail (url != NULL);1417 g_return_if_fail (url != NULL);
14181418
1419 /* Stop any currently pending or active page loads first */
1420 webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (music_store->priv->web_viewer));
1421
1422 /* If the load_real_store callback is set up, disable it first */1419 /* If the load_real_store callback is set up, disable it first */
1423 if (music_store->priv->idle_cb > 0) {1420 if (music_store->priv->idle_cb > 0) {
1424 g_source_remove (music_store->priv->idle_cb);1421 g_source_remove (music_store->priv->idle_cb);
1425 music_store->priv->idle_cb = 0;1422 music_store->priv->idle_cb = 0;
1426 }1423 }
14271424
1425 /* Stop any currently pending or active page loads first */
1426 webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (music_store->priv->web_viewer));
1427
1428 quoted_url = g_uri_escape_string (url, NULL, FALSE);1428 quoted_url = g_uri_escape_string (url, NULL, FALSE);
1429 real_url = g_strdup_printf ("%s%s?forward_on_to_url=%s",1429 real_url = g_strdup_printf ("%s%s?forward_on_to_url=%s",
1430 music_store->priv->base_url,1430 music_store->priv->base_url,

Subscribers

People subscribed via source and target branches