2007-12-17 18:28:40 +01:00
|
|
|
<part>
|
|
|
|
<title>GIO Overview</title>
|
|
|
|
|
2007-12-18 04:14:39 +01:00
|
|
|
<chapter>
|
|
|
|
<title>Introduction</title>
|
|
|
|
|
2007-12-18 01:56:35 +01:00
|
|
|
<para>
|
2007-12-18 04:14:39 +01:00
|
|
|
GIO is striving to provide a modern, easy-to-use VFS API that sits
|
2007-12-18 01:56:35 +01:00
|
|
|
at the right level in the library stack. The goal is to overcome the
|
2007-12-18 04:14:39 +01:00
|
|
|
shortcomings of GnomeVFS and provide an API that is so good that
|
2007-12-18 01:56:35 +01:00
|
|
|
developers prefer it over raw POSIX calls. Among other things
|
|
|
|
that means using GObject. It also means not cloning the POSIX
|
2007-12-19 12:19:12 +01:00
|
|
|
API, but providing higher-level, document-centric interfaces.
|
2007-12-18 01:56:35 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The abstract file system model of GIO consists of a number of
|
|
|
|
interfaces and base classes for I/O and files:
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GFile</term>
|
|
|
|
<listitem><para>reference to a file</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GFileInfo</term>
|
|
|
|
<listitem><para>information about a file or filesystem</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GFileEnumerator</term>
|
|
|
|
<listitem><para>list files in directories</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GDrive</term>
|
|
|
|
<listitem><para>represents a drive</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GVolume</term>
|
|
|
|
<listitem><para>represents a file system in an abstract way</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GMount</term>
|
|
|
|
<listitem><para>represents a mounted file system</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
Then there is a number of stream classes, similar to the input and
|
|
|
|
output stream hierarchies that can be found in frameworks like Java:
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GInputStream</term>
|
|
|
|
<listitem><para>read data</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GOutputStream</term>
|
|
|
|
<listitem><para>write data</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GSeekable</term>
|
2007-12-19 12:19:12 +01:00
|
|
|
<listitem><para>interface optionally implemented by streams to support seeking</para></listitem>
|
2007-12-18 01:56:35 +01:00
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
There are interfaces related to applications and the types
|
|
|
|
of files they handle:
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GAppInfo</term>
|
|
|
|
<listitem><para>information about an installed application</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>GIcon</term>
|
|
|
|
<listitem><para>abstract type for file and application icons</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
Beyond these, GIO provides facilities for file monitoring,
|
2007-12-18 04:14:39 +01:00
|
|
|
asynchronous I/O and filename completion. In addition to the
|
2007-12-18 01:56:35 +01:00
|
|
|
interfaces, GIO provides implementations for the local case.
|
|
|
|
Implementations for various network file systems are provided
|
|
|
|
by the GVFS package as loadable modules.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2007-12-18 04:14:39 +01:00
|
|
|
Other design choices which consciously break with the GnomeVFS
|
2007-12-18 01:56:35 +01:00
|
|
|
design are to move backends out-of-process, which minimizes the
|
|
|
|
dependency bloat and makes the whole system more robust. The backends
|
2007-12-18 04:14:39 +01:00
|
|
|
are not included in GIO, but in the separate GVFS package. The GVFS
|
|
|
|
package also contains the GVFS daemon, which spawn further mount
|
|
|
|
daemons for each individual connection.
|
2007-12-18 01:56:35 +01:00
|
|
|
</para>
|
|
|
|
|
2007-12-18 04:14:39 +01:00
|
|
|
<figure id="gvfs-overview">
|
|
|
|
<title>GIO in the GTK+ library stack</title>
|
|
|
|
<graphic fileref="gvfs-overview.png" format="PNG"></graphic>
|
|
|
|
</figure>
|
2007-12-17 18:28:40 +01:00
|
|
|
|
2007-12-18 01:56:35 +01:00
|
|
|
<para>
|
|
|
|
The GIO model of I/O is stateful: if an application establishes e.g.
|
2007-12-18 04:14:39 +01:00
|
|
|
a SFTP connection to a server, it becomes available to all applications
|
2007-12-18 01:56:35 +01:00
|
|
|
in the session; the user does not have to enter his password over
|
|
|
|
and over again.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
One of the big advantages of putting the VFS in the GLib layer
|
|
|
|
is that GTK+ can directly use it, e.g. in the filechooser.
|
|
|
|
</para>
|
2007-12-18 04:14:39 +01:00
|
|
|
</chapter>
|
|
|
|
|
|
|
|
<chapter>
|
|
|
|
<title>Compiling GIO applications</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
GIO comes with a <filename>gio-2.0.pc</filename> file that you
|
|
|
|
should use together with <literal>pkg-config</literal> to obtain
|
|
|
|
the necessary information about header files and libraries. See
|
|
|
|
the <literal>pkg-config</literal> man page or the GLib documentation
|
|
|
|
for more information on how to use <literal>pkg-config</literal>
|
|
|
|
to compile your application.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
If you are using GIO on UNIX-like systems, you may want to use
|
|
|
|
UNIX-specific GIO interfaces such as #GUnixInputStream,
|
|
|
|
#GUnixOutputStream, #GUnixMount or #GDesktopAppInfo.
|
|
|
|
To do so, use the <filename>gio-unix-2.0.pc</filename> file
|
|
|
|
instead of <filename>gio-2.0.pc</filename>
|
|
|
|
</para>
|
|
|
|
</chapter>
|
2007-12-18 01:56:35 +01:00
|
|
|
|
2007-12-17 18:28:40 +01:00
|
|
|
</part>
|