~sil/libubuntuone/restrict-domains

« back to all changes in this revision

Viewing changes to libubuntuone/u1-music-store.c

Connect syncdaemon only when we have OAuth tokens, and prepare for 7d change in library page

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
                                        
198
198
                parse_oauth_string (first_item->secret, oauth_token, oauth_token_secret);
199
199
                gnome_keyring_found_list_free (items_found);
 
200
 
 
201
                /* Connect to syncdaemon now that we have tokens */
 
202
                syncdaemon_connect ();
200
203
        }
201
204
}
202
205
 
362
365
                }
363
366
 
364
367
                return FALSE;
 
368
        } else {
 
369
                const gchar *library_override;
 
370
 
 
371
                library_override = g_getenv ("U1MUSICLIBRARYURL");
 
372
 
 
373
                /* If the URL being loaded is the 7d library page, and we have a library
 
374
                   override set, load ours instead. */
 
375
                if (g_strrstr (webkit_network_request_get_uri (request), "library.aspx") != NULL ||
 
376
                    g_str_has_prefix (webkit_network_request_get_uri (request), "https://one.ubuntu.com/music/library")) {
 
377
                        if (library_override != NULL) {
 
378
                                g_debug ("overriding the library page to ours");
 
379
                                webkit_web_view_open (web_view, library_override);
 
380
                                return;
 
381
                        }
 
382
                }
365
383
        }
366
384
 
367
385
        /* Change the cursor when loading */
425
443
        if (downloads_in_progress == NULL)
426
444
                downloads_in_progress = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
427
445
 
428
 
        for (keys = g_hash_table_get_keys (current_downloads);
429
 
             keys != NULL; ) {
 
446
        keys = g_hash_table_get_keys (current_downloads);
 
447
        while (keys != NULL) {
430
448
                g_hash_table_insert (downloads_in_progress, g_strdup (keys->data), g_strdup (keys->data));
431
449
                keys = g_list_remove (keys, keys->data);
432
450
        }
566
584
 
567
585
        gdk_window_set_cursor (GTK_WIDGET (web_view)->window, music_store->priv->normal_cursor);
568
586
 
569
 
        /* If the URL just loaded is the 7d library page, and we have a library
570
 
           override set, load ours instead. */
571
 
        if (g_strrstr (webkit_web_view_get_uri (web_view), "library.aspx") != NULL) {
572
 
                if (library_override != NULL) {
573
 
                        g_debug ("overriding the library page to ours");
574
 
                        webkit_web_view_open (web_view, library_override);
575
 
                        return;
576
 
                }
577
 
        }
578
 
 
579
587
        /* If the URL just loaded is the library page, update download status */
580
588
        tmp_url = g_strdup_printf ("%s%s", music_store->priv->base_url, U1_LIBRARY_URL);
581
589
        if (g_str_has_prefix (webkit_web_view_get_uri (web_view), tmp_url)) {