gio2 1.0.3-x86-mingw32 → 1.1.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.
- data/ext/gio2/extconf.rb +4 -42
- data/ext/gio2/gio2.c +18 -117
- data/ext/gio2/gio2.h +20 -339
- data/ext/gio2/rbgio.c +132 -0
- data/ext/gio2/rbgio2.h +156 -0
- data/ext/gio2/rbgio2conversions.h +154 -0
- data/ext/gio2/rbgio2private.h +147 -0
- data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
- data/ext/gio2/rbgioapplaunchcontext.c +81 -0
- data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
- data/ext/gio2/rbgioasyncresult.c +41 -0
- data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
- data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
- data/ext/gio2/rbgiocancellable.c +180 -0
- data/ext/gio2/rbgiocharsetconverter.c +57 -0
- data/ext/gio2/rbgiocontenttype.c +131 -0
- data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
- data/ext/gio2/rbgioconverterinputstream.c +43 -0
- data/ext/gio2/rbgioconverteroutputstream.c +43 -0
- data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
- data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
- data/ext/gio2/rbgiodesktopappinfo.c +87 -0
- data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
- data/ext/gio2/rbgioemblem.c +52 -0
- data/ext/gio2/rbgioemblemedicon.c +65 -0
- data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
- data/ext/gio2/rbgiofileattribute.c +114 -0
- data/ext/gio2/rbgiofileattributeinfo.c +86 -0
- data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
- data/ext/gio2/rbgiofileattributematcher.c +93 -0
- data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
- data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
- data/ext/gio2/rbgiofileicon.c +41 -0
- data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
- data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
- data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
- data/ext/gio2/rbgiofilemonitor.c +46 -0
- data/ext/gio2/rbgiofilenamecompleter.c +74 -0
- data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
- data/ext/gio2/rbgiofilterinputstream.c +28 -0
- data/ext/gio2/rbgiofilteroutputstream.c +28 -0
- data/ext/gio2/rbgioicon.c +69 -0
- data/ext/gio2/rbgioinetaddress.c +118 -0
- data/ext/gio2/rbgioinetsocketaddress.c +41 -0
- data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
- data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
- data/ext/gio2/rbgioio.c +73 -0
- data/ext/gio2/rbgioiomodule.c +45 -0
- data/ext/gio2/rbgioiomodules.c +47 -0
- data/ext/gio2/rbgioioscheduler.c +102 -0
- data/ext/gio2/rbgioioschedulerjob.c +121 -0
- data/ext/gio2/rbgioiostream.c +108 -0
- data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
- data/ext/gio2/rbgiomemoryinputstream.c +67 -0
- data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
- data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
- data/ext/gio2/rbgiomountoperation.c +53 -0
- data/ext/gio2/rbgionetworkaddress.c +59 -0
- data/ext/gio2/rbgionetworkservice.c +45 -0
- data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
- data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
- data/ext/gio2/rbgioseekable.c +91 -0
- data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
- data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
- data/ext/gio2/rbgiosocketaddress.c +34 -0
- data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
- data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
- data/ext/gio2/rbgiosocketconnectable.c +41 -0
- data/ext/gio2/rbgiosocketconnection.c +66 -0
- data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
- data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
- data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
- data/ext/gio2/rbgiosocketservice.c +66 -0
- data/ext/gio2/rbgiosrvtarget.c +76 -0
- data/ext/gio2/rbgiotcpconnection.c +28 -0
- data/ext/gio2/rbgiothemedicon.c +83 -0
- data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
- data/ext/gio2/rbgiounixconnection.c +71 -0
- data/ext/gio2/rbgiounixfdlist.c +115 -0
- data/ext/gio2/rbgiounixfdmessage.c +74 -0
- data/ext/gio2/rbgiounixinputstream.c +51 -0
- data/ext/gio2/rbgiounixmount.c +164 -0
- data/ext/gio2/rbgiounixmountmonitor.c +66 -0
- data/ext/gio2/rbgiounixmountpoint.c +136 -0
- data/ext/gio2/rbgiounixmountpoints.c +58 -0
- data/ext/gio2/rbgiounixmounts.c +58 -0
- data/ext/gio2/rbgiounixoutputstream.c +51 -0
- data/ext/gio2/rbgiounixsocketaddress.c +69 -0
- data/ext/gio2/rbgiovfs.c +84 -0
- data/ext/gio2/rbgiovolume.c +193 -0
- data/ext/gio2/rbgiovolumemonitor.c +77 -0
- data/ext/gio2/rbgiozlibcompressor.c +52 -0
- data/ext/gio2/rbgiozlibdecompressor.c +45 -0
- data/ext/gio2/util.c +57 -60
- data/lib/1.8/gio2.so +0 -0
- data/lib/1.9/gio2.so +0 -0
- data/lib/gio2/deprecated.rb +102 -0
- data/lib/gio2.rb +14 -12
- metadata +100 -88
- data/ChangeLog +0 -129
- data/ext/gio2/gapplaunchcontext.c +0 -79
- data/ext/gio2/gasyncresult.c +0 -39
- data/ext/gio2/gbufferedoutputstream.c +0 -48
- data/ext/gio2/gcancellable.c +0 -177
- data/ext/gio2/gcharsetconverter.c +0 -55
- data/ext/gio2/gcontenttype.c +0 -128
- data/ext/gio2/gconverterinputstream.c +0 -41
- data/ext/gio2/gconverteroutputstream.c +0 -41
- data/ext/gio2/gdesktopappinfo.c +0 -88
- data/ext/gio2/gemblem.c +0 -52
- data/ext/gio2/gemblemedicon.c +0 -63
- data/ext/gio2/gfileattribute.c +0 -111
- data/ext/gio2/gfileattributeinfo.c +0 -89
- data/ext/gio2/gfileattributeinfolist.c +0 -109
- data/ext/gio2/gfileattributematcher.c +0 -90
- data/ext/gio2/gfiledescriptorbased.c +0 -42
- data/ext/gio2/gfileicon.c +0 -39
- data/ext/gio2/gfilemonitor.c +0 -44
- data/ext/gio2/gfilenamecompleter.c +0 -72
- data/ext/gio2/gfilterinputstream.c +0 -27
- data/ext/gio2/gfilteroutputstream.c +0 -27
- data/ext/gio2/gicon.c +0 -67
- data/ext/gio2/ginetaddress.c +0 -116
- data/ext/gio2/ginetsocketaddress.c +0 -38
- data/ext/gio2/gioerror.c +0 -70
- data/ext/gio2/giomodule.c +0 -63
- data/ext/gio2/gioscheduler.c +0 -193
- data/ext/gio2/giostream.c +0 -106
- data/ext/gio2/gmemoryinputstream.c +0 -65
- data/ext/gio2/gmemoryoutputstream.c +0 -41
- data/ext/gio2/gmountoperation.c +0 -66
- data/ext/gio2/gnetworkaddress.c +0 -57
- data/ext/gio2/gnetworkservice.c +0 -43
- data/ext/gio2/gseekable.c +0 -89
- data/ext/gio2/gsimpleasyncresult.c +0 -153
- data/ext/gio2/gsocketaddress.c +0 -33
- data/ext/gio2/gsocketconnectable.c +0 -97
- data/ext/gio2/gsocketconnection.c +0 -75
- data/ext/gio2/gsocketcontrolmessage.c +0 -80
- data/ext/gio2/gsocketservice.c +0 -64
- data/ext/gio2/gsrvtarget.c +0 -77
- data/ext/gio2/gtcpconnection.c +0 -27
- data/ext/gio2/gthemedicon.c +0 -81
- data/ext/gio2/gthreadedsocketservice.c +0 -40
- data/ext/gio2/gunixconnection.c +0 -69
- data/ext/gio2/gunixfdlist.c +0 -112
- data/ext/gio2/gunixfdmessage.c +0 -72
- data/ext/gio2/gunixinputstream.c +0 -49
- data/ext/gio2/gunixmounts.c +0 -343
- data/ext/gio2/gunixoutputstream.c +0 -49
- data/ext/gio2/gunixsocketaddress.c +0 -67
- data/ext/gio2/gvfs.c +0 -82
- data/ext/gio2/gvolume.c +0 -191
- data/ext/gio2/gvolumemonitor.c +0 -75
- data/ext/gio2/gzlibcompressor.c +0 -50
- data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,29 +1,31 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
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
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
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
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
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
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
23
|
-
#define
|
24
|
+
#define RG_TARGET_NAMESPACE cBufferedInputStream
|
25
|
+
#define _SELF(value) RVAL2GBUFFEREDINPUTSTREAM(value)
|
24
26
|
|
25
27
|
static VALUE
|
26
|
-
|
28
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
27
29
|
{
|
28
30
|
VALUE rbbase_stream, size;
|
29
31
|
GInputStream *base_stream, *stream;
|
@@ -40,13 +42,13 @@ bufferedinputstream_initialize(int argc, VALUE *argv, VALUE self)
|
|
40
42
|
}
|
41
43
|
|
42
44
|
static VALUE
|
43
|
-
|
45
|
+
rg_available(VALUE self)
|
44
46
|
{
|
45
47
|
return GSIZE2RVAL(g_buffered_input_stream_get_available(_SELF(self)));
|
46
48
|
}
|
47
49
|
|
48
50
|
static VALUE
|
49
|
-
|
51
|
+
rg_peek_buffer(VALUE self)
|
50
52
|
{
|
51
53
|
gsize size;
|
52
54
|
const void *buffer;
|
@@ -57,7 +59,7 @@ bufferedinputstream_peek_buffer(VALUE self)
|
|
57
59
|
}
|
58
60
|
|
59
61
|
static VALUE
|
60
|
-
|
62
|
+
rg_peek(VALUE self, VALUE rboffset, VALUE rbcount)
|
61
63
|
{
|
62
64
|
gsize offset = RVAL2GSIZE(rboffset);
|
63
65
|
gsize count = RVAL2GSIZE(rbcount);
|
@@ -75,7 +77,7 @@ bufferedinputstream_peek(VALUE self, VALUE rboffset, VALUE rbcount)
|
|
75
77
|
}
|
76
78
|
|
77
79
|
static VALUE
|
78
|
-
|
80
|
+
rg_fill(int argc, VALUE *argv, VALUE self)
|
79
81
|
{
|
80
82
|
VALUE count, cancellable;
|
81
83
|
GError *error = NULL;
|
@@ -95,7 +97,7 @@ bufferedinputstream_fill(int argc, VALUE *argv, VALUE self)
|
|
95
97
|
}
|
96
98
|
|
97
99
|
static VALUE
|
98
|
-
|
100
|
+
rg_fill_async(int argc, VALUE *argv, VALUE self)
|
99
101
|
{
|
100
102
|
VALUE rbcount, rbio_priority, rbcancellable, block;
|
101
103
|
gssize count;
|
@@ -118,7 +120,7 @@ bufferedinputstream_fill_async(int argc, VALUE *argv, VALUE self)
|
|
118
120
|
}
|
119
121
|
|
120
122
|
static VALUE
|
121
|
-
|
123
|
+
rg_fill_finish(VALUE self, VALUE result)
|
122
124
|
{
|
123
125
|
GError *error = NULL;
|
124
126
|
gsize bytes_read;
|
@@ -133,7 +135,7 @@ bufferedinputstream_fill_finish(VALUE self, VALUE result)
|
|
133
135
|
}
|
134
136
|
|
135
137
|
static VALUE
|
136
|
-
|
138
|
+
rg_read_byte(int argc, VALUE *argv, VALUE self)
|
137
139
|
{
|
138
140
|
VALUE cancellable;
|
139
141
|
GError *error = NULL;
|
@@ -150,16 +152,16 @@ bufferedinputstream_read_byte(int argc, VALUE *argv, VALUE self)
|
|
150
152
|
}
|
151
153
|
|
152
154
|
void
|
153
|
-
Init_gbufferedinputstream(VALUE
|
155
|
+
Init_gbufferedinputstream(VALUE mGio)
|
154
156
|
{
|
155
|
-
VALUE
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
157
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BUFFERED_INPUT_STREAM, "BufferedInputStream", mGio);
|
158
|
+
|
159
|
+
RG_DEF_METHOD(initialize, -1);
|
160
|
+
RG_DEF_METHOD(available, 0);
|
161
|
+
RG_DEF_METHOD(peek_buffer, 0);
|
162
|
+
RG_DEF_METHOD(peek, 2);
|
163
|
+
RG_DEF_METHOD(fill, -1);
|
164
|
+
RG_DEF_METHOD(fill_async, -1);
|
165
|
+
RG_DEF_METHOD(fill_finish, 1);
|
166
|
+
RG_DEF_METHOD(read_byte, -1);
|
165
167
|
}
|
@@ -0,0 +1,50 @@
|
|
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 cBufferedOutputStream
|
25
|
+
#define _SELF(value) RVAL2GBUFFEREDOUTPUTSTREAM(value)
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
29
|
+
{
|
30
|
+
VALUE rbbase_stream, size;
|
31
|
+
GOutputStream *base_stream, *stream;
|
32
|
+
|
33
|
+
rb_scan_args(argc, argv, "11", &rbbase_stream, &size);
|
34
|
+
base_stream = RVAL2GOUTPUTSTREAM(rbbase_stream);
|
35
|
+
|
36
|
+
stream = NIL_P(size) ?
|
37
|
+
g_buffered_output_stream_new(base_stream) :
|
38
|
+
g_buffered_output_stream_new_sized(base_stream, RVAL2GSIZE(size));
|
39
|
+
G_INITIALIZE(self, stream);
|
40
|
+
|
41
|
+
return Qnil;
|
42
|
+
}
|
43
|
+
|
44
|
+
void
|
45
|
+
Init_gbufferedoutputstream(VALUE mGio)
|
46
|
+
{
|
47
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BUFFERED_OUTPUT_STREAM, "BufferedOutputStream", mGio);
|
48
|
+
|
49
|
+
RG_DEF_METHOD(initialize, -1);
|
50
|
+
}
|
@@ -0,0 +1,180 @@
|
|
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 cCancellable
|
25
|
+
#define _SELF(value) RVAL2GCANCELLABLE(value)
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_initialize(VALUE self)
|
29
|
+
{
|
30
|
+
G_INITIALIZE(self, g_cancellable_new());
|
31
|
+
|
32
|
+
return Qnil;
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
rg_cancelled_p(VALUE self)
|
37
|
+
{
|
38
|
+
return CBOOL2RVAL(g_cancellable_is_cancelled(_SELF(self)));
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
rg_raise_error_if_cancelled(VALUE self)
|
43
|
+
{
|
44
|
+
GError *error = NULL;
|
45
|
+
|
46
|
+
if (g_cancellable_set_error_if_cancelled(_SELF(self), &error))
|
47
|
+
rbgio_raise_error(error);
|
48
|
+
|
49
|
+
return self;
|
50
|
+
}
|
51
|
+
|
52
|
+
static VALUE
|
53
|
+
rg_fd(VALUE self)
|
54
|
+
{
|
55
|
+
return FD2RVAL(g_cancellable_get_fd(_SELF(self)));
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE
|
59
|
+
rg_make_pollfd(VALUE self)
|
60
|
+
{
|
61
|
+
GCancellable *cancellable = _SELF(self);
|
62
|
+
GPollFD *gfd = g_new(GPollFD, 1);
|
63
|
+
|
64
|
+
g_cancellable_make_pollfd(cancellable, gfd);
|
65
|
+
|
66
|
+
return GPOLLFD2RVAL(gfd);
|
67
|
+
}
|
68
|
+
|
69
|
+
G_GNUC_NORETURN static VALUE
|
70
|
+
rg_release_fd(VALUE self)
|
71
|
+
{
|
72
|
+
/* TODO: How do we implement this? Maybe not at all? */
|
73
|
+
self = self;
|
74
|
+
rb_raise(rb_eNotImpError, "release_fd has not been implemented yet");
|
75
|
+
#if 0
|
76
|
+
g_cancellable_release_fd(_SELF(self));
|
77
|
+
|
78
|
+
return self;
|
79
|
+
#endif
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
rg_s_current(G_GNUC_UNUSED VALUE self)
|
84
|
+
{
|
85
|
+
return GOBJ2RVAL(g_cancellable_get_current());
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
rg_pop_current(VALUE self)
|
90
|
+
{
|
91
|
+
g_cancellable_pop_current(_SELF(self));
|
92
|
+
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
rg_push_current(VALUE self)
|
98
|
+
{
|
99
|
+
g_cancellable_push_current(_SELF(self));
|
100
|
+
|
101
|
+
return self;
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
rg_reset(VALUE self)
|
106
|
+
{
|
107
|
+
g_cancellable_reset(_SELF(self));
|
108
|
+
|
109
|
+
return self;
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
cancellable_connect_callback_call(VALUE block)
|
114
|
+
{
|
115
|
+
static ID s_id_call;
|
116
|
+
|
117
|
+
if (s_id_call == 0)
|
118
|
+
s_id_call = rb_intern("call");
|
119
|
+
|
120
|
+
rb_funcall(block, s_id_call, 0);
|
121
|
+
|
122
|
+
return Qnil;
|
123
|
+
}
|
124
|
+
|
125
|
+
static void
|
126
|
+
cancellable_connect_callback(gpointer block)
|
127
|
+
{
|
128
|
+
G_PROTECT_CALLBACK(cancellable_connect_callback_call, block);
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE
|
132
|
+
rg_connect(VALUE self)
|
133
|
+
{
|
134
|
+
VALUE block;
|
135
|
+
|
136
|
+
block = rb_block_proc();
|
137
|
+
G_RELATIVE(self, block);
|
138
|
+
|
139
|
+
return GULONG2RVAL(g_cancellable_connect(_SELF(self),
|
140
|
+
G_CALLBACK(cancellable_connect_callback),
|
141
|
+
(gpointer)block,
|
142
|
+
NULL));
|
143
|
+
}
|
144
|
+
|
145
|
+
static VALUE
|
146
|
+
rg_disconnect(VALUE self, VALUE handler_id)
|
147
|
+
{
|
148
|
+
g_cancellable_disconnect(_SELF(self), RVAL2GULONG(handler_id));
|
149
|
+
|
150
|
+
return self;
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
rg_cancel(VALUE self)
|
155
|
+
{
|
156
|
+
g_cancellable_cancel(_SELF(self));
|
157
|
+
|
158
|
+
return self;
|
159
|
+
}
|
160
|
+
|
161
|
+
void
|
162
|
+
Init_gcancellable(VALUE mGio)
|
163
|
+
{
|
164
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CANCELLABLE, "Cancellable", mGio);
|
165
|
+
|
166
|
+
RG_DEF_SMETHOD(current, 0);
|
167
|
+
|
168
|
+
RG_DEF_METHOD(initialize, 0);
|
169
|
+
RG_DEF_METHOD_P(cancelled, 0);
|
170
|
+
RG_DEF_METHOD(raise_error_if_cancelled, 0);
|
171
|
+
RG_DEF_METHOD(fd, 0);
|
172
|
+
RG_DEF_METHOD(make_pollfd, 0);
|
173
|
+
RG_DEF_METHOD(release_fd, 0);
|
174
|
+
RG_DEF_METHOD(pop_current, 0);
|
175
|
+
RG_DEF_METHOD(push_current, 0);
|
176
|
+
RG_DEF_METHOD(reset, 0);
|
177
|
+
RG_DEF_METHOD(connect, 0);
|
178
|
+
RG_DEF_METHOD(disconnect, 1);
|
179
|
+
RG_DEF_METHOD(cancel, 0);
|
180
|
+
}
|
@@ -0,0 +1,57 @@
|
|
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 cCharsetConverter
|
25
|
+
#define _SELF(value) RVAL2GCHARSETCONVERTER(value)
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_initialize(VALUE self, VALUE to, VALUE from)
|
29
|
+
{
|
30
|
+
GError *error = NULL;
|
31
|
+
GCharsetConverter *converter;
|
32
|
+
|
33
|
+
converter = g_charset_converter_new(RVAL2CSTR(to),
|
34
|
+
RVAL2CSTR(from),
|
35
|
+
&error);
|
36
|
+
if (converter == NULL)
|
37
|
+
rbgio_raise_error(error);
|
38
|
+
|
39
|
+
G_INITIALIZE(self, converter);
|
40
|
+
|
41
|
+
return Qnil;
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
rg_num_fallbacks(VALUE self)
|
46
|
+
{
|
47
|
+
return GUINT2RVAL(g_charset_converter_get_num_fallbacks(_SELF(self)));
|
48
|
+
}
|
49
|
+
|
50
|
+
void
|
51
|
+
Init_gcharsetconverter(VALUE mGio)
|
52
|
+
{
|
53
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CHARSET_CONVERTER, "CharsetConverter", mGio);
|
54
|
+
|
55
|
+
RG_DEF_METHOD(initialize, 2);
|
56
|
+
RG_DEF_METHOD(num_fallbacks, 0);
|
57
|
+
}
|
@@ -0,0 +1,131 @@
|
|
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 mContentType
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_m_equals_p(G_GNUC_UNUSED VALUE self, VALUE arg1, VALUE arg2)
|
28
|
+
{
|
29
|
+
return CBOOL2RVAL(g_content_type_equals(RVAL2CSTR(arg1), RVAL2CSTR(arg2)));
|
30
|
+
}
|
31
|
+
|
32
|
+
static VALUE
|
33
|
+
rg_m_is_a_p(G_GNUC_UNUSED VALUE self, VALUE arg1, VALUE arg2)
|
34
|
+
{
|
35
|
+
return CBOOL2RVAL(g_content_type_is_a(RVAL2CSTR(arg1), RVAL2CSTR(arg2)));
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
rg_m_unknown_p(G_GNUC_UNUSED VALUE type)
|
40
|
+
{
|
41
|
+
return CBOOL2RVAL(g_content_type_is_unknown(RVAL2CSTR(type)));
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
rg_m_get_description(G_GNUC_UNUSED VALUE type)
|
46
|
+
{
|
47
|
+
return CSTR2RVAL_FREE(g_content_type_get_description(RVAL2CSTR(type)));
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rg_m_get_mime_type(G_GNUC_UNUSED VALUE type)
|
52
|
+
{
|
53
|
+
return CSTR2RVAL_FREE(g_content_type_get_mime_type(RVAL2CSTR(type)));
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_m_get_icon(G_GNUC_UNUSED VALUE type)
|
58
|
+
{
|
59
|
+
return GOBJ2RVAL_UNREF(g_content_type_get_icon(RVAL2CSTR(type)));
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
rg_m_can_be_executable_p(G_GNUC_UNUSED VALUE type)
|
64
|
+
{
|
65
|
+
return CBOOL2RVAL(g_content_type_can_be_executable(RVAL2CSTR(type)));
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
rg_m_from_mime_type(G_GNUC_UNUSED VALUE type)
|
70
|
+
{
|
71
|
+
return CSTR2RVAL(g_content_type_from_mime_type(RVAL2CSTR(type)));
|
72
|
+
}
|
73
|
+
|
74
|
+
static VALUE
|
75
|
+
rg_m_guess(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
76
|
+
{
|
77
|
+
VALUE rbfilename,
|
78
|
+
rbdata;
|
79
|
+
const char *filename;
|
80
|
+
const guchar *data;
|
81
|
+
gboolean result_uncertain;
|
82
|
+
char *type;
|
83
|
+
|
84
|
+
rb_scan_args(argc, argv, "02", &rbfilename, &rbdata);
|
85
|
+
|
86
|
+
if (NIL_P(rbfilename) && NIL_P(rbdata))
|
87
|
+
rb_raise(rb_eArgError,
|
88
|
+
"Either filename or data can be nil but not both");
|
89
|
+
|
90
|
+
filename = RVAL2CSTR_ACCEPT_NIL(rbfilename);
|
91
|
+
data = (guchar *)RVAL2CSTR_ACCEPT_NIL(rbdata);
|
92
|
+
|
93
|
+
type = g_content_type_guess(filename,
|
94
|
+
data,
|
95
|
+
(gsize)((data != NULL) ? RSTRING_LEN(rbdata) : 0),
|
96
|
+
&result_uncertain);
|
97
|
+
|
98
|
+
return rb_assoc_new(CSTR2RVAL_FREE(type), CBOOL2RVAL(result_uncertain));
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
rg_m_guess_for_tree(G_GNUC_UNUSED VALUE self, VALUE root)
|
103
|
+
{
|
104
|
+
return STRV2RVAL_FREE(g_content_type_guess_for_tree(RVAL2GFILE(root)));
|
105
|
+
}
|
106
|
+
|
107
|
+
static VALUE
|
108
|
+
rg_m_registered(G_GNUC_UNUSED VALUE self)
|
109
|
+
{
|
110
|
+
return GLIST2ARY_STR_FREE(g_content_types_get_registered());
|
111
|
+
}
|
112
|
+
|
113
|
+
void
|
114
|
+
Init_gcontenttype(VALUE mGio)
|
115
|
+
{
|
116
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "ContentType");
|
117
|
+
|
118
|
+
/* TODO: Should wrap this in a class. */
|
119
|
+
RG_DEF_MODFUNC_P(equals, 2);
|
120
|
+
/* TODO: This name isn't great. */
|
121
|
+
RG_DEF_MODFUNC_P(is_a, 2);
|
122
|
+
RG_DEF_MODFUNC_P(unknown, 1);
|
123
|
+
RG_DEF_MODFUNC(get_description, 1);
|
124
|
+
RG_DEF_MODFUNC(get_mime_type, 1);
|
125
|
+
RG_DEF_MODFUNC(get_icon, 1);
|
126
|
+
RG_DEF_MODFUNC_P(can_be_executable, 1);
|
127
|
+
RG_DEF_MODFUNC(from_mime_type, 1);
|
128
|
+
RG_DEF_MODFUNC(guess, -1);
|
129
|
+
RG_DEF_MODFUNC(guess_for_tree, 1);
|
130
|
+
RG_DEF_MODFUNC(registered, 0);
|
131
|
+
}
|
@@ -1,42 +1,38 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
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
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
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
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
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
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
23
|
-
#define
|
24
|
-
|
25
|
-
#define RVAL2GCONVERTERFLAGS(value) \
|
26
|
-
RVAL2GFLAGS((value), G_TYPE_CONVERTER_FLAGS)
|
24
|
+
#define RG_TARGET_NAMESPACE mConverter
|
25
|
+
#define _SELF(value) RVAL2GCONVERTER(value)
|
27
26
|
|
28
27
|
#define RVAL2GCONVERTERFLAGSDEFAULT(value) \
|
29
28
|
RVAL2TYPE_WITH_DEFAULT((value), \
|
30
29
|
RVAL2GCONVERTERFLAGS, \
|
31
30
|
G_CONVERTER_NO_FLAGS)
|
32
31
|
|
33
|
-
#define GCONVERTERRESULT2RVAL(value) \
|
34
|
-
GFLAGS2RVAL((value), G_TYPE_CONVERTER_RESULT)
|
35
|
-
|
36
32
|
/* TODO: Look at gconverteroutputstream for implementing this. */
|
37
33
|
/* TODO: Actually, is there any point in implementing this? */
|
38
34
|
static VALUE
|
39
|
-
|
35
|
+
rg_convert(int argc, VALUE *argv, VALUE self)
|
40
36
|
{
|
41
37
|
VALUE input, rbflags;
|
42
38
|
GConverter *converter;
|
@@ -100,7 +96,7 @@ converter_convert(int argc, VALUE *argv, VALUE self)
|
|
100
96
|
}
|
101
97
|
|
102
98
|
static VALUE
|
103
|
-
|
99
|
+
rg_reset(VALUE self)
|
104
100
|
{
|
105
101
|
g_converter_reset(_SELF(self));
|
106
102
|
|
@@ -108,10 +104,10 @@ converter_reset(VALUE self)
|
|
108
104
|
}
|
109
105
|
|
110
106
|
void
|
111
|
-
Init_gconverter(VALUE
|
107
|
+
Init_gconverter(VALUE mGio)
|
112
108
|
{
|
113
|
-
VALUE
|
109
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_CONVERTER, "Converter", mGio);
|
114
110
|
|
115
|
-
|
116
|
-
|
111
|
+
RG_DEF_METHOD(convert, -1);
|
112
|
+
RG_DEF_METHOD(reset, 0);
|
117
113
|
}
|
@@ -0,0 +1,43 @@
|
|
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 cConverterInputStream
|
25
|
+
#define _SELF(value) RVAL2GCONVERTERINPUTSTREAM(value)
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_initialize(VALUE self, VALUE base_stream, VALUE converter)
|
29
|
+
{
|
30
|
+
G_INITIALIZE(self,
|
31
|
+
g_converter_input_stream_new(RVAL2GINPUTSTREAM(base_stream),
|
32
|
+
RVAL2GCONVERTER(converter)));
|
33
|
+
|
34
|
+
return Qnil;
|
35
|
+
}
|
36
|
+
|
37
|
+
void
|
38
|
+
Init_gconverterinputstream(VALUE mGio)
|
39
|
+
{
|
40
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CONVERTER_INPUT_STREAM, "ConverterInputStream", mGio);
|
41
|
+
|
42
|
+
RG_DEF_METHOD(initialize, 2);
|
43
|
+
}
|