Codebase list xapp / 78669e2
favorite-vfs-file-monitor.c: When handling folder updates, send out removals before additions. When a favorited folder is moved to a different location, its uri in favorites:/// won't change, since it's based only on the basename. Sending removes first makes sure both operations occur - if additions are sent first, they will be ignored because their apparent uri hasn't changed, so we'll end up just removing the file from the view. Michael Webster 3 years ago
1 changed file(s) with 18 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
205205 XAppFavoriteInfo *info = (XAppFavoriteInfo *) ptr_a;
206206 const gchar *uri = (gchar *) ptr_b;
207207
208 // GCompareFunc returns 0 when there's a match.
208209 return g_strcmp0 (info->uri, uri);
209210 }
210211
251252 {
252253 added = g_list_prepend (added, new_info);
253254 }
255 }
256
257 for (iter = removed; iter != NULL; iter = iter->next)
258 {
259 XAppFavoriteInfo *removed_info = (XAppFavoriteInfo *) iter->data;
260
261 GFile *file = _favorite_vfs_file_new_for_info (removed_info);
262
263 g_file_monitor_emit_event (G_FILE_MONITOR (monitor),
264 file,
265 NULL,
266 G_FILE_MONITOR_EVENT_DELETED);
267 g_file_monitor_emit_event (G_FILE_MONITOR (monitor),
268 file,
269 NULL,
270 G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT);
271 g_object_unref (file);
254272 }
255273
256274 for (iter = added; iter != NULL; iter = iter->next)
270288 g_object_unref (file);
271289 }
272290
273 for (iter = removed; iter != NULL; iter = iter->next)
274 {
275 XAppFavoriteInfo *removed_info = (XAppFavoriteInfo *) iter->data;
276
277 GFile *file = _favorite_vfs_file_new_for_info (removed_info);
278
279 g_file_monitor_emit_event (G_FILE_MONITOR (monitor),
280 file,
281 NULL,
282 G_FILE_MONITOR_EVENT_DELETED);
283 g_file_monitor_emit_event (G_FILE_MONITOR (monitor),
284 file,
285 NULL,
286 G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT);
287 g_object_unref (file);
288 }
289
290291 g_list_free (added);
291292 g_list_free (removed);
292293