Merge lp:~rodrigo-moya/ubuntuone-client/final-nautilus-refactor into lp:ubuntuone-client
- final-nautilus-refactor
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 744 |
Merged at revision: | 742 |
Proposed branch: | lp:~rodrigo-moya/ubuntuone-client/final-nautilus-refactor |
Merge into: | lp:ubuntuone-client |
Diff against target: |
668 lines (+209/-149) 11 files modified
libsyncdaemon/syncdaemon-daemon.c (+10/-10) libsyncdaemon/syncdaemon-daemon.h (+1/-1) libsyncdaemon/syncdaemon-publicfiles-interface.c (+44/-14) libsyncdaemon/syncdaemon-publicfiles-interface.h (+1/-1) libsyncdaemon/syncdaemon-shares-interface.c (+22/-7) libsyncdaemon/syncdaemon-shares-interface.h (+1/-1) nautilus/context-menu.c (+5/-7) nautilus/file-watcher.c (+77/-64) nautilus/ubuntuone-nautilus.c (+8/-31) nautilus/ubuntuone-nautilus.h (+1/-4) nautilus/utils.c (+39/-9) |
To merge this branch: | bzr merge lp:~rodrigo-moya/ubuntuone-client/final-nautilus-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
John Lenton (community) | Approve | ||
Natalia Bidart (community) | Approve | ||
Review via email:
|
Commit message
- Cache public files in libsyncdaemon
- Fix issue with emblems disappearing
Description of the change
- Cache public files in libsyncdaemon
- Fix issue with emblems disappearing
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Also reported bug #663333.
Other than that, emblems does show up for themes ubuntu-* and humanity-* (other themes doesn't show the synchronized emblem).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Both issues (KeyError and missing emblems) are reported on bug #442504 and bug #645299.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
John Lenton (chipaca) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) wrote : | # |
syncdaemon-
syncdaemon-
syncdaemon-
make: *** [syncdaemon-
- 744. By Rodrigo Moya
-
Fix building with --enable-debug
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'libsyncdaemon/syncdaemon-daemon.c' | |||
2 | --- libsyncdaemon/syncdaemon-daemon.c 2010-10-21 11:41:33 +0000 | |||
3 | +++ libsyncdaemon/syncdaemon-daemon.c 2010-11-03 15:01:52 +0000 | |||
4 | @@ -74,7 +74,7 @@ | |||
5 | 74 | FOLDER_SUBSCRIBED_SIGNAL, | 74 | FOLDER_SUBSCRIBED_SIGNAL, |
6 | 75 | FOLDER_UNSUBSCRIBED_SIGNAL, | 75 | FOLDER_UNSUBSCRIBED_SIGNAL, |
7 | 76 | FILE_PUBLISHED_SIGNAL, | 76 | FILE_PUBLISHED_SIGNAL, |
9 | 77 | GOT_PUBLISHED_FILES_SIGNAL, | 77 | FILE_UNPUBLISHED_SIGNAL, |
10 | 78 | SHARE_CREATED_SIGNAL, | 78 | SHARE_CREATED_SIGNAL, |
11 | 79 | SHARE_DELETED_SIGNAL, | 79 | SHARE_DELETED_SIGNAL, |
12 | 80 | DOWNLOAD_STARTED_SIGNAL, | 80 | DOWNLOAD_STARTED_SIGNAL, |
13 | @@ -218,15 +218,15 @@ | |||
14 | 218 | G_TYPE_NONE, 2, | 218 | G_TYPE_NONE, 2, |
15 | 219 | G_TYPE_BOOLEAN, | 219 | G_TYPE_BOOLEAN, |
16 | 220 | G_TYPE_OBJECT); | 220 | G_TYPE_OBJECT); |
26 | 221 | daemon_signals[GOT_PUBLISHED_FILES_SIGNAL] = g_signal_new ("got_published_files", | 221 | daemon_signals[FILE_UNPUBLISHED_SIGNAL] = g_signal_new ("file_unpublished", |
27 | 222 | G_TYPE_FROM_CLASS (klass), | 222 | G_TYPE_FROM_CLASS (klass), |
28 | 223 | (GSignalFlags) G_SIGNAL_RUN_LAST, | 223 | (GSignalFlags) G_SIGNAL_RUN_LAST, |
29 | 224 | G_STRUCT_OFFSET (SyncdaemonDaemonClass, got_published_files), | 224 | G_STRUCT_OFFSET (SyncdaemonDaemonClass, file_unpublished), |
30 | 225 | NULL, NULL, | 225 | NULL, NULL, |
31 | 226 | _syncdaemon_marshal_VOID__BOOLEAN_POINTER, | 226 | _syncdaemon_marshal_VOID__BOOLEAN_OBJECT, |
32 | 227 | G_TYPE_NONE, 2, | 227 | G_TYPE_NONE, 2, |
33 | 228 | G_TYPE_BOOLEAN, | 228 | G_TYPE_BOOLEAN, |
34 | 229 | G_TYPE_POINTER); | 229 | G_TYPE_OBJECT); |
35 | 230 | daemon_signals[SHARE_CREATED_SIGNAL] = g_signal_new ("share_created", | 230 | daemon_signals[SHARE_CREATED_SIGNAL] = g_signal_new ("share_created", |
36 | 231 | G_TYPE_FROM_CLASS (klass), | 231 | G_TYPE_FROM_CLASS (klass), |
37 | 232 | (GSignalFlags) G_SIGNAL_RUN_LAST, | 232 | (GSignalFlags) G_SIGNAL_RUN_LAST, |
38 | 233 | 233 | ||
39 | === modified file 'libsyncdaemon/syncdaemon-daemon.h' | |||
40 | --- libsyncdaemon/syncdaemon-daemon.h 2010-10-21 11:41:33 +0000 | |||
41 | +++ libsyncdaemon/syncdaemon-daemon.h 2010-11-03 15:01:52 +0000 | |||
42 | @@ -67,7 +67,7 @@ | |||
43 | 67 | void (* folder_unsubscribed) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info); | 67 | void (* folder_unsubscribed) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info); |
44 | 68 | 68 | ||
45 | 69 | void (* file_published) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFileInfo *file_info); | 69 | void (* file_published) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFileInfo *file_info); |
47 | 70 | void (* got_published_files) (SyncdaemonDaemon *daemon, gboolean success, GSList *files); | 70 | void (* file_unpublished) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFileInfo *file_info); |
48 | 71 | 71 | ||
49 | 72 | void (* share_created) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info); | 72 | void (* share_created) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info); |
50 | 73 | void (* share_deleted) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info); | 73 | void (* share_deleted) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info); |
51 | 74 | 74 | ||
52 | === modified file 'libsyncdaemon/syncdaemon-publicfiles-interface.c' | |||
53 | --- libsyncdaemon/syncdaemon-publicfiles-interface.c 2010-08-25 18:18:56 +0000 | |||
54 | +++ libsyncdaemon/syncdaemon-publicfiles-interface.c 2010-11-03 15:01:52 +0000 | |||
55 | @@ -27,6 +27,7 @@ | |||
56 | 27 | 27 | ||
57 | 28 | struct _SyncdaemonPublicfilesInterfacePrivate { | 28 | struct _SyncdaemonPublicfilesInterfacePrivate { |
58 | 29 | GObject *proxy; | 29 | GObject *proxy; |
59 | 30 | GHashTable *public_files; | ||
60 | 30 | }; | 31 | }; |
61 | 31 | 32 | ||
62 | 32 | static void | 33 | static void |
63 | @@ -35,6 +36,9 @@ | |||
64 | 35 | SyncdaemonPublicfilesInterface *interface = SYNCDAEMON_PUBLICFILES_INTERFACE (object); | 36 | SyncdaemonPublicfilesInterface *interface = SYNCDAEMON_PUBLICFILES_INTERFACE (object); |
65 | 36 | 37 | ||
66 | 37 | if (interface->priv != NULL) { | 38 | if (interface->priv != NULL) { |
67 | 39 | if (interface->priv->public_files != NULL) | ||
68 | 40 | g_hash_table_destroy (interface->priv->public_files); | ||
69 | 41 | |||
70 | 38 | g_free (interface->priv); | 42 | g_free (interface->priv); |
71 | 39 | } | 43 | } |
72 | 40 | 44 | ||
73 | @@ -60,7 +64,10 @@ | |||
74 | 60 | SyncdaemonFileInfo *finfo; | 64 | SyncdaemonFileInfo *finfo; |
75 | 61 | 65 | ||
76 | 62 | finfo = syncdaemon_file_info_new_from_hash_table (hash); | 66 | finfo = syncdaemon_file_info_new_from_hash_table (hash); |
78 | 63 | g_signal_emit_by_name (daemon, "file_published", TRUE, finfo); | 67 | if (syncdaemon_file_info_get_is_public (finfo)) |
79 | 68 | g_signal_emit_by_name (daemon, "file_published", TRUE, finfo); | ||
80 | 69 | else | ||
81 | 70 | g_signal_emit_by_name (daemon, "file_unpublished", TRUE, finfo); | ||
82 | 64 | 71 | ||
83 | 65 | g_object_unref (G_OBJECT (finfo)); | 72 | g_object_unref (G_OBJECT (finfo)); |
84 | 66 | } | 73 | } |
85 | @@ -72,21 +79,24 @@ | |||
86 | 72 | SyncdaemonDaemon *daemon = NULL; | 79 | SyncdaemonDaemon *daemon = NULL; |
87 | 73 | SyncdaemonPublicfilesInterface *interface = SYNCDAEMON_PUBLICFILES_INTERFACE (user_data); | 80 | SyncdaemonPublicfilesInterface *interface = SYNCDAEMON_PUBLICFILES_INTERFACE (user_data); |
88 | 74 | 81 | ||
89 | 82 | if (interface->priv->public_files == NULL) { | ||
90 | 83 | interface->priv->public_files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); | ||
91 | 84 | } | ||
92 | 85 | |||
93 | 75 | g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL); | 86 | g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL); |
94 | 76 | if (daemon != NULL) { | 87 | if (daemon != NULL) { |
95 | 77 | GSList *finfo_list = NULL; | ||
96 | 78 | guint i; | 88 | guint i; |
97 | 79 | 89 | ||
98 | 80 | for (i = 0; i < files->len; i++) { | 90 | for (i = 0; i < files->len; i++) { |
99 | 81 | SyncdaemonFileInfo *finfo = syncdaemon_file_info_new_from_hash_table (g_ptr_array_index (files, i)); | 91 | SyncdaemonFileInfo *finfo = syncdaemon_file_info_new_from_hash_table (g_ptr_array_index (files, i)); |
100 | 82 | 92 | ||
102 | 83 | finfo_list = g_slist_append (finfo_list, finfo); | 93 | if (SYNCDAEMON_IS_FILE_INFO (finfo)) { |
103 | 94 | g_hash_table_insert (interface->priv->public_files, | ||
104 | 95 | g_strdup (syncdaemon_file_info_get_path (finfo)), | ||
105 | 96 | finfo); | ||
106 | 97 | g_signal_emit_by_name (daemon, "file_published", TRUE, finfo); | ||
107 | 98 | } | ||
108 | 84 | } | 99 | } |
109 | 85 | |||
110 | 86 | g_signal_emit_by_name (daemon, "got_published_files", TRUE, finfo_list); | ||
111 | 87 | |||
112 | 88 | g_slist_foreach (finfo_list, (GFunc) g_object_unref, NULL); | ||
113 | 89 | g_slist_free (finfo_list); | ||
114 | 90 | } | 100 | } |
115 | 91 | } | 101 | } |
116 | 92 | 102 | ||
117 | @@ -198,13 +208,33 @@ | |||
118 | 198 | 208 | ||
119 | 199 | /** | 209 | /** |
120 | 200 | * syncdaemon_publicfiles_interface_get_public_files: | 210 | * syncdaemon_publicfiles_interface_get_public_files: |
121 | 211 | * | ||
122 | 212 | * Return value: A #GSList of #SyncdaemonFileInfo objects, each of which describes | ||
123 | 213 | * a published file for the user. When no longer needed, this list should be | ||
124 | 214 | * freed by calling g_slist_free, but the data within the list should never | ||
125 | 215 | * be freed, as it belongs to the library. | ||
126 | 201 | */ | 216 | */ |
128 | 202 | void | 217 | GSList * |
129 | 203 | syncdaemon_publicfiles_interface_get_public_files (SyncdaemonPublicfilesInterface *interface) | 218 | syncdaemon_publicfiles_interface_get_public_files (SyncdaemonPublicfilesInterface *interface) |
130 | 204 | { | 219 | { |
136 | 205 | g_return_if_fail (SYNCDAEMON_IS_PUBLICFILES_INTERFACE (interface)); | 220 | GSList *files_list = NULL; |
137 | 206 | 221 | ||
138 | 207 | dbus_g_proxy_begin_call (DBUS_G_PROXY (interface->priv->proxy), "get_public_files", | 222 | g_return_val_if_fail (SYNCDAEMON_IS_PUBLICFILES_INTERFACE (interface), NULL); |
139 | 208 | no_output_dbus_call_ended_cb, interface, NULL, | 223 | |
140 | 209 | G_TYPE_INVALID); | 224 | if (interface->priv->public_files == NULL) { |
141 | 225 | /* Only retrieve list if we haven't yet */ | ||
142 | 226 | dbus_g_proxy_begin_call (DBUS_G_PROXY (interface->priv->proxy), "get_public_files", | ||
143 | 227 | no_output_dbus_call_ended_cb, interface, NULL, | ||
144 | 228 | G_TYPE_INVALID); | ||
145 | 229 | } else { | ||
146 | 230 | GHashTableIter iter; | ||
147 | 231 | gchar *path; | ||
148 | 232 | SyncdaemonFileInfo *finfo; | ||
149 | 233 | |||
150 | 234 | g_hash_table_iter_init (&iter, interface->priv->public_files); | ||
151 | 235 | while (g_hash_table_iter_next (&iter, (gpointer *) &path, (gpointer *) &finfo)) | ||
152 | 236 | files_list = g_slist_append (files_list, finfo); | ||
153 | 237 | } | ||
154 | 238 | |||
155 | 239 | return files_list; | ||
156 | 210 | } | 240 | } |
157 | 211 | 241 | ||
158 | === modified file 'libsyncdaemon/syncdaemon-publicfiles-interface.h' | |||
159 | --- libsyncdaemon/syncdaemon-publicfiles-interface.h 2010-06-04 15:36:24 +0000 | |||
160 | +++ libsyncdaemon/syncdaemon-publicfiles-interface.h 2010-11-03 15:01:52 +0000 | |||
161 | @@ -53,7 +53,7 @@ | |||
162 | 53 | const gchar *share_id, | 53 | const gchar *share_id, |
163 | 54 | const gchar *node_id, | 54 | const gchar *node_id, |
164 | 55 | gboolean is_public); | 55 | gboolean is_public); |
166 | 56 | void syncdaemon_publicfiles_interface_get_public_files (SyncdaemonPublicfilesInterface *interface); | 56 | GSList *syncdaemon_publicfiles_interface_get_public_files (SyncdaemonPublicfilesInterface *interface); |
167 | 57 | 57 | ||
168 | 58 | G_END_DECLS | 58 | G_END_DECLS |
169 | 59 | 59 | ||
170 | 60 | 60 | ||
171 | === modified file 'libsyncdaemon/syncdaemon-shares-interface.c' | |||
172 | --- libsyncdaemon/syncdaemon-shares-interface.c 2010-07-21 11:40:57 +0000 | |||
173 | +++ libsyncdaemon/syncdaemon-shares-interface.c 2010-11-03 15:01:52 +0000 | |||
174 | @@ -273,15 +273,30 @@ | |||
175 | 273 | * syncdaemon_shares_interface_delete: | 273 | * syncdaemon_shares_interface_delete: |
176 | 274 | */ | 274 | */ |
177 | 275 | void | 275 | void |
179 | 276 | syncdaemon_shares_interface_delete (SyncdaemonSharesInterface *interface, const gchar *share_id) | 276 | syncdaemon_shares_interface_delete (SyncdaemonSharesInterface *interface, const gchar *path) |
180 | 277 | { | 277 | { |
181 | 278 | GSList *shares, *l; | ||
182 | 279 | const gchar *share_id = NULL; | ||
183 | 280 | |||
184 | 278 | g_return_if_fail (SYNCDAEMON_IS_SHARES_INTERFACE (interface)); | 281 | g_return_if_fail (SYNCDAEMON_IS_SHARES_INTERFACE (interface)); |
191 | 279 | g_return_if_fail (share_id != NULL); | 282 | g_return_if_fail (path != NULL); |
192 | 280 | 283 | ||
193 | 281 | dbus_g_proxy_begin_call (DBUS_G_PROXY (interface->priv->proxy), "delete_share", | 284 | shares = syncdaemon_shares_interface_get_shared (interface); |
194 | 282 | no_output_dbus_call_ended_cb, interface, NULL, | 285 | for (l = shares; l != NULL; l = l->next) { |
195 | 283 | G_TYPE_STRING, share_id, | 286 | SyncdaemonShareInfo *sinfo = SYNCDAEMON_SHARE_INFO (l->data); |
196 | 284 | G_TYPE_INVALID); | 287 | |
197 | 288 | if (g_str_equal (path, syncdaemon_share_info_get_path (sinfo))) | ||
198 | 289 | share_id = syncdaemon_share_info_get_node_id (sinfo); | ||
199 | 290 | } | ||
200 | 291 | |||
201 | 292 | if (share_id != NULL) { | ||
202 | 293 | dbus_g_proxy_begin_call (DBUS_G_PROXY (interface->priv->proxy), "delete_share", | ||
203 | 294 | no_output_dbus_call_ended_cb, interface, NULL, | ||
204 | 295 | G_TYPE_STRING, share_id, | ||
205 | 296 | G_TYPE_INVALID); | ||
206 | 297 | } | ||
207 | 298 | |||
208 | 299 | g_slist_free (shares); | ||
209 | 285 | } | 300 | } |
210 | 286 | 301 | ||
211 | 287 | /** | 302 | /** |
212 | 288 | 303 | ||
213 | === modified file 'libsyncdaemon/syncdaemon-shares-interface.h' | |||
214 | --- libsyncdaemon/syncdaemon-shares-interface.h 2010-07-20 14:10:43 +0000 | |||
215 | +++ libsyncdaemon/syncdaemon-shares-interface.h 2010-11-03 15:01:52 +0000 | |||
216 | @@ -55,7 +55,7 @@ | |||
217 | 55 | GSList *usernames, | 55 | GSList *usernames, |
218 | 56 | const gchar *name, | 56 | const gchar *name, |
219 | 57 | gboolean allow_modifications); | 57 | gboolean allow_modifications); |
221 | 58 | void syncdaemon_shares_interface_delete (SyncdaemonSharesInterface *interface, const gchar *share_id); | 58 | void syncdaemon_shares_interface_delete (SyncdaemonSharesInterface *interface, const gchar *path); |
222 | 59 | GSList *syncdaemon_shares_interface_get_shared (SyncdaemonSharesInterface *interface); | 59 | GSList *syncdaemon_shares_interface_get_shared (SyncdaemonSharesInterface *interface); |
223 | 60 | GSList *syncdaemon_shares_interface_get_shares (SyncdaemonSharesInterface *interface); | 60 | GSList *syncdaemon_shares_interface_get_shares (SyncdaemonSharesInterface *interface); |
224 | 61 | void syncdaemon_shares_interface_refresh (SyncdaemonSharesInterface *interface); | 61 | void syncdaemon_shares_interface_refresh (SyncdaemonSharesInterface *interface); |
225 | 62 | 62 | ||
226 | === modified file 'nautilus/context-menu.c' | |||
227 | --- nautilus/context-menu.c 2010-10-05 12:47:32 +0000 | |||
228 | +++ nautilus/context-menu.c 2010-11-03 15:01:52 +0000 | |||
229 | @@ -138,7 +138,7 @@ | |||
230 | 138 | (SyncdaemonGotMetadataFunc) got_public_meta, data); | 138 | (SyncdaemonGotMetadataFunc) got_public_meta, data); |
231 | 139 | } | 139 | } |
232 | 140 | 140 | ||
234 | 141 | g_hash_table_replace (data->uon->public, g_strdup (data->path), UPDATE_PENDING); | 141 | g_hash_table_replace (data->uon->public, g_strdup (data->path), g_strdup (UPDATE_PENDING)); |
235 | 142 | file_watcher_update_path (data->uon->file_watcher, data->path); | 142 | file_watcher_update_path (data->uon->file_watcher, data->path); |
236 | 143 | } | 143 | } |
237 | 144 | 144 | ||
238 | @@ -156,14 +156,11 @@ | |||
239 | 156 | unshare_folder_cb (NautilusMenuItem *item, gpointer user_data) | 156 | unshare_folder_cb (NautilusMenuItem *item, gpointer user_data) |
240 | 157 | { | 157 | { |
241 | 158 | MenuCallbackData * data = (MenuCallbackData *) user_data; | 158 | MenuCallbackData * data = (MenuCallbackData *) user_data; |
242 | 159 | gchar * share_id; | ||
243 | 160 | SyncdaemonSharesInterface *interface; | 159 | SyncdaemonSharesInterface *interface; |
244 | 161 | 160 | ||
245 | 162 | interface = (SyncdaemonSharesInterface *) syncdaemon_daemon_get_shares_interface (data->uon->syncdaemon); | 161 | interface = (SyncdaemonSharesInterface *) syncdaemon_daemon_get_shares_interface (data->uon->syncdaemon); |
250 | 163 | if (interface != NULL) { | 162 | if (interface != NULL) |
251 | 164 | share_id = g_hash_table_lookup (data->uon->shares, data->path); | 163 | syncdaemon_shares_interface_delete (interface, data->path); |
248 | 165 | syncdaemon_shares_interface_delete (interface, share_id); | ||
249 | 166 | } | ||
252 | 167 | } | 164 | } |
253 | 168 | 165 | ||
254 | 169 | static void | 166 | static void |
255 | @@ -217,7 +214,8 @@ | |||
256 | 217 | if (strcmp (item, UPDATE_PENDING) == 0) | 214 | if (strcmp (item, UPDATE_PENDING) == 0) |
257 | 218 | is_pending = TRUE; | 215 | is_pending = TRUE; |
258 | 219 | } | 216 | } |
260 | 220 | if (g_hash_table_lookup (uon->shares, path) != NULL) | 217 | |
261 | 218 | if (ubuntuone_is_folder_shared (uon, path)) | ||
262 | 221 | is_shared = TRUE; | 219 | is_shared = TRUE; |
263 | 222 | 220 | ||
264 | 223 | is_dir = nautilus_file_info_is_directory (file); | 221 | is_dir = nautilus_file_info_is_directory (file); |
265 | 224 | 222 | ||
266 | === modified file 'nautilus/file-watcher.c' | |||
267 | --- nautilus/file-watcher.c 2010-10-08 07:46:41 +0000 | |||
268 | +++ nautilus/file-watcher.c 2010-11-03 15:01:52 +0000 | |||
269 | @@ -29,13 +29,25 @@ | |||
270 | 29 | 29 | ||
271 | 30 | G_DEFINE_TYPE(FileWatcher, file_watcher, G_TYPE_OBJECT) | 30 | G_DEFINE_TYPE(FileWatcher, file_watcher, G_TYPE_OBJECT) |
272 | 31 | 31 | ||
273 | 32 | static void observed_file_unrefed (gpointer user_data, GObject *where_the_object_was); | ||
274 | 33 | |||
275 | 34 | static void | ||
276 | 35 | foreach_weak_unref (gpointer key, gpointer value, gpointer user_data) | ||
277 | 36 | { | ||
278 | 37 | g_object_weak_unref (G_OBJECT (value), | ||
279 | 38 | (GWeakNotify) observed_file_unrefed, | ||
280 | 39 | user_data); | ||
281 | 40 | } | ||
282 | 41 | |||
283 | 32 | static void | 42 | static void |
284 | 33 | file_watcher_finalize (GObject *object) | 43 | file_watcher_finalize (GObject *object) |
285 | 34 | { | 44 | { |
286 | 35 | FileWatcher *watcher = FILE_WATCHER (object); | 45 | FileWatcher *watcher = FILE_WATCHER (object); |
287 | 36 | 46 | ||
289 | 37 | if (watcher->files != NULL) | 47 | if (watcher->files != NULL) { |
290 | 48 | g_hash_table_foreach (watcher->files, (GHFunc) foreach_weak_unref, watcher); | ||
291 | 38 | g_hash_table_destroy (watcher->files); | 49 | g_hash_table_destroy (watcher->files); |
292 | 50 | } | ||
293 | 39 | 51 | ||
294 | 40 | G_OBJECT_CLASS (file_watcher_parent_class)->finalize (object); | 52 | G_OBJECT_CLASS (file_watcher_parent_class)->finalize (object); |
295 | 41 | } | 53 | } |
296 | @@ -52,7 +64,7 @@ | |||
297 | 52 | file_watcher_init (FileWatcher *watcher) | 64 | file_watcher_init (FileWatcher *watcher) |
298 | 53 | { | 65 | { |
299 | 54 | watcher->uon = NULL; | 66 | watcher->uon = NULL; |
301 | 55 | watcher->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); | 67 | watcher->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); |
302 | 56 | } | 68 | } |
303 | 57 | 69 | ||
304 | 58 | static void | 70 | static void |
305 | @@ -87,13 +99,7 @@ | |||
306 | 87 | 99 | ||
307 | 88 | path = syncdaemon_share_info_get_path (share_info); | 100 | path = syncdaemon_share_info_get_path (share_info); |
308 | 89 | if (success) { | 101 | if (success) { |
316 | 90 | const gchar * id; | 102 | file_watcher_update_path (watcher, path); |
310 | 91 | |||
311 | 92 | id = syncdaemon_share_info_get_volume_id (share_info); | ||
312 | 93 | if (!g_hash_table_lookup (watcher->uon->shares, path)) { | ||
313 | 94 | g_hash_table_insert (watcher->uon->shares, g_strdup (path), g_strdup (id)); | ||
314 | 95 | file_watcher_update_path (watcher, path); | ||
315 | 96 | } | ||
317 | 97 | } else { | 103 | } else { |
318 | 98 | ubuntuone_show_error_dialog (watcher->uon, _("Error creating share."), | 104 | ubuntuone_show_error_dialog (watcher->uon, _("Error creating share."), |
319 | 99 | _("There was an error sharing the folder '%s'"), | 105 | _("There was an error sharing the folder '%s'"), |
320 | @@ -112,7 +118,6 @@ | |||
321 | 112 | 118 | ||
322 | 113 | path = syncdaemon_share_info_get_path (share_info); | 119 | path = syncdaemon_share_info_get_path (share_info); |
323 | 114 | if (success) { | 120 | if (success) { |
324 | 115 | g_hash_table_remove (watcher->uon->shares, path); | ||
325 | 116 | file_watcher_update_path (watcher, path); | 121 | file_watcher_update_path (watcher, path); |
326 | 117 | } else { | 122 | } else { |
327 | 118 | ubuntuone_show_error_dialog (watcher->uon, _("Error deleting share."), | 123 | ubuntuone_show_error_dialog (watcher->uon, _("Error deleting share."), |
328 | @@ -186,7 +191,6 @@ | |||
329 | 186 | g_hash_table_replace (watcher->uon->public, g_strdup (path), g_strdup (url)); | 191 | g_hash_table_replace (watcher->uon->public, g_strdup (path), g_strdup (url)); |
330 | 187 | 192 | ||
331 | 188 | file_watcher_update_path (watcher, path); | 193 | file_watcher_update_path (watcher, path); |
332 | 189 | watcher->uon->gotpubs = TRUE; | ||
333 | 190 | } else { | 194 | } else { |
334 | 191 | ubuntuone_show_error_dialog (watcher->uon, _("Error publishing file."), | 195 | ubuntuone_show_error_dialog (watcher->uon, _("Error publishing file."), |
335 | 192 | _("There was an error publishing file '%s'"), | 196 | _("There was an error publishing file '%s'"), |
336 | @@ -194,35 +198,6 @@ | |||
337 | 194 | } | 198 | } |
338 | 195 | } | 199 | } |
339 | 196 | 200 | ||
340 | 197 | static void | ||
341 | 198 | got_public_files_cb (SyncdaemonDaemon *daemon, | ||
342 | 199 | gboolean success, | ||
343 | 200 | GSList *files, | ||
344 | 201 | gpointer user_data) | ||
345 | 202 | { | ||
346 | 203 | FileWatcher *watcher = FILE_WATCHER (user_data); | ||
347 | 204 | |||
348 | 205 | if (success) { | ||
349 | 206 | GSList *l; | ||
350 | 207 | |||
351 | 208 | g_hash_table_remove_all (watcher->uon->public); | ||
352 | 209 | for (l = files; l != NULL; l = l->next) { | ||
353 | 210 | const gchar *path; | ||
354 | 211 | SyncdaemonFileInfo *finfo = SYNCDAEMON_FILE_INFO (l->data); | ||
355 | 212 | |||
356 | 213 | path = syncdaemon_file_info_get_path (finfo); | ||
357 | 214 | g_hash_table_insert (watcher->uon->public, | ||
358 | 215 | g_strdup (path), | ||
359 | 216 | g_strdup (syncdaemon_file_info_get_public_url (finfo))); | ||
360 | 217 | |||
361 | 218 | file_watcher_update_path (watcher, path); | ||
362 | 219 | } | ||
363 | 220 | } else { | ||
364 | 221 | ubuntuone_show_error_dialog (watcher->uon, _("Error getting public files"), | ||
365 | 222 | _("There was an error getting the list of public files")); | ||
366 | 223 | } | ||
367 | 224 | } | ||
368 | 225 | |||
369 | 226 | FileWatcher * | 201 | FileWatcher * |
370 | 227 | file_watcher_new (UbuntuOneNautilus *uon) | 202 | file_watcher_new (UbuntuOneNautilus *uon) |
371 | 228 | { | 203 | { |
372 | @@ -260,8 +235,8 @@ | |||
373 | 260 | /* Connect to public files-related signals */ | 235 | /* Connect to public files-related signals */ |
374 | 261 | g_signal_connect (G_OBJECT (uon->syncdaemon), "file_published", | 236 | g_signal_connect (G_OBJECT (uon->syncdaemon), "file_published", |
375 | 262 | G_CALLBACK (file_published_cb), watcher); | 237 | G_CALLBACK (file_published_cb), watcher); |
378 | 263 | g_signal_connect (G_OBJECT (uon->syncdaemon), "got_published_files", | 238 | g_signal_connect (G_OBJECT (uon->syncdaemon), "file_unpublished", |
379 | 264 | G_CALLBACK (got_public_files_cb), watcher); | 239 | G_CALLBACK (file_published_cb), watcher); |
380 | 265 | 240 | ||
381 | 266 | return watcher; | 241 | return watcher; |
382 | 267 | } | 242 | } |
383 | @@ -286,11 +261,25 @@ | |||
384 | 286 | return is_shared; | 261 | return is_shared; |
385 | 287 | } | 262 | } |
386 | 288 | 263 | ||
387 | 264 | static void | ||
388 | 265 | observed_file_unrefed (gpointer user_data, GObject *where_the_object_was) | ||
389 | 266 | { | ||
390 | 267 | gchar *path; | ||
391 | 268 | FileWatcher *watcher = FILE_WATCHER (user_data); | ||
392 | 269 | |||
393 | 270 | path = g_filename_from_uri (nautilus_file_info_get_uri (NAUTILUS_FILE_INFO (where_the_object_was)), NULL, NULL); | ||
394 | 271 | if (g_hash_table_lookup (watcher->files, path)) | ||
395 | 272 | g_hash_table_remove (watcher->files, path); | ||
396 | 273 | |||
397 | 274 | g_free (path); | ||
398 | 275 | } | ||
399 | 276 | |||
400 | 289 | void | 277 | void |
401 | 290 | file_watcher_add_file (FileWatcher *watcher, NautilusFileInfo *file) | 278 | file_watcher_add_file (FileWatcher *watcher, NautilusFileInfo *file) |
402 | 291 | { | 279 | { |
403 | 292 | gboolean is_root; | 280 | gboolean is_root; |
404 | 293 | gchar *path = NULL; | 281 | gchar *path = NULL; |
405 | 282 | NautilusFileInfo *old_file; | ||
406 | 294 | 283 | ||
407 | 295 | g_return_if_fail (IS_FILE_WATCHER (watcher)); | 284 | g_return_if_fail (IS_FILE_WATCHER (watcher)); |
408 | 296 | 285 | ||
409 | @@ -299,7 +288,14 @@ | |||
410 | 299 | return; | 288 | return; |
411 | 300 | 289 | ||
412 | 301 | /* Always add it to the observed hash table, so that we can update emblems */ | 290 | /* Always add it to the observed hash table, so that we can update emblems */ |
414 | 302 | g_hash_table_insert (watcher->files, path, g_object_ref (file)); | 291 | if ((old_file = g_hash_table_lookup (watcher->files, path))) { |
415 | 292 | g_object_weak_unref (G_OBJECT (old_file), | ||
416 | 293 | (GWeakNotify) observed_file_unrefed, watcher); | ||
417 | 294 | } | ||
418 | 295 | |||
419 | 296 | g_object_weak_ref (G_OBJECT (file), | ||
420 | 297 | (GWeakNotify) observed_file_unrefed, watcher); | ||
421 | 298 | g_hash_table_insert (watcher->files, g_strdup (path), file); | ||
422 | 303 | 299 | ||
423 | 304 | /* Retrieve metadata */ | 300 | /* Retrieve metadata */ |
424 | 305 | if (syncdaemon_daemon_is_folder_enabled (watcher->uon->syncdaemon, path, &is_root)) { | 301 | if (syncdaemon_daemon_is_folder_enabled (watcher->uon->syncdaemon, path, &is_root)) { |
425 | @@ -312,32 +308,49 @@ | |||
426 | 312 | 308 | ||
427 | 313 | metadata = syncdaemon_filesystem_interface_get_metadata ( | 309 | metadata = syncdaemon_filesystem_interface_get_metadata ( |
428 | 314 | SYNCDAEMON_FILESYSTEM_INTERFACE (interface), path, is_dir); | 310 | SYNCDAEMON_FILESYSTEM_INTERFACE (interface), path, is_dir); |
443 | 315 | 311 | if (SYNCDAEMON_IS_METADATA (metadata)) { | |
444 | 316 | if (syncdaemon_metadata_get_is_synced (metadata)) | 312 | if (syncdaemon_metadata_get_is_synced (metadata)) |
445 | 317 | nautilus_file_info_add_emblem (file, "ubuntuone-synchronized"); | 313 | nautilus_file_info_add_emblem (file, "ubuntuone-synchronized"); |
446 | 318 | else | 314 | else |
447 | 319 | nautilus_file_info_add_emblem (file, "ubuntuone-updating"); | 315 | nautilus_file_info_add_emblem (file, "ubuntuone-updating"); |
448 | 320 | 316 | ||
449 | 321 | if (is_dir) { | 317 | if (is_dir) { |
450 | 322 | /* If it's a directory, check shares */ | 318 | /* If it's a directory, check shares */ |
451 | 323 | interface = syncdaemon_daemon_get_shares_interface (watcher->uon->syncdaemon); | 319 | interface = syncdaemon_daemon_get_shares_interface (watcher->uon->syncdaemon); |
452 | 324 | if (check_for_shared_folder ((const gchar *) path, | 320 | if (check_for_shared_folder ((const gchar *) path, |
453 | 325 | syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface))) || | 321 | syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface))) || |
454 | 326 | check_for_shared_folder ((const gchar *) path, | 322 | check_for_shared_folder ((const gchar *) path, |
455 | 327 | syncdaemon_shares_interface_get_shares (SYNCDAEMON_SHARES_INTERFACE (interface)))) { | 323 | syncdaemon_shares_interface_get_shares (SYNCDAEMON_SHARES_INTERFACE (interface)))) { |
456 | 328 | nautilus_file_info_add_emblem (file, "shared"); | 324 | nautilus_file_info_add_emblem (file, "shared"); |
457 | 325 | } | ||
458 | 326 | } else { | ||
459 | 327 | GSList *public_files, *l; | ||
460 | 328 | |||
461 | 329 | /* If it's a file, check for public files */ | ||
462 | 330 | interface = syncdaemon_daemon_get_publicfiles_interface (watcher->uon->syncdaemon); | ||
463 | 331 | public_files = syncdaemon_publicfiles_interface_get_public_files (SYNCDAEMON_PUBLICFILES_INTERFACE (interface)); | ||
464 | 332 | for (l = public_files; l != NULL; l = l->next) { | ||
465 | 333 | SyncdaemonFileInfo *file_info = SYNCDAEMON_FILE_INFO (l->data); | ||
466 | 334 | |||
467 | 335 | if (!SYNCDAEMON_IS_FILE_INFO (file_info)) | ||
468 | 336 | continue; | ||
469 | 337 | |||
470 | 338 | if (g_strcmp0 (path, syncdaemon_file_info_get_path (file_info)) == 0) { | ||
471 | 339 | nautilus_file_info_add_emblem (file, "ubuntuone-public"); | ||
472 | 340 | break; | ||
473 | 341 | } | ||
474 | 342 | } | ||
475 | 343 | |||
476 | 344 | g_slist_free (public_files); | ||
477 | 329 | } | 345 | } |
480 | 330 | } else { | 346 | |
481 | 331 | /* If it's a file, check for public files */ | 347 | /* Free memory */ |
482 | 348 | g_object_unref (G_OBJECT (metadata)); | ||
483 | 332 | } | 349 | } |
484 | 333 | |||
485 | 334 | /* Free memory */ | ||
486 | 335 | g_object_unref (G_OBJECT (metadata)); | ||
487 | 336 | } | 350 | } |
488 | 337 | } | 351 | } |
489 | 338 | 352 | ||
492 | 339 | /* if (g_hash_table_lookup (watcher->uon->public, path)) */ | 353 | g_free (path); |
491 | 340 | /* nautilus_file_info_add_emblem (file, "ubuntuone-public"); */ | ||
493 | 341 | } | 354 | } |
494 | 342 | 355 | ||
495 | 343 | void | 356 | void |
496 | 344 | 357 | ||
497 | === modified file 'nautilus/ubuntuone-nautilus.c' | |||
498 | --- nautilus/ubuntuone-nautilus.c 2010-10-08 07:46:41 +0000 | |||
499 | +++ nautilus/ubuntuone-nautilus.c 2010-11-03 15:01:52 +0000 | |||
500 | @@ -172,9 +172,8 @@ | |||
501 | 172 | ubuntuone_nautilus_instance_init (UbuntuOneNautilus * uon) | 172 | ubuntuone_nautilus_instance_init (UbuntuOneNautilus * uon) |
502 | 173 | { | 173 | { |
503 | 174 | uon->connected = FALSE; | 174 | uon->connected = FALSE; |
504 | 175 | uon->shares = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); | ||
505 | 176 | uon->udfs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); | 175 | uon->udfs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); |
507 | 177 | uon->public = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); | 176 | uon->public = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); |
508 | 178 | 177 | ||
509 | 179 | uon->syncdaemon = syncdaemon_daemon_new (); | 178 | uon->syncdaemon = syncdaemon_daemon_new (); |
510 | 180 | g_signal_connect (G_OBJECT (uon->syncdaemon), "ready", | 179 | g_signal_connect (G_OBJECT (uon->syncdaemon), "ready", |
511 | @@ -187,7 +186,6 @@ | |||
512 | 187 | uon->managed = g_build_filename (g_get_home_dir (), "Ubuntu One", NULL); | 186 | uon->managed = g_build_filename (g_get_home_dir (), "Ubuntu One", NULL); |
513 | 188 | uon->gotroot = FALSE; | 187 | uon->gotroot = FALSE; |
514 | 189 | uon->gotudfs = FALSE; | 188 | uon->gotudfs = FALSE; |
515 | 190 | uon->gotpubs = FALSE; | ||
516 | 191 | } | 189 | } |
517 | 192 | 190 | ||
518 | 193 | static void | 191 | static void |
519 | @@ -209,9 +207,6 @@ | |||
520 | 209 | if (uon->syncdaemon) | 207 | if (uon->syncdaemon) |
521 | 210 | g_object_unref (uon->syncdaemon); | 208 | g_object_unref (uon->syncdaemon); |
522 | 211 | 209 | ||
523 | 212 | g_hash_table_destroy (uon->shares); | ||
524 | 213 | uon->shares = NULL; | ||
525 | 214 | |||
526 | 215 | g_hash_table_destroy (uon->udfs); | 210 | g_hash_table_destroy (uon->udfs); |
527 | 216 | uon->udfs = NULL; | 211 | uon->udfs = NULL; |
528 | 217 | 212 | ||
529 | @@ -333,36 +328,18 @@ | |||
530 | 333 | } | 328 | } |
531 | 334 | } | 329 | } |
532 | 335 | 330 | ||
533 | 336 | /* Get the list of shared folders */ | ||
534 | 337 | interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon); | ||
535 | 338 | if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) { | ||
536 | 339 | GSList *shares; | ||
537 | 340 | |||
538 | 341 | shares = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface)); | ||
539 | 342 | while (shares != NULL) { | ||
540 | 343 | const gchar *id, *path; | ||
541 | 344 | SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (shares->data); | ||
542 | 345 | |||
543 | 346 | /* This code is duplicated in file-watcher.c */ | ||
544 | 347 | path = syncdaemon_share_info_get_path (share_info); | ||
545 | 348 | id = syncdaemon_share_info_get_volume_id (share_info); | ||
546 | 349 | if (!g_hash_table_lookup (uon->shares, path)) { | ||
547 | 350 | g_hash_table_insert (uon->shares, g_strdup (path), g_strdup (id)); | ||
548 | 351 | file_watcher_update_path (uon->file_watcher, path); | ||
549 | 352 | } | ||
550 | 353 | |||
551 | 354 | shares = g_slist_remove (shares, shares->data); | ||
552 | 355 | } | ||
553 | 356 | } | ||
554 | 357 | |||
555 | 358 | /* Get the list of public files if we haven't already */ | 331 | /* Get the list of public files if we haven't already */ |
557 | 359 | if (is_online && !uon->gotpubs) { | 332 | if (is_online) { |
558 | 360 | SyncdaemonInterface *public; | 333 | SyncdaemonInterface *public; |
559 | 361 | 334 | ||
560 | 362 | public = syncdaemon_daemon_get_publicfiles_interface (uon->syncdaemon); | 335 | public = syncdaemon_daemon_get_publicfiles_interface (uon->syncdaemon); |
561 | 363 | if (public != NULL) { | 336 | if (public != NULL) { |
564 | 364 | syncdaemon_publicfiles_interface_get_public_files (SYNCDAEMON_PUBLICFILES_INTERFACE (public)); | 337 | GSList *files_list; |
565 | 365 | uon->gotpubs = TRUE; | 338 | |
566 | 339 | /* We just call it here so that libsyncdaemon caches it, but we discard | ||
567 | 340 | the list, as we don't need it yet */ | ||
568 | 341 | files_list = syncdaemon_publicfiles_interface_get_public_files (SYNCDAEMON_PUBLICFILES_INTERFACE (public)); | ||
569 | 342 | g_slist_free (files_list); | ||
570 | 366 | } | 343 | } |
571 | 367 | } | 344 | } |
572 | 368 | } | 345 | } |
573 | 369 | 346 | ||
574 | === modified file 'nautilus/ubuntuone-nautilus.h' | |||
575 | --- nautilus/ubuntuone-nautilus.h 2010-09-30 13:04:47 +0000 | |||
576 | +++ nautilus/ubuntuone-nautilus.h 2010-11-03 15:01:52 +0000 | |||
577 | @@ -50,10 +50,6 @@ | |||
578 | 50 | /* Avoid calling get_rootdir and get_folders lots of times */ | 50 | /* Avoid calling get_rootdir and get_folders lots of times */ |
579 | 51 | gboolean gotroot; | 51 | gboolean gotroot; |
580 | 52 | gboolean gotudfs; | 52 | gboolean gotudfs; |
581 | 53 | gboolean gotpubs; | ||
582 | 54 | |||
583 | 55 | /* Lists of ul/dl/shares for setting emblems */ | ||
584 | 56 | GHashTable * shares; | ||
585 | 57 | 53 | ||
586 | 58 | /* Lists of public files and user defined folders */ | 54 | /* Lists of public files and user defined folders */ |
587 | 59 | GHashTable * public; | 55 | GHashTable * public; |
588 | @@ -67,6 +63,7 @@ | |||
589 | 67 | GType ubuntuone_nautilus_get_type (void); | 63 | GType ubuntuone_nautilus_get_type (void); |
590 | 68 | 64 | ||
591 | 69 | /* Utility functions */ | 65 | /* Utility functions */ |
592 | 66 | gboolean ubuntuone_is_folder_shared (UbuntuOneNautilus *uon, const gchar *path); | ||
593 | 70 | gboolean ubuntuone_is_location_bar_enabled (void); | 67 | gboolean ubuntuone_is_location_bar_enabled (void); |
594 | 71 | 68 | ||
595 | 72 | gboolean ubuntuone_check_shares_and_public_files (UbuntuOneNautilus *uon, | 69 | gboolean ubuntuone_check_shares_and_public_files (UbuntuOneNautilus *uon, |
596 | 73 | 70 | ||
597 | === modified file 'nautilus/utils.c' | |||
598 | --- nautilus/utils.c 2010-09-29 11:12:35 +0000 | |||
599 | +++ nautilus/utils.c 2010-11-03 15:01:52 +0000 | |||
600 | @@ -59,22 +59,27 @@ | |||
601 | 59 | } | 59 | } |
602 | 60 | 60 | ||
603 | 61 | /* Now check for published files */ | 61 | /* Now check for published files */ |
611 | 62 | if (uon->gotpubs) { | 62 | interface = syncdaemon_daemon_get_publicfiles_interface (uon->syncdaemon); |
612 | 63 | GHashTableIter iter; | 63 | if (SYNCDAEMON_IS_PUBLICFILES_INTERFACE (interface)) { |
613 | 64 | gchar *key, *value; | 64 | GSList *public_files, *l; |
614 | 65 | 65 | public_files = syncdaemon_publicfiles_interface_get_public_files (SYNCDAEMON_PUBLICFILES_INTERFACE (interface)); | |
615 | 66 | g_hash_table_iter_init (&iter, uon->public); | 66 | |
616 | 67 | while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) { | 67 | for (l = public_files; l != NULL; l = l->next) { |
617 | 68 | if (g_str_has_prefix (key, syncdaemon_folder_info_get_path (folder_info))) { | 68 | const gchar *path; |
618 | 69 | |||
619 | 70 | path = syncdaemon_file_info_get_path (SYNCDAEMON_FILE_INFO (l->data)); | ||
620 | 71 | if (g_str_has_prefix (path, syncdaemon_folder_info_get_path (folder_info))) { | ||
621 | 69 | has_published = TRUE; | 72 | has_published = TRUE; |
622 | 70 | 73 | ||
623 | 71 | question = g_string_append (question, "\t- "); | 74 | question = g_string_append (question, "\t- "); |
625 | 72 | question = g_string_append (question, key); | 75 | question = g_string_append (question, path); |
626 | 73 | question = g_string_append (question, _(" (Published at ")); | 76 | question = g_string_append (question, _(" (Published at ")); |
628 | 74 | question = g_string_append (question, value); | 77 | question = g_string_append (question, syncdaemon_file_info_get_public_url (SYNCDAEMON_FILE_INFO (l->data))); |
629 | 75 | question = g_string_append (question, ")\n"); | 78 | question = g_string_append (question, ")\n"); |
630 | 76 | } | 79 | } |
631 | 77 | } | 80 | } |
632 | 81 | |||
633 | 82 | g_slist_free (public_files); | ||
634 | 78 | } | 83 | } |
635 | 79 | 84 | ||
636 | 80 | if (has_shares || has_published) { | 85 | if (has_shares || has_published) { |
637 | @@ -101,6 +106,31 @@ | |||
638 | 101 | } | 106 | } |
639 | 102 | 107 | ||
640 | 103 | gboolean | 108 | gboolean |
641 | 109 | ubuntuone_is_folder_shared (UbuntuOneNautilus *uon, const gchar *path) | ||
642 | 110 | { | ||
643 | 111 | GSList *shares, *l; | ||
644 | 112 | SyncdaemonInterface *interface; | ||
645 | 113 | gboolean is_shared = FALSE; | ||
646 | 114 | |||
647 | 115 | interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon); | ||
648 | 116 | if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) { | ||
649 | 117 | shares = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface)); | ||
650 | 118 | for (l = shares; l != NULL; l = l->next) { | ||
651 | 119 | SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (l->data); | ||
652 | 120 | |||
653 | 121 | if (g_strcmp0 (syncdaemon_share_info_get_path (share_info), path) == 0) { | ||
654 | 122 | is_shared = TRUE; | ||
655 | 123 | break; | ||
656 | 124 | } | ||
657 | 125 | } | ||
658 | 126 | |||
659 | 127 | g_slist_free (shares); | ||
660 | 128 | } | ||
661 | 129 | |||
662 | 130 | return is_shared; | ||
663 | 131 | } | ||
664 | 132 | |||
665 | 133 | gboolean | ||
666 | 104 | ubuntuone_is_location_bar_enabled (void) | 134 | ubuntuone_is_location_bar_enabled (void) |
667 | 105 | { | 135 | { |
668 | 106 | GConfClient *conf_client; | 136 | GConfClient *conf_client; |
I'm getting the following, but rodrigo says he will fix this on another branch:
** (nautilus:9918): WARNING **: Failed calling get_metadata_ and_quick_ tree_synced: Traceback (most recent call last): pymodules/ python2. 6/dbus/ service. py", line 702, in _message_cb method( self, *args, **keywords) pymodules/ python2. 6/ubuntuone/ syncdaemon/ dbus_interface. py", line 1027, in get_metadata_ and_quick_ tree_synced manager. get_by_ path(real_ path) pymodules/ python2. 6/ubuntuone/ syncdaemon/ filesystem_ manager. py", line 607, in get_by_path path[path] nessita/ .local/ share/ubuntuone /shares'
File "/usr/lib/
retval = candidate_
File "/usr/lib/
mdobj = self.fs_
File "/usr/lib/
mdid = self._idx_
KeyError: '/home/