gio2 0.90.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +60 -0
- data/README +34 -0
- data/Rakefile +76 -0
- data/ext/gio2/depend +5 -0
- data/ext/gio2/extconf.rb +91 -0
- data/ext/gio2/gappinfo.c +318 -0
- data/ext/gio2/gapplaunchcontext.c +79 -0
- data/ext/gio2/gasyncinitable.c +244 -0
- data/ext/gio2/gasyncresult.c +39 -0
- data/ext/gio2/gbufferedinputstream.c +184 -0
- data/ext/gio2/gbufferedoutputstream.c +82 -0
- data/ext/gio2/gcancellable.c +177 -0
- data/ext/gio2/gcharsetconverter.c +72 -0
- data/ext/gio2/gcontenttype.c +135 -0
- data/ext/gio2/gconverter.c +117 -0
- data/ext/gio2/gconverterinputstream.c +48 -0
- data/ext/gio2/gconverteroutputstream.c +48 -0
- data/ext/gio2/gdatainputstream.c +341 -0
- data/ext/gio2/gdataoutputstream.c +202 -0
- data/ext/gio2/gdesktopappinfo.c +90 -0
- data/ext/gio2/gdrive.c +267 -0
- data/ext/gio2/gemblem.c +71 -0
- data/ext/gio2/gemblemedicon.c +63 -0
- data/ext/gio2/gfile.c +2058 -0
- data/ext/gio2/gfileattribute.c +263 -0
- data/ext/gio2/gfileattributematcher.c +90 -0
- data/ext/gio2/gfiledescriptorbased.c +42 -0
- data/ext/gio2/gfileenumerator.c +167 -0
- data/ext/gio2/gfileicon.c +46 -0
- data/ext/gio2/gfileinfo.c +641 -0
- data/ext/gio2/gfileinputstream.c +92 -0
- data/ext/gio2/gfileiostream.c +98 -0
- data/ext/gio2/gfilemonitor.c +63 -0
- data/ext/gio2/gfilenamecompleter.c +72 -0
- data/ext/gio2/gfileoutputstream.c +100 -0
- data/ext/gio2/gfilterinputstream.c +56 -0
- data/ext/gio2/gfilteroutputstream.c +56 -0
- data/ext/gio2/gicon.c +69 -0
- data/ext/gio2/ginetaddress.c +188 -0
- data/ext/gio2/ginetsocketaddress.c +54 -0
- data/ext/gio2/ginitable.c +195 -0
- data/ext/gio2/ginputstream.c +341 -0
- data/ext/gio2/gio2.c +120 -0
- data/ext/gio2/gio2.def +2 -0
- data/ext/gio2/gio2.h +343 -0
- data/ext/gio2/gioerror.c +67 -0
- data/ext/gio2/giomodule.c +63 -0
- data/ext/gio2/gioscheduler.c +195 -0
- data/ext/gio2/giostream.c +129 -0
- data/ext/gio2/gloadableicon.c +91 -0
- data/ext/gio2/gmemoryinputstream.c +65 -0
- data/ext/gio2/gmemoryoutputstream.c +65 -0
- data/ext/gio2/gmount.c +283 -0
- data/ext/gio2/gmountoperation.c +168 -0
- data/ext/gio2/gnetworkaddress.c +71 -0
- data/ext/gio2/gnetworkservice.c +64 -0
- data/ext/gio2/goutputstream.c +343 -0
- data/ext/gio2/gresolver.c +230 -0
- data/ext/gio2/gseekable.c +89 -0
- data/ext/gio2/gsimpleasyncresult.c +153 -0
- data/ext/gio2/gsocket.c +451 -0
- data/ext/gio2/gsocketaddress.c +45 -0
- data/ext/gio2/gsocketclient.c +273 -0
- data/ext/gio2/gsocketconnectable.c +97 -0
- data/ext/gio2/gsocketconnection.c +82 -0
- data/ext/gio2/gsocketcontrolmessage.c +82 -0
- data/ext/gio2/gsocketlistener.c +239 -0
- data/ext/gio2/gsocketservice.c +64 -0
- data/ext/gio2/gsrvtarget.c +77 -0
- data/ext/gio2/gtcpconnection.c +48 -0
- data/ext/gio2/gthemedicon.c +86 -0
- data/ext/gio2/gthreadedsocketservice.c +39 -0
- data/ext/gio2/gunixconnection.c +69 -0
- data/ext/gio2/gunixfdlist.c +112 -0
- data/ext/gio2/gunixfdmessage.c +81 -0
- data/ext/gio2/gunixinputstream.c +73 -0
- data/ext/gio2/gunixmounts.c +346 -0
- data/ext/gio2/gunixoutputstream.c +73 -0
- data/ext/gio2/gunixsocketaddress.c +79 -0
- data/ext/gio2/gvfs.c +84 -0
- data/ext/gio2/gvolume.c +191 -0
- data/ext/gio2/gvolumemonitor.c +77 -0
- data/ext/gio2/gzlibcompressor.c +47 -0
- data/ext/gio2/gzlibdecompressor.c +43 -0
- data/ext/gio2/util.c +323 -0
- data/extconf.rb +49 -0
- data/lib/gio2.rb +141 -0
- metadata +184 -0
@@ -0,0 +1,46 @@
|
|
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_FILE_ICON(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
fileicon_initialize(VALUE self, VALUE file)
|
27
|
+
{
|
28
|
+
G_INITIALIZE(self, g_file_icon_new(RVAL2GFILE(file)));
|
29
|
+
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
fileicon_get_file(VALUE self)
|
35
|
+
{
|
36
|
+
return GOBJ2RVAL(g_file_icon_get_file(_SELF(self)));
|
37
|
+
}
|
38
|
+
|
39
|
+
void
|
40
|
+
Init_gfileicon(VALUE glib)
|
41
|
+
{
|
42
|
+
VALUE fileicon = G_DEF_CLASS(G_TYPE_FILE_ICON, "FileIcon", glib);
|
43
|
+
|
44
|
+
rb_define_method(fileicon, "initialize", fileicon_initialize, 1);
|
45
|
+
rb_define_method(fileicon, "file", fileicon_get_file, 0);
|
46
|
+
}
|
@@ -0,0 +1,641 @@
|
|
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) RVAL2GFILEINFO(value)
|
24
|
+
|
25
|
+
#define GFILEATTRIBUTESTATUS2RVAL(value) \
|
26
|
+
GENUM2RVAL((value), G_TYPE_FILE_ATTRIBUTE_STATUS)
|
27
|
+
|
28
|
+
#define RVAL2GFILEATTRIBUTESTATUS(value) \
|
29
|
+
GENUM2RVAL((value), G_TYPE_FILE_ATTRIBUTE_STATUS)
|
30
|
+
|
31
|
+
#define RVAL2FILEINFONAMESPACEDEFAULT(value) \
|
32
|
+
RVAL2TYPE_WITH_DEFAULT((value), RVAL2CSTR, "*")
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
fileinfo_initialize(VALUE self)
|
36
|
+
{
|
37
|
+
G_INITIALIZE(self, g_file_info_new());
|
38
|
+
|
39
|
+
return Qnil;
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE
|
43
|
+
fileinfo_dup(VALUE self)
|
44
|
+
{
|
45
|
+
return GOBJ2RVAL_UNREF(g_file_info_dup(_SELF(self)));
|
46
|
+
}
|
47
|
+
|
48
|
+
/* TODO: Does this make sense from the Ruby side? */
|
49
|
+
static VALUE
|
50
|
+
fileinfo_copy_into(VALUE self, VALUE other)
|
51
|
+
{
|
52
|
+
g_file_info_copy_into(_SELF(self), _SELF(other));
|
53
|
+
|
54
|
+
return self;
|
55
|
+
}
|
56
|
+
|
57
|
+
static VALUE
|
58
|
+
fileinfo_has_attribute(VALUE self, VALUE attribute)
|
59
|
+
{
|
60
|
+
return CBOOL2RVAL(g_file_info_has_attribute(_SELF(self), RVAL2CSTR(attribute)));
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
fileinfo_has_namespace(VALUE self, VALUE namespace)
|
65
|
+
{
|
66
|
+
return CBOOL2RVAL(g_file_info_has_namespace(_SELF(self), RVAL2CSTR(namespace)));
|
67
|
+
}
|
68
|
+
|
69
|
+
static VALUE
|
70
|
+
fileinfo_set_attribute_status(VALUE self, VALUE attribute, VALUE status)
|
71
|
+
{
|
72
|
+
return CBOOL2RVAL(g_file_info_set_attribute_status(_SELF(self),
|
73
|
+
RVAL2CSTR(attribute),
|
74
|
+
RVAL2GFILEATTRIBUTESTATUS(status)));
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE
|
78
|
+
fileinfo_list_attributes(int argc, VALUE *argv, VALUE self)
|
79
|
+
{
|
80
|
+
VALUE name_space;
|
81
|
+
|
82
|
+
rb_scan_args(argc, argv, "01", &name_space);
|
83
|
+
|
84
|
+
return STRVECTOR2ARY_FREE(g_file_info_list_attributes(_SELF(self),
|
85
|
+
RVAL2FILEINFONAMESPACEDEFAULT(name_space)));
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
fileinfo_get_attribute_type(VALUE self, VALUE attribute)
|
90
|
+
{
|
91
|
+
return GFILEATTRIBUTETYPE2RVAL(g_file_info_get_attribute_type(_SELF(self), RVAL2CSTR(attribute)));
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
fileinfo_remove_attribute(VALUE self, VALUE attribute)
|
96
|
+
{
|
97
|
+
g_file_info_remove_attribute(_SELF(self), RVAL2CSTR(attribute));
|
98
|
+
|
99
|
+
return self;
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE
|
103
|
+
fileinfo_get_attribute_as_string(VALUE self, VALUE attribute)
|
104
|
+
{
|
105
|
+
return CSTR2RVAL_FREE(g_file_info_get_attribute_as_string(_SELF(self), RVAL2CSTR(attribute)));
|
106
|
+
}
|
107
|
+
|
108
|
+
static VALUE
|
109
|
+
file_attribute_to_value(GFileAttributeType type, gpointer value)
|
110
|
+
{
|
111
|
+
switch (type) {
|
112
|
+
case G_FILE_ATTRIBUTE_TYPE_STRING:
|
113
|
+
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
|
114
|
+
return CSTR2RVAL(value);
|
115
|
+
case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
|
116
|
+
return CBOOL2RVAL(*(gboolean *)value);
|
117
|
+
case G_FILE_ATTRIBUTE_TYPE_UINT32:
|
118
|
+
return GUINT322RVAL(*(guint32 *)value);
|
119
|
+
case G_FILE_ATTRIBUTE_TYPE_INT32:
|
120
|
+
return GINT322RVAL(*(gint32 *)value);
|
121
|
+
case G_FILE_ATTRIBUTE_TYPE_UINT64:
|
122
|
+
return GUINT642RVAL(*(guint64 *)value);
|
123
|
+
case G_FILE_ATTRIBUTE_TYPE_INT64:
|
124
|
+
return GINT642RVAL(*(gint64 *)value);
|
125
|
+
case G_FILE_ATTRIBUTE_TYPE_OBJECT:
|
126
|
+
return GOBJ2RVAL((GObject *)value);
|
127
|
+
case G_FILE_ATTRIBUTE_TYPE_STRINGV:
|
128
|
+
return STRVECTOR2ARY_FREE((char **)value);
|
129
|
+
case G_FILE_ATTRIBUTE_TYPE_INVALID:
|
130
|
+
rb_raise(rb_eArgError, "invalid file attribute type");
|
131
|
+
break;
|
132
|
+
default:
|
133
|
+
rb_raise(rb_eArgError, "unknown file attribute type");
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE
|
139
|
+
fileinfo_get_attribute_data(VALUE self, VALUE attribute)
|
140
|
+
{
|
141
|
+
GFileAttributeType type;
|
142
|
+
gpointer value;
|
143
|
+
GFileAttributeStatus status;
|
144
|
+
|
145
|
+
if (!g_file_info_get_attribute_data(_SELF(self),
|
146
|
+
RVAL2CSTR(attribute),
|
147
|
+
&type,
|
148
|
+
&value,
|
149
|
+
&status))
|
150
|
+
return Qnil;
|
151
|
+
|
152
|
+
return rb_ary_new3(3,
|
153
|
+
GFILEATTRIBUTETYPE2RVAL(type),
|
154
|
+
file_attribute_to_value(type, value),
|
155
|
+
GFILEATTRIBUTESTATUS2RVAL(status));
|
156
|
+
}
|
157
|
+
|
158
|
+
static VALUE
|
159
|
+
fileinfo_get_attribute_status(VALUE self, VALUE attribute)
|
160
|
+
{
|
161
|
+
return GFILEATTRIBUTESTATUS2RVAL(g_file_info_get_attribute_status(_SELF(self),
|
162
|
+
RVAL2CSTR(attribute)));
|
163
|
+
}
|
164
|
+
|
165
|
+
static VALUE
|
166
|
+
fileinfo_get_attribute_string(VALUE self, VALUE attribute)
|
167
|
+
{
|
168
|
+
return CSTR2RVAL(g_file_info_get_attribute_string(_SELF(self),
|
169
|
+
RVAL2CSTR(attribute)));
|
170
|
+
}
|
171
|
+
|
172
|
+
static VALUE
|
173
|
+
fileinfo_get_attribute_stringv(VALUE self, VALUE attribute)
|
174
|
+
{
|
175
|
+
return STRVECTOR2ARY_FREE(g_file_info_get_attribute_stringv(_SELF(self),
|
176
|
+
RVAL2CSTR(attribute)));
|
177
|
+
}
|
178
|
+
|
179
|
+
static VALUE
|
180
|
+
fileinfo_get_attribute_byte_string(VALUE self, VALUE attribute)
|
181
|
+
{
|
182
|
+
return CSTR2RVAL(g_file_info_get_attribute_byte_string(_SELF(self),
|
183
|
+
RVAL2CSTR(attribute)));
|
184
|
+
}
|
185
|
+
|
186
|
+
static VALUE
|
187
|
+
fileinfo_get_attribute_boolean(VALUE self, VALUE attribute)
|
188
|
+
{
|
189
|
+
return CBOOL2RVAL(g_file_info_get_attribute_boolean(_SELF(self),
|
190
|
+
RVAL2CSTR(attribute)));
|
191
|
+
}
|
192
|
+
|
193
|
+
static VALUE
|
194
|
+
fileinfo_get_attribute_uint32(VALUE self, VALUE attribute)
|
195
|
+
{
|
196
|
+
return GUINT322RVAL(g_file_info_get_attribute_uint32(_SELF(self),
|
197
|
+
RVAL2CSTR(attribute)));
|
198
|
+
}
|
199
|
+
|
200
|
+
static VALUE
|
201
|
+
fileinfo_get_attribute_int32(VALUE self, VALUE attribute)
|
202
|
+
{
|
203
|
+
return GINT322RVAL(g_file_info_get_attribute_int32(_SELF(self),
|
204
|
+
RVAL2CSTR(attribute)));
|
205
|
+
}
|
206
|
+
|
207
|
+
static VALUE
|
208
|
+
fileinfo_get_attribute_uint64(VALUE self, VALUE attribute)
|
209
|
+
{
|
210
|
+
return GUINT642RVAL(g_file_info_get_attribute_uint64(_SELF(self),
|
211
|
+
RVAL2CSTR(attribute)));
|
212
|
+
}
|
213
|
+
|
214
|
+
static VALUE
|
215
|
+
fileinfo_get_attribute_int64(VALUE self, VALUE attribute)
|
216
|
+
{
|
217
|
+
return GINT642RVAL(g_file_info_get_attribute_int64(_SELF(self),
|
218
|
+
RVAL2CSTR(attribute)));
|
219
|
+
}
|
220
|
+
|
221
|
+
static VALUE
|
222
|
+
fileinfo_get_attribute_object(VALUE self, VALUE attribute)
|
223
|
+
{
|
224
|
+
return GOBJ2RVAL(g_file_info_get_attribute_object(_SELF(self),
|
225
|
+
RVAL2CSTR(attribute)));
|
226
|
+
}
|
227
|
+
|
228
|
+
static VALUE
|
229
|
+
fileinfo_get_attribute_value(VALUE self, VALUE attribute)
|
230
|
+
{
|
231
|
+
GFileAttributeType type;
|
232
|
+
gpointer value;
|
233
|
+
GFileAttributeStatus status;
|
234
|
+
|
235
|
+
if (!g_file_info_get_attribute_data(_SELF(self),
|
236
|
+
RVAL2CSTR(attribute),
|
237
|
+
&type,
|
238
|
+
&value,
|
239
|
+
&status))
|
240
|
+
return Qnil;
|
241
|
+
|
242
|
+
return file_attribute_to_value(type, value);
|
243
|
+
}
|
244
|
+
|
245
|
+
/* TODO: Do we need set_attribute? */
|
246
|
+
|
247
|
+
static VALUE
|
248
|
+
fileinfo_set_attribute_string(VALUE self, VALUE attribute, VALUE value)
|
249
|
+
{
|
250
|
+
g_file_info_set_attribute_string(_SELF(self),
|
251
|
+
RVAL2CSTR(attribute),
|
252
|
+
RVAL2CSTR(value));
|
253
|
+
|
254
|
+
return self;
|
255
|
+
}
|
256
|
+
|
257
|
+
static VALUE
|
258
|
+
fileinfo_set_attribute_byte_string(VALUE self, VALUE attribute, VALUE value)
|
259
|
+
{
|
260
|
+
g_file_info_set_attribute_byte_string(_SELF(self),
|
261
|
+
RVAL2CSTR(attribute),
|
262
|
+
RVAL2CSTR(value));
|
263
|
+
|
264
|
+
return self;
|
265
|
+
}
|
266
|
+
|
267
|
+
static VALUE
|
268
|
+
fileinfo_set_attribute_boolean(VALUE self, VALUE attribute, VALUE value)
|
269
|
+
{
|
270
|
+
g_file_info_set_attribute_boolean(_SELF(self),
|
271
|
+
RVAL2CSTR(attribute),
|
272
|
+
RVAL2CBOOL(value));
|
273
|
+
|
274
|
+
return self;
|
275
|
+
}
|
276
|
+
|
277
|
+
static VALUE
|
278
|
+
fileinfo_set_attribute_uint32(VALUE self, VALUE attribute, VALUE value)
|
279
|
+
{
|
280
|
+
g_file_info_set_attribute_uint32(_SELF(self),
|
281
|
+
RVAL2CSTR(attribute),
|
282
|
+
RVAL2GUINT32(value));
|
283
|
+
|
284
|
+
return self;
|
285
|
+
}
|
286
|
+
|
287
|
+
static VALUE
|
288
|
+
fileinfo_set_attribute_int32(VALUE self, VALUE attribute, VALUE value)
|
289
|
+
{
|
290
|
+
g_file_info_set_attribute_int32(_SELF(self),
|
291
|
+
RVAL2CSTR(attribute),
|
292
|
+
RVAL2GINT32(value));
|
293
|
+
|
294
|
+
return self;
|
295
|
+
}
|
296
|
+
|
297
|
+
static VALUE
|
298
|
+
fileinfo_set_attribute_uint64(VALUE self, VALUE attribute, VALUE value)
|
299
|
+
{
|
300
|
+
g_file_info_set_attribute_uint64(_SELF(self),
|
301
|
+
RVAL2CSTR(attribute),
|
302
|
+
RVAL2GUINT64(value));
|
303
|
+
|
304
|
+
return self;
|
305
|
+
}
|
306
|
+
|
307
|
+
static VALUE
|
308
|
+
fileinfo_set_attribute_int64(VALUE self, VALUE attribute, VALUE value)
|
309
|
+
{
|
310
|
+
g_file_info_set_attribute_int64(_SELF(self),
|
311
|
+
RVAL2CSTR(attribute),
|
312
|
+
RVAL2GINT64(value));
|
313
|
+
|
314
|
+
return self;
|
315
|
+
}
|
316
|
+
|
317
|
+
static VALUE
|
318
|
+
fileinfo_set_attribute_object(VALUE self, VALUE attribute, VALUE value)
|
319
|
+
{
|
320
|
+
g_file_info_set_attribute_object(_SELF(self),
|
321
|
+
RVAL2CSTR(attribute),
|
322
|
+
RVAL2GOBJ(value));
|
323
|
+
|
324
|
+
return self;
|
325
|
+
}
|
326
|
+
|
327
|
+
/* TODO: How do we implement set_attribute_value? */
|
328
|
+
|
329
|
+
static VALUE
|
330
|
+
fileinfo_clear_status(VALUE self)
|
331
|
+
{
|
332
|
+
g_file_info_clear_status(_SELF(self));
|
333
|
+
|
334
|
+
return self;
|
335
|
+
}
|
336
|
+
|
337
|
+
static VALUE
|
338
|
+
fileinfo_get_file_type(VALUE self)
|
339
|
+
{
|
340
|
+
return GFILETYPE2RVAL(g_file_info_get_file_type(_SELF(self)));
|
341
|
+
}
|
342
|
+
|
343
|
+
static VALUE
|
344
|
+
fileinfo_is_hidden(VALUE self)
|
345
|
+
{
|
346
|
+
return CBOOL2RVAL(g_file_info_get_is_hidden(_SELF(self)));
|
347
|
+
}
|
348
|
+
|
349
|
+
static VALUE
|
350
|
+
fileinfo_is_backup(VALUE self)
|
351
|
+
{
|
352
|
+
return CBOOL2RVAL(g_file_info_get_is_backup(_SELF(self)));
|
353
|
+
}
|
354
|
+
|
355
|
+
static VALUE
|
356
|
+
fileinfo_is_symlink(VALUE self)
|
357
|
+
{
|
358
|
+
return CBOOL2RVAL(g_file_info_get_is_symlink(_SELF(self)));
|
359
|
+
}
|
360
|
+
|
361
|
+
static VALUE
|
362
|
+
fileinfo_get_name(VALUE self)
|
363
|
+
{
|
364
|
+
return CSTR2RVAL(g_file_info_get_name(_SELF(self)));
|
365
|
+
}
|
366
|
+
|
367
|
+
static VALUE
|
368
|
+
fileinfo_get_display_name(VALUE self)
|
369
|
+
{
|
370
|
+
return CSTR2RVAL(g_file_info_get_display_name(_SELF(self)));
|
371
|
+
}
|
372
|
+
|
373
|
+
static VALUE
|
374
|
+
fileinfo_get_edit_name(VALUE self)
|
375
|
+
{
|
376
|
+
return CSTR2RVAL(g_file_info_get_edit_name(_SELF(self)));
|
377
|
+
}
|
378
|
+
|
379
|
+
static VALUE
|
380
|
+
fileinfo_get_icon(VALUE self)
|
381
|
+
{
|
382
|
+
return GOBJ2RVAL(g_file_info_get_icon(_SELF(self)));
|
383
|
+
}
|
384
|
+
|
385
|
+
static VALUE
|
386
|
+
fileinfo_get_content_type(VALUE self)
|
387
|
+
{
|
388
|
+
return CSTR2RVAL(g_file_info_get_content_type(_SELF(self)));
|
389
|
+
}
|
390
|
+
|
391
|
+
static VALUE
|
392
|
+
fileinfo_get_size(VALUE self)
|
393
|
+
{
|
394
|
+
return GOFFSET2RVAL(g_file_info_get_size(_SELF(self)));
|
395
|
+
}
|
396
|
+
|
397
|
+
static VALUE
|
398
|
+
fileinfo_get_modification_time(VALUE self)
|
399
|
+
{
|
400
|
+
GTimeVal time;
|
401
|
+
|
402
|
+
g_file_info_get_modification_time(_SELF(self), &time);
|
403
|
+
|
404
|
+
return GTIMEVAL2RVAL(&time);
|
405
|
+
}
|
406
|
+
|
407
|
+
static VALUE
|
408
|
+
fileinfo_get_symlink_target(VALUE self)
|
409
|
+
{
|
410
|
+
return CSTR2RVAL(g_file_info_get_symlink_target(_SELF(self)));
|
411
|
+
}
|
412
|
+
|
413
|
+
static VALUE
|
414
|
+
fileinfo_get_etag(VALUE self)
|
415
|
+
{
|
416
|
+
return CSTR2RVAL(g_file_info_get_etag(_SELF(self)));
|
417
|
+
}
|
418
|
+
|
419
|
+
static VALUE
|
420
|
+
fileinfo_get_sort_order(VALUE self)
|
421
|
+
{
|
422
|
+
return GINT322RVAL(g_file_info_get_sort_order(_SELF(self)));
|
423
|
+
}
|
424
|
+
|
425
|
+
static VALUE
|
426
|
+
fileinfo_set_attribute_mask(VALUE self, VALUE rbmask)
|
427
|
+
{
|
428
|
+
gboolean should_unref;
|
429
|
+
GFileAttributeMatcher *mask;
|
430
|
+
|
431
|
+
if (NIL_P(rbmask)) {
|
432
|
+
g_file_info_unset_attribute_mask(_SELF(self));
|
433
|
+
return self;
|
434
|
+
}
|
435
|
+
|
436
|
+
if (TYPE(rbmask) == T_STRING) {
|
437
|
+
mask = g_file_attribute_matcher_new(RVAL2CSTR(rbmask));
|
438
|
+
should_unref = TRUE;
|
439
|
+
} else {
|
440
|
+
mask = RVAL2GFILEATTRIBUTEMATCHER(rbmask);
|
441
|
+
should_unref = FALSE;
|
442
|
+
}
|
443
|
+
|
444
|
+
g_file_info_set_attribute_mask(_SELF(self), mask);
|
445
|
+
|
446
|
+
if (should_unref)
|
447
|
+
g_file_attribute_matcher_unref(mask);
|
448
|
+
|
449
|
+
return self;
|
450
|
+
}
|
451
|
+
|
452
|
+
static VALUE
|
453
|
+
fileinfo_unset_attribute_mask(VALUE self)
|
454
|
+
{
|
455
|
+
g_file_info_unset_attribute_mask(_SELF(self));
|
456
|
+
|
457
|
+
return self;
|
458
|
+
}
|
459
|
+
|
460
|
+
static VALUE
|
461
|
+
fileinfo_set_file_type(VALUE self, VALUE value)
|
462
|
+
{
|
463
|
+
g_file_info_set_file_type(_SELF(self), RVAL2GFILETYPE(value));
|
464
|
+
|
465
|
+
return self;
|
466
|
+
}
|
467
|
+
|
468
|
+
static VALUE
|
469
|
+
fileinfo_set_is_hidden(VALUE self, VALUE value)
|
470
|
+
{
|
471
|
+
g_file_info_set_is_hidden(_SELF(self), RVAL2CBOOL(value));
|
472
|
+
|
473
|
+
return self;
|
474
|
+
}
|
475
|
+
|
476
|
+
static VALUE
|
477
|
+
fileinfo_set_is_symlink(VALUE self, VALUE value)
|
478
|
+
{
|
479
|
+
g_file_info_set_is_symlink(_SELF(self), RVAL2CBOOL(value));
|
480
|
+
|
481
|
+
return self;
|
482
|
+
}
|
483
|
+
|
484
|
+
static VALUE
|
485
|
+
fileinfo_set_name(VALUE self, VALUE value)
|
486
|
+
{
|
487
|
+
g_file_info_set_name(_SELF(self), RVAL2CSTR(value));
|
488
|
+
|
489
|
+
return self;
|
490
|
+
}
|
491
|
+
|
492
|
+
static VALUE
|
493
|
+
fileinfo_set_display_name(VALUE self, VALUE value)
|
494
|
+
{
|
495
|
+
g_file_info_set_display_name(_SELF(self), RVAL2CSTR(value));
|
496
|
+
|
497
|
+
return self;
|
498
|
+
}
|
499
|
+
|
500
|
+
static VALUE
|
501
|
+
fileinfo_set_edit_name(VALUE self, VALUE value)
|
502
|
+
{
|
503
|
+
g_file_info_set_edit_name(_SELF(self), RVAL2CSTR(value));
|
504
|
+
|
505
|
+
return self;
|
506
|
+
}
|
507
|
+
|
508
|
+
static VALUE
|
509
|
+
fileinfo_set_icon(VALUE self, VALUE value)
|
510
|
+
{
|
511
|
+
g_file_info_set_icon(_SELF(self), RVAL2GICON(value));
|
512
|
+
|
513
|
+
return self;
|
514
|
+
}
|
515
|
+
|
516
|
+
static VALUE
|
517
|
+
fileinfo_set_content_type(VALUE self, VALUE value)
|
518
|
+
{
|
519
|
+
g_file_info_set_content_type(_SELF(self), RVAL2CSTR(value));
|
520
|
+
|
521
|
+
return self;
|
522
|
+
}
|
523
|
+
|
524
|
+
static VALUE
|
525
|
+
fileinfo_set_size(VALUE self, VALUE value)
|
526
|
+
{
|
527
|
+
g_file_info_set_size(_SELF(self), RVAL2GOFFSET(value));
|
528
|
+
|
529
|
+
return self;
|
530
|
+
}
|
531
|
+
|
532
|
+
static VALUE
|
533
|
+
fileinfo_set_modification_time(VALUE self, VALUE rbtime)
|
534
|
+
{
|
535
|
+
GTimeVal time;
|
536
|
+
|
537
|
+
rbgio_rval_to_gtimeval(rbtime, &time);
|
538
|
+
|
539
|
+
g_file_info_set_modification_time(_SELF(self), &time);
|
540
|
+
|
541
|
+
return self;
|
542
|
+
}
|
543
|
+
|
544
|
+
static VALUE
|
545
|
+
fileinfo_set_symlink_target(VALUE self, VALUE value)
|
546
|
+
{
|
547
|
+
g_file_info_set_symlink_target(_SELF(self), RVAL2CSTR(value));
|
548
|
+
|
549
|
+
return self;
|
550
|
+
}
|
551
|
+
|
552
|
+
static VALUE
|
553
|
+
fileinfo_set_sort_order(VALUE self, VALUE value)
|
554
|
+
{
|
555
|
+
g_file_info_set_sort_order(_SELF(self), RVAL2GINT32(value));
|
556
|
+
|
557
|
+
return self;
|
558
|
+
}
|
559
|
+
|
560
|
+
void
|
561
|
+
Init_gfileinfo(VALUE glib)
|
562
|
+
{
|
563
|
+
VALUE fileinfo = G_DEF_CLASS(G_TYPE_FILE_INFO, "FileInfo", glib);
|
564
|
+
|
565
|
+
G_DEF_CLASS(G_TYPE_FILE_TYPE, "FileType", glib);
|
566
|
+
G_DEF_CONSTANTS(glib, G_TYPE_FILE_TYPE, "G_FILE_");
|
567
|
+
|
568
|
+
rb_define_method(fileinfo, "initialize", fileinfo_initialize, 0);
|
569
|
+
rb_define_method(fileinfo, "dup", fileinfo_dup, 0);
|
570
|
+
rb_define_method(fileinfo, "copy_into", fileinfo_copy_into, 1);
|
571
|
+
rb_define_method(fileinfo, "has_attribute?", fileinfo_has_attribute, 1);
|
572
|
+
rb_define_method(fileinfo, "has_namespace?", fileinfo_has_namespace, 1);
|
573
|
+
rb_define_method(fileinfo, "attributes", fileinfo_list_attributes, -1);
|
574
|
+
rb_define_method(fileinfo, "get_attribute_type", fileinfo_get_attribute_type, 1);
|
575
|
+
rb_define_method(fileinfo, "remove_attribute", fileinfo_remove_attribute, 1);
|
576
|
+
rb_define_method(fileinfo, "get_attribute_as_string", fileinfo_get_attribute_as_string, 1);
|
577
|
+
rb_define_method(fileinfo, "get_attribute_data", fileinfo_get_attribute_data, 1);
|
578
|
+
rb_define_method(fileinfo, "get_attribute_status", fileinfo_get_attribute_status, 1);
|
579
|
+
rb_define_method(fileinfo, "get_attribute_string", fileinfo_get_attribute_string, 1);
|
580
|
+
rb_define_method(fileinfo, "get_attribute_stringv", fileinfo_get_attribute_stringv, 1);
|
581
|
+
rb_define_method(fileinfo, "get_attribute_byte_string", fileinfo_get_attribute_byte_string, 1);
|
582
|
+
rb_define_method(fileinfo, "get_attribute_boolean", fileinfo_get_attribute_boolean, 1);
|
583
|
+
rb_define_method(fileinfo, "get_attribute_uint32", fileinfo_get_attribute_uint32, 1);
|
584
|
+
rb_define_method(fileinfo, "get_attribute_int32", fileinfo_get_attribute_int32, 1);
|
585
|
+
rb_define_method(fileinfo, "get_attribute_uint64", fileinfo_get_attribute_uint64, 1);
|
586
|
+
rb_define_method(fileinfo, "get_attribute_int64", fileinfo_get_attribute_int64, 1);
|
587
|
+
rb_define_method(fileinfo, "get_attribute_object", fileinfo_get_attribute_object, 1);
|
588
|
+
rb_define_method(fileinfo, "get_attribute_value", fileinfo_get_attribute_value, 1);
|
589
|
+
rb_define_alias(fileinfo, "[]", "get_attribute_value");
|
590
|
+
rb_define_method(fileinfo, "set_attribute_status", fileinfo_set_attribute_status, 2);
|
591
|
+
rb_define_method(fileinfo, "set_attribute_string", fileinfo_set_attribute_string, 2);
|
592
|
+
rb_define_method(fileinfo, "set_attribute_byte_string", fileinfo_set_attribute_byte_string, 2);
|
593
|
+
rb_define_method(fileinfo, "set_attribute_boolean", fileinfo_set_attribute_boolean, 2);
|
594
|
+
rb_define_method(fileinfo, "set_attribute_uint32", fileinfo_set_attribute_uint32, 2);
|
595
|
+
rb_define_method(fileinfo, "set_attribute_int32", fileinfo_set_attribute_int32, 2);
|
596
|
+
rb_define_method(fileinfo, "set_attribute_uint64", fileinfo_set_attribute_uint64, 2);
|
597
|
+
rb_define_method(fileinfo, "set_attribute_int64", fileinfo_set_attribute_int64, 2);
|
598
|
+
rb_define_method(fileinfo, "set_attribute_object", fileinfo_set_attribute_object, 2);
|
599
|
+
rb_define_method(fileinfo, "clear_status", fileinfo_clear_status, 0);
|
600
|
+
rb_define_method(fileinfo, "file_type", fileinfo_get_file_type, 0);
|
601
|
+
rb_define_method(fileinfo, "hidden?", fileinfo_is_hidden, 0);
|
602
|
+
rb_define_method(fileinfo, "backup?", fileinfo_is_backup, 0);
|
603
|
+
rb_define_method(fileinfo, "symlink?", fileinfo_is_symlink, 0);
|
604
|
+
rb_define_method(fileinfo, "name", fileinfo_get_name, 0);
|
605
|
+
rb_define_method(fileinfo, "display_name", fileinfo_get_display_name, 0);
|
606
|
+
rb_define_method(fileinfo, "edit_name", fileinfo_get_edit_name, 0);
|
607
|
+
rb_define_method(fileinfo, "icon", fileinfo_get_icon, 0);
|
608
|
+
rb_define_method(fileinfo, "content_type", fileinfo_get_content_type, 0);
|
609
|
+
rb_define_method(fileinfo, "size", fileinfo_get_size, 0);
|
610
|
+
rb_define_method(fileinfo, "modification_time", fileinfo_get_modification_time, 0);
|
611
|
+
rb_define_method(fileinfo, "symlink_target", fileinfo_get_symlink_target, 0);
|
612
|
+
rb_define_method(fileinfo, "etag", fileinfo_get_etag, 0);
|
613
|
+
rb_define_method(fileinfo, "sort_order", fileinfo_get_sort_order, 0);
|
614
|
+
rb_define_method(fileinfo, "set_attribute_mask", fileinfo_set_attribute_mask, 1);
|
615
|
+
G_DEF_SETTER(fileinfo, "attribute_mask");
|
616
|
+
rb_define_method(fileinfo, "unset_attribute_mask", fileinfo_unset_attribute_mask, 0);
|
617
|
+
rb_define_method(fileinfo, "set_file_type", fileinfo_set_file_type, 1);
|
618
|
+
G_DEF_SETTER(fileinfo, "file_type");
|
619
|
+
rb_define_method(fileinfo, "set_hidden", fileinfo_set_is_hidden, 1);
|
620
|
+
G_DEF_SETTER(fileinfo, "hidden");
|
621
|
+
rb_define_method(fileinfo, "set_symlink", fileinfo_set_is_symlink, 1);
|
622
|
+
G_DEF_SETTER(fileinfo, "symlink");
|
623
|
+
rb_define_method(fileinfo, "set_name", fileinfo_set_name, 1);
|
624
|
+
G_DEF_SETTER(fileinfo, "name");
|
625
|
+
rb_define_method(fileinfo, "set_display_name", fileinfo_set_display_name, 1);
|
626
|
+
G_DEF_SETTER(fileinfo, "display_name");
|
627
|
+
rb_define_method(fileinfo, "set_edit_name", fileinfo_set_edit_name, 1);
|
628
|
+
G_DEF_SETTER(fileinfo, "edit_name");
|
629
|
+
rb_define_method(fileinfo, "set_icon", fileinfo_set_icon, 1);
|
630
|
+
G_DEF_SETTER(fileinfo, "icon");
|
631
|
+
rb_define_method(fileinfo, "set_content_type", fileinfo_set_content_type, 1);
|
632
|
+
G_DEF_SETTER(fileinfo, "content_type");
|
633
|
+
rb_define_method(fileinfo, "set_size", fileinfo_set_size, 1);
|
634
|
+
G_DEF_SETTER(fileinfo, "size");
|
635
|
+
rb_define_method(fileinfo, "set_modification_time", fileinfo_set_modification_time, 1);
|
636
|
+
G_DEF_SETTER(fileinfo, "modification_time");
|
637
|
+
rb_define_method(fileinfo, "set_symlink_target", fileinfo_set_symlink_target, 1);
|
638
|
+
G_DEF_SETTER(fileinfo, "symlink_target");
|
639
|
+
rb_define_method(fileinfo, "set_sort_order", fileinfo_set_sort_order, 1);
|
640
|
+
G_DEF_SETTER(fileinfo, "sort_order");
|
641
|
+
}
|