gio2 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/gio2.rb +38 -143
- 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/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.rb +21 -0
- data/test/gio2-test-utils/fixture.rb +24 -0
- data/test/gio2-test-utils/socket-client.rb +59 -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,66 +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 cSocketService
|
25
|
-
#define _SELF(value) RVAL2GSOCKETSERVICE(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self)
|
29
|
-
{
|
30
|
-
G_INITIALIZE(self, g_socket_service_new());
|
31
|
-
|
32
|
-
return Qnil;
|
33
|
-
}
|
34
|
-
|
35
|
-
static VALUE
|
36
|
-
rg_start(VALUE self)
|
37
|
-
{
|
38
|
-
g_socket_service_start(_SELF(self));
|
39
|
-
|
40
|
-
return self;
|
41
|
-
}
|
42
|
-
|
43
|
-
static VALUE
|
44
|
-
rg_stop(VALUE self)
|
45
|
-
{
|
46
|
-
g_socket_service_stop(_SELF(self));
|
47
|
-
|
48
|
-
return self;
|
49
|
-
}
|
50
|
-
|
51
|
-
static VALUE
|
52
|
-
rg_active_p(VALUE self)
|
53
|
-
{
|
54
|
-
return CBOOL2RVAL(g_socket_service_is_active(_SELF(self)));
|
55
|
-
}
|
56
|
-
|
57
|
-
void
|
58
|
-
Init_gsocketservice(VALUE mGio)
|
59
|
-
{
|
60
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_SERVICE, "SocketService", mGio);
|
61
|
-
|
62
|
-
RG_DEF_METHOD(initialize, 0);
|
63
|
-
RG_DEF_METHOD(start, 0);
|
64
|
-
RG_DEF_METHOD(stop, 0);
|
65
|
-
RG_DEF_METHOD_P(active, 0);
|
66
|
-
}
|
data/ext/gio2/rbgiosrvtarget.c
DELETED
@@ -1,76 +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 cSrvTarget
|
25
|
-
#define _SELF(value) RVAL2GSRVTARGET(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self, VALUE hostname, VALUE port, VALUE priority, VALUE weight)
|
29
|
-
{
|
30
|
-
/* TODO: Does this work with boxed? */
|
31
|
-
/* TODO: hostname should be infected when returned. */
|
32
|
-
G_INITIALIZE(self, g_srv_target_new(RVAL2CSTR(hostname),
|
33
|
-
RVAL2GUINT16(port),
|
34
|
-
RVAL2GUINT16(priority),
|
35
|
-
RVAL2GUINT16(weight)));
|
36
|
-
|
37
|
-
return Qnil;
|
38
|
-
}
|
39
|
-
|
40
|
-
static VALUE
|
41
|
-
rg_hostname(VALUE self)
|
42
|
-
{
|
43
|
-
return CSTR2RVAL(g_srv_target_get_hostname(_SELF(self)));
|
44
|
-
}
|
45
|
-
|
46
|
-
static VALUE
|
47
|
-
rg_port(VALUE self)
|
48
|
-
{
|
49
|
-
return GUINT162RVAL(g_srv_target_get_port(_SELF(self)));
|
50
|
-
}
|
51
|
-
|
52
|
-
static VALUE
|
53
|
-
rg_priority(VALUE self)
|
54
|
-
{
|
55
|
-
return GUINT162RVAL(g_srv_target_get_priority(_SELF(self)));
|
56
|
-
}
|
57
|
-
|
58
|
-
static VALUE
|
59
|
-
rg_weight(VALUE self)
|
60
|
-
{
|
61
|
-
return GUINT162RVAL(g_srv_target_get_weight(_SELF(self)));
|
62
|
-
}
|
63
|
-
|
64
|
-
/* TODO: srvtarget_list_sort */
|
65
|
-
|
66
|
-
void
|
67
|
-
Init_gsrvtarget(VALUE mGio)
|
68
|
-
{
|
69
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SRV_TARGET, "SrvTarget", mGio);
|
70
|
-
|
71
|
-
RG_DEF_METHOD(initialize, 4);
|
72
|
-
RG_DEF_METHOD(hostname, 0);
|
73
|
-
RG_DEF_METHOD(port, 0);
|
74
|
-
RG_DEF_METHOD(priority, 0);
|
75
|
-
RG_DEF_METHOD(weight, 0);
|
76
|
-
}
|
@@ -1,28 +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
|
-
void
|
25
|
-
Init_gtcpconnection(VALUE mGio)
|
26
|
-
{
|
27
|
-
(void)G_DEF_CLASS(G_TYPE_TCP_CONNECTION, "TcpConnection", mGio);
|
28
|
-
}
|
data/ext/gio2/rbgiothemedicon.c
DELETED
@@ -1,83 +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 mThemedIcon
|
25
|
-
#define _SELF(value) RVAL2GTHEMEDICON(value)
|
26
|
-
|
27
|
-
/* TODO: Is this unnecessarily complicated? */
|
28
|
-
static VALUE
|
29
|
-
rg_initialize(int argc, VALUE *argv, VALUE self)
|
30
|
-
{
|
31
|
-
VALUE iconnames, with_default_fallbacks;
|
32
|
-
GIcon *icon;
|
33
|
-
|
34
|
-
rb_scan_args(argc, argv, "11", &iconnames, &with_default_fallbacks);
|
35
|
-
|
36
|
-
if (TYPE(iconnames) != T_ARRAY) {
|
37
|
-
const char *iconname = RVAL2CSTR(iconnames);
|
38
|
-
|
39
|
-
icon = RVAL2CBOOL(with_default_fallbacks) ?
|
40
|
-
g_themed_icon_new_with_default_fallbacks(iconname) :
|
41
|
-
g_themed_icon_new(iconname);
|
42
|
-
|
43
|
-
G_INITIALIZE(self, icon);
|
44
|
-
|
45
|
-
return Qnil;
|
46
|
-
}
|
47
|
-
|
48
|
-
if (argc > 1)
|
49
|
-
rb_raise(rb_eArgError,
|
50
|
-
"only one argument allowed when first argument is an Array");
|
51
|
-
|
52
|
-
icon = g_themed_icon_new_from_names(RVAL2STRV_DUP(iconnames), -1);
|
53
|
-
|
54
|
-
G_INITIALIZE(self, icon);
|
55
|
-
|
56
|
-
return Qnil;
|
57
|
-
}
|
58
|
-
|
59
|
-
static VALUE
|
60
|
-
rg_prepend_name(VALUE self, VALUE iconname)
|
61
|
-
{
|
62
|
-
g_themed_icon_prepend_name(_SELF(self), RVAL2CSTR(iconname));
|
63
|
-
|
64
|
-
return self;
|
65
|
-
}
|
66
|
-
|
67
|
-
static VALUE
|
68
|
-
rg_append_name(VALUE self, VALUE iconname)
|
69
|
-
{
|
70
|
-
g_themed_icon_append_name(_SELF(self), RVAL2CSTR(iconname));
|
71
|
-
|
72
|
-
return self;
|
73
|
-
}
|
74
|
-
|
75
|
-
void
|
76
|
-
Init_gthemedicon(VALUE mGio)
|
77
|
-
{
|
78
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_THEMED_ICON, "ThemedIcon", mGio);
|
79
|
-
|
80
|
-
RG_DEF_METHOD(initialize, -1);
|
81
|
-
RG_DEF_METHOD(prepend_name, 1);
|
82
|
-
RG_DEF_METHOD(append_name, 1);
|
83
|
-
}
|
@@ -1,43 +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 cThreadedSocketService
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self, VALUE max_threads)
|
28
|
-
{
|
29
|
-
G_INITIALIZE(self,
|
30
|
-
g_threaded_socket_service_new(RVAL2TYPE_WITH_DEFAULT(max_threads,
|
31
|
-
RVAL2GINT,
|
32
|
-
10)));
|
33
|
-
|
34
|
-
return Qnil;
|
35
|
-
}
|
36
|
-
|
37
|
-
void
|
38
|
-
Init_gthreadedsocketservice(VALUE mGio)
|
39
|
-
{
|
40
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_THREADED_SOCKET_SERVICE, "ThreadedSocketService", mGio);
|
41
|
-
|
42
|
-
RG_DEF_METHOD(initialize, -1);
|
43
|
-
}
|
@@ -1,89 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
-
*
|
5
|
-
* This library is free software; you can redistribute it and/or
|
6
|
-
* modify it under the terms of the GNU Lesser General Public
|
7
|
-
* License as published by the Free Software Foundation; either
|
8
|
-
* version 2.1 of the License, or (at your option) any later version.
|
9
|
-
*
|
10
|
-
* This library is distributed in the hope that it will be useful,
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
* Lesser General Public License for more details.
|
14
|
-
*
|
15
|
-
* You should have received a copy of the GNU Lesser General Public
|
16
|
-
* License along with this library; if not, write to the Free Software
|
17
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgio2private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cTlsCertificate
|
24
|
-
#define _SELF(value) RVAL2GOBJ(value)
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self, VALUE data)
|
28
|
-
{
|
29
|
-
GTlsCertificate *certificate;
|
30
|
-
GError *error = NULL;
|
31
|
-
|
32
|
-
certificate = g_tls_certificate_new_from_pem(StringValuePtr(data),
|
33
|
-
RSTRING_LEN(data),
|
34
|
-
&error);
|
35
|
-
if (error)
|
36
|
-
rbgio_raise_error(error);
|
37
|
-
|
38
|
-
G_INITIALIZE(self, certificate);
|
39
|
-
|
40
|
-
return Qnil;
|
41
|
-
}
|
42
|
-
|
43
|
-
static VALUE
|
44
|
-
rg_s_load(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
45
|
-
{
|
46
|
-
VALUE cert_file, key_file;
|
47
|
-
GError *error = NULL;
|
48
|
-
GTlsCertificate *certificate;
|
49
|
-
|
50
|
-
rb_scan_args(argc, argv, "11", &cert_file, &key_file);
|
51
|
-
if (NIL_P(key_file)) {
|
52
|
-
certificate = g_tls_certificate_new_from_file(StringValuePtr(cert_file),
|
53
|
-
&error);
|
54
|
-
} else {
|
55
|
-
certificate = g_tls_certificate_new_from_files(StringValuePtr(cert_file),
|
56
|
-
StringValuePtr(key_file),
|
57
|
-
&error);
|
58
|
-
}
|
59
|
-
|
60
|
-
if (error)
|
61
|
-
rbgio_raise_error(error);
|
62
|
-
|
63
|
-
return GOBJ2RVAL_UNREF(certificate);
|
64
|
-
}
|
65
|
-
|
66
|
-
static VALUE
|
67
|
-
rg_verify(VALUE self, VALUE identity, VALUE trusted_ca)
|
68
|
-
{
|
69
|
-
GTlsCertificateFlags flags;
|
70
|
-
|
71
|
-
flags = g_tls_certificate_verify(_SELF(self),
|
72
|
-
RVAL2GOBJ(identity),
|
73
|
-
RVAL2GOBJ(trusted_ca));
|
74
|
-
return GFLAGS2RVAL(flags, G_TYPE_TLS_CERTIFICATE_FLAGS);
|
75
|
-
}
|
76
|
-
|
77
|
-
void
|
78
|
-
Init_gtlscertificate(VALUE mGio)
|
79
|
-
{
|
80
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TLS_CERTIFICATE,
|
81
|
-
"TlsCertificate", mGio);
|
82
|
-
|
83
|
-
G_DEF_CLASS(G_TYPE_TLS_CERTIFICATE_FLAGS, "TlsCertificateFlags", mGio);
|
84
|
-
|
85
|
-
RG_DEF_SMETHOD(load, -1);
|
86
|
-
|
87
|
-
RG_DEF_METHOD(initialize, 1);
|
88
|
-
RG_DEF_METHOD(verify, 2);
|
89
|
-
}
|
@@ -1,71 +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
|
-
#ifdef HAVE_GIO_UNIX
|
25
|
-
#include <gio/gunixconnection.h>
|
26
|
-
|
27
|
-
#define RG_TARGET_NAMESPACE cUnixConnection
|
28
|
-
#define _SELF(value) RVAL2GUNIXCONNECTION(value)
|
29
|
-
|
30
|
-
static VALUE
|
31
|
-
rg_receive_fd(int argc, VALUE *argv, VALUE self)
|
32
|
-
{
|
33
|
-
VALUE cancellable;
|
34
|
-
GError *error = NULL;
|
35
|
-
gint fd;
|
36
|
-
|
37
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
38
|
-
fd = g_unix_connection_receive_fd(_SELF(self),
|
39
|
-
RVAL2GCANCELLABLE(cancellable),
|
40
|
-
&error);
|
41
|
-
if (fd == -1)
|
42
|
-
rbgio_raise_error(error);
|
43
|
-
|
44
|
-
return FD2RVAL(fd);
|
45
|
-
}
|
46
|
-
|
47
|
-
static VALUE
|
48
|
-
rg_send_fd(int argc, VALUE *argv, VALUE self)
|
49
|
-
{
|
50
|
-
VALUE fd, cancellable;
|
51
|
-
GError *error = NULL;
|
52
|
-
|
53
|
-
rb_scan_args(argc, argv, "11", &fd, &cancellable);
|
54
|
-
if (!g_unix_connection_send_fd(_SELF(self), RVAL2FD(fd),
|
55
|
-
RVAL2GCANCELLABLE(cancellable), &error))
|
56
|
-
rbgio_raise_error(error);
|
57
|
-
|
58
|
-
return self;
|
59
|
-
}
|
60
|
-
#endif
|
61
|
-
|
62
|
-
void
|
63
|
-
Init_gunixconnection(G_GNUC_UNUSED VALUE mGio)
|
64
|
-
{
|
65
|
-
#ifdef HAVE_GIO_UNIX
|
66
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_CONNECTION, "UnixConnection", mGio);
|
67
|
-
|
68
|
-
RG_DEF_METHOD(receive_fd, -1);
|
69
|
-
RG_DEF_METHOD(send_fd, -1);
|
70
|
-
#endif
|
71
|
-
}
|