diff options
-rw-r--r-- | daemon/trashlib/trashdir.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/daemon/trashlib/trashdir.c b/daemon/trashlib/trashdir.c index c470d3bd..0d7d2b1b 100644 --- a/daemon/trashlib/trashdir.c +++ b/daemon/trashlib/trashdir.c @@ -163,10 +163,27 @@ trash_dir_changed (GFileMonitor *monitor, TrashDir *dir = user_data; if (event_type == G_FILE_MONITOR_EVENT_CREATED) - trash_root_add_item (dir->root, file, dir->topdir, dir->is_homedir); + { + dir->items = g_slist_insert_sorted (dir->items, + g_object_ref (file), + (GCompareFunc) compare_basename); + trash_root_add_item (dir->root, file, dir->topdir, dir->is_homedir); + } else if (event_type == G_FILE_MONITOR_EVENT_DELETED) - trash_root_remove_item (dir->root, file, dir->is_homedir); + { + GSList *node; + + node = g_slist_find_custom (dir->items, + file, + (GCompareFunc) compare_basename); + if (node) + { + g_object_unref (node->data); + dir->items = g_slist_delete_link (dir->items, node); + } + trash_root_remove_item (dir->root, file, dir->is_homedir); + } else if (event_type == G_FILE_MONITOR_EVENT_PRE_UNMOUNT || event_type == G_FILE_MONITOR_EVENT_UNMOUNTED || |