Table 5. Comparison of GnomeVFS and GIO concepts
The handling of trashed files has been changed in GIO, compared
to gnome-vfs. gnome-vfs has a home-grown trash implementation that
predates the freedesktop.org Desktop Trash Can specification
that is implemented in GIO. The location for storing trashed files
has changed from
In gnome-vfs, the static void file_changed (GFileMonitor *file_monitor, GFile *child, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { switch (event_type) { case G_FILE_MONITOR_EVENT_DELETED: g_print ("'%s' removed from trash\n", g_file_get_basename (child)); break; case G_FILE_MONITOR_EVENT_CREATED: g_print ("'%s' added to trash\n", g_file_get_basename (child)); break; default: ; } } static void start_monitoring_trash (void) { GFile *file; GFileMonitor *monitor; file = g_file_new_for_uri ("trash://"); monitor = g_file_monitor_directory (file, 0, NULL, NULL); g_object_unref (file); g_signal_connect (monitor, "changed", G_CALLBACK (file_changed), NULL); /* ... */ }
GIO exposes some useful metadata about trashed files. There are
trash::orig-path and trash::deletion-date attributes. The
standard::icon attribute of the
Moving a file to the trash is much simpler with GIO. Instead of
using |