1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Migrating from GnomeVFS to GIO</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="migrating.html" title="Part III. Migrating to GIO">
9 <link rel="prev" href="ch19.html" title="Migrating from POSIX to GIO">
10 <link rel="next" href="ch20s02.html" title="Operations on multiple files">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="part" href="pt01.html" title="Part I. GIO Overview">
14 <link rel="chapter" href="ch01.html" title="Introduction">
15 <link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16 <link rel="chapter" href="ch03.html" title="Running GIO applications">
17 <link rel="chapter" href="extending-gio.html" title="Extending GIO">
18 <link rel="part" href="pt02.html" title="Part II. API Reference">
19 <link rel="chapter" href="file_ops.html" title="File Operations">
20 <link rel="chapter" href="file_mon.html" title="File System Monitoring">
21 <link rel="chapter" href="async.html" title="Asynchronous I/O">
22 <link rel="chapter" href="conversion.html" title="Data conversion">
23 <link rel="chapter" href="streaming.html" title="Streaming I/O">
24 <link rel="chapter" href="types.html" title="File types and applications">
25 <link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
26 <link rel="chapter" href="icons.html" title="Icons">
27 <link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
28 <link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
29 <link rel="chapter" href="resolver.html" title="DNS resolution">
30 <link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
31 <link rel="chapter" href="utils.html" title="Utilities">
32 <link rel="chapter" href="extending.html" title="Extending GIO">
33 <link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
34 <link rel="chapter" href="ch19.html" title="Migrating from POSIX to GIO">
35 <link rel="chapter" href="ch20.html" title="Migrating from GnomeVFS to GIO">
36 <link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
37 <link rel="index" href="api-index-full.html" title="Index">
38 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
39 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
40 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
46 <td><a accesskey="p" href="ch19.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
47 <td><a accesskey="u" href="migrating.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
48 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
49 <th width="100%" align="center">GIO Reference Manual</th>
50 <td><a accesskey="n" href="ch20s02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
52 <div class="chapter" title="Migrating from GnomeVFS to GIO">
53 <div class="titlepage"><div><div><h2 class="title">
54 <a name="id554953"></a>Migrating from GnomeVFS to GIO</h2></div></div></div>
56 <dt><span class="section"><a href="ch20.html#id559976">Trash handling</a></span></dt>
57 <dt><span class="section"><a href="ch20s02.html">Operations on multiple files</a></span></dt>
58 <dt><span class="section"><a href="ch20s03.html">Mime monitoring</a></span></dt>
61 <a name="gnome-vfs-vs-gio"></a><p class="title"><b>Table 5. Comparison of GnomeVFS and GIO concepts</b></p>
62 <div class="table-contents"><table summary="Comparison of GnomeVFS and GIO concepts" border="1">
77 <td>GnomeVFSFileInfo</td>
81 <td>GnomeVFSResult</td>
82 <td>GError, with G_IO_ERROR values</td>
85 <td>GnomeVFSHandle & GnomeVFSAsyncHandle</td>
86 <td>GInputStream or GOutputStream</td>
89 <td>GnomeVFSDirectoryHandle</td>
90 <td>GFileEnumerator</td>
97 <td>GnomeVFSMonitor</td>
101 <td>GnomeVFSVolumeMonitor</td>
102 <td>GVolumeMonitor</td>
105 <td>GnomeVFSVolume</td>
109 <td>GnomeVFSDrive</td>
117 <td>GnomeVFSContext</td>
118 <td>GCancellable</td>
121 <td>gnome_vfs_async_cancel</td>
122 <td>g_cancellable_cancel</td>
127 <br class="table-break"><div class="section" title="Trash handling">
128 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
129 <a name="id559976"></a>Trash handling</h2></div></div></div>
131 The handling of trashed files has been changed in GIO, compared
132 to gnome-vfs. gnome-vfs has a home-grown trash implementation that
133 predates the freedesktop.org <a class="ulink" href="http://www.freedesktop.org/wiki/Specifications/trash-spec" target="_top">Desktop Trash Can</a> specification
134 that is implemented in GIO. The location for storing trashed files
135 has changed from <code class="filename">$HOME/.Trash</code> to
136 <code class="filename">$HOME/.local/share/Trash</code> (or more correctly
137 <code class="filename">$XDG_DATA_HOME/Trash</code>), which means that
138 there is a need for migrating files that have been trashed by
139 gnome-vfs to the new location.
142 In gnome-vfs, the <code class="filename">trash://</code> scheme offering a
143 merged view of all trash directories was implemented in nautilus,
144 and trash-handling applications had to find and monitor all trash
145 directories themselves. With GIO, the <code class="filename">trash://</code>
146 implementation has been moved to gvfs and applications can simply
147 monitor that location:
149 <div class="informalexample"><pre class="programlisting">
151 file_changed (GFileMonitor *file_monitor,
154 GFileMonitorEvent event_type,
159 case G_FILE_MONITOR_EVENT_DELETED:
160 g_print ("'%s' removed from trash\n", g_file_get_basename (child));
162 case G_FILE_MONITOR_EVENT_CREATED:
163 g_print ("'%s' added to trash\n", g_file_get_basename (child));
170 start_monitoring_trash (void)
173 GFileMonitor *monitor;
175 file = g_file_new_for_uri ("trash://");
176 monitor = g_file_monitor_directory (file, 0, NULL, NULL);
177 g_object_unref (file);
179 g_signal_connect (monitor, "changed", G_CALLBACK (file_changed), NULL);
186 GIO exposes some useful metadata about trashed files. There are
187 trash::orig-path and trash::deletion-date attributes. The
188 standard::icon attribute of the <code class="filename">trash://</code>
189 itself provides a suitable icon for displaying the trash can on
190 the desktop. If you are using this icon, make sure to monitor
191 this attribute for changes, since the icon may be updated to
192 reflect that state of the trash can.
195 Moving a file to the trash is much simpler with GIO. Instead of
196 using <a href="/usr/share/gtk-doc/html/gnome-vfs-2.0/gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory"><code class="function">gnome_vfs_find_directory()</code></a> with <code class="literal">GNOME_VFS_DIRECTORY_KIND_TRASH</code>
197 to find out where to move the trashed file, just use the <a class="link" href="GFile.html#g-file-trash" title="g_file_trash ()"><code class="function">g_file_trash()</code></a>
204 Generated by GTK-Doc V1.13</div>