Merge lp:~rodrigo-moya/libubuntuone/location-property into lp:libubuntuone

Proposed by Rodrigo Moya
Status: Merged
Approved by: Rodrigo Moya
Approved revision: 66
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/libubuntuone/location-property
Merge into: lp:libubuntuone
Diff against target: 89 lines (+35/-2)
4 files modified
bindings/python/ubuntuone.defs (+5/-0)
libubuntuone/u1-music-store.c (+26/-1)
libubuntuone/u1-music-store.h (+2/-1)
tests/test-music-store.c (+2/-0)
To merge this branch: bzr merge lp:~rodrigo-moya/libubuntuone/location-property
Reviewer Review Type Date Requested Status
Stuart Langridge (community) Approve
Review via email: mp+21140@code.launchpad.net

Commit message

Export library path from music store widget

Description of the change

Export library path from music store widget

To post a comment you must log in.
66. By Rodrigo Moya

Added new method to Python bindings

Revision history for this message
Stuart Langridge (sil) wrote :

Works

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bindings/python/ubuntuone.defs'
2--- bindings/python/ubuntuone.defs 2010-02-09 22:54:22 +0000
3+++ bindings/python/ubuntuone.defs 2010-03-11 15:37:25 +0000
4@@ -24,4 +24,9 @@
5 (return-type "GtkWidget*")
6 )
7
8+(define-method get_library_location
9+ (of-object "U1MusicStore")
10+ (c-name "u1_music_store_get_library_location")
11+ (return-type "const-gchar*")
12+)
13
14
15=== modified file 'libubuntuone/u1-music-store.c'
16--- libubuntuone/u1-music-store.c 2010-03-08 16:55:26 +0000
17+++ libubuntuone/u1-music-store.c 2010-03-11 15:37:25 +0000
18@@ -30,6 +30,8 @@
19 #include "syncdaemon.h"
20 #include "u1-marshal.h"
21
22+#define U1_MUSIC_LIBRARY_LOCATION ".ubuntuone/Purchased from Ubuntu One"
23+
24 #define U1_STORE_URL "/music/login"
25 #define U1_LIBRARY_URL "/music/store/library"
26 #define U1_NOT_LOGGED_IN_STORE_URL "/music/store-no-token"
27@@ -472,7 +474,7 @@
28 }
29
30 full_path = g_build_filename (g_get_home_dir (),
31- ".ubuntuone/Purchased from Ubuntu One",
32+ U1_MUSIC_LIBRARY_LOCATION,
33 prop, NULL);
34
35 download = g_hash_table_lookup (current_downloads, full_path);
36@@ -788,3 +790,26 @@
37
38 return (GtkWidget *) music_store;
39 }
40+
41+/**
42+ * u1_music_store_get_library_location:
43+ * @music_store: A #U1MusicStore object.
44+ *
45+ * Return the location where purchased music is stored on the user's
46+ * computer.
47+ *
48+ * Return value: Location of the music library.
49+ */
50+const gchar *
51+u1_music_store_get_library_location (U1MusicStore *music_store)
52+{
53+ static gchar *full_path = NULL;
54+
55+ if (full_path == NULL) {
56+ full_path = g_build_filename (g_get_home_dir (),
57+ U1_MUSIC_LIBRARY_LOCATION,
58+ NULL);
59+ }
60+
61+ return (const gchar *) full_path;
62+}
63
64=== modified file 'libubuntuone/u1-music-store.h'
65--- libubuntuone/u1-music-store.h 2010-03-04 10:04:51 +0000
66+++ libubuntuone/u1-music-store.h 2010-03-11 15:37:25 +0000
67@@ -52,7 +52,8 @@
68
69 GType u1_music_store_get_type (void);
70
71-GtkWidget *u1_music_store_new (void);
72+GtkWidget *u1_music_store_new (void);
73+const gchar *u1_music_store_get_library_location (U1MusicStore *music_store);
74
75 G_END_DECLS
76
77
78=== modified file 'tests/test-music-store.c'
79--- tests/test-music-store.c 2010-03-05 12:50:50 +0000
80+++ tests/test-music-store.c 2010-03-11 15:37:25 +0000
81@@ -66,6 +66,8 @@
82 g_signal_connect (G_OBJECT (music_store), "download-finished", G_CALLBACK (download_finished_cb), NULL);
83 gtk_widget_show (music_store);
84 gtk_container_add (GTK_CONTAINER (window), music_store);
85+
86+ g_print ("Music library location: %s\n", u1_music_store_get_library_location (music_store));
87
88 /* Run the application */
89 gtk_widget_show (window);

Subscribers

People subscribed via source and target branches