Merge lp:~dobey/ubuntuone-client/bad-compare into lp:ubuntuone-client

Proposed by Rodney Dawes on 2011-09-21
Status: Merged
Approved by: Rodney Dawes on 2011-09-26
Approved revision: 1137
Merged at revision: 1137
Proposed branch: lp:~dobey/ubuntuone-client/bad-compare
Merge into: lp:ubuntuone-client
Diff against target: 413 lines (+137/-133) 1 file modified
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/bad-compare
Reviewer Review Type Date Requested Status
Manuel de la Peña Approve on 2011-09-28
Roberto Alsina 2011-09-21 Approve on 2011-09-26
Review via email: mp+76476@code.launchpad.net

Commit Message

Append directory separator to UDF path before comparing

Description of the Change

To test this IRL:

./autogen.sh
cd libsyncdaemon
make && sudo make install
pkill -9 nautilus
(open nautilus and check that UDFs of similar names aren't blocked in the extension)
make uninstall
pkill -9 nautilus

This will install the lib into /usr/local so you can test without polluting the system, and make uninstall will uninstall the lib from /usr/local. Restarting nautilus the first time is so that it will load the library from /usr/local, and the second time, is so that it will be reset to the system install after doing the uninstall.

To post a comment you must log in.
1137. By Rodney Dawes on 2011-09-23

tabify

Roberto Alsina (ralsina) :
review: Approve
review: Approve

Preview Diff

1=== modified file 'libsyncdaemon/syncdaemon-daemon.c'
2--- libsyncdaemon/syncdaemon-daemon.c 2011-04-08 20:29:02 +0000
3+++ libsyncdaemon/syncdaemon-daemon.c 2011-09-23 13:59:33 +0000
4@@ -129,12 +129,12 @@
5
6 /* Register signals */
7 daemon_signals[READY_SIGNAL] = g_signal_new ("ready",
8- G_TYPE_FROM_CLASS (klass),
9- (GSignalFlags) G_SIGNAL_RUN_LAST,
10- G_STRUCT_OFFSET (SyncdaemonDaemonClass, ready),
11- NULL, NULL,
12- g_cclosure_marshal_VOID__VOID,
13- G_TYPE_NONE, 0);
14+ G_TYPE_FROM_CLASS (klass),
15+ (GSignalFlags) G_SIGNAL_RUN_LAST,
16+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, ready),
17+ NULL, NULL,
18+ g_cclosure_marshal_VOID__VOID,
19+ G_TYPE_NONE, 0);
20 daemon_signals[CONNECTED_SIGNAL] = g_signal_new ("connected",
21 G_TYPE_FROM_CLASS (klass),
22 (GSignalFlags) G_SIGNAL_RUN_LAST,
23@@ -143,54 +143,54 @@
24 g_cclosure_marshal_VOID__VOID,
25 G_TYPE_NONE, 0);
26 daemon_signals[DISCONNECTED_SIGNAL] = g_signal_new ("disconnected",
27- G_TYPE_FROM_CLASS (klass),
28- (GSignalFlags) G_SIGNAL_RUN_LAST,
29- G_STRUCT_OFFSET (SyncdaemonDaemonClass, disconnected),
30- NULL, NULL,
31- g_cclosure_marshal_VOID__VOID,
32- G_TYPE_NONE, 0);
33+ G_TYPE_FROM_CLASS (klass),
34+ (GSignalFlags) G_SIGNAL_RUN_LAST,
35+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, disconnected),
36+ NULL, NULL,
37+ g_cclosure_marshal_VOID__VOID,
38+ G_TYPE_NONE, 0);
39 daemon_signals[STATUS_CHANGED_SIGNAL] = g_signal_new ("status_changed",
40- G_TYPE_FROM_CLASS (klass),
41- (GSignalFlags) G_SIGNAL_RUN_LAST,
42- G_STRUCT_OFFSET (SyncdaemonDaemonClass, status_changed),
43- NULL, NULL,
44- g_cclosure_marshal_VOID__OBJECT,
45- G_TYPE_NONE, 1,
46- G_TYPE_OBJECT);
47+ G_TYPE_FROM_CLASS (klass),
48+ (GSignalFlags) G_SIGNAL_RUN_LAST,
49+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, status_changed),
50+ NULL, NULL,
51+ g_cclosure_marshal_VOID__OBJECT,
52+ G_TYPE_NONE, 1,
53+ G_TYPE_OBJECT);
54 daemon_signals[EVENT_SIGNAL] = g_signal_new ("event",
55- G_TYPE_FROM_CLASS (klass),
56- (GSignalFlags) G_SIGNAL_RUN_LAST,
57- G_STRUCT_OFFSET (SyncdaemonDaemonClass, event),
58- NULL, NULL,
59- g_cclosure_marshal_VOID__POINTER,
60- G_TYPE_NONE, 1,
61- G_TYPE_POINTER);
62+ G_TYPE_FROM_CLASS (klass),
63+ (GSignalFlags) G_SIGNAL_RUN_LAST,
64+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, event),
65+ NULL, NULL,
66+ g_cclosure_marshal_VOID__POINTER,
67+ G_TYPE_NONE, 1,
68+ G_TYPE_POINTER);
69 daemon_signals[ERROR_SIGNAL] = g_signal_new ("error",
70- G_TYPE_FROM_CLASS (klass),
71- (GSignalFlags) G_SIGNAL_RUN_LAST,
72- G_STRUCT_OFFSET (SyncdaemonDaemonClass, error),
73- NULL, NULL,
74- _syncdaemon_marshal_VOID__STRING_POINTER,
75- G_TYPE_NONE, 2,
76- G_TYPE_STRING, G_TYPE_POINTER);
77+ G_TYPE_FROM_CLASS (klass),
78+ (GSignalFlags) G_SIGNAL_RUN_LAST,
79+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, error),
80+ NULL, NULL,
81+ _syncdaemon_marshal_VOID__STRING_POINTER,
82+ G_TYPE_NONE, 2,
83+ G_TYPE_STRING, G_TYPE_POINTER);
84 daemon_signals[FOLDER_CREATED_SIGNAL] = g_signal_new ("folder_created",
85- G_TYPE_FROM_CLASS (klass),
86- (GSignalFlags) G_SIGNAL_RUN_LAST,
87- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_created),
88- NULL, NULL,
89- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
90- G_TYPE_NONE, 2,
91- G_TYPE_BOOLEAN,
92- G_TYPE_OBJECT);
93+ G_TYPE_FROM_CLASS (klass),
94+ (GSignalFlags) G_SIGNAL_RUN_LAST,
95+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_created),
96+ NULL, NULL,
97+ _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
98+ G_TYPE_NONE, 2,
99+ G_TYPE_BOOLEAN,
100+ G_TYPE_OBJECT);
101 daemon_signals[FOLDER_DELETED_SIGNAL] = g_signal_new ("folder_deleted",
102- G_TYPE_FROM_CLASS (klass),
103- (GSignalFlags) G_SIGNAL_RUN_LAST,
104- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_deleted),
105- NULL, NULL,
106- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
107- G_TYPE_NONE, 2,
108- G_TYPE_BOOLEAN,
109- G_TYPE_OBJECT);
110+ G_TYPE_FROM_CLASS (klass),
111+ (GSignalFlags) G_SIGNAL_RUN_LAST,
112+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_deleted),
113+ NULL, NULL,
114+ _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
115+ G_TYPE_NONE, 2,
116+ G_TYPE_BOOLEAN,
117+ G_TYPE_OBJECT);
118 daemon_signals[FOLDER_SUBSCRIBED_SIGNAL] = g_signal_new ("folder_subscribed",
119 G_TYPE_FROM_CLASS (klass),
120 (GSignalFlags) G_SIGNAL_RUN_LAST,
121@@ -210,14 +210,14 @@
122 G_TYPE_BOOLEAN,
123 G_TYPE_OBJECT);
124 daemon_signals[FILE_PUBLISHED_SIGNAL] = g_signal_new ("file_published",
125- G_TYPE_FROM_CLASS (klass),
126- (GSignalFlags) G_SIGNAL_RUN_LAST,
127- G_STRUCT_OFFSET (SyncdaemonDaemonClass, file_published),
128- NULL, NULL,
129- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
130- G_TYPE_NONE, 2,
131- G_TYPE_BOOLEAN,
132- G_TYPE_OBJECT);
133+ G_TYPE_FROM_CLASS (klass),
134+ (GSignalFlags) G_SIGNAL_RUN_LAST,
135+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, file_published),
136+ NULL, NULL,
137+ _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
138+ G_TYPE_NONE, 2,
139+ G_TYPE_BOOLEAN,
140+ G_TYPE_OBJECT);
141 daemon_signals[FILE_UNPUBLISHED_SIGNAL] = g_signal_new ("file_unpublished",
142 G_TYPE_FROM_CLASS (klass),
143 (GSignalFlags) G_SIGNAL_RUN_LAST,
144@@ -228,23 +228,23 @@
145 G_TYPE_BOOLEAN,
146 G_TYPE_OBJECT);
147 daemon_signals[SHARE_CREATED_SIGNAL] = g_signal_new ("share_created",
148- G_TYPE_FROM_CLASS (klass),
149- (GSignalFlags) G_SIGNAL_RUN_LAST,
150- G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_created),
151- NULL, NULL,
152- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
153- G_TYPE_NONE, 2,
154- G_TYPE_BOOLEAN,
155- G_TYPE_OBJECT);
156+ G_TYPE_FROM_CLASS (klass),
157+ (GSignalFlags) G_SIGNAL_RUN_LAST,
158+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_created),
159+ NULL, NULL,
160+ _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
161+ G_TYPE_NONE, 2,
162+ G_TYPE_BOOLEAN,
163+ G_TYPE_OBJECT);
164 daemon_signals[SHARE_DELETED_SIGNAL] = g_signal_new ("share_deleted",
165- G_TYPE_FROM_CLASS (klass),
166- (GSignalFlags) G_SIGNAL_RUN_LAST,
167- G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_deleted),
168- NULL, NULL,
169- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
170- G_TYPE_NONE, 2,
171- G_TYPE_BOOLEAN,
172- G_TYPE_OBJECT);
173+ G_TYPE_FROM_CLASS (klass),
174+ (GSignalFlags) G_SIGNAL_RUN_LAST,
175+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_deleted),
176+ NULL, NULL,
177+ _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
178+ G_TYPE_NONE, 2,
179+ G_TYPE_BOOLEAN,
180+ G_TYPE_OBJECT);
181 daemon_signals[DOWNLOAD_STARTED_SIGNAL] = g_signal_new ("download_started",
182 G_TYPE_FROM_CLASS (klass),
183 (GSignalFlags) G_SIGNAL_RUN_LAST,
184@@ -254,13 +254,13 @@
185 G_TYPE_NONE, 1,
186 G_TYPE_STRING);
187 daemon_signals[DOWNLOAD_FILE_PROGRESS_SIGNAL] = g_signal_new ("download_file_progress",
188- G_TYPE_FROM_CLASS (klass),
189- (GSignalFlags) G_SIGNAL_RUN_LAST,
190- G_STRUCT_OFFSET (SyncdaemonDaemonClass, download_file_progress),
191- NULL, NULL,
192- _syncdaemon_marshal_VOID__STRING_OBJECT,
193- G_TYPE_NONE, 2,
194- G_TYPE_STRING, G_TYPE_OBJECT);
195+ G_TYPE_FROM_CLASS (klass),
196+ (GSignalFlags) G_SIGNAL_RUN_LAST,
197+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, download_file_progress),
198+ NULL, NULL,
199+ _syncdaemon_marshal_VOID__STRING_OBJECT,
200+ G_TYPE_NONE, 2,
201+ G_TYPE_STRING, G_TYPE_OBJECT);
202 daemon_signals[DOWNLOAD_FINISHED_SIGNAL] = g_signal_new ("download_finished",
203 G_TYPE_FROM_CLASS (klass),
204 (GSignalFlags) G_SIGNAL_RUN_LAST,
205@@ -270,37 +270,37 @@
206 G_TYPE_NONE, 2,
207 G_TYPE_STRING, G_TYPE_OBJECT);
208 daemon_signals[UPLOAD_STARTED_SIGNAL] = g_signal_new ("upload_started",
209- G_TYPE_FROM_CLASS (klass),
210- (GSignalFlags) G_SIGNAL_RUN_LAST,
211- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_started),
212- NULL, NULL,
213- g_cclosure_marshal_VOID__STRING,
214- G_TYPE_NONE, 1,
215- G_TYPE_STRING);
216+ G_TYPE_FROM_CLASS (klass),
217+ (GSignalFlags) G_SIGNAL_RUN_LAST,
218+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_started),
219+ NULL, NULL,
220+ g_cclosure_marshal_VOID__STRING,
221+ G_TYPE_NONE, 1,
222+ G_TYPE_STRING);
223 daemon_signals[UPLOAD_FILE_PROGRESS_SIGNAL] = g_signal_new ("upload_file_progress",
224- G_TYPE_FROM_CLASS (klass),
225- (GSignalFlags) G_SIGNAL_RUN_LAST,
226- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_file_progress),
227- NULL, NULL,
228- _syncdaemon_marshal_VOID__STRING_OBJECT,
229- G_TYPE_NONE, 2,
230- G_TYPE_STRING, G_TYPE_OBJECT);
231+ G_TYPE_FROM_CLASS (klass),
232+ (GSignalFlags) G_SIGNAL_RUN_LAST,
233+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_file_progress),
234+ NULL, NULL,
235+ _syncdaemon_marshal_VOID__STRING_OBJECT,
236+ G_TYPE_NONE, 2,
237+ G_TYPE_STRING, G_TYPE_OBJECT);
238 daemon_signals[UPLOAD_FINISHED_SIGNAL] = g_signal_new ("upload_finished",
239- G_TYPE_FROM_CLASS (klass),
240- (GSignalFlags) G_SIGNAL_RUN_LAST,
241- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_finished),
242- NULL, NULL,
243- _syncdaemon_marshal_VOID__STRING_OBJECT,
244- G_TYPE_NONE, 2,
245- G_TYPE_STRING, G_TYPE_OBJECT);
246+ G_TYPE_FROM_CLASS (klass),
247+ (GSignalFlags) G_SIGNAL_RUN_LAST,
248+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_finished),
249+ NULL, NULL,
250+ _syncdaemon_marshal_VOID__STRING_OBJECT,
251+ G_TYPE_NONE, 2,
252+ G_TYPE_STRING, G_TYPE_OBJECT);
253 daemon_signals[QUOTA_EXCEEDED_SIGNAL] = g_signal_new ("quota_exceeded",
254- G_TYPE_FROM_CLASS (klass),
255- (GSignalFlags) G_SIGNAL_RUN_LAST,
256- G_STRUCT_OFFSET (SyncdaemonDaemonClass, quota_exceeded),
257- NULL, NULL,
258- g_cclosure_marshal_VOID__POINTER,
259- G_TYPE_NONE, 1,
260- G_TYPE_POINTER);
261+ G_TYPE_FROM_CLASS (klass),
262+ (GSignalFlags) G_SIGNAL_RUN_LAST,
263+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, quota_exceeded),
264+ NULL, NULL,
265+ g_cclosure_marshal_VOID__POINTER,
266+ G_TYPE_NONE, 1,
267+ G_TYPE_POINTER);
268 }
269
270 static void
271@@ -309,7 +309,7 @@
272 SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
273
274 if (daemon != NULL)
275- g_signal_emit_by_name (daemon, "quota_exceeded", volume_info);
276+ g_signal_emit_by_name (daemon, "quota_exceeded", volume_info);
277 }
278
279 static gboolean
280@@ -330,22 +330,22 @@
281 if (daemon->priv->daemon_interface != NULL)
282 g_object_unref (daemon->priv->daemon_interface);
283 daemon->priv->daemon_interface = g_object_new (SYNCDAEMON_TYPE_INTERFACE,
284- "daemon", daemon,
285- NULL);
286+ "daemon", daemon,
287+ NULL);
288 proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface),
289- SYNCDAEMON_DBUS_NAME, "/",
290- "com.ubuntuone.SyncDaemon.SyncDaemon");
291+ SYNCDAEMON_DBUS_NAME, "/",
292+ "com.ubuntuone.SyncDaemon.SyncDaemon");
293 if (proxy != NULL) {
294 daemon->priv->ready = TRUE;
295
296 dbus_g_proxy_add_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
297 dbus_g_type_get_map ("GHashTable",
298- G_TYPE_STRING,
299- G_TYPE_STRING),
300+ G_TYPE_STRING,
301+ G_TYPE_STRING),
302 G_TYPE_INVALID);
303 dbus_g_proxy_connect_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
304- G_CALLBACK (quota_exceeded_cb),
305- daemon, NULL);
306+ G_CALLBACK (quota_exceeded_cb),
307+ daemon, NULL);
308
309 /* Now get all the interfaces so that we get the signals from them */
310 syncdaemon_daemon_get_config_interface (daemon);
311@@ -365,10 +365,10 @@
312
313 static void
314 name_owner_changed_cb (DBusGProxy *proxy,
315- const char *name,
316- const char *old_owner,
317- const char *new_owner,
318- gpointer user_data)
319+ const char *name,
320+ const char *old_owner,
321+ const char *new_owner,
322+ gpointer user_data)
323 {
324 SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
325
326@@ -402,7 +402,7 @@
327 daemon->priv->ready = FALSE;
328 daemon->priv->connected = FALSE;
329 daemon->priv->subinterfaces = g_hash_table_new_full (g_str_hash, g_str_equal,
330- g_free, g_object_unref);
331+ g_free, g_object_unref);
332 daemon->priv->auth = g_object_new (SYNCDAEMON_TYPE_AUTHENTICATION, NULL);
333
334 /* Initialize DBus */
335@@ -442,9 +442,9 @@
336 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
337 G_TYPE_INVALID);
338 dbus_g_proxy_connect_signal (DBUS_G_PROXY (daemon->priv->dbus_proxy),
339- "NameOwnerChanged",
340- G_CALLBACK (name_owner_changed_cb),
341- daemon, NULL);
342+ "NameOwnerChanged",
343+ G_CALLBACK (name_owner_changed_cb),
344+ daemon, NULL);
345 }
346
347 /**
348@@ -502,8 +502,8 @@
349 #ifdef HAVE_GDBUS
350 #else
351 if (!dbus_g_proxy_begin_call (DBUS_G_PROXY (proxy), "connect",
352- connect_response_cb, daemon, NULL,
353- G_TYPE_INVALID)) {
354+ connect_response_cb, daemon, NULL,
355+ G_TYPE_INVALID)) {
356 g_warning ("Call to 'connect' method failed");
357
358 return FALSE;
359@@ -544,8 +544,8 @@
360 #ifdef HAVE_GDBUS
361 #else
362 if (!dbus_g_proxy_begin_call (DBUS_G_PROXY (proxy), "disconnect",
363- disconnect_response_cb, daemon, NULL,
364- G_TYPE_INVALID)) {
365+ disconnect_response_cb, daemon, NULL,
366+ G_TYPE_INVALID)) {
367 g_warning ("Call to 'disconnect' method failed");
368
369 return FALSE;
370@@ -850,8 +850,8 @@
371 interface = syncdaemon_daemon_get_filesystem_interface (daemon);
372 if (interface != NULL) {
373 return syncdaemon_filesystem_interface_get_metadata (SYNCDAEMON_FILESYSTEM_INTERFACE (interface),
374- path,
375- with_subtree_sync_check);
376+ path,
377+ with_subtree_sync_check);
378 }
379
380 return NULL;
381@@ -920,7 +920,7 @@
382 syncdaemon_daemon_is_folder_enabled (SyncdaemonDaemon *daemon, const gchar *path, gboolean *is_root)
383 {
384 const gchar *root;
385- gchar *root_with_slash;
386+ gchar *root_with_slash;
387 gboolean managed = FALSE, is_subscribed = FALSE;
388 gchar *dirpath;
389 SyncdaemonInterface *interface;
390@@ -959,18 +959,22 @@
391 udfs = syncdaemon_folders_interface_get_folders (SYNCDAEMON_FOLDERS_INTERFACE (interface));
392 for (l = udfs; l != NULL; l = l->next) {
393 const gchar *tmp_path;
394+ gchar *tmp_path_with_slash;
395 SyncdaemonFolderInfo *finfo = SYNCDAEMON_FOLDER_INFO (l->data);
396
397 tmp_path = syncdaemon_folder_info_get_path (finfo);
398 is_subscribed = syncdaemon_folder_info_get_subscribed (finfo);
399+
400+ tmp_path_with_slash = g_strconcat (tmp_path, G_DIR_SEPARATOR_S, NULL);
401 if (g_strcmp0 (path, tmp_path) == 0) {
402 managed = is_subscribed;
403 *is_root = TRUE;
404 break;
405- } else if (g_str_has_prefix (path, tmp_path)) {
406+ } else if (g_str_has_prefix (path, tmp_path_with_slash)) {
407 managed = is_subscribed;
408 break;
409 }
410+ g_free (tmp_path_with_slash);
411 }
412
413 g_slist_free (udfs);

Subscribers

People subscribed via source and target branches