gio2 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +26 -9
- data/ext/gio2/extconf.rb +38 -28
- data/ext/gio2/rb-gio2-pollable-source.c +59 -0
- data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
- data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
- data/extconf.rb +22 -6
- data/lib/1.9/gio2.so +0 -0
- data/lib/2.0/gio2.so +0 -0
- data/lib/2.1/gio2.so +0 -0
- data/lib/gio2/deprecated.rb +16 -0
- data/lib/gio2/inet-address.rb +33 -0
- data/lib/gio2/input-stream.rb +39 -0
- data/lib/gio2/loader.rb +244 -0
- data/lib/gio2/output-stream.rb +24 -0
- data/lib/gio2/pollable-input-stream.rb +51 -0
- data/lib/gio2/pollable-output-stream.rb +32 -0
- data/lib/gio2/resources.rb +62 -0
- data/lib/gio2.rb +38 -143
- data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
- data/test/fixture/resource/Rakefile +32 -0
- data/test/fixture/resource/logo.png +0 -0
- data/test/fixture/resource/ruby-gio2.gresource +0 -0
- data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
- data/test/gio2-test-utils/fixture.rb +24 -0
- data/test/gio2-test-utils/socket-client.rb +59 -0
- data/test/gio2-test-utils.rb +21 -0
- data/test/run-test.rb +45 -9
- data/test/test-buffered-input-stream.rb +23 -0
- data/test/test-charset-converter.rb +23 -0
- data/test/test-content-type.rb +31 -0
- data/test/test-data-input-stream.rb +21 -0
- data/test/test-file-enumerator.rb +26 -0
- data/test/test-file-monitor.rb +33 -0
- data/test/test-file.rb +28 -0
- data/test/test-inet-address.rb +34 -0
- data/test/test-input-stream.rb +36 -0
- data/test/test-output-stream.rb +39 -0
- data/test/test-pollable-input-stream.rb +54 -0
- data/test/test-pollable-output-stream.rb +53 -0
- data/test/test-resources.rb +58 -0
- metadata +49 -107
- data/README +0 -34
- data/ext/gio2/depend +0 -11
- data/ext/gio2/gio2.def +0 -2
- data/ext/gio2/gio2.h +0 -30
- data/ext/gio2/rbgio.c +0 -133
- data/ext/gio2/rbgio2.h +0 -158
- data/ext/gio2/rbgio2conversions.h +0 -154
- data/ext/gio2/rbgio2private.h +0 -148
- data/ext/gio2/rbgioappinfo.c +0 -317
- data/ext/gio2/rbgioapplaunchcontext.c +0 -81
- data/ext/gio2/rbgioasyncinitable.c +0 -246
- data/ext/gio2/rbgioasyncresult.c +0 -41
- data/ext/gio2/rbgiobufferedinputstream.c +0 -167
- data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
- data/ext/gio2/rbgiocancellable.c +0 -180
- data/ext/gio2/rbgiocharsetconverter.c +0 -57
- data/ext/gio2/rbgiocontenttype.c +0 -131
- data/ext/gio2/rbgioconverter.c +0 -113
- data/ext/gio2/rbgioconverterinputstream.c +0 -43
- data/ext/gio2/rbgioconverteroutputstream.c +0 -43
- data/ext/gio2/rbgiodatainputstream.c +0 -309
- data/ext/gio2/rbgiodataoutputstream.c +0 -186
- data/ext/gio2/rbgiodesktopappinfo.c +0 -87
- data/ext/gio2/rbgiodrive.c +0 -266
- data/ext/gio2/rbgioemblem.c +0 -52
- data/ext/gio2/rbgioemblemedicon.c +0 -65
- data/ext/gio2/rbgiofile.c +0 -2045
- data/ext/gio2/rbgiofileattribute.c +0 -114
- data/ext/gio2/rbgiofileattributeinfo.c +0 -86
- data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
- data/ext/gio2/rbgiofileattributematcher.c +0 -95
- data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
- data/ext/gio2/rbgiofileenumerator.c +0 -166
- data/ext/gio2/rbgiofileicon.c +0 -41
- data/ext/gio2/rbgiofileinfo.c +0 -617
- data/ext/gio2/rbgiofileinputstream.c +0 -91
- data/ext/gio2/rbgiofileiostream.c +0 -98
- data/ext/gio2/rbgiofilemonitor.c +0 -46
- data/ext/gio2/rbgiofilenamecompleter.c +0 -73
- data/ext/gio2/rbgiofileoutputstream.c +0 -98
- data/ext/gio2/rbgiofilterinputstream.c +0 -28
- data/ext/gio2/rbgioicon.c +0 -69
- data/ext/gio2/rbgioinetaddress.c +0 -118
- data/ext/gio2/rbgioinetsocketaddress.c +0 -41
- data/ext/gio2/rbgioinitable.c +0 -199
- data/ext/gio2/rbgioinputstream.c +0 -341
- data/ext/gio2/rbgioio.c +0 -73
- data/ext/gio2/rbgioiomodule.c +0 -45
- data/ext/gio2/rbgioiomodules.c +0 -47
- data/ext/gio2/rbgioioscheduler.c +0 -102
- data/ext/gio2/rbgioioschedulerjob.c +0 -121
- data/ext/gio2/rbgioiostream.c +0 -107
- data/ext/gio2/rbgioloadableicon.c +0 -92
- data/ext/gio2/rbgiomemoryinputstream.c +0 -67
- data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
- data/ext/gio2/rbgiomount.c +0 -286
- data/ext/gio2/rbgiomountoperation.c +0 -53
- data/ext/gio2/rbgionetworkaddress.c +0 -59
- data/ext/gio2/rbgionetworkservice.c +0 -45
- data/ext/gio2/rbgiooutputstream.c +0 -331
- data/ext/gio2/rbgioresolver.c +0 -230
- data/ext/gio2/rbgioseekable.c +0 -91
- data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
- data/ext/gio2/rbgiosocket.c +0 -390
- data/ext/gio2/rbgiosocketaddress.c +0 -34
- data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
- data/ext/gio2/rbgiosocketclient.c +0 -207
- data/ext/gio2/rbgiosocketconnectable.c +0 -41
- data/ext/gio2/rbgiosocketconnection.c +0 -66
- data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
- data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
- data/ext/gio2/rbgiosocketlistener.c +0 -246
- data/ext/gio2/rbgiosocketservice.c +0 -66
- data/ext/gio2/rbgiosrvtarget.c +0 -76
- data/ext/gio2/rbgiotcpconnection.c +0 -28
- data/ext/gio2/rbgiothemedicon.c +0 -83
- data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
- data/ext/gio2/rbgiotlscertificate.c +0 -89
- data/ext/gio2/rbgiounixconnection.c +0 -71
- data/ext/gio2/rbgiounixfdlist.c +0 -115
- data/ext/gio2/rbgiounixfdmessage.c +0 -74
- data/ext/gio2/rbgiounixinputstream.c +0 -51
- data/ext/gio2/rbgiounixmount.c +0 -164
- data/ext/gio2/rbgiounixmountmonitor.c +0 -65
- data/ext/gio2/rbgiounixmountpoint.c +0 -136
- data/ext/gio2/rbgiounixmountpoints.c +0 -58
- data/ext/gio2/rbgiounixmounts.c +0 -58
- data/ext/gio2/rbgiounixoutputstream.c +0 -51
- data/ext/gio2/rbgiounixsocketaddress.c +0 -69
- data/ext/gio2/rbgiovfs.c +0 -84
- data/ext/gio2/rbgiovolume.c +0 -193
- data/ext/gio2/rbgiovolumemonitor.c +0 -77
- data/ext/gio2/rbgiozlibcompressor.c +0 -52
- data/ext/gio2/rbgiozlibdecompressor.c +0 -45
- data/ext/gio2/util.c +0 -303
- data/test/test_bufferedinputstream.rb +0 -9
- data/test/test_charsetconverter.rb +0 -9
- data/test/test_datainputstream.rb +0 -7
- data/test/test_fileenumerator.rb +0 -8
- data/test/test_filemonitor.rb +0 -17
- data/test/test_inetaddress.rb +0 -8
@@ -1,331 +0,0 @@
|
|
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 cOutputStream
|
25
|
-
#define _SELF(value) RVAL2GOUTPUTSTREAM(value)
|
26
|
-
|
27
|
-
#define RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(value) \
|
28
|
-
RVAL2TYPE_WITH_DEFAULT((value), \
|
29
|
-
RVAL2GOUTPUTSTREAMSPLICEFLAGS, \
|
30
|
-
G_OUTPUT_STREAM_SPLICE_NONE)
|
31
|
-
|
32
|
-
static VALUE
|
33
|
-
rg_write(int argc, VALUE *argv, VALUE self)
|
34
|
-
{
|
35
|
-
VALUE rbbuffer, cancellable;
|
36
|
-
const char *buffer;
|
37
|
-
GError *error = NULL;
|
38
|
-
gssize bytes_written;
|
39
|
-
|
40
|
-
rb_scan_args(argc, argv, "11", &rbbuffer, &cancellable);
|
41
|
-
buffer = RVAL2CSTR(rbbuffer);
|
42
|
-
bytes_written = g_output_stream_write(_SELF(self),
|
43
|
-
buffer,
|
44
|
-
(gsize)RSTRING_LEN(rbbuffer),
|
45
|
-
RVAL2GCANCELLABLE(cancellable),
|
46
|
-
&error);
|
47
|
-
if (bytes_written == -1)
|
48
|
-
rbgio_raise_error(error);
|
49
|
-
|
50
|
-
return GSSIZE2RVAL(bytes_written);
|
51
|
-
}
|
52
|
-
|
53
|
-
static VALUE
|
54
|
-
rg_write_all(int argc, VALUE *argv, VALUE self)
|
55
|
-
{
|
56
|
-
VALUE rbbuffer, cancellable;
|
57
|
-
const char *buffer;
|
58
|
-
gsize bytes_written;
|
59
|
-
GError *error = NULL;
|
60
|
-
|
61
|
-
rb_scan_args(argc, argv, "11", &rbbuffer, &cancellable);
|
62
|
-
buffer = RVAL2CSTR(rbbuffer);
|
63
|
-
if (!g_output_stream_write_all(_SELF(self),
|
64
|
-
buffer,
|
65
|
-
(gsize)RSTRING_LEN(rbbuffer),
|
66
|
-
&bytes_written,
|
67
|
-
RVAL2GCANCELLABLE(cancellable),
|
68
|
-
&error))
|
69
|
-
rbgio_raise_error(error);
|
70
|
-
|
71
|
-
return GSIZE2RVAL(bytes_written);
|
72
|
-
}
|
73
|
-
|
74
|
-
static VALUE
|
75
|
-
rg_splice(int argc, VALUE *argv, VALUE self)
|
76
|
-
{
|
77
|
-
VALUE source, flags, cancellable;
|
78
|
-
GError *error = NULL;
|
79
|
-
gssize bytes_spliced;
|
80
|
-
|
81
|
-
rb_scan_args(argc, argv, "12", &source, &flags, &cancellable);
|
82
|
-
bytes_spliced = g_output_stream_splice(_SELF(self),
|
83
|
-
RVAL2GINPUTSTREAM(source),
|
84
|
-
RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(flags),
|
85
|
-
RVAL2GCANCELLABLE(cancellable),
|
86
|
-
&error);
|
87
|
-
if (bytes_spliced == -1)
|
88
|
-
rbgio_raise_error(error);
|
89
|
-
|
90
|
-
return GSSIZE2RVAL(bytes_spliced);
|
91
|
-
}
|
92
|
-
|
93
|
-
typedef gboolean (*CancellableMethod)(GOutputStream *, GCancellable *, GError **);
|
94
|
-
|
95
|
-
static VALUE
|
96
|
-
cancellable_method(CancellableMethod method, int argc, VALUE *argv, VALUE self)
|
97
|
-
{
|
98
|
-
VALUE cancellable;
|
99
|
-
GError *error = NULL;
|
100
|
-
|
101
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
102
|
-
if (!method(_SELF(self), RVAL2GCANCELLABLE(cancellable), &error))
|
103
|
-
rbgio_raise_error(error);
|
104
|
-
|
105
|
-
return self;
|
106
|
-
}
|
107
|
-
|
108
|
-
static VALUE
|
109
|
-
rg_flush(int argc, VALUE *argv, VALUE self)
|
110
|
-
{
|
111
|
-
return cancellable_method(g_output_stream_flush, argc, argv, self);
|
112
|
-
}
|
113
|
-
|
114
|
-
static VALUE
|
115
|
-
rg_close(int argc, VALUE *argv, VALUE self)
|
116
|
-
{
|
117
|
-
return cancellable_method(g_output_stream_close, argc, argv, self);
|
118
|
-
}
|
119
|
-
|
120
|
-
/* TODO: Does it make sense to use buffer and count? We should probably
|
121
|
-
* provide a better wrapper that simply pumps out buffer while count hasn't
|
122
|
-
* been reached, calling the callback with the bytes written, then with the
|
123
|
-
* result. */
|
124
|
-
static VALUE
|
125
|
-
rg_write_async(int argc, VALUE *argv, VALUE self)
|
126
|
-
{
|
127
|
-
VALUE rbbuffer, rbcount, rbio_priority, rbcancellable, block;
|
128
|
-
const gchar *buffer;
|
129
|
-
gsize count;
|
130
|
-
int io_priority;
|
131
|
-
GCancellable *cancellable;
|
132
|
-
|
133
|
-
rb_scan_args(argc, argv, "22&", &rbbuffer, &rbcount, &rbio_priority, &rbcancellable, &block);
|
134
|
-
buffer = RVAL2CSTR(rbbuffer);
|
135
|
-
count = RVAL2GSIZE(rbcount);
|
136
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
137
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
138
|
-
SAVE_BLOCK(block);
|
139
|
-
g_output_stream_write_async(_SELF(self),
|
140
|
-
buffer,
|
141
|
-
count,
|
142
|
-
io_priority,
|
143
|
-
cancellable,
|
144
|
-
rbgio_async_ready_callback,
|
145
|
-
(gpointer)block);
|
146
|
-
|
147
|
-
return self;
|
148
|
-
}
|
149
|
-
|
150
|
-
typedef gssize (*SSizeFinishMethod)(GOutputStream *, GAsyncResult *, GError **);
|
151
|
-
|
152
|
-
static VALUE
|
153
|
-
ssize_finish_method(SSizeFinishMethod method, VALUE self, VALUE result)
|
154
|
-
{
|
155
|
-
GError *error = NULL;
|
156
|
-
gssize bytes_read;
|
157
|
-
|
158
|
-
bytes_read = method(_SELF(self), RVAL2GASYNCRESULT(result), &error);
|
159
|
-
if (error != NULL)
|
160
|
-
rbgio_raise_error(error);
|
161
|
-
|
162
|
-
return GSSIZE2RVAL(bytes_read);
|
163
|
-
}
|
164
|
-
|
165
|
-
static VALUE
|
166
|
-
rg_write_finish(VALUE self, VALUE result)
|
167
|
-
{
|
168
|
-
return ssize_finish_method(g_output_stream_write_finish, self, result);
|
169
|
-
}
|
170
|
-
|
171
|
-
static VALUE
|
172
|
-
rg_splice_async(int argc, VALUE *argv, VALUE self)
|
173
|
-
{
|
174
|
-
VALUE rbsource, rbflags, rbio_priority, rbcancellable, block;
|
175
|
-
GInputStream *source;
|
176
|
-
GOutputStreamSpliceFlags flags;
|
177
|
-
int io_priority;
|
178
|
-
GCancellable *cancellable;
|
179
|
-
|
180
|
-
rb_scan_args(argc, argv, "12&", &rbsource, &rbflags, &rbio_priority, &rbcancellable, &block);
|
181
|
-
source = RVAL2GINPUTSTREAM(rbsource);
|
182
|
-
flags = RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(rbflags);
|
183
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
184
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
185
|
-
SAVE_BLOCK(block);
|
186
|
-
g_output_stream_splice_async(_SELF(self),
|
187
|
-
source,
|
188
|
-
flags,
|
189
|
-
io_priority,
|
190
|
-
cancellable,
|
191
|
-
rbgio_async_ready_callback,
|
192
|
-
(gpointer)block);
|
193
|
-
|
194
|
-
return self;
|
195
|
-
}
|
196
|
-
|
197
|
-
static VALUE
|
198
|
-
rg_splice_finish(VALUE self, VALUE result)
|
199
|
-
{
|
200
|
-
return ssize_finish_method(g_output_stream_splice_finish, self, result);
|
201
|
-
}
|
202
|
-
|
203
|
-
static VALUE
|
204
|
-
rg_flush_async(int argc, VALUE *argv, VALUE self)
|
205
|
-
{
|
206
|
-
VALUE rbio_priority, rbcancellable, block;
|
207
|
-
int io_priority;
|
208
|
-
GCancellable *cancellable;
|
209
|
-
|
210
|
-
rb_scan_args(argc, argv, "02&", &rbio_priority, &rbcancellable, &block);
|
211
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
212
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
213
|
-
SAVE_BLOCK(block);
|
214
|
-
g_output_stream_flush_async(_SELF(self),
|
215
|
-
io_priority,
|
216
|
-
cancellable,
|
217
|
-
rbgio_async_ready_callback,
|
218
|
-
(gpointer)block);
|
219
|
-
|
220
|
-
return self;
|
221
|
-
}
|
222
|
-
|
223
|
-
typedef gboolean (*BooleanFinishMethod)(GOutputStream *, GAsyncResult *, GError **);
|
224
|
-
|
225
|
-
static VALUE
|
226
|
-
boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
|
227
|
-
{
|
228
|
-
GError *error = NULL;
|
229
|
-
|
230
|
-
if (!method(_SELF(self), RVAL2GASYNCRESULT(result), &error))
|
231
|
-
rbgio_raise_error(error);
|
232
|
-
|
233
|
-
return self;
|
234
|
-
}
|
235
|
-
|
236
|
-
static VALUE
|
237
|
-
rg_flush_finish(VALUE self, VALUE result)
|
238
|
-
{
|
239
|
-
return boolean_finish_method(g_output_stream_flush_finish, self, result);
|
240
|
-
}
|
241
|
-
|
242
|
-
static VALUE
|
243
|
-
rg_close_async(int argc, VALUE *argv, VALUE self)
|
244
|
-
{
|
245
|
-
VALUE rbio_priority, rbcancellable, block;
|
246
|
-
int io_priority;
|
247
|
-
GCancellable *cancellable;
|
248
|
-
|
249
|
-
rb_scan_args(argc, argv, "02&", &rbio_priority, &rbcancellable, &block);
|
250
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
251
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
252
|
-
SAVE_BLOCK(block);
|
253
|
-
g_output_stream_close_async(_SELF(self),
|
254
|
-
io_priority,
|
255
|
-
cancellable,
|
256
|
-
rbgio_async_ready_callback,
|
257
|
-
(gpointer)block);
|
258
|
-
|
259
|
-
return self;
|
260
|
-
}
|
261
|
-
|
262
|
-
static VALUE
|
263
|
-
rg_close_finish(VALUE self, VALUE result)
|
264
|
-
{
|
265
|
-
return boolean_finish_method(g_output_stream_close_finish, self, result);
|
266
|
-
}
|
267
|
-
|
268
|
-
static VALUE
|
269
|
-
rg_closing_p(VALUE self)
|
270
|
-
{
|
271
|
-
return CBOOL2RVAL(g_output_stream_is_closing(_SELF(self)));
|
272
|
-
}
|
273
|
-
|
274
|
-
static VALUE
|
275
|
-
rg_closed_p(VALUE self)
|
276
|
-
{
|
277
|
-
return CBOOL2RVAL(g_output_stream_is_closed(_SELF(self)));
|
278
|
-
}
|
279
|
-
|
280
|
-
static VALUE
|
281
|
-
rg_has_pending_p(VALUE self)
|
282
|
-
{
|
283
|
-
return CBOOL2RVAL(g_output_stream_has_pending(_SELF(self)));
|
284
|
-
}
|
285
|
-
|
286
|
-
static VALUE
|
287
|
-
rg_set_pending(VALUE self)
|
288
|
-
{
|
289
|
-
GError *error = NULL;
|
290
|
-
|
291
|
-
if (!g_output_stream_set_pending(_SELF(self), &error))
|
292
|
-
rbgio_raise_error(error);
|
293
|
-
|
294
|
-
return self;
|
295
|
-
}
|
296
|
-
|
297
|
-
static VALUE
|
298
|
-
rg_clear_pending(VALUE self)
|
299
|
-
{
|
300
|
-
g_output_stream_clear_pending(_SELF(self));
|
301
|
-
|
302
|
-
return self;
|
303
|
-
}
|
304
|
-
|
305
|
-
void
|
306
|
-
Init_goutputstream(VALUE mGio)
|
307
|
-
{
|
308
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_OUTPUT_STREAM, "OutputStream", mGio);
|
309
|
-
|
310
|
-
G_DEF_CLASS(G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "SpliceFlags", RG_TARGET_NAMESPACE);
|
311
|
-
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "G_OUTPUT_STREAM_");
|
312
|
-
|
313
|
-
RG_DEF_METHOD(write, -1);
|
314
|
-
RG_DEF_METHOD(write_all, -1);
|
315
|
-
RG_DEF_METHOD(splice, -1);
|
316
|
-
RG_DEF_METHOD(flush, -1);
|
317
|
-
RG_DEF_METHOD(close, -1);
|
318
|
-
RG_DEF_METHOD(write_async, -1);
|
319
|
-
RG_DEF_METHOD(write_finish, 1);
|
320
|
-
RG_DEF_METHOD(splice_async, -1);
|
321
|
-
RG_DEF_METHOD(splice_finish, 1);
|
322
|
-
RG_DEF_METHOD(flush_async, -1);
|
323
|
-
RG_DEF_METHOD(flush_finish, 1);
|
324
|
-
RG_DEF_METHOD(close_async, -1);
|
325
|
-
RG_DEF_METHOD(close_finish, 0);
|
326
|
-
RG_DEF_METHOD_P(closing, 0);
|
327
|
-
RG_DEF_METHOD_P(closed, 0);
|
328
|
-
RG_DEF_METHOD_P(has_pending, 0);
|
329
|
-
RG_DEF_METHOD(set_pending, 0);
|
330
|
-
RG_DEF_METHOD(clear_pending, 0);
|
331
|
-
}
|
data/ext/gio2/rbgioresolver.c
DELETED
@@ -1,230 +0,0 @@
|
|
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 cResolver
|
25
|
-
#define _SELF(value) RVAL2GRESOLVER(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_s_default(G_GNUC_UNUSED VALUE self)
|
29
|
-
{
|
30
|
-
return GOBJ2RVAL_UNREF(g_resolver_get_default());
|
31
|
-
}
|
32
|
-
|
33
|
-
static VALUE
|
34
|
-
rg_s_set_default(G_GNUC_UNUSED VALUE self, VALUE resolver)
|
35
|
-
{
|
36
|
-
g_resolver_set_default(_SELF(resolver));
|
37
|
-
|
38
|
-
return self;
|
39
|
-
}
|
40
|
-
|
41
|
-
static VALUE
|
42
|
-
rg_lookup_by_name(VALUE self, VALUE hostname, VALUE cancellable)
|
43
|
-
{
|
44
|
-
GError *error = NULL;
|
45
|
-
GList *addresses;
|
46
|
-
|
47
|
-
addresses = g_resolver_lookup_by_name(_SELF(self),
|
48
|
-
RVAL2CSTR(hostname),
|
49
|
-
RVAL2GCANCELLABLE(cancellable),
|
50
|
-
&error);
|
51
|
-
if (addresses == NULL)
|
52
|
-
rbgio_raise_error(error);
|
53
|
-
|
54
|
-
return GLIST2ARY_UNREF_FREE(addresses);
|
55
|
-
}
|
56
|
-
|
57
|
-
static VALUE
|
58
|
-
rg_lookup_by_name_async(int argc, VALUE *argv, VALUE self)
|
59
|
-
{
|
60
|
-
VALUE rbhostname, rbcancellable, block;
|
61
|
-
const gchar *hostname;
|
62
|
-
GCancellable *cancellable;
|
63
|
-
|
64
|
-
rb_scan_args(argc, argv, "11&", &hostname, &rbcancellable, &block);
|
65
|
-
hostname = RVAL2CSTR(rbhostname);
|
66
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
67
|
-
SAVE_BLOCK(block);
|
68
|
-
g_resolver_lookup_by_name_async(_SELF(self),
|
69
|
-
hostname,
|
70
|
-
cancellable,
|
71
|
-
rbgio_async_ready_callback,
|
72
|
-
(gpointer)block);
|
73
|
-
|
74
|
-
return self;
|
75
|
-
}
|
76
|
-
|
77
|
-
static VALUE
|
78
|
-
rg_lookup_by_name_finish(VALUE self, VALUE result)
|
79
|
-
{
|
80
|
-
GError *error = NULL;
|
81
|
-
GList *addresses;
|
82
|
-
|
83
|
-
addresses = g_resolver_lookup_by_name_finish(_SELF(self),
|
84
|
-
RVAL2GASYNCRESULT(result),
|
85
|
-
&error);
|
86
|
-
if (addresses == NULL)
|
87
|
-
rbgio_raise_error(error);
|
88
|
-
|
89
|
-
return GLIST2ARY_UNREF_FREE(addresses);
|
90
|
-
}
|
91
|
-
|
92
|
-
static VALUE
|
93
|
-
rg_lookup_by_address(int argc, VALUE *argv, VALUE self)
|
94
|
-
{
|
95
|
-
VALUE address, cancellable;
|
96
|
-
GError *error = NULL;
|
97
|
-
gchar *hostname;
|
98
|
-
|
99
|
-
rb_scan_args(argc, argv, "11", &address, &cancellable);
|
100
|
-
hostname = g_resolver_lookup_by_address(_SELF(self),
|
101
|
-
RVAL2GINETADDRESS(address),
|
102
|
-
RVAL2GCANCELLABLE(cancellable),
|
103
|
-
&error);
|
104
|
-
if (hostname == NULL)
|
105
|
-
rbgio_raise_error(error);
|
106
|
-
|
107
|
-
return CSTR2RVAL_FREE(hostname);
|
108
|
-
}
|
109
|
-
|
110
|
-
static VALUE
|
111
|
-
rg_lookup_by_address_async(int argc, VALUE *argv, VALUE self)
|
112
|
-
{
|
113
|
-
VALUE rbaddress, rbcancellable, block;
|
114
|
-
GInetAddress *address;
|
115
|
-
GCancellable *cancellable;
|
116
|
-
|
117
|
-
rb_scan_args(argc, argv, "11&", &rbaddress, &rbcancellable, &block);
|
118
|
-
address = RVAL2GINETADDRESS(rbaddress);
|
119
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
120
|
-
SAVE_BLOCK(block);
|
121
|
-
g_resolver_lookup_by_address_async(_SELF(self),
|
122
|
-
address,
|
123
|
-
cancellable,
|
124
|
-
rbgio_async_ready_callback,
|
125
|
-
(gpointer)block);
|
126
|
-
|
127
|
-
return self;
|
128
|
-
}
|
129
|
-
|
130
|
-
static VALUE
|
131
|
-
rg_lookup_by_address_finish(VALUE self, VALUE result)
|
132
|
-
{
|
133
|
-
GError *error = NULL;
|
134
|
-
gchar *hostname;
|
135
|
-
|
136
|
-
hostname = g_resolver_lookup_by_address_finish(_SELF(self),
|
137
|
-
RVAL2GASYNCRESULT(result),
|
138
|
-
&error);
|
139
|
-
if (hostname == NULL)
|
140
|
-
rbgio_raise_error(error);
|
141
|
-
|
142
|
-
return CSTR2RVAL_FREE(hostname);
|
143
|
-
}
|
144
|
-
|
145
|
-
static VALUE
|
146
|
-
rg_lookup_service(int argc, VALUE *argv, VALUE self)
|
147
|
-
{
|
148
|
-
VALUE service, protocol, domain, cancellable;
|
149
|
-
GError *error = NULL;
|
150
|
-
GList *targets;
|
151
|
-
|
152
|
-
rb_scan_args(argc, argv, "31", &service, &protocol, &domain, &cancellable);
|
153
|
-
targets = g_resolver_lookup_service(_SELF(self),
|
154
|
-
RVAL2CSTR(service),
|
155
|
-
RVAL2CSTR(protocol),
|
156
|
-
RVAL2CSTR(domain),
|
157
|
-
RVAL2GCANCELLABLE(cancellable),
|
158
|
-
&error);
|
159
|
-
if (targets == NULL)
|
160
|
-
rbgio_raise_error(error);
|
161
|
-
|
162
|
-
return GLIST2ARY_UNREF_FREE(targets);
|
163
|
-
}
|
164
|
-
|
165
|
-
static VALUE
|
166
|
-
rg_lookup_service_async(int argc, VALUE *argv, VALUE self)
|
167
|
-
{
|
168
|
-
VALUE rbservice, rbprotocol, rbdomain, rbcancellable, block;
|
169
|
-
const gchar *service;
|
170
|
-
const gchar *protocol;
|
171
|
-
const gchar *domain;
|
172
|
-
GCancellable *cancellable;
|
173
|
-
|
174
|
-
rb_scan_args(argc, argv, "31&", &rbservice, &rbprotocol, &rbdomain, &rbcancellable, &block);
|
175
|
-
service = RVAL2CSTR(rbservice);
|
176
|
-
protocol = RVAL2CSTR(rbprotocol);
|
177
|
-
domain = RVAL2CSTR(rbdomain);
|
178
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
179
|
-
SAVE_BLOCK(block);
|
180
|
-
g_resolver_lookup_service_async(_SELF(self),
|
181
|
-
service,
|
182
|
-
protocol,
|
183
|
-
domain,
|
184
|
-
cancellable,
|
185
|
-
rbgio_async_ready_callback,
|
186
|
-
(gpointer)block);
|
187
|
-
|
188
|
-
return self;
|
189
|
-
}
|
190
|
-
|
191
|
-
static VALUE
|
192
|
-
rg_lookup_service_finish(VALUE self, VALUE result)
|
193
|
-
{
|
194
|
-
GError *error = NULL;
|
195
|
-
GList *targets;
|
196
|
-
|
197
|
-
targets = g_resolver_lookup_service_finish(_SELF(self), RVAL2GASYNCRESULT(result), &error);
|
198
|
-
if (targets == NULL)
|
199
|
-
rbgio_raise_error(error);
|
200
|
-
|
201
|
-
return GLIST2ARY_UNREF_FREE(targets);
|
202
|
-
}
|
203
|
-
|
204
|
-
void
|
205
|
-
Init_gresolver(VALUE mGio)
|
206
|
-
{
|
207
|
-
VALUE RG_TARGET_NAMESPACE, error;
|
208
|
-
|
209
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_RESOLVER, "Resolver", mGio);
|
210
|
-
|
211
|
-
RG_DEF_SMETHOD(default, 0);
|
212
|
-
RG_DEF_SMETHOD(set_default, 1);
|
213
|
-
|
214
|
-
/* TODO: Taint result of these methods? */
|
215
|
-
RG_DEF_METHOD(lookup_by_name, 2);
|
216
|
-
RG_DEF_METHOD(lookup_by_name_async, -1);
|
217
|
-
RG_DEF_METHOD(lookup_by_name_finish, 1);
|
218
|
-
RG_DEF_METHOD(lookup_by_address, -1);
|
219
|
-
RG_DEF_METHOD(lookup_by_address_async, -1);
|
220
|
-
RG_DEF_METHOD(lookup_by_address_finish, 1);
|
221
|
-
RG_DEF_METHOD(lookup_service, -1);
|
222
|
-
RG_DEF_METHOD(lookup_service_async, -1);
|
223
|
-
RG_DEF_METHOD(lookup_service_finish, 1);
|
224
|
-
|
225
|
-
error = rbgio_define_domain_error(RG_TARGET_NAMESPACE, "Error", G_RESOLVER_ERROR, "GResolverErrorEnum", rb_eIOError);
|
226
|
-
|
227
|
-
rbgio_define_error(RG_TARGET_NAMESPACE, "NotFoundError", G_RESOLVER_ERROR_NOT_FOUND, error);
|
228
|
-
rbgio_define_error(RG_TARGET_NAMESPACE, "TemporaryFailureError", G_RESOLVER_ERROR_TEMPORARY_FAILURE, error);
|
229
|
-
rbgio_define_error(RG_TARGET_NAMESPACE, "InternalError", G_RESOLVER_ERROR_INTERNAL, error);
|
230
|
-
}
|
data/ext/gio2/rbgioseekable.c
DELETED
@@ -1,91 +0,0 @@
|
|
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 mSeekable
|
25
|
-
#define _SELF(value) RVAL2GSEEKABLE(value)
|
26
|
-
|
27
|
-
#define RVAL2GSEEKTYPEDEFAULT(value) \
|
28
|
-
RVAL2TYPE_WITH_DEFAULT((value), NUM2INT, G_SEEK_CUR)
|
29
|
-
|
30
|
-
static VALUE
|
31
|
-
rg_tell(VALUE self)
|
32
|
-
{
|
33
|
-
return GOFFSET2RVAL(g_seekable_tell(_SELF(self)));
|
34
|
-
}
|
35
|
-
|
36
|
-
static VALUE
|
37
|
-
rg_can_seek_p(VALUE self)
|
38
|
-
{
|
39
|
-
return CBOOL2RVAL(g_seekable_can_seek(_SELF(self)));
|
40
|
-
}
|
41
|
-
|
42
|
-
static VALUE
|
43
|
-
rg_seek(int argc, VALUE *argv, VALUE self)
|
44
|
-
{
|
45
|
-
VALUE offset, type, cancellable;
|
46
|
-
GError *error = NULL;
|
47
|
-
|
48
|
-
rb_scan_args(argc, argv, "12", &offset, &type, &cancellable);
|
49
|
-
if (!g_seekable_seek(_SELF(self),
|
50
|
-
RVAL2GOFFSET(offset),
|
51
|
-
RVAL2GSEEKTYPEDEFAULT(type),
|
52
|
-
RVAL2GCANCELLABLE(cancellable),
|
53
|
-
&error))
|
54
|
-
rbgio_raise_error(error);
|
55
|
-
|
56
|
-
return self;
|
57
|
-
}
|
58
|
-
|
59
|
-
static VALUE
|
60
|
-
rg_can_truncate_p(VALUE self)
|
61
|
-
{
|
62
|
-
return CBOOL2RVAL(g_seekable_can_truncate(_SELF(self)));
|
63
|
-
}
|
64
|
-
|
65
|
-
static VALUE
|
66
|
-
rg_truncate(int argc, VALUE *argv, VALUE self)
|
67
|
-
{
|
68
|
-
VALUE offset, cancellable;
|
69
|
-
GError *error = NULL;
|
70
|
-
|
71
|
-
rb_scan_args(argc, argv, "11", &offset, &cancellable);
|
72
|
-
if (!g_seekable_truncate(_SELF(self),
|
73
|
-
RVAL2GOFFSET(offset),
|
74
|
-
RVAL2GCANCELLABLE(cancellable),
|
75
|
-
&error))
|
76
|
-
rbgio_raise_error(error);
|
77
|
-
|
78
|
-
return self;
|
79
|
-
}
|
80
|
-
|
81
|
-
void
|
82
|
-
Init_gseekable(VALUE mGio)
|
83
|
-
{
|
84
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_SEEKABLE, "Seekable", mGio);
|
85
|
-
|
86
|
-
RG_DEF_METHOD(tell, 0);
|
87
|
-
RG_DEF_METHOD_P(can_seek, 0);
|
88
|
-
RG_DEF_METHOD(seek, -1);
|
89
|
-
RG_DEF_METHOD_P(can_truncate, 0);
|
90
|
-
RG_DEF_METHOD(truncate, -1);
|
91
|
-
}
|