void fileops_empty_trash () { if (pool == NULL) { pool = g_thread_pool_new(_empty_trash_job, NULL, -1, FALSE, NULL); atexit(destroy_thread_pool); } GList* trash_list = NULL; GVolumeMonitor* vol_monitor = g_volume_monitor_get (); GList* mount_list = g_volume_monitor_get_mounts (vol_monitor); g_object_unref (vol_monitor); //iterate through all mounts GList* l; for (l = mount_list; l != NULL; l = l->next) { trash_list = g_list_concat (trash_list, _get_trash_dirs_for_mount (l->data)); } g_list_free_full (mount_list, g_object_unref); //add 'trash:' prefix trash_list = g_list_prepend (trash_list, g_file_new_for_uri ("trash:")); g_thread_pool_push(pool, trash_list, NULL); }
void fileops_empty_trash () { GList* trash_list = NULL; GVolumeMonitor* vol_monitor = g_volume_monitor_get (); GList* mount_list = g_volume_monitor_get_mounts (vol_monitor); g_object_unref (vol_monitor); //iterate through all mounts GList* l; for (l = mount_list; l != NULL; l = l->next) { trash_list = g_list_concat (trash_list, _get_trash_dirs_for_mount (l->data)); } g_list_free_full (mount_list, g_object_unref); //add 'trash:' prefix trash_list = g_list_prepend (trash_list, g_file_new_for_uri ("trash:")); g_io_scheduler_push_job (_empty_trash_job, trash_list, NULL, 0, NULL); }