summaryrefstree
path: root/usr/share/gtk-doc/html/gio/ch01.html
blob: 5831806362f84c4daefb0b5606223a039350c220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Introduction</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="pt01.html" title="Part I. GIO Overview">
<link rel="prev" href="pt01.html" title="Part I. GIO Overview">
<link rel="next" href="ch02.html" title="Writing GIO applications">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="pt01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="pt01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="ch02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="id-1.3.2"></a>Introduction</h2></div></div></div>
<p>
    GIO is striving to provide a modern, easy-to-use VFS API that sits
    at the right level in the library stack, as well as other generally
    useful APIs for desktop applications (such as networking and
    D-Bus support). The goal is to overcome the shortcomings of GnomeVFS
    and provide an API that is so good that developers prefer it over raw
    POSIX calls. Among other things that means using GObject. It also means
    not cloning the POSIX API, but providing higher-level, document-centric
    interfaces.
  </p>
<p>
    The abstract file system model of GIO consists of a number of
    interfaces and base classes for I/O and files:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">GFile</span></p></td>
<td><p>reference to a file</p></td>
</tr>
<tr>
<td><p><span class="term">GFileInfo</span></p></td>
<td><p>information about a file or filesystem</p></td>
</tr>
<tr>
<td><p><span class="term">GFileEnumerator</span></p></td>
<td><p>list files in directories</p></td>
</tr>
<tr>
<td><p><span class="term">GDrive</span></p></td>
<td><p>represents a drive</p></td>
</tr>
<tr>
<td><p><span class="term">GVolume</span></p></td>
<td><p>represents a file system in an abstract way</p></td>
</tr>
<tr>
<td><p><span class="term">GMount</span></p></td>
<td><p>represents a mounted file system</p></td>
</tr>
</tbody>
</table></div>
<p>
    Then there is a number of stream classes, similar to the input and
    output stream hierarchies that can be found in frameworks like Java:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">GInputStream</span></p></td>
<td><p>read data</p></td>
</tr>
<tr>
<td><p><span class="term">GOutputStream</span></p></td>
<td><p>write data</p></td>
</tr>
<tr>
<td><p><span class="term">GIOStream</span></p></td>
<td><p>read and write data</p></td>
</tr>
<tr>
<td><p><span class="term">GSeekable</span></p></td>
<td><p>interface optionally implemented by streams to support seeking</p></td>
</tr>
</tbody>
</table></div>
<p>
    There are interfaces related to applications and the types
    of files they handle:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">GAppInfo</span></p></td>
<td><p>information about an installed application</p></td>
</tr>
<tr>
<td><p><span class="term">GIcon</span></p></td>
<td><p>abstract type for file and application icons</p></td>
</tr>
</tbody>
</table></div>
<p>
    There is a framework for storing and retrieving application settings:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">GSettings</span></p></td>
<td><p>stores and retrieves application settings</p></td>
</tr></tbody>
</table></div>
<p>
    There is support for network programming, including connectivity monitoring,
    name resolution, lowlevel socket APIs and highlevel client and server
    helper classes:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">GSocket</span></p></td>
<td><p>lowlevel platform independent socket object</p></td>
</tr>
<tr>
<td><p><span class="term">GResolver</span></p></td>
<td><p>asynchronous and cancellable DNS resolver</p></td>
</tr>
<tr>
<td><p><span class="term">GSocketClient</span></p></td>
<td><p>high-level network client helper</p></td>
</tr>
<tr>
<td><p><span class="term">GSocketService</span></p></td>
<td><p>high-level network server helper</p></td>
</tr>
<tr>
<td><p><span class="term">GSocketConnection</span></p></td>
<td><p>network connection stream</p></td>
</tr>
<tr>
<td><p><span class="term">GNetworkMonitor</span></p></td>
<td><p>network connectivity monitoring</p></td>
</tr>
</tbody>
</table></div>
<p>
    There is support for connecting to D-Bus,
    sending and receiving messages, owning and watching bus names,
    and making objects available on the bus:
    </p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">GDBusConnection</span></p></td>
<td><p>a D-Bus connection</p></td>
</tr>
<tr>
<td><p><span class="term">GDBusMethodInvocation</span></p></td>
<td><p>for handling remove calls</p></td>
</tr>
<tr>
<td><p><span class="term">GDBusServer</span></p></td>
<td><p>helper for accepting connections</p></td>
</tr>
<tr>
<td><p><span class="term">GDBusProxy</span></p></td>
<td><p>proxy to access D-Bus interfaces on a remote object</p></td>
</tr>
</tbody>
</table></div>
<p>
    Beyond these, GIO provides facilities for file monitoring,
    asynchronous I/O and filename completion. In addition to the
    interfaces, GIO provides implementations for the local case.
    Implementations for various network file systems are provided
    by the GVFS package as loadable modules.
  </p>
<p>
    Other design choices which consciously break with the GnomeVFS
    design are to move backends out-of-process, which minimizes the
    dependency bloat and makes the whole system more robust. The backends
    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.
  </p>
<div class="figure">
<a name="gvfs-overview"></a><p class="title"><b>Figure 1. GIO in the GTK+ library stack</b></p>
<div class="figure-contents"><div><img src="gvfs-overview.png" alt="GIO in the GTK+ library stack"></div></div>
</div>
<br class="figure-break"><p>
    The GIO model of I/O is stateful: if an application establishes e.g.
    a SFTP connection to a server, it becomes available to all applications
    in the session; the user does not have to enter his password over
    and over again.
  </p>
<p>
    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.
  </p>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>