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,202 @@
|
|
|
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_DATA_OUTPUT_STREAM(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
static VALUE
|
|
26
|
+
dataoutputstream_initialize(int argc, VALUE *argv, VALUE self)
|
|
27
|
+
{
|
|
28
|
+
VALUE base_stream,
|
|
29
|
+
byte_order;
|
|
30
|
+
|
|
31
|
+
rb_scan_args(argc, argv, "11", &base_stream, &byte_order);
|
|
32
|
+
|
|
33
|
+
G_INITIALIZE(self, g_data_output_stream_new(RVAL2GOUTPUTSTREAM(base_stream)));
|
|
34
|
+
|
|
35
|
+
if (!NIL_P(byte_order))
|
|
36
|
+
g_data_output_stream_set_byte_order(_SELF(self),
|
|
37
|
+
RVAL2GDATASTREAMBYTEORDER(byte_order));
|
|
38
|
+
|
|
39
|
+
return Qnil;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static VALUE
|
|
43
|
+
dataoutputstream_get_byte_order(VALUE self)
|
|
44
|
+
{
|
|
45
|
+
return GDATASTREAMBYTEORDER2RVAL(g_data_output_stream_get_byte_order(_SELF(self)));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static VALUE
|
|
49
|
+
dataoutputstream_set_byte_order(VALUE self, VALUE value)
|
|
50
|
+
{
|
|
51
|
+
g_data_output_stream_set_byte_order(_SELF(self),
|
|
52
|
+
RVAL2GDATASTREAMBYTEORDER(value));
|
|
53
|
+
|
|
54
|
+
return self;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static VALUE
|
|
58
|
+
dataoutputstream_put_byte(int argc, VALUE *argv, VALUE self)
|
|
59
|
+
{
|
|
60
|
+
VALUE value, cancellable;
|
|
61
|
+
GError *error = NULL;
|
|
62
|
+
|
|
63
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
64
|
+
if (!g_data_output_stream_put_byte(_SELF(self),
|
|
65
|
+
RVAL2GUCHAR(value),
|
|
66
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
67
|
+
&error))
|
|
68
|
+
rbgio_raise_error(error);
|
|
69
|
+
|
|
70
|
+
return self;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static VALUE
|
|
74
|
+
dataoutputstream_put_int16(int argc, VALUE *argv, VALUE self)
|
|
75
|
+
{
|
|
76
|
+
VALUE value, cancellable;
|
|
77
|
+
GError *error = NULL;
|
|
78
|
+
|
|
79
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
80
|
+
if (!g_data_output_stream_put_int16(_SELF(self),
|
|
81
|
+
RVAL2GINT16(value),
|
|
82
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
83
|
+
&error))
|
|
84
|
+
rbgio_raise_error(error);
|
|
85
|
+
|
|
86
|
+
return self;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static VALUE
|
|
90
|
+
dataoutputstream_put_uint16(int argc, VALUE *argv, VALUE self)
|
|
91
|
+
{
|
|
92
|
+
VALUE value, cancellable;
|
|
93
|
+
GError *error = NULL;
|
|
94
|
+
|
|
95
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
96
|
+
if (!g_data_output_stream_put_uint16(_SELF(self),
|
|
97
|
+
RVAL2GUINT16(value),
|
|
98
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
99
|
+
&error))
|
|
100
|
+
rbgio_raise_error(error);
|
|
101
|
+
|
|
102
|
+
return self;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static VALUE
|
|
106
|
+
dataoutputstream_put_int32(int argc, VALUE *argv, VALUE self)
|
|
107
|
+
{
|
|
108
|
+
VALUE value, cancellable;
|
|
109
|
+
GError *error = NULL;
|
|
110
|
+
|
|
111
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
112
|
+
if (!g_data_output_stream_put_int32(_SELF(self),
|
|
113
|
+
RVAL2GINT32(value),
|
|
114
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
115
|
+
&error))
|
|
116
|
+
rbgio_raise_error(error);
|
|
117
|
+
|
|
118
|
+
return self;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static VALUE
|
|
122
|
+
dataoutputstream_put_uint32(int argc, VALUE *argv, VALUE self)
|
|
123
|
+
{
|
|
124
|
+
VALUE value, cancellable;
|
|
125
|
+
GError *error = NULL;
|
|
126
|
+
|
|
127
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
128
|
+
if (!g_data_output_stream_put_uint32(_SELF(self),
|
|
129
|
+
RVAL2GINT32(value),
|
|
130
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
131
|
+
&error))
|
|
132
|
+
rbgio_raise_error(error);
|
|
133
|
+
|
|
134
|
+
return self;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static VALUE
|
|
138
|
+
dataoutputstream_put_int64(int argc, VALUE *argv, VALUE self)
|
|
139
|
+
{
|
|
140
|
+
VALUE value, cancellable;
|
|
141
|
+
GError *error = NULL;
|
|
142
|
+
|
|
143
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
144
|
+
if (!g_data_output_stream_put_int64(_SELF(self),
|
|
145
|
+
RVAL2GINT64(value),
|
|
146
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
147
|
+
&error))
|
|
148
|
+
rbgio_raise_error(error);
|
|
149
|
+
|
|
150
|
+
return self;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static VALUE
|
|
154
|
+
dataoutputstream_put_uint64(int argc, VALUE *argv, VALUE self)
|
|
155
|
+
{
|
|
156
|
+
VALUE value, cancellable;
|
|
157
|
+
GError *error = NULL;
|
|
158
|
+
|
|
159
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
160
|
+
if (!g_data_output_stream_put_uint64(_SELF(self),
|
|
161
|
+
RVAL2GUINT64(value),
|
|
162
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
163
|
+
&error))
|
|
164
|
+
rbgio_raise_error(error);
|
|
165
|
+
|
|
166
|
+
return self;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static VALUE
|
|
170
|
+
dataoutputstream_put_string(int argc, VALUE *argv, VALUE self)
|
|
171
|
+
{
|
|
172
|
+
VALUE value, cancellable;
|
|
173
|
+
GError *error = NULL;
|
|
174
|
+
|
|
175
|
+
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
|
176
|
+
if (!g_data_output_stream_put_string(_SELF(self),
|
|
177
|
+
RVAL2CSTR(value),
|
|
178
|
+
RVAL2GCANCELLABLE(cancellable),
|
|
179
|
+
&error))
|
|
180
|
+
rbgio_raise_error(error);
|
|
181
|
+
|
|
182
|
+
return self;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
void
|
|
186
|
+
Init_gdataoutputstream(VALUE glib)
|
|
187
|
+
{
|
|
188
|
+
VALUE dataoutputstream = G_DEF_CLASS(G_TYPE_DATA_OUTPUT_STREAM, "DataOutputStream", glib);
|
|
189
|
+
|
|
190
|
+
rb_define_method(dataoutputstream, "initialize", dataoutputstream_initialize, -1);
|
|
191
|
+
rb_define_method(dataoutputstream, "byte_order", dataoutputstream_get_byte_order, 0);
|
|
192
|
+
rb_define_method(dataoutputstream, "set_byte_order", dataoutputstream_set_byte_order, 1);
|
|
193
|
+
G_DEF_SETTER(dataoutputstream, "byte_order");
|
|
194
|
+
rb_define_method(dataoutputstream, "put_byte", dataoutputstream_put_byte, -1);
|
|
195
|
+
rb_define_method(dataoutputstream, "put_int16", dataoutputstream_put_int16, -1);
|
|
196
|
+
rb_define_method(dataoutputstream, "put_uint16", dataoutputstream_put_uint16, -1);
|
|
197
|
+
rb_define_method(dataoutputstream, "put_int32", dataoutputstream_put_int32, -1);
|
|
198
|
+
rb_define_method(dataoutputstream, "put_uint32", dataoutputstream_put_uint32, -1);
|
|
199
|
+
rb_define_method(dataoutputstream, "put_int64", dataoutputstream_put_int64, -1);
|
|
200
|
+
rb_define_method(dataoutputstream, "put_uint64", dataoutputstream_put_uint64, -1);
|
|
201
|
+
rb_define_method(dataoutputstream, "put_string", dataoutputstream_put_string, -1);
|
|
202
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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/gdesktopappinfo.h>
|
|
25
|
+
|
|
26
|
+
#define _SELF(value) G_DESKTOP_APP_INFO(RVAL2GOBJ(value))
|
|
27
|
+
|
|
28
|
+
#define RVAL2GKEYFILE(value) \
|
|
29
|
+
((GKeyFile *)(RVAL2BOXED((value), G_TYPE_KEY_FILE)))
|
|
30
|
+
|
|
31
|
+
static VALUE
|
|
32
|
+
desktopappinfo_new_from_filename(G_GNUC_UNUSED VALUE self, VALUE filename)
|
|
33
|
+
{
|
|
34
|
+
return GOBJ2RVAL_UNREF(g_desktop_app_info_new_from_filename(RVAL2CSTR(filename)));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static VALUE
|
|
38
|
+
desktopappinfo_new_from_keyfile(G_GNUC_UNUSED VALUE self, VALUE keyfile)
|
|
39
|
+
{
|
|
40
|
+
return GOBJ2RVAL_UNREF(g_desktop_app_info_new_from_keyfile(RVAL2GKEYFILE(keyfile)));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static VALUE
|
|
44
|
+
desktopappinfo_initialize(VALUE self, VALUE desktop_id)
|
|
45
|
+
{
|
|
46
|
+
G_INITIALIZE(self, g_desktop_app_info_new(RVAL2CSTR(desktop_id)));
|
|
47
|
+
|
|
48
|
+
return Qnil;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static VALUE
|
|
52
|
+
desktopappinfo_get_filename(VALUE self)
|
|
53
|
+
{
|
|
54
|
+
return CSTR2RVAL(g_desktop_app_info_get_filename(_SELF(self)));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static VALUE
|
|
58
|
+
desktopappinfo_get_is_hidden(VALUE self)
|
|
59
|
+
{
|
|
60
|
+
return CBOOL2RVAL(g_desktop_app_info_get_is_hidden(_SELF(self)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static VALUE
|
|
64
|
+
desktopappinfo_set_desktop_env(G_GNUC_UNUSED VALUE self, VALUE desktop_env)
|
|
65
|
+
{
|
|
66
|
+
g_desktop_app_info_set_desktop_env(RVAL2CSTR(desktop_env));
|
|
67
|
+
|
|
68
|
+
return self;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* TODO: g_desktop_app_info_lookup_get_default_for_uri_scheme ()? */
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
void
|
|
75
|
+
Init_gdesktopappinfo(G_GNUC_UNUSED VALUE glib)
|
|
76
|
+
{
|
|
77
|
+
#ifdef HAVE_GIO_UNIX
|
|
78
|
+
VALUE desktopappinfo = G_DEF_CLASS(G_TYPE_DESKTOP_APP_INFO, "DesktopAppInfo", glib);
|
|
79
|
+
|
|
80
|
+
rb_define_const(desktopappinfo, "LOOKUP_EXTENSION_POINT_NAME", CSTR2RVAL(G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME));
|
|
81
|
+
|
|
82
|
+
rb_define_singleton_method(desktopappinfo, "new_from_filename", desktopappinfo_new_from_filename, 1);
|
|
83
|
+
rb_define_singleton_method(desktopappinfo, "new_from_keyfile", desktopappinfo_new_from_keyfile, 1);
|
|
84
|
+
rb_define_singleton_method(desktopappinfo, "set_desktop_env", desktopappinfo_set_desktop_env, 1);
|
|
85
|
+
|
|
86
|
+
rb_define_method(desktopappinfo, "initialize", desktopappinfo_initialize, 1);
|
|
87
|
+
rb_define_method(desktopappinfo, "filename", desktopappinfo_get_filename, 0);
|
|
88
|
+
rb_define_method(desktopappinfo, "hidden?", desktopappinfo_get_is_hidden, 0);
|
|
89
|
+
#endif
|
|
90
|
+
}
|
data/ext/gio2/gdrive.c
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
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_DRIVE(RVAL2GOBJ(value))
|
|
24
|
+
|
|
25
|
+
#define GDRIVESTARTSTOPTYPE2RVAL(value) \
|
|
26
|
+
GENUM2RVAL((value), G_TYPE_DRIVE_START_STOP_TYPE)
|
|
27
|
+
|
|
28
|
+
static VALUE
|
|
29
|
+
drive_get_name(VALUE self)
|
|
30
|
+
{
|
|
31
|
+
return CSTR2RVAL_FREE(g_drive_get_name(_SELF(self)));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static VALUE
|
|
35
|
+
drive_get_icon(VALUE self)
|
|
36
|
+
{
|
|
37
|
+
return GOBJ2RVAL_UNREF(g_drive_get_icon(_SELF(self)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static VALUE
|
|
41
|
+
drive_has_volumes(VALUE self)
|
|
42
|
+
{
|
|
43
|
+
return CBOOL2RVAL(g_drive_has_volumes(_SELF(self)));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static VALUE
|
|
47
|
+
drive_get_volumes(VALUE self)
|
|
48
|
+
{
|
|
49
|
+
return GLIST2ARY_FREE(g_drive_get_volumes(_SELF(self)));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static VALUE
|
|
53
|
+
drive_can_eject(VALUE self)
|
|
54
|
+
{
|
|
55
|
+
return CBOOL2RVAL(g_drive_can_eject(_SELF(self)));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static VALUE
|
|
59
|
+
drive_get_start_stop_type(VALUE self)
|
|
60
|
+
{
|
|
61
|
+
return GDRIVESTARTSTOPTYPE2RVAL(g_drive_get_start_stop_type(_SELF(self)));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static VALUE
|
|
65
|
+
drive_can_start(VALUE self)
|
|
66
|
+
{
|
|
67
|
+
return CBOOL2RVAL(g_drive_can_start(_SELF(self)));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static VALUE
|
|
71
|
+
drive_can_start_degraded(VALUE self)
|
|
72
|
+
{
|
|
73
|
+
return CBOOL2RVAL(g_drive_can_start_degraded(_SELF(self)));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static VALUE
|
|
77
|
+
drive_can_stop(VALUE self)
|
|
78
|
+
{
|
|
79
|
+
return CBOOL2RVAL(g_drive_can_stop(_SELF(self)));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static VALUE
|
|
83
|
+
drive_can_poll_for_media(VALUE self)
|
|
84
|
+
{
|
|
85
|
+
return CBOOL2RVAL(g_drive_can_poll_for_media(_SELF(self)));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static VALUE
|
|
89
|
+
drive_poll_for_media(int argc, VALUE *argv, VALUE self)
|
|
90
|
+
{
|
|
91
|
+
VALUE rbcancellable, block;
|
|
92
|
+
GCancellable *cancellable;
|
|
93
|
+
|
|
94
|
+
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
|
95
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
96
|
+
g_drive_poll_for_media(_SELF(self),
|
|
97
|
+
cancellable,
|
|
98
|
+
rbgio_async_ready_callback,
|
|
99
|
+
(gpointer)block);
|
|
100
|
+
|
|
101
|
+
return self;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
typedef gboolean (*BooleanFinishMethod)(GDrive *, GAsyncResult *, GError **);
|
|
105
|
+
|
|
106
|
+
static VALUE
|
|
107
|
+
boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
|
|
108
|
+
{
|
|
109
|
+
GError *error = NULL;
|
|
110
|
+
|
|
111
|
+
if (!method(_SELF(self), RVAL2GASYNCRESULT(result), &error))
|
|
112
|
+
rbgio_raise_error(error);
|
|
113
|
+
|
|
114
|
+
return self;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static VALUE
|
|
118
|
+
drive_poll_for_media_finish(VALUE self, VALUE result)
|
|
119
|
+
{
|
|
120
|
+
return boolean_finish_method(g_drive_poll_for_media_finish, self, result);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static VALUE
|
|
124
|
+
drive_has_media(VALUE self)
|
|
125
|
+
{
|
|
126
|
+
return CBOOL2RVAL(g_drive_has_media(_SELF(self)));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static VALUE
|
|
130
|
+
drive_is_media_check_automatic(VALUE self)
|
|
131
|
+
{
|
|
132
|
+
return CBOOL2RVAL(g_drive_is_media_check_automatic(_SELF(self)));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static VALUE
|
|
136
|
+
drive_is_media_removable(VALUE self)
|
|
137
|
+
{
|
|
138
|
+
return CBOOL2RVAL(g_drive_is_media_removable(_SELF(self)));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
typedef void (*EjectStopMethod)(GDrive *,
|
|
142
|
+
GMountUnmountFlags,
|
|
143
|
+
GMountOperation *,
|
|
144
|
+
GCancellable *,
|
|
145
|
+
GAsyncReadyCallback,
|
|
146
|
+
gpointer);
|
|
147
|
+
|
|
148
|
+
static VALUE
|
|
149
|
+
eject_stop_method(EjectStopMethod method, int argc, VALUE *argv, VALUE self)
|
|
150
|
+
{
|
|
151
|
+
VALUE rbflags, rbmount_operation, rbcancellable, block;
|
|
152
|
+
GMountUnmountFlags flags;
|
|
153
|
+
GMountOperation *mount_operation;
|
|
154
|
+
GCancellable *cancellable;
|
|
155
|
+
|
|
156
|
+
rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
|
|
157
|
+
flags = RVAL2GMOUNTUNMOUNTFLAGSDEFAULT(rbflags);
|
|
158
|
+
mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
|
|
159
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
160
|
+
SAVE_BLOCK(block);
|
|
161
|
+
method(_SELF(self),
|
|
162
|
+
flags,
|
|
163
|
+
mount_operation,
|
|
164
|
+
cancellable,
|
|
165
|
+
rbgio_async_ready_callback,
|
|
166
|
+
(gpointer)block);
|
|
167
|
+
|
|
168
|
+
return self;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static VALUE
|
|
172
|
+
drive_eject_with_operation(int argc, VALUE *argv, VALUE self)
|
|
173
|
+
{
|
|
174
|
+
return eject_stop_method(g_drive_eject_with_operation, argc, argv, self);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static VALUE
|
|
178
|
+
drive_eject_with_operation_finish(VALUE self, VALUE result)
|
|
179
|
+
{
|
|
180
|
+
return boolean_finish_method(g_drive_eject_with_operation_finish, self, result);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static VALUE
|
|
184
|
+
drive_start(int argc, VALUE *argv, VALUE self)
|
|
185
|
+
{
|
|
186
|
+
VALUE rbflags, rbmount_operation, rbcancellable, block;
|
|
187
|
+
GDriveStartFlags flags;
|
|
188
|
+
GMountOperation *mount_operation;
|
|
189
|
+
GCancellable *cancellable;
|
|
190
|
+
|
|
191
|
+
rb_scan_args(argc, argv, "03", &rbflags, &rbmount_operation, &rbcancellable, &block);
|
|
192
|
+
flags = RVAL2GDRIVESTARTFLAGSDEFAULT(rbflags);
|
|
193
|
+
mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
|
|
194
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
|
195
|
+
SAVE_BLOCK(block);
|
|
196
|
+
g_drive_start(_SELF(self), flags, mount_operation, cancellable,
|
|
197
|
+
rbgio_async_ready_callback, (gpointer)block);
|
|
198
|
+
|
|
199
|
+
return self;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
static VALUE
|
|
203
|
+
drive_start_finish(VALUE self, VALUE result)
|
|
204
|
+
{
|
|
205
|
+
return boolean_finish_method(g_drive_start_finish, self, result);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static VALUE
|
|
209
|
+
drive_stop(int argc, VALUE *argv, VALUE self)
|
|
210
|
+
{
|
|
211
|
+
return eject_stop_method(g_drive_stop, argc, argv, self);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static VALUE
|
|
215
|
+
drive_stop_finish(VALUE self, VALUE result)
|
|
216
|
+
{
|
|
217
|
+
return boolean_finish_method(g_drive_stop_finish, self, result);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
static VALUE
|
|
221
|
+
drive_enumerate_identifiers(VALUE self)
|
|
222
|
+
{
|
|
223
|
+
return STRVECTOR2ARY_FREE(g_drive_enumerate_identifiers(_SELF(self)));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static VALUE
|
|
227
|
+
drive_get_identifier(VALUE self, VALUE kind)
|
|
228
|
+
{
|
|
229
|
+
return CSTR2RVAL_FREE(g_drive_get_identifier(_SELF(self), RVAL2CSTR(kind)));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
void
|
|
233
|
+
Init_gdrive(VALUE glib)
|
|
234
|
+
{
|
|
235
|
+
VALUE drive = G_DEF_INTERFACE(G_TYPE_DRIVE, "Drive", glib);
|
|
236
|
+
|
|
237
|
+
G_DEF_CLASS(G_TYPE_DRIVE_START_FLAGS, "StartFlags", drive);
|
|
238
|
+
G_DEF_CONSTANTS(drive, G_TYPE_DRIVE_START_FLAGS, "G_DRIVE_");
|
|
239
|
+
|
|
240
|
+
G_DEF_CLASS(G_TYPE_DRIVE_START_STOP_TYPE, "StartStopType", drive);
|
|
241
|
+
G_DEF_CONSTANTS(drive, G_TYPE_DRIVE_START_STOP_TYPE, "G_DRIVE_");
|
|
242
|
+
|
|
243
|
+
rb_define_method(drive, "name", drive_get_name, 0);
|
|
244
|
+
rb_define_method(drive, "icon", drive_get_icon, 0);
|
|
245
|
+
rb_define_method(drive, "has_volumes?", drive_has_volumes, 0);
|
|
246
|
+
rb_define_method(drive, "volumes", drive_get_volumes, 0);
|
|
247
|
+
rb_define_method(drive, "can_eject?", drive_can_eject, 0);
|
|
248
|
+
rb_define_method(drive, "start_stop_type", drive_get_start_stop_type, 0);
|
|
249
|
+
rb_define_method(drive, "can_start?", drive_can_start, 0);
|
|
250
|
+
rb_define_method(drive, "can_start_degraded?", drive_can_start_degraded, 0);
|
|
251
|
+
rb_define_method(drive, "can_stop?", drive_can_stop, 0);
|
|
252
|
+
rb_define_method(drive, "can_poll_for_media?", drive_can_poll_for_media, 0);
|
|
253
|
+
rb_define_method(drive, "poll_for_media", drive_poll_for_media, -1);
|
|
254
|
+
rb_define_method(drive, "poll_for_media_finish", drive_poll_for_media_finish, 1);
|
|
255
|
+
rb_define_method(drive, "has_media?", drive_has_media, 0);
|
|
256
|
+
rb_define_method(drive, "media_check_automatic?", drive_is_media_check_automatic, 0);
|
|
257
|
+
rb_define_method(drive, "media_removable?", drive_is_media_removable, 0);
|
|
258
|
+
rb_define_method(drive, "eject_with_operation", drive_eject_with_operation, -1);
|
|
259
|
+
rb_define_method(drive, "eject_with_operation_finish", drive_eject_with_operation_finish, 1);
|
|
260
|
+
rb_define_method(drive, "start", drive_start, -1);
|
|
261
|
+
rb_define_method(drive, "start_finish", drive_start_finish, 1);
|
|
262
|
+
rb_define_method(drive, "stop", drive_stop, -1);
|
|
263
|
+
rb_define_method(drive, "stop_finish", drive_stop_finish, 1);
|
|
264
|
+
rb_define_method(drive, "enumerate_identifiers", drive_enumerate_identifiers, -1);
|
|
265
|
+
rb_define_alias(drive, "identifiers", "enumerate_identifiers");
|
|
266
|
+
rb_define_method(drive, "get_identifier", drive_get_identifier, 1);
|
|
267
|
+
}
|