gio2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gio2/extconf.rb +4 -42
- data/ext/gio2/gio2.c +18 -117
- data/ext/gio2/gio2.h +20 -339
- data/ext/gio2/rbgio.c +132 -0
- data/ext/gio2/rbgio2.h +156 -0
- data/ext/gio2/rbgio2conversions.h +154 -0
- data/ext/gio2/rbgio2private.h +147 -0
- data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
- data/ext/gio2/rbgioapplaunchcontext.c +81 -0
- data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
- data/ext/gio2/rbgioasyncresult.c +41 -0
- data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
- data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
- data/ext/gio2/rbgiocancellable.c +180 -0
- data/ext/gio2/rbgiocharsetconverter.c +57 -0
- data/ext/gio2/rbgiocontenttype.c +131 -0
- data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
- data/ext/gio2/rbgioconverterinputstream.c +43 -0
- data/ext/gio2/rbgioconverteroutputstream.c +43 -0
- data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
- data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
- data/ext/gio2/rbgiodesktopappinfo.c +87 -0
- data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
- data/ext/gio2/rbgioemblem.c +52 -0
- data/ext/gio2/rbgioemblemedicon.c +65 -0
- data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
- data/ext/gio2/rbgiofileattribute.c +114 -0
- data/ext/gio2/rbgiofileattributeinfo.c +86 -0
- data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
- data/ext/gio2/rbgiofileattributematcher.c +93 -0
- data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
- data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
- data/ext/gio2/rbgiofileicon.c +41 -0
- data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
- data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
- data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
- data/ext/gio2/rbgiofilemonitor.c +46 -0
- data/ext/gio2/rbgiofilenamecompleter.c +74 -0
- data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
- data/ext/gio2/rbgiofilterinputstream.c +28 -0
- data/ext/gio2/rbgiofilteroutputstream.c +28 -0
- data/ext/gio2/rbgioicon.c +69 -0
- data/ext/gio2/rbgioinetaddress.c +118 -0
- data/ext/gio2/rbgioinetsocketaddress.c +41 -0
- data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
- data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
- data/ext/gio2/rbgioio.c +73 -0
- data/ext/gio2/rbgioiomodule.c +45 -0
- data/ext/gio2/rbgioiomodules.c +47 -0
- data/ext/gio2/rbgioioscheduler.c +102 -0
- data/ext/gio2/rbgioioschedulerjob.c +121 -0
- data/ext/gio2/rbgioiostream.c +108 -0
- data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
- data/ext/gio2/rbgiomemoryinputstream.c +67 -0
- data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
- data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
- data/ext/gio2/rbgiomountoperation.c +53 -0
- data/ext/gio2/rbgionetworkaddress.c +59 -0
- data/ext/gio2/rbgionetworkservice.c +45 -0
- data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
- data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
- data/ext/gio2/rbgioseekable.c +91 -0
- data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
- data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
- data/ext/gio2/rbgiosocketaddress.c +34 -0
- data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
- data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
- data/ext/gio2/rbgiosocketconnectable.c +41 -0
- data/ext/gio2/rbgiosocketconnection.c +66 -0
- data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
- data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
- data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
- data/ext/gio2/rbgiosocketservice.c +66 -0
- data/ext/gio2/rbgiosrvtarget.c +76 -0
- data/ext/gio2/rbgiotcpconnection.c +28 -0
- data/ext/gio2/rbgiothemedicon.c +83 -0
- data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
- data/ext/gio2/rbgiounixconnection.c +71 -0
- data/ext/gio2/rbgiounixfdlist.c +115 -0
- data/ext/gio2/rbgiounixfdmessage.c +74 -0
- data/ext/gio2/rbgiounixinputstream.c +51 -0
- data/ext/gio2/rbgiounixmount.c +164 -0
- data/ext/gio2/rbgiounixmountmonitor.c +66 -0
- data/ext/gio2/rbgiounixmountpoint.c +136 -0
- data/ext/gio2/rbgiounixmountpoints.c +58 -0
- data/ext/gio2/rbgiounixmounts.c +58 -0
- data/ext/gio2/rbgiounixoutputstream.c +51 -0
- data/ext/gio2/rbgiounixsocketaddress.c +69 -0
- data/ext/gio2/rbgiovfs.c +84 -0
- data/ext/gio2/rbgiovolume.c +193 -0
- data/ext/gio2/rbgiovolumemonitor.c +77 -0
- data/ext/gio2/rbgiozlibcompressor.c +52 -0
- data/ext/gio2/rbgiozlibdecompressor.c +45 -0
- data/ext/gio2/util.c +57 -60
- data/lib/gio2/deprecated.rb +102 -0
- data/lib/gio2.rb +14 -12
- metadata +100 -88
- data/ChangeLog +0 -129
- data/ext/gio2/gapplaunchcontext.c +0 -79
- data/ext/gio2/gasyncresult.c +0 -39
- data/ext/gio2/gbufferedoutputstream.c +0 -48
- data/ext/gio2/gcancellable.c +0 -177
- data/ext/gio2/gcharsetconverter.c +0 -55
- data/ext/gio2/gcontenttype.c +0 -128
- data/ext/gio2/gconverterinputstream.c +0 -41
- data/ext/gio2/gconverteroutputstream.c +0 -41
- data/ext/gio2/gdesktopappinfo.c +0 -88
- data/ext/gio2/gemblem.c +0 -52
- data/ext/gio2/gemblemedicon.c +0 -63
- data/ext/gio2/gfileattribute.c +0 -111
- data/ext/gio2/gfileattributeinfo.c +0 -89
- data/ext/gio2/gfileattributeinfolist.c +0 -109
- data/ext/gio2/gfileattributematcher.c +0 -90
- data/ext/gio2/gfiledescriptorbased.c +0 -42
- data/ext/gio2/gfileicon.c +0 -39
- data/ext/gio2/gfilemonitor.c +0 -44
- data/ext/gio2/gfilenamecompleter.c +0 -72
- data/ext/gio2/gfilterinputstream.c +0 -27
- data/ext/gio2/gfilteroutputstream.c +0 -27
- data/ext/gio2/gicon.c +0 -67
- data/ext/gio2/ginetaddress.c +0 -116
- data/ext/gio2/ginetsocketaddress.c +0 -38
- data/ext/gio2/gioerror.c +0 -70
- data/ext/gio2/giomodule.c +0 -63
- data/ext/gio2/gioscheduler.c +0 -193
- data/ext/gio2/giostream.c +0 -106
- data/ext/gio2/gmemoryinputstream.c +0 -65
- data/ext/gio2/gmemoryoutputstream.c +0 -41
- data/ext/gio2/gmountoperation.c +0 -66
- data/ext/gio2/gnetworkaddress.c +0 -57
- data/ext/gio2/gnetworkservice.c +0 -43
- data/ext/gio2/gseekable.c +0 -89
- data/ext/gio2/gsimpleasyncresult.c +0 -153
- data/ext/gio2/gsocketaddress.c +0 -33
- data/ext/gio2/gsocketconnectable.c +0 -97
- data/ext/gio2/gsocketconnection.c +0 -75
- data/ext/gio2/gsocketcontrolmessage.c +0 -80
- data/ext/gio2/gsocketservice.c +0 -64
- data/ext/gio2/gsrvtarget.c +0 -77
- data/ext/gio2/gtcpconnection.c +0 -27
- data/ext/gio2/gthemedicon.c +0 -81
- data/ext/gio2/gthreadedsocketservice.c +0 -40
- data/ext/gio2/gunixconnection.c +0 -69
- data/ext/gio2/gunixfdlist.c +0 -112
- data/ext/gio2/gunixfdmessage.c +0 -72
- data/ext/gio2/gunixinputstream.c +0 -49
- data/ext/gio2/gunixmounts.c +0 -343
- data/ext/gio2/gunixoutputstream.c +0 -49
- data/ext/gio2/gunixsocketaddress.c +0 -67
- data/ext/gio2/gvfs.c +0 -82
- data/ext/gio2/gvolume.c +0 -191
- data/ext/gio2/gvolumemonitor.c +0 -75
- data/ext/gio2/gzlibcompressor.c +0 -50
- data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,29 +1,31 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
23
|
-
#define
|
24
|
+
#define RG_TARGET_NAMESPACE mInitable
|
25
|
+
#define _SELF(value) RVAL2GINITABLE(value)
|
24
26
|
|
25
27
|
static VALUE
|
26
|
-
|
28
|
+
rg_init(int argc, VALUE *argv, VALUE self)
|
27
29
|
{
|
28
30
|
VALUE cancellable;
|
29
31
|
GError *error = NULL;
|
@@ -105,6 +107,8 @@ rbgio_ginitable_new_ensure(struct rbgio_ginitable_new_data *data)
|
|
105
107
|
if (G_IS_VALUE(&data->parameters[i].value))
|
106
108
|
g_value_unset(&data->parameters[i].value);
|
107
109
|
|
110
|
+
g_free(data->parameters);
|
111
|
+
|
108
112
|
return Qnil;
|
109
113
|
}
|
110
114
|
|
@@ -146,7 +150,7 @@ rbgio_ginitable_new(GType type, VALUE parameters, VALUE cancellable)
|
|
146
150
|
data.rbparameters = parameters;
|
147
151
|
data.index = 0;
|
148
152
|
data.n_parameters = RVAL2GUINT(rb_funcall(parameters, s_id_length, 0));
|
149
|
-
data.parameters =
|
153
|
+
data.parameters = g_new(GParameter, data.n_parameters);
|
150
154
|
data.error = NULL;
|
151
155
|
|
152
156
|
object = (GObject *)rb_ensure(rbgio_ginitable_new_body, (VALUE)&data,
|
@@ -157,12 +161,12 @@ rbgio_ginitable_new(GType type, VALUE parameters, VALUE cancellable)
|
|
157
161
|
return object;
|
158
162
|
}
|
159
163
|
|
160
|
-
/* NOTE: We don
|
164
|
+
/* NOTE: We don't implement g_initable_new. */
|
161
165
|
|
162
|
-
/* NOTE: We don
|
166
|
+
/* NOTE: We don't implement g_initable_new_valist. */
|
163
167
|
|
164
168
|
static VALUE
|
165
|
-
|
169
|
+
rg_m_new(int argc, VALUE *argv, VALUE self)
|
166
170
|
{
|
167
171
|
const RGObjClassInfo* info;
|
168
172
|
VALUE cancellable, parameters;
|
@@ -185,11 +189,11 @@ initable_initialize(int argc, VALUE *argv, VALUE self)
|
|
185
189
|
}
|
186
190
|
|
187
191
|
void
|
188
|
-
Init_ginitable(VALUE
|
192
|
+
Init_ginitable(VALUE mGio)
|
189
193
|
{
|
190
|
-
VALUE
|
194
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_INITABLE, "Initable", mGio);
|
191
195
|
|
192
|
-
|
196
|
+
RG_DEF_MODFUNC(new, -1);
|
193
197
|
|
194
|
-
|
198
|
+
RG_DEF_METHOD(init, -1);
|
195
199
|
}
|
@@ -1,31 +1,33 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
24
|
+
#define RG_TARGET_NAMESPACE cInputStream
|
23
25
|
#define _SELF(value) RVAL2GINPUTSTREAM(value)
|
24
26
|
|
25
27
|
static VALUE s_cReadAsyncResult;
|
26
28
|
|
27
29
|
static VALUE
|
28
|
-
|
30
|
+
rg_read(int argc, VALUE *argv, VALUE self)
|
29
31
|
{
|
30
32
|
VALUE rbcount, cancellable, result;
|
31
33
|
gsize count;
|
@@ -51,7 +53,7 @@ inputstream_read(int argc, VALUE *argv, VALUE self)
|
|
51
53
|
}
|
52
54
|
|
53
55
|
static VALUE
|
54
|
-
|
56
|
+
rg_read_all(int argc, VALUE *argv, VALUE self)
|
55
57
|
{
|
56
58
|
VALUE rbcount, cancellable, result;
|
57
59
|
gsize count;
|
@@ -77,7 +79,7 @@ inputstream_read_all(int argc, VALUE *argv, VALUE self)
|
|
77
79
|
}
|
78
80
|
|
79
81
|
static VALUE
|
80
|
-
|
82
|
+
rg_skip(int argc, VALUE *argv, VALUE self)
|
81
83
|
{
|
82
84
|
VALUE count, cancellable;
|
83
85
|
GError *error = NULL;
|
@@ -95,7 +97,7 @@ inputstream_skip(int argc, VALUE *argv, VALUE self)
|
|
95
97
|
}
|
96
98
|
|
97
99
|
static VALUE
|
98
|
-
|
100
|
+
rg_close(int argc, VALUE *argv, VALUE self)
|
99
101
|
{
|
100
102
|
VALUE cancellable;
|
101
103
|
GError *error = NULL;
|
@@ -169,7 +171,7 @@ read_async_callback(G_GNUC_UNUSED GObject *source,
|
|
169
171
|
}
|
170
172
|
|
171
173
|
static VALUE
|
172
|
-
|
174
|
+
rg_read_async(int argc, VALUE *argv, VALUE self)
|
173
175
|
{
|
174
176
|
VALUE rbcount, rbio_priority, rbcancellable, block, data;
|
175
177
|
gsize count;
|
@@ -194,7 +196,7 @@ inputstream_read_async(int argc, VALUE *argv, VALUE self)
|
|
194
196
|
}
|
195
197
|
|
196
198
|
static VALUE
|
197
|
-
|
199
|
+
rg_read_finish(VALUE self, VALUE rbresult)
|
198
200
|
{
|
199
201
|
struct read_async_result *result;
|
200
202
|
GError *error = NULL;
|
@@ -215,7 +217,7 @@ inputstream_read_finish(VALUE self, VALUE rbresult)
|
|
215
217
|
}
|
216
218
|
|
217
219
|
static VALUE
|
218
|
-
|
220
|
+
rg_skip_async(int argc, VALUE *argv, VALUE self)
|
219
221
|
{
|
220
222
|
VALUE rbcount, rbio_priority, rbcancellable, block;
|
221
223
|
gsize count;
|
@@ -238,7 +240,7 @@ inputstream_skip_async(int argc, VALUE *argv, VALUE self)
|
|
238
240
|
}
|
239
241
|
|
240
242
|
static VALUE
|
241
|
-
|
243
|
+
rg_skip_finish(VALUE self, VALUE result)
|
242
244
|
{
|
243
245
|
GError *error = NULL;
|
244
246
|
gssize skipped_bytes;
|
@@ -253,7 +255,7 @@ inputstream_skip_finish(VALUE self, VALUE result)
|
|
253
255
|
}
|
254
256
|
|
255
257
|
static VALUE
|
256
|
-
|
258
|
+
rg_close_async(int argc, VALUE *argv, VALUE self)
|
257
259
|
{
|
258
260
|
VALUE rbio_priority, rbcancellable, block;
|
259
261
|
int io_priority;
|
@@ -273,7 +275,7 @@ inputstream_close_async(int argc, VALUE *argv, VALUE self)
|
|
273
275
|
}
|
274
276
|
|
275
277
|
static VALUE
|
276
|
-
|
278
|
+
rg_close_finish(VALUE self, VALUE result)
|
277
279
|
{
|
278
280
|
GError *error = NULL;
|
279
281
|
if (!g_input_stream_skip_finish(_SELF(self),
|
@@ -285,19 +287,19 @@ inputstream_close_finish(VALUE self, VALUE result)
|
|
285
287
|
}
|
286
288
|
|
287
289
|
static VALUE
|
288
|
-
|
290
|
+
rg_closed_p(VALUE self)
|
289
291
|
{
|
290
292
|
return CBOOL2RVAL(g_input_stream_is_closed(_SELF(self)));
|
291
293
|
}
|
292
294
|
|
293
295
|
static VALUE
|
294
|
-
|
296
|
+
rg_has_pending_p(VALUE self)
|
295
297
|
{
|
296
298
|
return CBOOL2RVAL(g_input_stream_has_pending(_SELF(self)));
|
297
299
|
}
|
298
300
|
|
299
301
|
static VALUE
|
300
|
-
|
302
|
+
rg_set_pending(VALUE self)
|
301
303
|
{
|
302
304
|
GError *error = NULL;
|
303
305
|
|
@@ -308,7 +310,7 @@ inputstream_set_pending(VALUE self)
|
|
308
310
|
}
|
309
311
|
|
310
312
|
static VALUE
|
311
|
-
|
313
|
+
rg_clear_pending(VALUE self)
|
312
314
|
{
|
313
315
|
g_input_stream_clear_pending(_SELF(self));
|
314
316
|
|
@@ -316,24 +318,24 @@ inputstream_clear_pending(VALUE self)
|
|
316
318
|
}
|
317
319
|
|
318
320
|
void
|
319
|
-
Init_ginputstream(VALUE
|
321
|
+
Init_ginputstream(VALUE mGio)
|
320
322
|
{
|
321
|
-
VALUE
|
322
|
-
|
323
|
-
s_cReadAsyncResult = rb_define_class_under(
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
323
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_INPUT_STREAM, "InputStream", mGio);
|
324
|
+
|
325
|
+
s_cReadAsyncResult = rb_define_class_under(RG_TARGET_NAMESPACE, "ReadAsyncResult", rb_cObject);
|
326
|
+
|
327
|
+
RG_DEF_METHOD(read, -1);
|
328
|
+
RG_DEF_METHOD(read_all, -1);
|
329
|
+
RG_DEF_METHOD(skip, -1);
|
330
|
+
RG_DEF_METHOD(close, -1);
|
331
|
+
RG_DEF_METHOD(read_async, -1);
|
332
|
+
RG_DEF_METHOD(read_finish, 1);
|
333
|
+
RG_DEF_METHOD(skip_async, -1);
|
334
|
+
RG_DEF_METHOD(skip_finish, 1);
|
335
|
+
RG_DEF_METHOD(close_async, -1);
|
336
|
+
RG_DEF_METHOD(close_finish, 1);
|
337
|
+
RG_DEF_METHOD_P(closed, 0);
|
338
|
+
RG_DEF_METHOD_P(has_pending, 0);
|
339
|
+
RG_DEF_METHOD(set_pending, 0);
|
340
|
+
RG_DEF_METHOD(clear_pending, 0);
|
339
341
|
}
|
data/ext/gio2/rbgioio.c
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgio2private.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE mIO
|
25
|
+
|
26
|
+
/* NOTE: g_io_error_from_errno doesn't make sense from Ruby. */
|
27
|
+
|
28
|
+
void
|
29
|
+
Init_gioerror(VALUE mGio)
|
30
|
+
{
|
31
|
+
VALUE RG_TARGET_NAMESPACE, error;
|
32
|
+
|
33
|
+
RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IO");
|
34
|
+
|
35
|
+
error = rbgio_define_domain_error(RG_TARGET_NAMESPACE, "Error", G_IO_ERROR, "GIOErrorEnum", rb_eIOError);
|
36
|
+
|
37
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "FailedError", G_IO_ERROR_FAILED, error);
|
38
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotFoundError", G_IO_ERROR_NOT_FOUND, error);
|
39
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "ExistsError", G_IO_ERROR_EXISTS, error);
|
40
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "IsDirectoryError", G_IO_ERROR_IS_DIRECTORY, error);
|
41
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotDirectoryError", G_IO_ERROR_NOT_DIRECTORY, error);
|
42
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotEmptyError", G_IO_ERROR_NOT_EMPTY, error);
|
43
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotRegularFileError", G_IO_ERROR_NOT_REGULAR_FILE, error);
|
44
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotSymbolicLinkError", G_IO_ERROR_NOT_SYMBOLIC_LINK, error);
|
45
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotMountableFileError", G_IO_ERROR_NOT_MOUNTABLE_FILE, error);
|
46
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "FilenameTooLongError", G_IO_ERROR_FILENAME_TOO_LONG, error);
|
47
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidFilenameError", G_IO_ERROR_INVALID_FILENAME, error);
|
48
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "TooManyLinksError", G_IO_ERROR_TOO_MANY_LINKS, error);
|
49
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NoSpaceError", G_IO_ERROR_NO_SPACE, error);
|
50
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidArgumentError", G_IO_ERROR_INVALID_ARGUMENT, error);
|
51
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "PermissionDeniedError", G_IO_ERROR_PERMISSION_DENIED, error);
|
52
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotSupportedError", G_IO_ERROR_NOT_SUPPORTED, error);
|
53
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotMountedError", G_IO_ERROR_NOT_MOUNTED, error);
|
54
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "AlreadyMountedError", G_IO_ERROR_ALREADY_MOUNTED, error);
|
55
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "ClosedError", G_IO_ERROR_CLOSED, error);
|
56
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "CancelledError", G_IO_ERROR_CANCELLED, error);
|
57
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "PendingError", G_IO_ERROR_PENDING, error);
|
58
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "ReadOnlyError", G_IO_ERROR_READ_ONLY, error);
|
59
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "CantCreateBackupError", G_IO_ERROR_CANT_CREATE_BACKUP, error);
|
60
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "WrongEtagError", G_IO_ERROR_WRONG_ETAG, error);
|
61
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "TimedOutError", G_IO_ERROR_TIMED_OUT, error);
|
62
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "WouldRecurseError", G_IO_ERROR_WOULD_RECURSE, error);
|
63
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "BusyError", G_IO_ERROR_BUSY, error);
|
64
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "WouldBlockError", G_IO_ERROR_WOULD_BLOCK, error);
|
65
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "HostNotFoundError", G_IO_ERROR_HOST_NOT_FOUND, error);
|
66
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "WouldMergeError", G_IO_ERROR_WOULD_MERGE, error);
|
67
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "FailedHandledError", G_IO_ERROR_FAILED_HANDLED, error);
|
68
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "TooManyOpenFilesError", G_IO_ERROR_TOO_MANY_OPEN_FILES, error);
|
69
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "NotInitializedError", G_IO_ERROR_NOT_INITIALIZED, error);
|
70
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "AddressInUseError", G_IO_ERROR_ADDRESS_IN_USE, error);
|
71
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "PartialInputError", G_IO_ERROR_PARTIAL_INPUT, error);
|
72
|
+
rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidDataError", G_IO_ERROR_INVALID_DATA, error);
|
73
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgio2private.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cIOModule
|
25
|
+
#define _SELF(value) RVAL2GIOMODULE(value)
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_initialize(VALUE self, VALUE filename)
|
29
|
+
{
|
30
|
+
G_INITIALIZE(self, g_io_module_new(RVAL2CSTR(filename)));
|
31
|
+
|
32
|
+
return Qnil;
|
33
|
+
}
|
34
|
+
|
35
|
+
/* NOTE: No point in implementing g_io_module_query. */
|
36
|
+
|
37
|
+
void
|
38
|
+
Init_giomodule(VALUE mGio)
|
39
|
+
{
|
40
|
+
VALUE RG_TARGET_NAMESPACE;
|
41
|
+
|
42
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_IO_TYPE_MODULE, "IOModule", mGio);
|
43
|
+
|
44
|
+
RG_DEF_METHOD(initialize, 1);
|
45
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgio2private.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE mIOModules
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_m_load_all_in_directory(G_GNUC_UNUSED VALUE self, VALUE dirname)
|
28
|
+
{
|
29
|
+
return GLIST2ARY_FREE(g_io_modules_load_all_in_directory(RVAL2CSTR(dirname)));
|
30
|
+
}
|
31
|
+
|
32
|
+
static VALUE
|
33
|
+
rg_m_scan_all_in_directory(VALUE self, VALUE dirname)
|
34
|
+
{
|
35
|
+
g_io_modules_scan_all_in_directory(RVAL2CSTR(dirname));
|
36
|
+
|
37
|
+
return self;
|
38
|
+
}
|
39
|
+
|
40
|
+
void
|
41
|
+
Init_giomodules(VALUE mGio)
|
42
|
+
{
|
43
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IOModules");
|
44
|
+
|
45
|
+
RG_DEF_MODFUNC(load_all_in_directory, 1);
|
46
|
+
RG_DEF_MODFUNC(scan_all_in_directory, 1);
|
47
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgio2private.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE mIOScheduler
|
25
|
+
|
26
|
+
struct ioscheduler_job_callback_data
|
27
|
+
{
|
28
|
+
GIOSchedulerJob *job;
|
29
|
+
GCancellable *cancellable;
|
30
|
+
gpointer data;
|
31
|
+
};
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
ioscheduler_job_callback_call(VALUE data)
|
35
|
+
{
|
36
|
+
static VALUE s_id_call;
|
37
|
+
struct ioscheduler_job_callback_data *real;
|
38
|
+
|
39
|
+
if (s_id_call == 0)
|
40
|
+
s_id_call = rb_intern("call");
|
41
|
+
|
42
|
+
real = (struct ioscheduler_job_callback_data *)data;
|
43
|
+
|
44
|
+
/* TODO: Totally unsure if _UNREF is correct here or not. */
|
45
|
+
return rb_funcall(USE_BLOCK_AND_SAVE(real->data), s_id_call, 2,
|
46
|
+
GOBJ2RVAL_UNREF(real->job),
|
47
|
+
GOBJ2RVAL_UNREF(real->cancellable));
|
48
|
+
}
|
49
|
+
|
50
|
+
static gboolean
|
51
|
+
ioscheduler_job_callback(GIOSchedulerJob *job,
|
52
|
+
GCancellable *cancellable,
|
53
|
+
gpointer data)
|
54
|
+
{
|
55
|
+
struct ioscheduler_job_callback_data real = { job, cancellable, data };
|
56
|
+
|
57
|
+
return RVAL2CBOOL(G_PROTECT_CALLBACK(ioscheduler_job_callback_call,
|
58
|
+
&real));
|
59
|
+
}
|
60
|
+
|
61
|
+
static void
|
62
|
+
ioscheduler_job_callback_free(gpointer data)
|
63
|
+
{
|
64
|
+
USE_BLOCK((VALUE)data);
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
rg_s_push_job(int argc, VALUE *argv, VALUE self)
|
69
|
+
{
|
70
|
+
VALUE rbio_priority, rbcancellable, block;
|
71
|
+
gint io_priority;
|
72
|
+
GCancellable *cancellable;
|
73
|
+
|
74
|
+
rb_scan_args(argc, argv, "02", &rbio_priority, &rbcancellable);
|
75
|
+
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
76
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
77
|
+
block = rb_block_proc();
|
78
|
+
SAVE_BLOCK(block);
|
79
|
+
g_io_scheduler_push_job(ioscheduler_job_callback,
|
80
|
+
(gpointer)block,
|
81
|
+
ioscheduler_job_callback_free,
|
82
|
+
io_priority,
|
83
|
+
cancellable);
|
84
|
+
|
85
|
+
return self;
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
rg_s_cancel_all_jobs(VALUE self)
|
90
|
+
{
|
91
|
+
g_io_scheduler_cancel_all_jobs();
|
92
|
+
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
void
|
97
|
+
Init_gioscheduler(VALUE mGio)
|
98
|
+
{
|
99
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IOScheduler");
|
100
|
+
RG_DEF_SMETHOD(push_job, -1);
|
101
|
+
RG_DEF_SMETHOD(cancel_all_jobs, 0);
|
102
|
+
}
|