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,48 @@
|
|
|
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_TCP_CONNECTION(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
static VALUE
|
|
26
|
+
tcpconnection_set_graceful_disconnect(VALUE self, VALUE graceful_disconnect)
|
|
27
|
+
{
|
|
28
|
+
g_tcp_connection_set_graceful_disconnect(_SELF(self),
|
|
29
|
+
RVAL2CBOOL(graceful_disconnect));
|
|
30
|
+
|
|
31
|
+
return self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static VALUE
|
|
35
|
+
tcpconnection_get_graceful_disconnect(VALUE self)
|
|
36
|
+
{
|
|
37
|
+
return CBOOL2RVAL(g_tcp_connection_get_graceful_disconnect(_SELF(self)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void
|
|
41
|
+
Init_gtcpconnection(VALUE glib)
|
|
42
|
+
{
|
|
43
|
+
VALUE tcpconnection = G_DEF_CLASS(G_TYPE_TCP_CONNECTION, "TcpConnection", glib);
|
|
44
|
+
|
|
45
|
+
rb_define_method(tcpconnection, "set_graceful_disconnect", tcpconnection_set_graceful_disconnect, 1);
|
|
46
|
+
G_DEF_SETTER(tcpconnection, "graceful_disconnect");
|
|
47
|
+
rb_define_method(tcpconnection, "graceful_disconnect?", tcpconnection_get_graceful_disconnect, 0);
|
|
48
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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_THEMED_ICON(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
/* TODO: Is this unnecessarily complicated? */
|
|
26
|
+
static VALUE
|
|
27
|
+
themedicon_initialize(int argc, VALUE *argv, VALUE self)
|
|
28
|
+
{
|
|
29
|
+
VALUE rbiconnames, with_default_fallbacks;
|
|
30
|
+
char **iconnames;
|
|
31
|
+
GIcon *icon;
|
|
32
|
+
|
|
33
|
+
rb_scan_args(argc, argv, "11", &rbiconnames, &with_default_fallbacks);
|
|
34
|
+
|
|
35
|
+
if (TYPE(rbiconnames) != T_ARRAY) {
|
|
36
|
+
const char *iconname = RVAL2CSTR(rbiconnames);
|
|
37
|
+
|
|
38
|
+
icon = RVAL2CBOOL(with_default_fallbacks) ?
|
|
39
|
+
g_themed_icon_new_with_default_fallbacks(iconname) :
|
|
40
|
+
g_themed_icon_new(iconname);
|
|
41
|
+
|
|
42
|
+
G_INITIALIZE(self, icon);
|
|
43
|
+
|
|
44
|
+
return Qnil;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (argc > 1)
|
|
48
|
+
rb_raise(rb_eArgError,
|
|
49
|
+
"only one argument allowed when first argument is an Array");
|
|
50
|
+
|
|
51
|
+
iconnames = ARY2STRVECTOR(rbiconnames);
|
|
52
|
+
|
|
53
|
+
icon = g_themed_icon_new_from_names(iconnames, -1);
|
|
54
|
+
|
|
55
|
+
g_free(iconnames);
|
|
56
|
+
|
|
57
|
+
G_INITIALIZE(self, icon);
|
|
58
|
+
|
|
59
|
+
return Qnil;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static VALUE
|
|
63
|
+
themedicon_prepend_name(VALUE self, VALUE iconname)
|
|
64
|
+
{
|
|
65
|
+
g_themed_icon_prepend_name(_SELF(self), RVAL2CSTR(iconname));
|
|
66
|
+
|
|
67
|
+
return self;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static VALUE
|
|
71
|
+
themedicon_append_name(VALUE self, VALUE iconname)
|
|
72
|
+
{
|
|
73
|
+
g_themed_icon_append_name(_SELF(self), RVAL2CSTR(iconname));
|
|
74
|
+
|
|
75
|
+
return self;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void
|
|
79
|
+
Init_gthemedicon(VALUE glib)
|
|
80
|
+
{
|
|
81
|
+
VALUE themedicon = G_DEF_INTERFACE(G_TYPE_THEMED_ICON, "ThemedIcon", glib);
|
|
82
|
+
|
|
83
|
+
rb_define_method(themedicon, "initialize", themedicon_initialize, 1);
|
|
84
|
+
rb_define_method(themedicon, "prepend_name", themedicon_prepend_name, 1);
|
|
85
|
+
rb_define_method(themedicon, "append_name", themedicon_append_name, 1);
|
|
86
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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_THREADED_SOCKET_SERVICE(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
static VALUE
|
|
26
|
+
threadedsocketservice_initialize(VALUE self)
|
|
27
|
+
{
|
|
28
|
+
G_INITIALIZE(self, g_socket_service_new());
|
|
29
|
+
|
|
30
|
+
return Qnil;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void
|
|
34
|
+
Init_gthreadedsocketservice(VALUE glib)
|
|
35
|
+
{
|
|
36
|
+
VALUE threadedsocketservice = G_DEF_CLASS(G_TYPE_THREADED_SOCKET_SERVICE, "ThreadedSocketService", glib);
|
|
37
|
+
|
|
38
|
+
rb_define_method(threadedsocketservice, "initialize", threadedsocketservice_initialize, 0);
|
|
39
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
#ifdef HAVE_GIO_UNIX
|
|
24
|
+
#include <gio/gunixconnection.h>
|
|
25
|
+
|
|
26
|
+
#define _SELF(value) G_UNIX_CONNECTION(RVAL2GOBJ(value))
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
unixconnection_receive_fd(int argc, VALUE *argv, VALUE self)
|
|
30
|
+
{
|
|
31
|
+
VALUE cancellable;
|
|
32
|
+
GError *error = NULL;
|
|
33
|
+
gint fd;
|
|
34
|
+
|
|
35
|
+
rb_scan_args(argc, argv, "01", &cancellable);
|
|
36
|
+
fd = g_unix_connection_receive_fd(_SELF(self),
|
|
37
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
38
|
+
&error);
|
|
39
|
+
if (fd == -1)
|
|
40
|
+
rbgio_raise_error(error);
|
|
41
|
+
|
|
42
|
+
return FD2RVAL(fd);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static VALUE
|
|
46
|
+
unixconnection_send_fd(int argc, VALUE *argv, VALUE self)
|
|
47
|
+
{
|
|
48
|
+
VALUE fd, cancellable;
|
|
49
|
+
GError *error = NULL;
|
|
50
|
+
|
|
51
|
+
rb_scan_args(argc, argv, "11", &fd, &cancellable);
|
|
52
|
+
if (!g_unix_connection_send_fd(_SELF(self), RVAL2FD(fd),
|
|
53
|
+
RVAL2GCANCELLABLE(cancellable), &error))
|
|
54
|
+
rbgio_raise_error(error);
|
|
55
|
+
|
|
56
|
+
return self;
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
void
|
|
61
|
+
Init_gunixconnection(G_GNUC_UNUSED VALUE glib)
|
|
62
|
+
{
|
|
63
|
+
#ifdef HAVE_GIO_UNIX
|
|
64
|
+
VALUE unixconnection = G_DEF_CLASS(G_TYPE_UNIX_CONNECTION, "UnixConnection", glib);
|
|
65
|
+
|
|
66
|
+
rb_define_method(unixconnection, "receive_fd", unixconnection_receive_fd, -1);
|
|
67
|
+
rb_define_method(unixconnection, "send_fd", unixconnection_send_fd, -1);
|
|
68
|
+
#endif
|
|
69
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
#ifdef HAVE_GIO_UNIX
|
|
24
|
+
#include <gio/gunixfdlist.h>
|
|
25
|
+
|
|
26
|
+
#define _SELF(value) RVAL2GUNIXFDLIST(value)
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
unixfdlist_initialize(int argc, VALUE *argv, VALUE self)
|
|
30
|
+
{
|
|
31
|
+
VALUE rbfds;
|
|
32
|
+
gint i, n_fds;
|
|
33
|
+
gint *fds;
|
|
34
|
+
|
|
35
|
+
rb_scan_args(argc, argv, "0*", &rbfds);
|
|
36
|
+
n_fds = RARRAY_LEN(rbfds);
|
|
37
|
+
if (n_fds == 0) {
|
|
38
|
+
G_INITIALIZE(self, g_unix_fd_list_new());
|
|
39
|
+
return Qnil;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
fds = ALLOCA_N(gint, n_fds);
|
|
43
|
+
for (i = 0; i < n_fds; i++)
|
|
44
|
+
fds[0] = RVAL2FD(RARRAY_PTR(rbfds)[i]);
|
|
45
|
+
|
|
46
|
+
G_INITIALIZE(self, g_unix_fd_list_new_from_array(fds, n_fds));
|
|
47
|
+
|
|
48
|
+
return Qnil;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static VALUE
|
|
52
|
+
unixfdlist_get_length(VALUE self)
|
|
53
|
+
{
|
|
54
|
+
return GINT2RVAL(g_unix_fd_list_get_length(_SELF(self)));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static VALUE
|
|
58
|
+
unixfdlist_get(VALUE self, VALUE index)
|
|
59
|
+
{
|
|
60
|
+
GError *error = NULL;
|
|
61
|
+
gint fd;
|
|
62
|
+
|
|
63
|
+
fd = g_unix_fd_list_get(_SELF(self), RVAL2GINT(index), &error);
|
|
64
|
+
if (fd == -1)
|
|
65
|
+
rbgio_raise_error(error);
|
|
66
|
+
|
|
67
|
+
/* TODO: This fd must be closed properly. How do we deal with that? */
|
|
68
|
+
return FD2RVAL(fd);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static VALUE
|
|
72
|
+
unixfdlist_peek_fds(VALUE self)
|
|
73
|
+
{
|
|
74
|
+
return GFDS2ARY(g_unix_fd_list_peek_fds(_SELF(self), NULL));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static VALUE
|
|
78
|
+
unixfdlist_steal_fds(VALUE self)
|
|
79
|
+
{
|
|
80
|
+
return GFDS2ARY_FREE(g_unix_fd_list_steal_fds(_SELF(self), NULL));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static VALUE
|
|
84
|
+
unixfdlist_append(VALUE self, VALUE fd)
|
|
85
|
+
{
|
|
86
|
+
GError *error = NULL;
|
|
87
|
+
int index;
|
|
88
|
+
|
|
89
|
+
index = g_unix_fd_list_append(_SELF(self), RVAL2FD(fd), &error);
|
|
90
|
+
if (index == -1)
|
|
91
|
+
rbgio_raise_error(error);
|
|
92
|
+
|
|
93
|
+
return self;
|
|
94
|
+
}
|
|
95
|
+
#endif
|
|
96
|
+
|
|
97
|
+
void
|
|
98
|
+
Init_gunixfdlist(G_GNUC_UNUSED VALUE glib)
|
|
99
|
+
{
|
|
100
|
+
#ifdef HAVE_GIO_UNIX
|
|
101
|
+
VALUE unixfdlist = G_DEF_CLASS(G_TYPE_UNIX_FD_LIST, "UnixFdList", glib);
|
|
102
|
+
|
|
103
|
+
rb_define_method(unixfdlist, "initialize", unixfdlist_initialize, -1);
|
|
104
|
+
rb_define_method(unixfdlist, "length", unixfdlist_get_length, 0);
|
|
105
|
+
rb_define_method(unixfdlist, "get", unixfdlist_get, 1);
|
|
106
|
+
rb_define_alias(unixfdlist, "[]", "get");
|
|
107
|
+
rb_define_method(unixfdlist, "peek_fds", unixfdlist_peek_fds, 0);
|
|
108
|
+
rb_define_method(unixfdlist, "steal_fds", unixfdlist_steal_fds, 0);
|
|
109
|
+
rb_define_method(unixfdlist, "append", unixfdlist_append, 1);
|
|
110
|
+
rb_define_alias(unixfdlist, "<<", "append");
|
|
111
|
+
#endif
|
|
112
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
#ifdef HAVE_GIO_UNIX
|
|
24
|
+
#include <gio/gunixfdmessage.h>
|
|
25
|
+
|
|
26
|
+
#define _SELF(value) G_UNIX_FD_MESSAGE(RVAL2GOBJ(value))
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
unixfdmessage_initialize(int argc, VALUE *argv, VALUE self)
|
|
30
|
+
{
|
|
31
|
+
VALUE fd_list;
|
|
32
|
+
GSocketControlMessage *message;
|
|
33
|
+
|
|
34
|
+
rb_scan_args(argc, argv, "01", &fd_list);
|
|
35
|
+
message = NIL_P(fd_list) ?
|
|
36
|
+
g_unix_fd_message_new() :
|
|
37
|
+
g_unix_fd_message_new_with_fd_list(RVAL2GUNIXFDLIST(fd_list));
|
|
38
|
+
G_INITIALIZE(self, message);
|
|
39
|
+
|
|
40
|
+
return Qnil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static VALUE
|
|
44
|
+
unixfdmessage_get_fd_list(VALUE self)
|
|
45
|
+
{
|
|
46
|
+
/* TODO: Should we relate the return value with self? It’s apparently
|
|
47
|
+
* valid as long as self is valid. */
|
|
48
|
+
return GOBJ2RVAL(g_unix_fd_message_get_fd_list(_SELF(self)));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static VALUE
|
|
52
|
+
unixfdmessage_append_fd(VALUE self, VALUE fd)
|
|
53
|
+
{
|
|
54
|
+
GError *error = NULL;
|
|
55
|
+
|
|
56
|
+
if (!g_unix_fd_message_append_fd(_SELF(self), RVAL2FD(fd), &error))
|
|
57
|
+
rbgio_raise_error(error);
|
|
58
|
+
|
|
59
|
+
return self;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static VALUE
|
|
63
|
+
unixfdmessage_steal_fds(VALUE self)
|
|
64
|
+
{
|
|
65
|
+
return GFDS2ARY_FREE(g_unix_fd_message_steal_fds(_SELF(self), NULL));
|
|
66
|
+
}
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
void
|
|
70
|
+
Init_gunixfdmessage(G_GNUC_UNUSED VALUE glib)
|
|
71
|
+
{
|
|
72
|
+
#ifdef HAVE_GIO_UNIX
|
|
73
|
+
VALUE unixfdmessage = G_DEF_CLASS(G_TYPE_UNIX_FD_MESSAGE, "UnixFDMessage", glib);
|
|
74
|
+
|
|
75
|
+
rb_define_method(unixfdmessage, "initialize", unixfdmessage_initialize, -1);
|
|
76
|
+
rb_define_method(unixfdmessage, "fd_list", unixfdmessage_get_fd_list, 0);
|
|
77
|
+
rb_define_method(unixfdmessage, "append_fd", unixfdmessage_append_fd, 1);
|
|
78
|
+
rb_define_alias(unixfdmessage, "<<", "append_fd");
|
|
79
|
+
rb_define_method(unixfdmessage, "steal_fds", unixfdmessage_steal_fds, 0);
|
|
80
|
+
#endif
|
|
81
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
#ifdef HAVE_GIO_UNIX
|
|
24
|
+
#include <gio/gunixinputstream.h>
|
|
25
|
+
|
|
26
|
+
#define _SELF(value) G_UNIX_INPUT_STREAM(RVAL2GOBJ(value))
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
unixinputstream_initialize(int argc, VALUE *argv, VALUE self)
|
|
30
|
+
{
|
|
31
|
+
VALUE fd, close_fd;
|
|
32
|
+
|
|
33
|
+
rb_scan_args(argc, argv, "11", &fd, &close_fd);
|
|
34
|
+
G_INITIALIZE(self, g_unix_input_stream_new(RVAL2FD(fd),
|
|
35
|
+
RVAL2CBOOL(close_fd)));
|
|
36
|
+
|
|
37
|
+
return Qnil;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static VALUE
|
|
41
|
+
unixinputstream_set_close_fd(VALUE self, VALUE close_fd)
|
|
42
|
+
{
|
|
43
|
+
g_unix_input_stream_set_close_fd(_SELF(self), RVAL2CBOOL(close_fd));
|
|
44
|
+
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static VALUE
|
|
49
|
+
unixinputstream_get_close_fd(VALUE self)
|
|
50
|
+
{
|
|
51
|
+
return CBOOL2RVAL(g_unix_input_stream_get_close_fd(_SELF(self)));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static VALUE
|
|
55
|
+
unixinputstream_get_fd(VALUE self)
|
|
56
|
+
{
|
|
57
|
+
return FD2RVAL(g_unix_input_stream_get_fd(_SELF(self)));
|
|
58
|
+
}
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
void
|
|
62
|
+
Init_gunixinputstream(G_GNUC_UNUSED VALUE glib)
|
|
63
|
+
{
|
|
64
|
+
#ifdef HAVE_GIO_UNIX
|
|
65
|
+
VALUE unixinputstream = G_DEF_CLASS(G_TYPE_UNIX_INPUT_STREAM, "UnixInputStream", glib);
|
|
66
|
+
|
|
67
|
+
rb_define_method(unixinputstream, "initialize", unixinputstream_initialize, -1);
|
|
68
|
+
rb_define_method(unixinputstream, "set_close_fd", unixinputstream_set_close_fd, 1);
|
|
69
|
+
G_DEF_SETTER(unixinputstream, "close_fd");
|
|
70
|
+
rb_define_method(unixinputstream, "close_fd?", unixinputstream_get_close_fd, 0);
|
|
71
|
+
rb_define_method(unixinputstream, "fd", unixinputstream_get_fd, 0);
|
|
72
|
+
#endif
|
|
73
|
+
}
|