gio2 0.90.3
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.
- data/ChangeLog +60 -0
- data/README +34 -0
- data/Rakefile +76 -0
- data/ext/gio2/depend +5 -0
- data/ext/gio2/extconf.rb +91 -0
- data/ext/gio2/gappinfo.c +318 -0
- data/ext/gio2/gapplaunchcontext.c +79 -0
- data/ext/gio2/gasyncinitable.c +244 -0
- data/ext/gio2/gasyncresult.c +39 -0
- data/ext/gio2/gbufferedinputstream.c +184 -0
- data/ext/gio2/gbufferedoutputstream.c +82 -0
- data/ext/gio2/gcancellable.c +177 -0
- data/ext/gio2/gcharsetconverter.c +72 -0
- data/ext/gio2/gcontenttype.c +135 -0
- data/ext/gio2/gconverter.c +117 -0
- data/ext/gio2/gconverterinputstream.c +48 -0
- data/ext/gio2/gconverteroutputstream.c +48 -0
- data/ext/gio2/gdatainputstream.c +341 -0
- data/ext/gio2/gdataoutputstream.c +202 -0
- data/ext/gio2/gdesktopappinfo.c +90 -0
- data/ext/gio2/gdrive.c +267 -0
- data/ext/gio2/gemblem.c +71 -0
- data/ext/gio2/gemblemedicon.c +63 -0
- data/ext/gio2/gfile.c +2058 -0
- data/ext/gio2/gfileattribute.c +263 -0
- data/ext/gio2/gfileattributematcher.c +90 -0
- data/ext/gio2/gfiledescriptorbased.c +42 -0
- data/ext/gio2/gfileenumerator.c +167 -0
- data/ext/gio2/gfileicon.c +46 -0
- data/ext/gio2/gfileinfo.c +641 -0
- data/ext/gio2/gfileinputstream.c +92 -0
- data/ext/gio2/gfileiostream.c +98 -0
- data/ext/gio2/gfilemonitor.c +63 -0
- data/ext/gio2/gfilenamecompleter.c +72 -0
- data/ext/gio2/gfileoutputstream.c +100 -0
- data/ext/gio2/gfilterinputstream.c +56 -0
- data/ext/gio2/gfilteroutputstream.c +56 -0
- data/ext/gio2/gicon.c +69 -0
- data/ext/gio2/ginetaddress.c +188 -0
- data/ext/gio2/ginetsocketaddress.c +54 -0
- data/ext/gio2/ginitable.c +195 -0
- data/ext/gio2/ginputstream.c +341 -0
- data/ext/gio2/gio2.c +120 -0
- data/ext/gio2/gio2.def +2 -0
- data/ext/gio2/gio2.h +343 -0
- data/ext/gio2/gioerror.c +67 -0
- data/ext/gio2/giomodule.c +63 -0
- data/ext/gio2/gioscheduler.c +195 -0
- data/ext/gio2/giostream.c +129 -0
- data/ext/gio2/gloadableicon.c +91 -0
- data/ext/gio2/gmemoryinputstream.c +65 -0
- data/ext/gio2/gmemoryoutputstream.c +65 -0
- data/ext/gio2/gmount.c +283 -0
- data/ext/gio2/gmountoperation.c +168 -0
- data/ext/gio2/gnetworkaddress.c +71 -0
- data/ext/gio2/gnetworkservice.c +64 -0
- data/ext/gio2/goutputstream.c +343 -0
- data/ext/gio2/gresolver.c +230 -0
- data/ext/gio2/gseekable.c +89 -0
- data/ext/gio2/gsimpleasyncresult.c +153 -0
- data/ext/gio2/gsocket.c +451 -0
- data/ext/gio2/gsocketaddress.c +45 -0
- data/ext/gio2/gsocketclient.c +273 -0
- data/ext/gio2/gsocketconnectable.c +97 -0
- data/ext/gio2/gsocketconnection.c +82 -0
- data/ext/gio2/gsocketcontrolmessage.c +82 -0
- data/ext/gio2/gsocketlistener.c +239 -0
- data/ext/gio2/gsocketservice.c +64 -0
- data/ext/gio2/gsrvtarget.c +77 -0
- data/ext/gio2/gtcpconnection.c +48 -0
- data/ext/gio2/gthemedicon.c +86 -0
- data/ext/gio2/gthreadedsocketservice.c +39 -0
- data/ext/gio2/gunixconnection.c +69 -0
- data/ext/gio2/gunixfdlist.c +112 -0
- data/ext/gio2/gunixfdmessage.c +81 -0
- data/ext/gio2/gunixinputstream.c +73 -0
- data/ext/gio2/gunixmounts.c +346 -0
- data/ext/gio2/gunixoutputstream.c +73 -0
- data/ext/gio2/gunixsocketaddress.c +79 -0
- data/ext/gio2/gvfs.c +84 -0
- data/ext/gio2/gvolume.c +191 -0
- data/ext/gio2/gvolumemonitor.c +77 -0
- data/ext/gio2/gzlibcompressor.c +47 -0
- data/ext/gio2/gzlibdecompressor.c +43 -0
- data/ext/gio2/util.c +323 -0
- data/extconf.rb +49 -0
- data/lib/gio2.rb +141 -0
- metadata +184 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
|
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.
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "gio2.h"
|
|
22
|
+
|
|
23
|
+
#define _SELF(value) G_RESOLVER(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
static VALUE
|
|
26
|
+
resolver_get_default(G_GNUC_UNUSED VALUE self)
|
|
27
|
+
{
|
|
28
|
+
return GOBJ2RVAL_UNREF(g_resolver_get_default());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static VALUE
|
|
32
|
+
resolver_set_default(G_GNUC_UNUSED VALUE self, VALUE resolver)
|
|
33
|
+
{
|
|
34
|
+
g_resolver_set_default(_SELF(resolver));
|
|
35
|
+
|
|
36
|
+
return self;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static VALUE
|
|
40
|
+
resolver_lookup_by_name(VALUE self, VALUE hostname, VALUE cancellable)
|
|
41
|
+
{
|
|
42
|
+
GError *error = NULL;
|
|
43
|
+
GList *addresses;
|
|
44
|
+
|
|
45
|
+
addresses = g_resolver_lookup_by_name(_SELF(self),
|
|
46
|
+
RVAL2CSTR(hostname),
|
|
47
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
48
|
+
&error);
|
|
49
|
+
if (addresses == NULL)
|
|
50
|
+
rbgio_raise_error(error);
|
|
51
|
+
|
|
52
|
+
return GLIST2ARY_UNREF_FREE(addresses);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static VALUE
|
|
56
|
+
resolver_lookup_by_name_async(int argc, VALUE *argv, VALUE self)
|
|
57
|
+
{
|
|
58
|
+
VALUE rbhostname, rbcancellable, block;
|
|
59
|
+
const gchar *hostname;
|
|
60
|
+
GCancellable *cancellable;
|
|
61
|
+
|
|
62
|
+
rb_scan_args(argc, argv, "11&", &hostname, &rbcancellable, &block);
|
|
63
|
+
hostname = RVAL2CSTR(rbhostname);
|
|
64
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
65
|
+
SAVE_BLOCK(block);
|
|
66
|
+
g_resolver_lookup_by_name_async(_SELF(self),
|
|
67
|
+
hostname,
|
|
68
|
+
cancellable,
|
|
69
|
+
rbgio_async_ready_callback,
|
|
70
|
+
(gpointer)block);
|
|
71
|
+
|
|
72
|
+
return self;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static VALUE
|
|
76
|
+
resolver_lookup_by_name_finish(VALUE self, VALUE result)
|
|
77
|
+
{
|
|
78
|
+
GError *error = NULL;
|
|
79
|
+
GList *addresses;
|
|
80
|
+
|
|
81
|
+
addresses = g_resolver_lookup_by_name_finish(_SELF(self),
|
|
82
|
+
RVAL2GASYNCRESULT(result),
|
|
83
|
+
&error);
|
|
84
|
+
if (addresses == NULL)
|
|
85
|
+
rbgio_raise_error(error);
|
|
86
|
+
|
|
87
|
+
return GLIST2ARY_UNREF_FREE(addresses);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static VALUE
|
|
91
|
+
resolver_lookup_by_address(int argc, VALUE *argv, VALUE self)
|
|
92
|
+
{
|
|
93
|
+
VALUE address, cancellable;
|
|
94
|
+
GError *error = NULL;
|
|
95
|
+
gchar *hostname;
|
|
96
|
+
|
|
97
|
+
rb_scan_args(argc, argv, "11", &address, &cancellable);
|
|
98
|
+
hostname = g_resolver_lookup_by_address(_SELF(self),
|
|
99
|
+
RVAL2GINETADDRESS(address),
|
|
100
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
101
|
+
&error);
|
|
102
|
+
if (hostname == NULL)
|
|
103
|
+
rbgio_raise_error(error);
|
|
104
|
+
|
|
105
|
+
return CSTR2RVAL_FREE(hostname);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static VALUE
|
|
109
|
+
resolver_lookup_by_address_async(int argc, VALUE *argv, VALUE self)
|
|
110
|
+
{
|
|
111
|
+
VALUE rbaddress, rbcancellable, block;
|
|
112
|
+
GInetAddress *address;
|
|
113
|
+
GCancellable *cancellable;
|
|
114
|
+
|
|
115
|
+
rb_scan_args(argc, argv, "11&", &rbaddress, &rbcancellable, &block);
|
|
116
|
+
address = RVAL2GINETADDRESS(rbaddress);
|
|
117
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
118
|
+
SAVE_BLOCK(block);
|
|
119
|
+
g_resolver_lookup_by_address_async(_SELF(self),
|
|
120
|
+
address,
|
|
121
|
+
cancellable,
|
|
122
|
+
rbgio_async_ready_callback,
|
|
123
|
+
(gpointer)block);
|
|
124
|
+
|
|
125
|
+
return self;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static VALUE
|
|
129
|
+
resolver_lookup_by_address_finish(VALUE self, VALUE result)
|
|
130
|
+
{
|
|
131
|
+
GError *error = NULL;
|
|
132
|
+
gchar *hostname;
|
|
133
|
+
|
|
134
|
+
hostname = g_resolver_lookup_by_address_finish(_SELF(self),
|
|
135
|
+
RVAL2GASYNCRESULT(result),
|
|
136
|
+
&error);
|
|
137
|
+
if (hostname == NULL)
|
|
138
|
+
rbgio_raise_error(error);
|
|
139
|
+
|
|
140
|
+
return CSTR2RVAL_FREE(hostname);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static VALUE
|
|
144
|
+
resolver_lookup_service(int argc, VALUE *argv, VALUE self)
|
|
145
|
+
{
|
|
146
|
+
VALUE service, protocol, domain, cancellable;
|
|
147
|
+
GError *error = NULL;
|
|
148
|
+
GList *targets;
|
|
149
|
+
|
|
150
|
+
rb_scan_args(argc, argv, "31", &service, &protocol, &domain, &cancellable);
|
|
151
|
+
targets = g_resolver_lookup_service(_SELF(self),
|
|
152
|
+
RVAL2CSTR(service),
|
|
153
|
+
RVAL2CSTR(protocol),
|
|
154
|
+
RVAL2CSTR(domain),
|
|
155
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
156
|
+
&error);
|
|
157
|
+
if (targets == NULL)
|
|
158
|
+
rbgio_raise_error(error);
|
|
159
|
+
|
|
160
|
+
return GLIST2ARY_UNREF_FREE(targets);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static VALUE
|
|
164
|
+
resolver_lookup_service_async(int argc, VALUE *argv, VALUE self)
|
|
165
|
+
{
|
|
166
|
+
VALUE rbservice, rbprotocol, rbdomain, rbcancellable, block;
|
|
167
|
+
const gchar *service;
|
|
168
|
+
const gchar *protocol;
|
|
169
|
+
const gchar *domain;
|
|
170
|
+
GCancellable *cancellable;
|
|
171
|
+
|
|
172
|
+
rb_scan_args(argc, argv, "31&", &rbservice, &rbprotocol, &rbdomain, &rbcancellable, &block);
|
|
173
|
+
service = RVAL2CSTR(rbservice);
|
|
174
|
+
protocol = RVAL2CSTR(rbprotocol);
|
|
175
|
+
domain = RVAL2CSTR(rbdomain);
|
|
176
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
177
|
+
SAVE_BLOCK(block);
|
|
178
|
+
g_resolver_lookup_service_async(_SELF(self),
|
|
179
|
+
service,
|
|
180
|
+
protocol,
|
|
181
|
+
domain,
|
|
182
|
+
cancellable,
|
|
183
|
+
rbgio_async_ready_callback,
|
|
184
|
+
(gpointer)block);
|
|
185
|
+
|
|
186
|
+
return self;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
static VALUE
|
|
190
|
+
resolver_lookup_service_finish(VALUE self, VALUE result)
|
|
191
|
+
{
|
|
192
|
+
GError *error = NULL;
|
|
193
|
+
GList *targets;
|
|
194
|
+
|
|
195
|
+
targets = g_resolver_lookup_service_finish(_SELF(self), RVAL2GASYNCRESULT(result), &error);
|
|
196
|
+
if (targets == NULL)
|
|
197
|
+
rbgio_raise_error(error);
|
|
198
|
+
|
|
199
|
+
return GLIST2ARY_UNREF_FREE(targets);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
void
|
|
203
|
+
Init_gresolver(VALUE glib)
|
|
204
|
+
{
|
|
205
|
+
VALUE resolver, error;
|
|
206
|
+
|
|
207
|
+
resolver = G_DEF_CLASS(G_TYPE_RESOLVER, "Resolver", glib);
|
|
208
|
+
|
|
209
|
+
rb_define_singleton_method(resolver, "default", resolver_get_default, 0);
|
|
210
|
+
rb_define_singleton_method(resolver, "set_default", resolver_set_default, 1);
|
|
211
|
+
|
|
212
|
+
rb_undef_alloc_func(resolver);
|
|
213
|
+
|
|
214
|
+
/* TODO: Taint result of these methods? */
|
|
215
|
+
rb_define_method(resolver, "lookup_by_name", resolver_lookup_by_name, 2);
|
|
216
|
+
rb_define_method(resolver, "lookup_by_name_async", resolver_lookup_by_name_async, -1);
|
|
217
|
+
rb_define_method(resolver, "lookup_by_name_finish", resolver_lookup_by_name_finish, 1);
|
|
218
|
+
rb_define_method(resolver, "lookup_by_address", resolver_lookup_by_address, -1);
|
|
219
|
+
rb_define_method(resolver, "lookup_by_address_async", resolver_lookup_by_address_async, -1);
|
|
220
|
+
rb_define_method(resolver, "lookup_by_address_finish", resolver_lookup_by_address_finish, 1);
|
|
221
|
+
rb_define_method(resolver, "lookup_service", resolver_lookup_service, -1);
|
|
222
|
+
rb_define_method(resolver, "lookup_service_async", resolver_lookup_service_async, -1);
|
|
223
|
+
rb_define_method(resolver, "lookup_service_finish", resolver_lookup_service_finish, 1);
|
|
224
|
+
|
|
225
|
+
error = rbgio_define_domain_error(resolver, "Error", G_RESOLVER_ERROR, "GResolverErrorEnum", rb_eIOError);
|
|
226
|
+
|
|
227
|
+
rbgio_define_error(resolver, "NotFoundError", G_RESOLVER_ERROR_NOT_FOUND, error);
|
|
228
|
+
rbgio_define_error(resolver, "TemporaryFailureError", G_RESOLVER_ERROR_TEMPORARY_FAILURE, error);
|
|
229
|
+
rbgio_define_error(resolver, "InternalError", G_RESOLVER_ERROR_INTERNAL, error);
|
|
230
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
|
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.
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "gio2.h"
|
|
22
|
+
|
|
23
|
+
#define _SELF(value) G_SEEKABLE(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
#define RVAL2GSEEKTYPEDEFAULT(value) \
|
|
26
|
+
RVAL2TYPE_WITH_DEFAULT((value), NUM2INT, G_SEEK_CUR)
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
seekable_tell(VALUE self)
|
|
30
|
+
{
|
|
31
|
+
return GOFFSET2RVAL(g_seekable_tell(_SELF(self)));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static VALUE
|
|
35
|
+
seekable_can_seek(VALUE self)
|
|
36
|
+
{
|
|
37
|
+
return CBOOL2RVAL(g_seekable_can_seek(_SELF(self)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static VALUE
|
|
41
|
+
seekable_seek(int argc, VALUE *argv, VALUE self)
|
|
42
|
+
{
|
|
43
|
+
VALUE offset, type, cancellable;
|
|
44
|
+
GError *error = NULL;
|
|
45
|
+
|
|
46
|
+
rb_scan_args(argc, argv, "12", &offset, &type, &cancellable);
|
|
47
|
+
if (!g_seekable_seek(_SELF(self),
|
|
48
|
+
RVAL2GOFFSET(offset),
|
|
49
|
+
RVAL2GSEEKTYPEDEFAULT(type),
|
|
50
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
51
|
+
&error))
|
|
52
|
+
rbgio_raise_error(error);
|
|
53
|
+
|
|
54
|
+
return self;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static VALUE
|
|
58
|
+
seekable_can_truncate(VALUE self)
|
|
59
|
+
{
|
|
60
|
+
return CBOOL2RVAL(g_seekable_can_truncate(_SELF(self)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static VALUE
|
|
64
|
+
seekable_truncate(int argc, VALUE *argv, VALUE self)
|
|
65
|
+
{
|
|
66
|
+
VALUE offset, cancellable;
|
|
67
|
+
GError *error = NULL;
|
|
68
|
+
|
|
69
|
+
rb_scan_args(argc, argv, "11", &offset, &cancellable);
|
|
70
|
+
if (!g_seekable_truncate(_SELF(self),
|
|
71
|
+
RVAL2GOFFSET(offset),
|
|
72
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
73
|
+
&error))
|
|
74
|
+
rbgio_raise_error(error);
|
|
75
|
+
|
|
76
|
+
return self;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void
|
|
80
|
+
Init_gseekable(VALUE glib)
|
|
81
|
+
{
|
|
82
|
+
VALUE seekable = G_DEF_INTERFACE(G_TYPE_SEEKABLE, "Seekable", glib);
|
|
83
|
+
|
|
84
|
+
rb_define_method(seekable, "tell", seekable_tell, 0);
|
|
85
|
+
rb_define_method(seekable, "can_seek?", seekable_can_seek, 0);
|
|
86
|
+
rb_define_method(seekable, "seek", seekable_seek, -1);
|
|
87
|
+
rb_define_method(seekable, "can_truncate?", seekable_can_truncate, 0);
|
|
88
|
+
rb_define_method(seekable, "truncate", seekable_truncate, -1);
|
|
89
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
|
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.
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "gio2.h"
|
|
22
|
+
|
|
23
|
+
#define _SELF(value) G_SIMPLE_ASYNC_RESULT(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
static VALUE
|
|
26
|
+
simpleasyncresult_initialize(VALUE self, VALUE object)
|
|
27
|
+
{
|
|
28
|
+
VALUE block;
|
|
29
|
+
|
|
30
|
+
/* TODO: I have absolutely no idea if this makes sense. Should we even
|
|
31
|
+
* be providing this method? */
|
|
32
|
+
block = rb_block_proc();
|
|
33
|
+
SAVE_BLOCK(block);
|
|
34
|
+
G_INITIALIZE(self,
|
|
35
|
+
g_simple_async_result_new(RVAL2GOBJ(object),
|
|
36
|
+
rbgio_async_ready_callback,
|
|
37
|
+
(gpointer)block,
|
|
38
|
+
(gpointer)block));
|
|
39
|
+
|
|
40
|
+
return Qnil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* NOTE: Can’t implement g_simple_async_result_new_error. */
|
|
44
|
+
|
|
45
|
+
/* NOTE: Can’t implement g_simple_async_result_new_from_error. */
|
|
46
|
+
|
|
47
|
+
/* NOTE: Can’t implement g_simple_async_result_set_op_res_gpointer. */
|
|
48
|
+
|
|
49
|
+
/* NOTE: Can’t implement g_simple_async_result_get_op_res_gpointer. */
|
|
50
|
+
|
|
51
|
+
static VALUE
|
|
52
|
+
simpleasyncresult_set_op_res_gssize(VALUE self, VALUE op_res)
|
|
53
|
+
{
|
|
54
|
+
g_simple_async_result_set_op_res_gssize(_SELF(self),
|
|
55
|
+
RVAL2GSSIZE(op_res));
|
|
56
|
+
|
|
57
|
+
return self;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static VALUE
|
|
61
|
+
simpleasyncresult_get_op_res_gssize(VALUE self)
|
|
62
|
+
{
|
|
63
|
+
return GSSIZE2RVAL(g_simple_async_result_get_op_res_gssize(_SELF(self)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static VALUE
|
|
67
|
+
simpleasyncresult_set_op_res_gboolean(VALUE self, VALUE op_res)
|
|
68
|
+
{
|
|
69
|
+
g_simple_async_result_set_op_res_gboolean(_SELF(self),
|
|
70
|
+
RVAL2CBOOL(op_res));
|
|
71
|
+
|
|
72
|
+
return self;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static VALUE
|
|
76
|
+
simpleasyncresult_get_op_res_gboolean(VALUE self)
|
|
77
|
+
{
|
|
78
|
+
return CBOOL2RVAL(g_simple_async_result_get_op_res_gboolean(_SELF(self)));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static VALUE
|
|
82
|
+
simpleasyncresult_get_source_tag(VALUE self)
|
|
83
|
+
{
|
|
84
|
+
return (VALUE)g_simple_async_result_get_source_tag(_SELF(self));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static VALUE
|
|
88
|
+
simpleasyncresult_is_valid(VALUE self, VALUE source, VALUE source_tag)
|
|
89
|
+
{
|
|
90
|
+
return CBOOL2RVAL(g_simple_async_result_is_valid(RVAL2GASYNCRESULT(self),
|
|
91
|
+
RVAL2GOBJ(source),
|
|
92
|
+
(gpointer)source_tag));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static VALUE
|
|
96
|
+
simpleasyncresult_set_handle_cancellation(VALUE self, VALUE handle_cancellation)
|
|
97
|
+
{
|
|
98
|
+
g_simple_async_result_set_handle_cancellation(_SELF(self),
|
|
99
|
+
RVAL2CBOOL(handle_cancellation));
|
|
100
|
+
|
|
101
|
+
return self;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static VALUE
|
|
105
|
+
simpleasyncresult_complete(VALUE self)
|
|
106
|
+
{
|
|
107
|
+
g_simple_async_result_complete(_SELF(self));
|
|
108
|
+
|
|
109
|
+
return self;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static VALUE
|
|
113
|
+
simpleasyncresult_complete_in_idle(VALUE self)
|
|
114
|
+
{
|
|
115
|
+
g_simple_async_result_complete_in_idle(_SELF(self));
|
|
116
|
+
|
|
117
|
+
return self;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* TODO: Should we implement g_simple_async_result_run_in_thread? I’d say no,
|
|
121
|
+
* but I’m not sure. */
|
|
122
|
+
|
|
123
|
+
/* NOTE: Can’t implement g_simple_async_result_set_from_error. */
|
|
124
|
+
|
|
125
|
+
/* NOTE: Can’t implement g_simple_async_result_propagate_error. */
|
|
126
|
+
|
|
127
|
+
/* NOTE: Can’t implement g_simple_async_result_set_error. */
|
|
128
|
+
|
|
129
|
+
/* NOTE: Can’t implement g_simple_async_result_set_error_va. */
|
|
130
|
+
|
|
131
|
+
/* NOTE: Can’t implement g_simple_async_result_report_error_in_idle. */
|
|
132
|
+
|
|
133
|
+
/* NOTE: Can’t implement g_simple_async_result_report_gerror_in_idle. */
|
|
134
|
+
|
|
135
|
+
void
|
|
136
|
+
Init_gsimpleasyncresult(VALUE glib)
|
|
137
|
+
{
|
|
138
|
+
VALUE simpleasyncresult = G_DEF_CLASS(G_TYPE_SIMPLE_ASYNC_RESULT, "SimpleAsyncResult", glib);
|
|
139
|
+
|
|
140
|
+
rb_define_method(simpleasyncresult, "initialize", simpleasyncresult_initialize, 1);
|
|
141
|
+
rb_define_method(simpleasyncresult, "set_op_res_gssize", simpleasyncresult_set_op_res_gssize, 1);
|
|
142
|
+
G_DEF_SETTER(simpleasyncresult, "op_res_gssize");
|
|
143
|
+
rb_define_method(simpleasyncresult, "op_res_gssize", simpleasyncresult_get_op_res_gssize, 0);
|
|
144
|
+
rb_define_method(simpleasyncresult, "set_op_res_gboolean", simpleasyncresult_set_op_res_gboolean, 1);
|
|
145
|
+
G_DEF_SETTER(simpleasyncresult, "op_res_gboolean");
|
|
146
|
+
rb_define_method(simpleasyncresult, "op_res_gboolean", simpleasyncresult_get_op_res_gboolean, 0);
|
|
147
|
+
rb_define_method(simpleasyncresult, "source_tag", simpleasyncresult_get_source_tag, 0);
|
|
148
|
+
rb_define_method(simpleasyncresult, "valid?", simpleasyncresult_is_valid, 2);
|
|
149
|
+
rb_define_method(simpleasyncresult, "set_handle_cancellation", simpleasyncresult_set_handle_cancellation, 1);
|
|
150
|
+
G_DEF_SETTER(simpleasyncresult, "handle_cancellation");
|
|
151
|
+
rb_define_method(simpleasyncresult, "complete", simpleasyncresult_complete, 0);
|
|
152
|
+
rb_define_method(simpleasyncresult, "complete_in_idle", simpleasyncresult_complete_in_idle, 0);
|
|
153
|
+
}
|