Merge lp:~chipaca/ubuntuone-client/public_files_list_v2 into lp:ubuntuone-client

Proposed by John Lenton
Status: Merged
Approved by: dobey
Approved revision: 504
Merged at revision: not available
Proposed branch: lp:~chipaca/ubuntuone-client/public_files_list_v2
Merge into: lp:ubuntuone-client
Diff against target: 103 lines (+52/-8)
1 file modified
nautilus/ubuntuone-nautilus.c (+52/-8)
To merge this branch: bzr merge lp:~chipaca/ubuntuone-client/public_files_list_v2
Reviewer Review Type Date Requested Status
dobey (community) Approve
Vincenzo Di Somma (community) Approve
Rodrigo Moya (community) Approve
Review via email: mp+23507@code.launchpad.net

Commit message

Plug nautilus into syncdaemon's get_public_files. Without this patch, nautilus has no information as to what files the user has previously published.

Description of the change

This makes the public files notification work! yay

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

Looks ok to me

review: Approve
Revision history for this message
Vincenzo Di Somma (vds) :
review: Approve
503. By John Lenton

this is a fix for 562443

Revision history for this message
dobey (dobey) wrote :

I'd prefer to not have the additional got_one_public file function here, and just use a for loop instead. Is there any particular reason not to do so?

I'd also really like to know why exactly GSList wouldn't work for the signal here. We're using a GSList of GHashTables elsewhere for "aa{ss}" signatures from DBus, just fine. So, I'd like to understand why exactly it's failing here, but not elsewhere, and why a GPtrArray would work instead. It makes no sense to me at all.

Revision history for this message
John Lenton (chipaca) wrote :

I agree about avoiding got_one. Will change it to just a plain for, if that works.
And I agree it makes no sense. Yet it works. I'm not about to go spelunking into dbus_glib :)

504. By John Lenton

remove _got_one_ call

Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nautilus/ubuntuone-nautilus.c'
--- nautilus/ubuntuone-nautilus.c 2010-04-14 23:52:06 +0000
+++ nautilus/ubuntuone-nautilus.c 2010-04-16 16:25:49 +0000
@@ -164,6 +164,12 @@
164 GHashTable * hash,164 GHashTable * hash,
165 gchar * error,165 gchar * error,
166 gpointer user_data);166 gpointer user_data);
167static void ubuntuone_nautilus_got_public_files (DBusGProxy * proxy,
168 GPtrArray * files,
169 gpointer user_data);
170static void ubuntuone_nautilus_public_files_list_error (DBusGProxy * proxy,
171 gchar * error,
172 gpointer user_data);
167static void ubuntuone_nautilus_share_created (DBusGProxy * proxy,173static void ubuntuone_nautilus_share_created (DBusGProxy * proxy,
168 GHashTable * hash,174 GHashTable * hash,
169 gpointer user_data);175 gpointer user_data);
@@ -1083,6 +1089,25 @@
1083 dbus_g_proxy_connect_signal (uon->u1_public, "PublicAccessChangeError",1089 dbus_g_proxy_connect_signal (uon->u1_public, "PublicAccessChangeError",
1084 G_CALLBACK (ubuntuone_nautilus_publish_error),1090 G_CALLBACK (ubuntuone_nautilus_publish_error),
1085 uon, NULL);1091 uon, NULL);
1092
1093 dbus_g_proxy_add_signal (uon->u1_public, "PublicFilesList",
1094 dbus_g_type_get_collection ("GPtrArray",
1095 dbus_g_type_get_map
1096 ("GHashTable",
1097 G_TYPE_STRING,
1098 G_TYPE_STRING)),
1099 G_TYPE_INVALID);
1100 dbus_g_proxy_connect_signal (uon->u1_public, "PublicFilesList",
1101 G_CALLBACK (ubuntuone_nautilus_got_public_files),
1102 uon, NULL);
1103
1104 dbus_g_proxy_add_signal (uon->u1_public, "PublicFilesListError",
1105 G_TYPE_STRING,
1106 G_TYPE_INVALID);
1107 dbus_g_proxy_connect_signal (uon->u1_public, "PublicFilesListError",
1108 G_CALLBACK (ubuntuone_nautilus_public_files_list_error),
1109 uon, NULL);
1110
1086}1111}
10871112
1088static void ubuntuone_nautilus_class_init (UbuntuOneNautilusClass * klass) {1113static void ubuntuone_nautilus_class_init (UbuntuOneNautilusClass * klass) {
@@ -1343,11 +1368,9 @@
1343 gpointer user_data) {1368 gpointer user_data) {
1344 UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);1369 UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);
1345 gchar * status;1370 gchar * status;
1346 gchar * is_online;1371 gboolean is_online;
1347 gchar * is_connected;
13481372
1349 is_online = g_hash_table_lookup (hash, "is_online");1373 is_online = g_strcmp0(g_hash_table_lookup (hash, "is_online"), "True") == 0;
1350 is_connected = g_hash_table_lookup (hash, "is_connected");
1351 status = g_hash_table_lookup (hash, "name");1374 status = g_hash_table_lookup (hash, "name");
13521375
1353 /* Get the root when we get a status change signal, if we haven't yet */1376 /* Get the root when we get a status change signal, if we haven't yet */
@@ -1362,14 +1385,13 @@
1362 ubuntuone_nautilus_got_udfs, uon,1385 ubuntuone_nautilus_got_udfs, uon,
1363 NULL, G_TYPE_INVALID);1386 NULL, G_TYPE_INVALID);
13641387
1365#if 0
1366 /* The following code is disabled, for the time being. lp:562443 */
1367 /* Get the list of public files if we haven't already */1388 /* Get the list of public files if we haven't already */
1368 if (!uon->gotpubs)1389 if (is_online && !uon->gotpubs) {
1369 dbus_g_proxy_begin_call (uon->u1_public, "get_public_files",1390 dbus_g_proxy_begin_call (uon->u1_public, "get_public_files",
1370 ubuntuone_nautilus_end_dbus_call, uon,1391 ubuntuone_nautilus_end_dbus_call, uon,
1371 NULL, G_TYPE_INVALID);1392 NULL, G_TYPE_INVALID);
1372#endif1393 uon->gotpubs = TRUE;
1394 }
1373}1395}
13741396
1375static void ubuntuone_nautilus_upload_started (DBusGProxy * proxy,1397static void ubuntuone_nautilus_upload_started (DBusGProxy * proxy,
@@ -1505,6 +1527,28 @@
1505 ubuntuone_nautilus_file_published (proxy, hash, user_data);1527 ubuntuone_nautilus_file_published (proxy, hash, user_data);
1506}1528}
15071529
1530static void ubuntuone_nautilus_got_public_files (DBusGProxy * proxy,
1531 GPtrArray * files,
1532 gpointer user_data) {
1533 UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);
1534 int i;
1535
1536 g_hash_table_remove_all (uon->public);
1537 for (i = 0; i < files->len; i++)
1538 g_hash_table_insert (uon->public,
1539 g_strdup (g_hash_table_lookup (files->pdata[i], "path")),
1540 g_strdup (g_hash_table_lookup (files->pdata[i], "public_url")));
1541}
1542
1543static void ubuntuone_nautilus_public_files_list_error (DBusGProxy * proxy,
1544 gchar * error,
1545 gpointer user_data) {
1546 UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);
1547 /* the get_public_files call failed. We unset gotpubs, so the call
1548 is retried when the syncdaemon next tells us it's online */
1549 uon->gotpubs = FALSE;
1550}
1551
1508static void ubuntuone_nautilus_share_created (DBusGProxy * proxy,1552static void ubuntuone_nautilus_share_created (DBusGProxy * proxy,
1509 GHashTable * hash,1553 GHashTable * hash,
1510 gpointer user_data) {1554 gpointer user_data) {

Subscribers

People subscribed via source and target branches