gio2 0.90.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,82 @@
|
|
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_SOCKET_CONTROL_MESSAGE(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
socketcontrolmessage_deserialize(G_GNUC_UNUSED VALUE self, VALUE level, VALUE type, VALUE data)
|
27
|
+
{
|
28
|
+
StringValue(data);
|
29
|
+
return GOBJ2RVAL(g_socket_control_message_deserialize(FIX2INT(level),
|
30
|
+
FIX2INT(type),
|
31
|
+
RSTRING_LEN(data),
|
32
|
+
RSTRING_PTR(data)));
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
socketcontrolmessage_get_level(VALUE self)
|
37
|
+
{
|
38
|
+
return INT2FIX(g_socket_control_message_get_level(_SELF(self)));
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
socketcontrolmessage_get_msg_type(VALUE self)
|
43
|
+
{
|
44
|
+
return INT2FIX(g_socket_control_message_get_msg_type(_SELF(self)));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
socketcontrolmessage_get_size(VALUE self)
|
49
|
+
{
|
50
|
+
return GSIZE2RVAL(g_socket_control_message_get_size(_SELF(self)));
|
51
|
+
}
|
52
|
+
|
53
|
+
static VALUE
|
54
|
+
socketcontrolmessage_serialize(VALUE self)
|
55
|
+
{
|
56
|
+
gsize size;
|
57
|
+
VALUE result;
|
58
|
+
|
59
|
+
/* TODO: Is tainting really necessary? Where does the message come
|
60
|
+
* from? */
|
61
|
+
size = g_socket_control_message_get_size(_SELF(self));
|
62
|
+
result = rb_str_new(NULL, size);
|
63
|
+
g_socket_control_message_serialize(_SELF(self), RSTRING_PTR(result));
|
64
|
+
OBJ_TAINT(result);
|
65
|
+
|
66
|
+
return result;
|
67
|
+
}
|
68
|
+
|
69
|
+
void
|
70
|
+
Init_gsocketcontrolmessage(VALUE glib)
|
71
|
+
{
|
72
|
+
VALUE socketcontrolmessage = G_DEF_CLASS(G_TYPE_SOCKET_CONTROL_MESSAGE, "SocketControlMessage", glib);
|
73
|
+
|
74
|
+
rb_define_singleton_method(socketcontrolmessage, "deserialize", socketcontrolmessage_deserialize, 3);
|
75
|
+
|
76
|
+
rb_undef_alloc_func(socketcontrolmessage);
|
77
|
+
|
78
|
+
rb_define_method(socketcontrolmessage, "level", socketcontrolmessage_get_level, 0);
|
79
|
+
rb_define_method(socketcontrolmessage, "msg_type", socketcontrolmessage_get_msg_type, 0);
|
80
|
+
rb_define_method(socketcontrolmessage, "size", socketcontrolmessage_get_size, 0);
|
81
|
+
rb_define_method(socketcontrolmessage, "serialize", socketcontrolmessage_serialize, 0);
|
82
|
+
}
|
@@ -0,0 +1,239 @@
|
|
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_SOCKET_LISTENER(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
socketlistener_initialize(VALUE self)
|
27
|
+
{
|
28
|
+
G_INITIALIZE(self, g_socket_listener_new());
|
29
|
+
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
socketlistener_add_socket(int argc, VALUE *argv, VALUE self)
|
35
|
+
{
|
36
|
+
VALUE socket, source_object;
|
37
|
+
GError *error = NULL;
|
38
|
+
|
39
|
+
rb_scan_args(argc, argv, "11", &socket, &source_object);
|
40
|
+
if (!g_socket_listener_add_socket(_SELF(self), RVAL2GSOCKET(socket),
|
41
|
+
RVAL2GOBJ(source_object), &error))
|
42
|
+
rbgio_raise_error(error);
|
43
|
+
|
44
|
+
return self;
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
socketlistener_add_address(int argc, VALUE *argv, VALUE self)
|
49
|
+
{
|
50
|
+
VALUE rbaddress, type, protocol, source_object;
|
51
|
+
GError *error = NULL;
|
52
|
+
GSocketAddress *address;
|
53
|
+
|
54
|
+
rb_scan_args(argc, argv, "22", &rbaddress, &type, &protocol, &source_object);
|
55
|
+
if (!g_socket_listener_add_address(_SELF(self),
|
56
|
+
RVAL2GSOCKETADDRESS(rbaddress),
|
57
|
+
RVAL2GSOCKETTYPE(type),
|
58
|
+
RVAL2GSOCKETPROTOCOLDEFAULT(protocol),
|
59
|
+
RVAL2GOBJ(source_object),
|
60
|
+
&address,
|
61
|
+
&error))
|
62
|
+
rbgio_raise_error(error);
|
63
|
+
|
64
|
+
return GOBJ2RVAL_UNREF(address);
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
socketlistener_add_inet_port(int argc, VALUE *argv, VALUE self)
|
69
|
+
{
|
70
|
+
VALUE port, source_object;
|
71
|
+
GError *error = NULL;
|
72
|
+
|
73
|
+
rb_scan_args(argc, argv, "11", &port, &source_object);
|
74
|
+
if (!g_socket_listener_add_inet_port(_SELF(self),
|
75
|
+
RVAL2GUINT16(port),
|
76
|
+
RVAL2GOBJ(source_object),
|
77
|
+
&error))
|
78
|
+
rbgio_raise_error(error);
|
79
|
+
|
80
|
+
return self;
|
81
|
+
}
|
82
|
+
|
83
|
+
static VALUE
|
84
|
+
socketlistener_add_any_inet_port(int argc, VALUE *argv, VALUE self)
|
85
|
+
{
|
86
|
+
VALUE source_object;
|
87
|
+
GError *error = NULL;
|
88
|
+
guint16 port;
|
89
|
+
|
90
|
+
rb_scan_args(argc, argv, "01", &source_object);
|
91
|
+
port = g_socket_listener_add_any_inet_port(_SELF(self),
|
92
|
+
RVAL2GOBJ(source_object),
|
93
|
+
&error);
|
94
|
+
if (port == 0)
|
95
|
+
rbgio_raise_error(error);
|
96
|
+
|
97
|
+
return self;
|
98
|
+
}
|
99
|
+
|
100
|
+
static VALUE
|
101
|
+
socketlistener_accept(int argc, VALUE *argv, VALUE self)
|
102
|
+
{
|
103
|
+
VALUE source_object, cancellable;
|
104
|
+
GError *error = NULL;
|
105
|
+
GSocketConnection *connection;
|
106
|
+
|
107
|
+
rb_scan_args(argc, argv, "02", &source_object, &cancellable);
|
108
|
+
connection = g_socket_listener_accept(_SELF(self), RVAL2GOBJ(source_object),
|
109
|
+
RVAL2GCANCELLABLE(cancellable), &error);
|
110
|
+
if (connection == NULL)
|
111
|
+
rbgio_raise_error(error);
|
112
|
+
|
113
|
+
return GOBJ2RVAL_UNREF(connection);
|
114
|
+
}
|
115
|
+
|
116
|
+
static VALUE
|
117
|
+
socketlistener_accept_async(int argc, VALUE *argv, VALUE self)
|
118
|
+
{
|
119
|
+
VALUE rbcancellable, block;
|
120
|
+
GCancellable *cancellable;
|
121
|
+
|
122
|
+
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
123
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
124
|
+
SAVE_BLOCK(block);
|
125
|
+
g_socket_listener_accept_async(_SELF(self),
|
126
|
+
cancellable,
|
127
|
+
rbgio_async_ready_callback,
|
128
|
+
(gpointer)block);
|
129
|
+
|
130
|
+
return self;
|
131
|
+
}
|
132
|
+
|
133
|
+
static VALUE
|
134
|
+
socketlistener_accept_finish(int argc, VALUE *argv, VALUE self)
|
135
|
+
{
|
136
|
+
VALUE result, source_object;
|
137
|
+
GError *error = NULL;
|
138
|
+
GSocketConnection *connection;
|
139
|
+
|
140
|
+
rb_scan_args(argc, argv, "11", &result, &source_object);
|
141
|
+
connection = g_socket_listener_accept_finish(_SELF(self),
|
142
|
+
RVAL2GASYNCRESULT(result),
|
143
|
+
RVAL2GOBJ(source_object),
|
144
|
+
&error);
|
145
|
+
if (connection == NULL)
|
146
|
+
rbgio_raise_error(error);
|
147
|
+
|
148
|
+
return GOBJ2RVAL_UNREF(connection);
|
149
|
+
}
|
150
|
+
|
151
|
+
static VALUE
|
152
|
+
socketlistener_accept_socket(int argc, VALUE *argv, VALUE self)
|
153
|
+
{
|
154
|
+
VALUE source_object, cancellable;
|
155
|
+
GError *error = NULL;
|
156
|
+
GSocket *socket;
|
157
|
+
|
158
|
+
rb_scan_args(argc, argv, "02", &source_object, &cancellable);
|
159
|
+
socket = g_socket_listener_accept_socket(_SELF(self),
|
160
|
+
RVAL2GOBJ(source_object),
|
161
|
+
RVAL2GCANCELLABLE(cancellable),
|
162
|
+
&error);
|
163
|
+
if (socket == NULL)
|
164
|
+
rbgio_raise_error(error);
|
165
|
+
|
166
|
+
return GOBJ2RVAL_UNREF(socket);
|
167
|
+
}
|
168
|
+
|
169
|
+
static VALUE
|
170
|
+
socketlistener_accept_socket_async(int argc, VALUE *argv, VALUE self)
|
171
|
+
{
|
172
|
+
VALUE rbcancellable, block;
|
173
|
+
GCancellable *cancellable;
|
174
|
+
|
175
|
+
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
176
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
177
|
+
SAVE_BLOCK(block);
|
178
|
+
g_socket_listener_accept_socket_async(_SELF(self),
|
179
|
+
cancellable,
|
180
|
+
rbgio_async_ready_callback,
|
181
|
+
(gpointer)block);
|
182
|
+
|
183
|
+
return self;
|
184
|
+
}
|
185
|
+
|
186
|
+
static VALUE
|
187
|
+
socketlistener_accept_socket_finish(int argc, VALUE *argv, VALUE self)
|
188
|
+
{
|
189
|
+
VALUE result, source_object;
|
190
|
+
GError *error = NULL;
|
191
|
+
GSocket *socket;
|
192
|
+
|
193
|
+
rb_scan_args(argc, argv, "11", &result, &source_object);
|
194
|
+
socket = g_socket_listener_accept_socket_finish(_SELF(self),
|
195
|
+
RVAL2GASYNCRESULT(result),
|
196
|
+
RVAL2GOBJ(source_object),
|
197
|
+
&error);
|
198
|
+
if (socket == NULL)
|
199
|
+
rbgio_raise_error(error);
|
200
|
+
|
201
|
+
return GOBJ2RVAL_UNREF(socket);
|
202
|
+
}
|
203
|
+
|
204
|
+
static VALUE
|
205
|
+
socketlistener_close(VALUE self)
|
206
|
+
{
|
207
|
+
g_socket_listener_close(_SELF(self));
|
208
|
+
|
209
|
+
return self;
|
210
|
+
}
|
211
|
+
|
212
|
+
static VALUE
|
213
|
+
socketlistener_set_backlog(VALUE self, VALUE listen_backlog)
|
214
|
+
{
|
215
|
+
g_socket_listener_set_backlog(_SELF(self), FIX2INT(listen_backlog));
|
216
|
+
|
217
|
+
return self;
|
218
|
+
}
|
219
|
+
|
220
|
+
void
|
221
|
+
Init_gsocketlistener(VALUE glib)
|
222
|
+
{
|
223
|
+
VALUE socketlistener = G_DEF_CLASS(G_TYPE_SOCKET_LISTENER, "SocketListener", glib);
|
224
|
+
|
225
|
+
rb_define_method(socketlistener, "initialize", socketlistener_initialize, 0);
|
226
|
+
rb_define_method(socketlistener, "add_socket", socketlistener_add_socket, -1);
|
227
|
+
rb_define_method(socketlistener, "add_address", socketlistener_add_address, -1);
|
228
|
+
rb_define_method(socketlistener, "add_inet_port", socketlistener_add_inet_port, -1);
|
229
|
+
rb_define_method(socketlistener, "add_any_inet_port", socketlistener_add_any_inet_port, -1);
|
230
|
+
rb_define_method(socketlistener, "accept", socketlistener_accept, -1);
|
231
|
+
rb_define_method(socketlistener, "accept_async", socketlistener_accept_async, -1);
|
232
|
+
rb_define_method(socketlistener, "accept_finish", socketlistener_accept_finish, -1);
|
233
|
+
rb_define_method(socketlistener, "accept_socket", socketlistener_accept_socket, -1);
|
234
|
+
rb_define_method(socketlistener, "accept_socket_async", socketlistener_accept_socket_async, -1);
|
235
|
+
rb_define_method(socketlistener, "accept_socket_finish", socketlistener_accept_socket_finish, -1);
|
236
|
+
rb_define_method(socketlistener, "close", socketlistener_close, 0);
|
237
|
+
rb_define_method(socketlistener, "set_backlog", socketlistener_set_backlog, 1);
|
238
|
+
G_DEF_SETTER(socketlistener, "backlog");
|
239
|
+
}
|
@@ -0,0 +1,64 @@
|
|
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_SOCKET_SERVICE(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
socketservice_initialize(VALUE self)
|
27
|
+
{
|
28
|
+
G_INITIALIZE(self, g_socket_service_new());
|
29
|
+
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
socketservice_start(VALUE self)
|
35
|
+
{
|
36
|
+
g_socket_service_start(_SELF(self));
|
37
|
+
|
38
|
+
return self;
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
socketservice_stop(VALUE self)
|
43
|
+
{
|
44
|
+
g_socket_service_stop(_SELF(self));
|
45
|
+
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
socketservice_is_active(VALUE self)
|
51
|
+
{
|
52
|
+
return CBOOL2RVAL(g_socket_service_is_active(_SELF(self)));
|
53
|
+
}
|
54
|
+
|
55
|
+
void
|
56
|
+
Init_gsocketservice(VALUE glib)
|
57
|
+
{
|
58
|
+
VALUE socketservice = G_DEF_CLASS(G_TYPE_SOCKET_SERVICE, "SocketService", glib);
|
59
|
+
|
60
|
+
rb_define_method(socketservice, "initialize", socketservice_initialize, 0);
|
61
|
+
rb_define_method(socketservice, "start", socketservice_start, 0);
|
62
|
+
rb_define_method(socketservice, "stop", socketservice_stop, 0);
|
63
|
+
rb_define_method(socketservice, "active?", socketservice_is_active, 0);
|
64
|
+
}
|
@@ -0,0 +1,77 @@
|
|
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 RVAL2GSRVTARGET(object) \
|
24
|
+
((GSrvTarget *)(RVAL2BOXED(object, G_TYPE_SRV_TARGET)))
|
25
|
+
|
26
|
+
#define _SELF(value) RVAL2GSRVTARGET(value)
|
27
|
+
|
28
|
+
static VALUE
|
29
|
+
srvtarget_initialize(VALUE self, VALUE hostname, VALUE port, VALUE priority, VALUE weight)
|
30
|
+
{
|
31
|
+
/* TODO: Does this work with boxed? */
|
32
|
+
/* TODO: hostname should be infected when returned. */
|
33
|
+
G_INITIALIZE(self, g_srv_target_new(RVAL2CSTR(hostname),
|
34
|
+
RVAL2GUINT16(port),
|
35
|
+
RVAL2GUINT16(priority),
|
36
|
+
RVAL2GUINT16(weight)));
|
37
|
+
|
38
|
+
return Qnil;
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
srvtarget_get_hostname(VALUE self)
|
43
|
+
{
|
44
|
+
return CSTR2RVAL(g_srv_target_get_hostname(_SELF(self)));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
srvtarget_get_port(VALUE self)
|
49
|
+
{
|
50
|
+
return GUINT162RVAL(g_srv_target_get_port(_SELF(self)));
|
51
|
+
}
|
52
|
+
|
53
|
+
static VALUE
|
54
|
+
srvtarget_get_priority(VALUE self)
|
55
|
+
{
|
56
|
+
return GUINT162RVAL(g_srv_target_get_priority(_SELF(self)));
|
57
|
+
}
|
58
|
+
|
59
|
+
static VALUE
|
60
|
+
srvtarget_get_weight(VALUE self)
|
61
|
+
{
|
62
|
+
return GUINT162RVAL(g_srv_target_get_weight(_SELF(self)));
|
63
|
+
}
|
64
|
+
|
65
|
+
/* TODO: srvtarget_list_sort */
|
66
|
+
|
67
|
+
void
|
68
|
+
Init_gsrvtarget(VALUE glib)
|
69
|
+
{
|
70
|
+
VALUE srvtarget = G_DEF_CLASS(G_TYPE_SRV_TARGET, "SrvTarget", glib);
|
71
|
+
|
72
|
+
rb_define_method(srvtarget, "initialize", srvtarget_initialize, 4);
|
73
|
+
rb_define_method(srvtarget, "hostname", srvtarget_get_hostname, 0);
|
74
|
+
rb_define_method(srvtarget, "port", srvtarget_get_port, 0);
|
75
|
+
rb_define_method(srvtarget, "priority", srvtarget_get_priority, 0);
|
76
|
+
rb_define_method(srvtarget, "weight", srvtarget_get_weight, 0);
|
77
|
+
}
|