Merge lp:~dobey/libubuntuone/fix-load-order into lp:libubuntuone

Proposed by dobey
Status: Merged
Approved by: Rodrigo Moya
Approved revision: 119
Merged at revision: 119
Proposed branch: lp:~dobey/libubuntuone/fix-load-order
Merge into: lp:libubuntuone
Diff against target: 58 lines (+14/-11)
1 file modified
libubuntuone/u1-music-store.c (+14/-11)
To merge this branch: bzr merge lp:~dobey/libubuntuone/fix-load-order
Reviewer Review Type Date Requested Status
Rodrigo Moya (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+51957@code.launchpad.net

Commit message

Set the base_url on init, rather than later, as we may need it
Cancel the main page load callback if we're loading a u1ms link instead

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Looks ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntuone/u1-music-store.c'
2--- libubuntuone/u1-music-store.c 2011-02-22 19:26:15 +0000
3+++ libubuntuone/u1-music-store.c 2011-03-02 20:48:25 +0000
4@@ -256,19 +256,9 @@
5 get_url_to_use (U1MusicStore *music_store)
6 {
7 gchar *oauth_consumer_token, *oauth_consumer_secret, *oauth_token = NULL, *oauth_token_secret = NULL, *real_url;
8- const gchar *url_to_use;
9-
10- /* If U1MUSICSTOREURL is defined, use that instead of the real URL */
11- if (! (url_to_use = g_getenv ("U1MUSICSTOREURL")))
12- url_to_use = "https://one.ubuntu.com";
13-
14- if (music_store->priv->base_url != NULL)
15- g_free (music_store->priv->base_url);
16-
17- music_store->priv->base_url = g_strdup (url_to_use);
18
19 /* OAUth sign the URL */
20- if (g_str_has_prefix (url_to_use, "http://localhost") || g_str_has_prefix (url_to_use, "http://127.0.0.1")) {
21+ if (g_str_has_prefix (music_store->priv->base_url, "http://localhost") || g_str_has_prefix (music_store->priv->base_url, "http://127.0.0.1")) {
22 const gchar *oauthfile;
23
24 oauthfile = g_getenv ("OAUTHKEYFILE");
25@@ -957,6 +947,7 @@
26 u1_music_store_init (U1MusicStore *music_store)
27 {
28 gchar *new_user_agent;
29+ const gchar *url_to_use;
30 GError *error = NULL;
31
32 if (!g_thread_get_initialized ())
33@@ -966,6 +957,12 @@
34 music_store->priv->watched_downloads = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
35 music_store->priv->syncdaemon = syncdaemon_daemon_new ();
36
37+ /* If U1MUSICSTOREURL is defined, use that instead of the real URL */
38+ if (! (url_to_use = g_getenv ("U1MUSICSTOREURL")))
39+ url_to_use = "https://one.ubuntu.com";
40+
41+ music_store->priv->base_url = g_strdup (url_to_use);
42+
43 /* Initialize DBus */
44 music_store->priv->bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
45 if (error) {
46@@ -1096,6 +1093,12 @@
47 g_return_if_fail (U1_IS_MUSIC_STORE (music_store));
48 g_return_if_fail (url != NULL);
49
50+ /* If the load_real_store callback is set up, disable it first */
51+ if (music_store->priv->idle_cb > 0) {
52+ g_source_remove (music_store->priv->idle_cb);
53+ music_store->priv->idle_cb = 0;
54+ }
55+
56 real_url = g_strdup_printf ("%s%s?forward_on_to_url=%s",
57 music_store->priv->base_url,
58 U1_STORE_URL,

Subscribers

People subscribed via source and target branches