gio2 0.90.5 → 0.90.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +41 -0
- data/Rakefile +9 -70
- data/ext/gio2/Makefile +162 -0
- data/ext/gio2/extconf.rb +9 -9
- data/ext/gio2/gappinfo.o +0 -0
- data/ext/gio2/gapplaunchcontext.o +0 -0
- data/ext/gio2/gasyncinitable.c +0 -1
- data/ext/gio2/gasyncinitable.o +0 -0
- data/ext/gio2/gasyncresult.o +0 -0
- data/ext/gio2/gbufferedinputstream.c +0 -19
- data/ext/gio2/gbufferedinputstream.o +0 -0
- data/ext/gio2/gbufferedoutputstream.c +0 -34
- data/ext/gio2/gbufferedoutputstream.o +0 -0
- data/ext/gio2/gcancellable.o +0 -0
- data/ext/gio2/gcharsetconverter.c +0 -17
- data/ext/gio2/gcharsetconverter.o +0 -0
- data/ext/gio2/gcontenttype.c +1 -8
- data/ext/gio2/gcontenttype.o +0 -0
- data/ext/gio2/gconverter.o +0 -0
- data/ext/gio2/gconverterinputstream.c +0 -7
- data/ext/gio2/gconverterinputstream.o +0 -0
- data/ext/gio2/gconverteroutputstream.c +0 -7
- data/ext/gio2/gconverteroutputstream.o +0 -0
- data/ext/gio2/gdatainputstream.c +34 -57
- data/ext/gio2/gdatainputstream.o +0 -0
- data/ext/gio2/gdataoutputstream.c +0 -18
- data/ext/gio2/gdataoutputstream.o +0 -0
- data/ext/gio2/gdesktopappinfo.c +0 -2
- data/ext/gio2/gdesktopappinfo.o +0 -0
- data/ext/gio2/gdrive.o +0 -0
- data/ext/gio2/gemblem.c +0 -19
- data/ext/gio2/gemblem.o +0 -0
- data/ext/gio2/gemblemedicon.o +0 -0
- data/ext/gio2/gfile.c +4 -6
- data/ext/gio2/gfile.o +0 -0
- data/ext/gio2/gfileattribute.c +3 -155
- data/ext/gio2/gfileattribute.o +0 -0
- data/ext/gio2/gfileattributeinfo.c +89 -0
- data/ext/gio2/gfileattributeinfo.o +0 -0
- data/ext/gio2/gfileattributeinfolist.c +109 -0
- data/ext/gio2/gfileattributeinfolist.o +0 -0
- data/ext/gio2/gfileattributematcher.o +0 -0
- data/ext/gio2/gfiledescriptorbased.o +0 -0
- data/ext/gio2/gfileenumerator.c +0 -2
- data/ext/gio2/gfileenumerator.o +0 -0
- data/ext/gio2/gfileicon.c +0 -7
- data/ext/gio2/gfileicon.o +0 -0
- data/ext/gio2/gfileinfo.c +4 -11
- data/ext/gio2/gfileinfo.o +0 -0
- data/ext/gio2/gfileinputstream.c +0 -2
- data/ext/gio2/gfileinputstream.o +0 -0
- data/ext/gio2/gfileiostream.c +0 -2
- data/ext/gio2/gfileiostream.o +0 -0
- data/ext/gio2/gfilemonitor.c +0 -19
- data/ext/gio2/gfilemonitor.o +0 -0
- data/ext/gio2/gfilenamecompleter.o +0 -0
- data/ext/gio2/gfileoutputstream.c +1 -5
- data/ext/gio2/gfileoutputstream.o +0 -0
- data/ext/gio2/gfilterinputstream.c +1 -30
- data/ext/gio2/gfilterinputstream.o +0 -0
- data/ext/gio2/gfilteroutputstream.c +1 -30
- data/ext/gio2/gfilteroutputstream.o +0 -0
- data/ext/gio2/gicon.c +0 -2
- data/ext/gio2/gicon.o +0 -0
- data/ext/gio2/ginetaddress.c +0 -72
- data/ext/gio2/ginetaddress.o +0 -0
- data/ext/gio2/ginetsocketaddress.c +0 -16
- data/ext/gio2/ginetsocketaddress.o +0 -0
- data/ext/gio2/ginitable.o +0 -0
- data/ext/gio2/ginputstream.c +0 -2
- data/ext/gio2/ginputstream.o +0 -0
- data/ext/gio2/gio2.c +11 -1
- data/ext/gio2/gio2.h +9 -1
- data/ext/gio2/gio2.o +0 -0
- data/ext/gio2/gio2.so +0 -0
- data/ext/gio2/gioerror.c +4 -1
- data/ext/gio2/gioerror.o +0 -0
- data/ext/gio2/giomodule.c +2 -2
- data/ext/gio2/giomodule.o +0 -0
- data/ext/gio2/gioscheduler.c +4 -6
- data/ext/gio2/gioscheduler.o +0 -0
- data/ext/gio2/giostream.c +0 -23
- data/ext/gio2/giostream.o +0 -0
- data/ext/gio2/gloadableicon.c +0 -1
- data/ext/gio2/gloadableicon.o +0 -0
- data/ext/gio2/gmemoryinputstream.o +0 -0
- data/ext/gio2/gmemoryoutputstream.c +0 -24
- data/ext/gio2/gmemoryoutputstream.o +0 -0
- data/ext/gio2/gmount.c +1 -0
- data/ext/gio2/gmount.o +0 -0
- data/ext/gio2/gmountoperation.c +1 -103
- data/ext/gio2/gmountoperation.o +0 -0
- data/ext/gio2/gnetworkaddress.c +0 -14
- data/ext/gio2/gnetworkaddress.o +0 -0
- data/ext/gio2/gnetworkservice.c +0 -21
- data/ext/gio2/gnetworkservice.o +0 -0
- data/ext/gio2/goutputstream.c +8 -18
- data/ext/gio2/goutputstream.o +0 -0
- data/ext/gio2/gresolver.c +0 -2
- data/ext/gio2/gresolver.o +0 -0
- data/ext/gio2/gseekable.o +0 -0
- data/ext/gio2/gsimpleasyncresult.o +0 -0
- data/ext/gio2/gsocket.c +2 -80
- data/ext/gio2/gsocket.o +0 -0
- data/ext/gio2/gsocketaddress.c +1 -13
- data/ext/gio2/gsocketaddress.o +0 -0
- data/ext/gio2/gsocketclient.c +0 -68
- data/ext/gio2/gsocketclient.o +0 -0
- data/ext/gio2/gsocketconnectable.o +0 -0
- data/ext/gio2/gsocketconnection.c +1 -8
- data/ext/gio2/gsocketconnection.o +0 -0
- data/ext/gio2/gsocketcontrolmessage.c +0 -2
- data/ext/gio2/gsocketcontrolmessage.o +0 -0
- data/ext/gio2/gsocketlistener.c +27 -21
- data/ext/gio2/gsocketlistener.o +0 -0
- data/ext/gio2/gsocketservice.o +0 -0
- data/ext/gio2/gsrvtarget.o +0 -0
- data/ext/gio2/gtcpconnection.c +1 -22
- data/ext/gio2/gtcpconnection.o +0 -0
- data/ext/gio2/gthemedicon.o +0 -0
- data/ext/gio2/gthreadedsocketservice.c +6 -5
- data/ext/gio2/gthreadedsocketservice.o +0 -0
- data/ext/gio2/gunixconnection.o +0 -0
- data/ext/gio2/gunixfdlist.c +1 -1
- data/ext/gio2/gunixfdlist.o +0 -0
- data/ext/gio2/gunixfdmessage.c +0 -9
- data/ext/gio2/gunixfdmessage.o +0 -0
- data/ext/gio2/gunixinputstream.c +0 -24
- data/ext/gio2/gunixinputstream.o +0 -0
- data/ext/gio2/gunixmounts.c +1 -4
- data/ext/gio2/gunixmounts.o +0 -0
- data/ext/gio2/gunixoutputstream.c +0 -24
- data/ext/gio2/gunixoutputstream.o +0 -0
- data/ext/gio2/gunixsocketaddress.c +5 -17
- data/ext/gio2/gunixsocketaddress.o +0 -0
- data/ext/gio2/gvfs.c +0 -2
- data/ext/gio2/gvfs.o +0 -0
- data/ext/gio2/gvolume.o +0 -0
- data/ext/gio2/gvolumemonitor.c +0 -2
- data/ext/gio2/gvolumemonitor.o +0 -0
- data/ext/gio2/gzlibcompressor.c +3 -0
- data/ext/gio2/gzlibcompressor.o +0 -0
- data/ext/gio2/gzlibdecompressor.o +0 -0
- data/ext/gio2/ruby-gio2.pc +3 -0
- data/ext/gio2/util.c +3 -0
- data/ext/gio2/util.o +0 -0
- data/lib/gio2.rb +19 -1
- data/test/load-test.rb +14 -0
- data/test/test_bufferedinputstream.rb +2 -0
- data/test/test_charsetconverter.rb +2 -0
- data/test/test_datainputstream.rb +7 -0
- data/test/test_fileenumerator.rb +8 -0
- data/test/test_filemonitor.rb +2 -0
- data/test/test_inetaddress.rb +8 -0
- metadata +173 -79
data/ext/gio2/gdatainputstream.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
4
|
-
* Copyright (C) 2008-
|
4
|
+
* Copyright (C) 2008-2011 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
7
7
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -22,9 +22,6 @@
|
|
22
22
|
|
23
23
|
#define _SELF(value) G_DATA_INPUT_STREAM(RVAL2GOBJ(value))
|
24
24
|
|
25
|
-
#define GDATASTREAMNEWLINETYPE2RVAL(value) \
|
26
|
-
RVAL2GENUM((value), G_TYPE_DATA_STREAM_NEWLINE_TYPE)
|
27
|
-
|
28
25
|
#define RVAL2GDATASTREAMNEWLINETYPE(value) \
|
29
26
|
GENUM2RVAL((value), G_TYPE_DATA_STREAM_NEWLINE_TYPE)
|
30
27
|
|
@@ -48,36 +45,6 @@ datainputstream_initialize(int argc, VALUE *argv, VALUE self)
|
|
48
45
|
return Qnil;
|
49
46
|
}
|
50
47
|
|
51
|
-
static VALUE
|
52
|
-
datainputstream_get_byte_order(VALUE self)
|
53
|
-
{
|
54
|
-
return GDATASTREAMBYTEORDER2RVAL(g_data_input_stream_get_byte_order(_SELF(self)));
|
55
|
-
}
|
56
|
-
|
57
|
-
static VALUE
|
58
|
-
datainputstream_set_byte_order(VALUE self, VALUE value)
|
59
|
-
{
|
60
|
-
g_data_input_stream_set_byte_order(_SELF(self),
|
61
|
-
RVAL2GDATASTREAMBYTEORDER(value));
|
62
|
-
|
63
|
-
return self;
|
64
|
-
}
|
65
|
-
|
66
|
-
static VALUE
|
67
|
-
datainputstream_set_newline_type(VALUE self, VALUE value)
|
68
|
-
{
|
69
|
-
g_data_input_stream_set_newline_type(_SELF(self),
|
70
|
-
RVAL2GDATASTREAMNEWLINETYPE(value));
|
71
|
-
|
72
|
-
return self;
|
73
|
-
}
|
74
|
-
|
75
|
-
static VALUE
|
76
|
-
datainputstream_get_newline_type(VALUE self)
|
77
|
-
{
|
78
|
-
return GDATASTREAMNEWLINETYPE2RVAL(g_data_input_stream_get_newline_type(_SELF(self)));
|
79
|
-
}
|
80
|
-
|
81
48
|
static VALUE
|
82
49
|
datainputstream_read_byte(int argc, VALUE *argv, VALUE self)
|
83
50
|
{
|
@@ -253,20 +220,24 @@ datainputstream_read_line_finish(VALUE self, VALUE result)
|
|
253
220
|
return CSTR2RVAL_TAINTED_FREE(line, length);
|
254
221
|
}
|
255
222
|
|
223
|
+
#if GLIB_CHECK_VERSION(2, 26, 0)
|
256
224
|
static VALUE
|
257
|
-
|
225
|
+
datainputstream_read_upto(int argc, VALUE *argv, VALUE self)
|
258
226
|
{
|
259
|
-
VALUE
|
227
|
+
VALUE rbstop_chars, cancellable;
|
228
|
+
const char *stop_chars;
|
260
229
|
gsize length;
|
261
230
|
GError *error;
|
262
231
|
char *string;
|
263
232
|
|
264
|
-
rb_scan_args(argc, argv, "11", &
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
233
|
+
rb_scan_args(argc, argv, "11", &rbstop_chars, &cancellable);
|
234
|
+
stop_chars = RVAL2CSTR(rbstop_chars);
|
235
|
+
string = g_data_input_stream_read_upto(_SELF(self),
|
236
|
+
stop_chars,
|
237
|
+
RSTRING_LEN(rbstop_chars),
|
238
|
+
&length,
|
239
|
+
RVAL2GCANCELLABLE(cancellable),
|
240
|
+
&error);
|
270
241
|
if (error != NULL)
|
271
242
|
rbgio_raise_error(error);
|
272
243
|
|
@@ -274,7 +245,7 @@ datainputstream_read_until(int argc, VALUE *argv, VALUE self)
|
|
274
245
|
}
|
275
246
|
|
276
247
|
static VALUE
|
277
|
-
|
248
|
+
datainputstream_read_upto_async(int argc, VALUE *argv, VALUE self)
|
278
249
|
{
|
279
250
|
VALUE rbstop_chars, rbcancellable, rbio_priority, block;
|
280
251
|
const char *stop_chars;
|
@@ -286,32 +257,34 @@ datainputstream_read_until_async(int argc, VALUE *argv, VALUE self)
|
|
286
257
|
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
287
258
|
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
288
259
|
SAVE_BLOCK(block);
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
260
|
+
g_data_input_stream_read_upto_async(_SELF(self),
|
261
|
+
stop_chars,
|
262
|
+
RSTRING_LEN(rbstop_chars),
|
263
|
+
io_priority,
|
264
|
+
cancellable,
|
265
|
+
rbgio_async_ready_callback,
|
266
|
+
(gpointer)block);
|
295
267
|
|
296
268
|
return self;
|
297
269
|
}
|
298
270
|
|
299
271
|
static VALUE
|
300
|
-
|
272
|
+
datainputstream_read_upto_finish(VALUE self, VALUE result)
|
301
273
|
{
|
302
274
|
GError *error = NULL;
|
303
275
|
gsize length;
|
304
276
|
char *string;
|
305
277
|
|
306
|
-
string =
|
307
|
-
|
308
|
-
|
309
|
-
|
278
|
+
string = g_data_input_stream_read_upto_finish(_SELF(self),
|
279
|
+
RVAL2GASYNCRESULT(result),
|
280
|
+
&length,
|
281
|
+
&error);
|
310
282
|
if (error != NULL)
|
311
283
|
rbgio_raise_error(error);
|
312
284
|
|
313
285
|
return CSTR2RVAL_TAINTED_FREE(string, length);
|
314
286
|
}
|
287
|
+
#endif
|
315
288
|
|
316
289
|
void
|
317
290
|
Init_gdatainputstream(VALUE glib)
|
@@ -319,12 +292,14 @@ Init_gdatainputstream(VALUE glib)
|
|
319
292
|
VALUE datainputstream = G_DEF_CLASS(G_TYPE_DATA_INPUT_STREAM, "DataInputStream", glib);
|
320
293
|
|
321
294
|
rb_define_method(datainputstream, "initialize", datainputstream_initialize, -1);
|
295
|
+
/*
|
322
296
|
rb_define_method(datainputstream, "byte_order", datainputstream_get_byte_order, 0);
|
323
297
|
rb_define_method(datainputstream, "set_byte_order", datainputstream_set_byte_order, 1);
|
324
298
|
G_DEF_SETTER(datainputstream, "byte_order");
|
325
299
|
rb_define_method(datainputstream, "set_newline_type", datainputstream_set_newline_type, 1);
|
326
300
|
G_DEF_SETTER(datainputstream, "newline_type");
|
327
301
|
rb_define_method(datainputstream, "newline_type", datainputstream_get_newline_type, 0);
|
302
|
+
*/
|
328
303
|
rb_define_method(datainputstream, "read_byte", datainputstream_read_byte, -1);
|
329
304
|
rb_define_method(datainputstream, "read_int16", datainputstream_read_int16, -1);
|
330
305
|
rb_define_method(datainputstream, "read_uint16", datainputstream_read_uint16, -1);
|
@@ -335,7 +310,9 @@ Init_gdatainputstream(VALUE glib)
|
|
335
310
|
rb_define_method(datainputstream, "read_line", datainputstream_read_line, -1);
|
336
311
|
rb_define_method(datainputstream, "read_line_async", datainputstream_read_line_async, -1);
|
337
312
|
rb_define_method(datainputstream, "read_line_finish", datainputstream_read_line_finish, 1);
|
338
|
-
|
339
|
-
rb_define_method(datainputstream, "
|
340
|
-
rb_define_method(datainputstream, "
|
313
|
+
#if GLIB_CHECK_VERSION(2, 26, 0)
|
314
|
+
rb_define_method(datainputstream, "read_upto", datainputstream_read_upto, -1);
|
315
|
+
rb_define_method(datainputstream, "read_upto_async", datainputstream_read_upto_async, -1);
|
316
|
+
rb_define_method(datainputstream, "read_upto_finish", datainputstream_read_upto_finish, 1);
|
317
|
+
#endif
|
341
318
|
}
|
Binary file
|
@@ -39,21 +39,6 @@ dataoutputstream_initialize(int argc, VALUE *argv, VALUE self)
|
|
39
39
|
return Qnil;
|
40
40
|
}
|
41
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
42
|
static VALUE
|
58
43
|
dataoutputstream_put_byte(int argc, VALUE *argv, VALUE self)
|
59
44
|
{
|
@@ -188,9 +173,6 @@ Init_gdataoutputstream(VALUE glib)
|
|
188
173
|
VALUE dataoutputstream = G_DEF_CLASS(G_TYPE_DATA_OUTPUT_STREAM, "DataOutputStream", glib);
|
189
174
|
|
190
175
|
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
176
|
rb_define_method(dataoutputstream, "put_byte", dataoutputstream_put_byte, -1);
|
195
177
|
rb_define_method(dataoutputstream, "put_int16", dataoutputstream_put_int16, -1);
|
196
178
|
rb_define_method(dataoutputstream, "put_uint16", dataoutputstream_put_uint16, -1);
|
Binary file
|
data/ext/gio2/gdesktopappinfo.c
CHANGED
@@ -77,8 +77,6 @@ Init_gdesktopappinfo(G_GNUC_UNUSED VALUE glib)
|
|
77
77
|
#ifdef HAVE_GIO_UNIX
|
78
78
|
VALUE desktopappinfo = G_DEF_CLASS(G_TYPE_DESKTOP_APP_INFO, "DesktopAppInfo", glib);
|
79
79
|
|
80
|
-
rb_define_const(desktopappinfo, "LOOKUP_EXTENSION_POINT_NAME", CSTR2RVAL(G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME));
|
81
|
-
|
82
80
|
rb_define_singleton_method(desktopappinfo, "new_from_filename", desktopappinfo_new_from_filename, 1);
|
83
81
|
rb_define_singleton_method(desktopappinfo, "new_from_keyfile", desktopappinfo_new_from_keyfile, 1);
|
84
82
|
rb_define_singleton_method(desktopappinfo, "set_desktop_env", desktopappinfo_set_desktop_env, 1);
|
Binary file
|
data/ext/gio2/gdrive.o
ADDED
Binary file
|
data/ext/gio2/gemblem.c
CHANGED
@@ -20,11 +20,6 @@
|
|
20
20
|
|
21
21
|
#include "gio2.h"
|
22
22
|
|
23
|
-
#define _SELF(value) RVAL2GEMBLEM(value)
|
24
|
-
|
25
|
-
#define GEMBLEMORIGIN2RVAL(value) \
|
26
|
-
GENUM2RVAL((value), G_TYPE_EMBLEM_ORIGIN)
|
27
|
-
|
28
23
|
#define RVAL2GEMBLEMORIGIN(value) \
|
29
24
|
RVAL2GENUM((value), G_TYPE_EMBLEM_ORIGIN)
|
30
25
|
|
@@ -45,18 +40,6 @@ emblem_initialize(int argc, VALUE *argv, VALUE self)
|
|
45
40
|
return Qnil;
|
46
41
|
}
|
47
42
|
|
48
|
-
static VALUE
|
49
|
-
emblem_get_icon(VALUE self)
|
50
|
-
{
|
51
|
-
return GOBJ2RVAL(g_emblem_get_icon(_SELF(self)));
|
52
|
-
}
|
53
|
-
|
54
|
-
static VALUE
|
55
|
-
emblem_get_origin(VALUE self)
|
56
|
-
{
|
57
|
-
return GEMBLEMORIGIN2RVAL(g_emblem_get_origin(_SELF(self)));
|
58
|
-
}
|
59
|
-
|
60
43
|
void
|
61
44
|
Init_gemblem(VALUE glib)
|
62
45
|
{
|
@@ -66,6 +49,4 @@ Init_gemblem(VALUE glib)
|
|
66
49
|
G_DEF_CONSTANTS(emblem, G_TYPE_EMBLEM_ORIGIN, "G_EMBLEM_");
|
67
50
|
|
68
51
|
rb_define_method(emblem, "initialize", emblem_initialize, -1);
|
69
|
-
rb_define_method(emblem, "icon", emblem_get_icon, 0);
|
70
|
-
rb_define_method(emblem, "origin", emblem_get_origin, 0);
|
71
52
|
}
|
data/ext/gio2/gemblem.o
ADDED
Binary file
|
Binary file
|
data/ext/gio2/gfile.c
CHANGED
@@ -1423,7 +1423,7 @@ file_start_mountable(int argc, VALUE *argv, VALUE self)
|
|
1423
1423
|
GMountOperation *start_operation;
|
1424
1424
|
GCancellable *cancellable;
|
1425
1425
|
|
1426
|
-
rb_scan_args(argc, argv, "
|
1426
|
+
rb_scan_args(argc, argv, "03&", &rbflags, &rbstart_operation, &rbcancellable, &block);
|
1427
1427
|
flags = RVAL2GDRIVESTARTFLAGSDEFAULT(rbflags);
|
1428
1428
|
start_operation = RVAL2GMOUNTOPERATION(rbstart_operation);
|
1429
1429
|
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
@@ -1679,16 +1679,14 @@ file_replace_contents(int argc, VALUE *argv, VALUE self)
|
|
1679
1679
|
{
|
1680
1680
|
VALUE rbcontents, etag, make_backup, flags, cancellable;
|
1681
1681
|
const char *contents;
|
1682
|
-
gsize length;
|
1683
1682
|
char *new_etag;
|
1684
1683
|
GError *error = NULL;
|
1685
1684
|
|
1686
1685
|
rb_scan_args(argc, argv, "14", &rbcontents, &etag, &make_backup, &flags, &cancellable);
|
1687
1686
|
contents = RVAL2CSTR(rbcontents);
|
1688
|
-
length = RSTRING_LEN(rbcontents);
|
1689
1687
|
if (!g_file_replace_contents(_SELF(self),
|
1690
1688
|
contents,
|
1691
|
-
|
1689
|
+
(gsize)RSTRING_LEN(rbcontents),
|
1692
1690
|
RVAL2CSTR_ACCEPT_NIL(etag),
|
1693
1691
|
RVAL2CBOOL(make_backup),
|
1694
1692
|
RVAL2GFILECREATEFLAGSDEFAULT(flags),
|
@@ -1940,8 +1938,8 @@ Init_gfile(VALUE glib)
|
|
1940
1938
|
G_DEF_CLASS(G_TYPE_FILE_MONITOR_FLAGS, "MonitorFlags", file);
|
1941
1939
|
G_DEF_CONSTANTS(file, G_TYPE_FILE_MONITOR_FLAGS, "G_FILE_");
|
1942
1940
|
|
1943
|
-
G_DEF_CLASS(
|
1944
|
-
G_DEF_CONSTANTS(
|
1941
|
+
G_DEF_CLASS(G_TYPE_FILE_TYPE, "Type", file);
|
1942
|
+
G_DEF_CONSTANTS(file, G_TYPE_FILE_TYPE, "G_FILE_");
|
1945
1943
|
|
1946
1944
|
rb_define_singleton_method(file, "new_for_path", file_new_for_path, 1);
|
1947
1945
|
rb_define_singleton_method(file, "new_for_uri", file_new_for_uri, 1);
|
data/ext/gio2/gfile.o
ADDED
Binary file
|
data/ext/gio2/gfileattribute.c
CHANGED
@@ -20,141 +20,10 @@
|
|
20
20
|
|
21
21
|
#include "gio2.h"
|
22
22
|
|
23
|
-
static GFileAttributeInfo *
|
24
|
-
fileattributeinfo_copy(const GFileAttributeInfo *info)
|
25
|
-
{
|
26
|
-
return (GFileAttributeInfo *)info;
|
27
|
-
}
|
28
|
-
|
29
|
-
static void
|
30
|
-
fileattributeinfo_free(G_GNUC_UNUSED GFileAttributeInfo *info)
|
31
|
-
{
|
32
|
-
return;
|
33
|
-
}
|
34
|
-
|
35
|
-
static GType
|
36
|
-
g_file_attribute_info_get_type(void)
|
37
|
-
{
|
38
|
-
static GType our_type = 0;
|
39
|
-
|
40
|
-
if (our_type == 0)
|
41
|
-
our_type = g_boxed_type_register_static("GFileAttributeInfo",
|
42
|
-
(GBoxedCopyFunc)fileattributeinfo_copy,
|
43
|
-
(GBoxedFreeFunc)fileattributeinfo_free);
|
44
|
-
|
45
|
-
return our_type;
|
46
|
-
}
|
47
|
-
|
48
|
-
#define G_TYPE_FILE_ATTRIBUTE_INFO (g_file_attribute_info_get_type())
|
49
|
-
|
50
|
-
#define RVAL2GFILEATTRIBUTEINFO(object) \
|
51
|
-
((GFileAttributeInfo *)(RVAL2BOXED(object, G_TYPE_FILE_ATTRIBUTE_INFO)))
|
52
|
-
|
53
|
-
#define GFILEATTRIBUTEINFO2RVAL(object) \
|
54
|
-
BOXED2RVAL(object, G_TYPE_FILE_ATTRIBUTE_INFO)
|
55
|
-
|
56
|
-
#define _SELF(value) RVAL2GFILEATTRIBUTEINFO(value)
|
57
|
-
|
58
|
-
#define GFILEATTRIBUTEINFOFLAGS2RVAL(value) \
|
59
|
-
GFLAGS2RVAL((value), G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS)
|
60
|
-
|
61
|
-
#define RVAL2GFILEATTRIBUTEINFOFLAGS(value) \
|
62
|
-
RVAL2GFLAGS((value), G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS)
|
63
|
-
|
64
|
-
#define RVAL2GFILEATTRIBUTEINFOFLAGSDEFAULT(value) \
|
65
|
-
RVAL2TYPE_WITH_DEFAULT((value), \
|
66
|
-
RVAL2GFILEATTRIBUTEINFOFLAGS, \
|
67
|
-
G_FILE_ATTRIBUTE_INFO_NONE)
|
68
|
-
|
69
|
-
static VALUE
|
70
|
-
fileattributeinfo_name(VALUE self)
|
71
|
-
{
|
72
|
-
return CSTR2RVAL(_SELF(self)->name);
|
73
|
-
}
|
74
|
-
|
75
|
-
static VALUE
|
76
|
-
fileattributeinfo_type(VALUE self)
|
77
|
-
{
|
78
|
-
return GFILEATTRIBUTETYPE2RVAL(_SELF(self)->type);
|
79
|
-
}
|
80
|
-
|
81
|
-
static VALUE
|
82
|
-
fileattributeinfo_flags(VALUE self)
|
83
|
-
{
|
84
|
-
return GFILEATTRIBUTEINFOFLAGS2RVAL(_SELF(self)->flags);
|
85
|
-
}
|
86
|
-
|
87
|
-
#undef _SELF
|
88
|
-
|
89
|
-
GType
|
90
|
-
g_file_attribute_info_list_get_type(void)
|
91
|
-
{
|
92
|
-
static GType our_type = 0;
|
93
|
-
if (our_type == 0)
|
94
|
-
our_type = g_boxed_type_register_static("GFileAttributeInfoList",
|
95
|
-
(GBoxedCopyFunc)g_file_attribute_info_list_ref,
|
96
|
-
(GBoxedFreeFunc)g_file_attribute_info_list_unref);
|
97
|
-
return our_type;
|
98
|
-
}
|
99
|
-
|
100
|
-
#define RVAL2GFILEATTRIBUTEINFOLIST(object) \
|
101
|
-
((GFileAttributeInfoList *)(RVAL2BOXED(object, G_TYPE_FILE_ATTRIBUTE_INFO_LIST)))
|
102
|
-
|
103
|
-
#define _SELF(value) RVAL2GFILEATTRIBUTEINFOLIST(value)
|
104
|
-
|
105
|
-
static VALUE
|
106
|
-
fileattributeinfolist_initialize(VALUE self)
|
107
|
-
{
|
108
|
-
G_INITIALIZE(self, g_file_attribute_info_list_new());
|
109
|
-
|
110
|
-
return Qnil;
|
111
|
-
}
|
112
|
-
|
113
|
-
static VALUE
|
114
|
-
fileattributeinfolist_dup(VALUE self)
|
115
|
-
{
|
116
|
-
return GFILEATTRIBUTEINFOLIST2RVAL(g_file_attribute_info_list_dup(_SELF(self)));
|
117
|
-
}
|
118
|
-
|
119
|
-
static VALUE
|
120
|
-
fileattributeinfolist_lookup(VALUE self, VALUE name)
|
121
|
-
{
|
122
|
-
/* TODO: How do we deal with the const? */
|
123
|
-
return GFILEATTRIBUTEINFO2RVAL((GFileAttributeInfo *)g_file_attribute_info_list_lookup(_SELF(self),
|
124
|
-
RVAL2CSTR(name)));
|
125
|
-
}
|
126
|
-
|
127
|
-
static VALUE
|
128
|
-
fileattributeinfolist_add(int argc, VALUE *argv, VALUE self)
|
129
|
-
{
|
130
|
-
VALUE name, type, flags;
|
131
|
-
|
132
|
-
rb_scan_args(argc, argv, "21", &name, &type, &flags);
|
133
|
-
|
134
|
-
g_file_attribute_info_list_add(_SELF(self),
|
135
|
-
RVAL2CSTR(name),
|
136
|
-
RVAL2GFILEATTRIBUTETYPE(type),
|
137
|
-
RVAL2GFILEATTRIBUTEINFOFLAGSDEFAULT(flags));
|
138
|
-
|
139
|
-
return self;
|
140
|
-
}
|
141
|
-
|
142
|
-
static VALUE
|
143
|
-
fileattributeinfolist_each(VALUE self)
|
144
|
-
{
|
145
|
-
GFileAttributeInfoList *list = RVAL2GFILEATTRIBUTEINFOLIST(self);
|
146
|
-
int i;
|
147
|
-
|
148
|
-
for (i = 0; i < list->n_infos; i++)
|
149
|
-
rb_yield(GFILEATTRIBUTEINFO2RVAL(&list->infos[i]));
|
150
|
-
|
151
|
-
return self;
|
152
|
-
}
|
153
|
-
|
154
23
|
void
|
155
24
|
Init_gfileattribute(VALUE glib)
|
156
25
|
{
|
157
|
-
VALUE fileattribute
|
26
|
+
VALUE fileattribute;
|
158
27
|
|
159
28
|
fileattribute = rb_define_module_under(glib, "FileAttribute");
|
160
29
|
|
@@ -231,33 +100,12 @@ Init_gfileattribute(VALUE glib)
|
|
231
100
|
rb_define_const(fileattribute, "GVFS_BACKEND", CSTR2RVAL(G_FILE_ATTRIBUTE_GVFS_BACKEND));
|
232
101
|
rb_define_const(fileattribute, "SELINUX_CONTEXT", CSTR2RVAL(G_FILE_ATTRIBUTE_SELINUX_CONTEXT));
|
233
102
|
rb_define_const(fileattribute, "TRASH_ITEM_COUNT", CSTR2RVAL(G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT));
|
103
|
+
rb_define_const(fileattribute, "TRASH_DELETION_DATE", CSTR2RVAL(G_FILE_ATTRIBUTE_TRASH_DELETION_DATE));
|
104
|
+
rb_define_const(fileattribute, "TRASH_ORIG_PATH", CSTR2RVAL(G_FILE_ATTRIBUTE_TRASH_ORIG_PATH));
|
234
105
|
|
235
106
|
G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_TYPE, "Type", fileattribute);
|
236
107
|
G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_TYPE, "G_FILE_ATTRIBUTE_");
|
237
108
|
|
238
|
-
G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "InfoFlags", fileattribute);
|
239
|
-
G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "G_FILE_ATTRIBUTE_");
|
240
|
-
|
241
109
|
G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_STATUS, "Status", fileattribute);
|
242
110
|
G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_STATUS, "G_FILE_ATTRIBUTE_");
|
243
|
-
|
244
|
-
fileattributeinfo = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO, "Info", fileattribute);
|
245
|
-
|
246
|
-
rb_undef_alloc_func(fileattributeinfo);
|
247
|
-
rbgobj_boxed_not_copy_obj(G_TYPE_FILE_ATTRIBUTE_INFO);
|
248
|
-
|
249
|
-
rb_define_method(fileattributeinfo, "name", fileattributeinfo_name, 0);
|
250
|
-
rb_define_method(fileattributeinfo, "type", fileattributeinfo_type, 0);
|
251
|
-
rb_define_method(fileattributeinfo, "flags", fileattributeinfo_flags, 0);
|
252
|
-
|
253
|
-
fileattributeinfolist = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO_LIST, "InfoList", fileattributeinfo);
|
254
|
-
|
255
|
-
rb_include_module(fileattributeinfolist, rb_mEnumerable);
|
256
|
-
|
257
|
-
rb_define_method(fileattributeinfolist, "initialize", fileattributeinfolist_initialize, 0);
|
258
|
-
rb_define_method(fileattributeinfolist, "dup", fileattributeinfolist_dup, 0);
|
259
|
-
rb_define_method(fileattributeinfolist, "lookup", fileattributeinfolist_lookup, 1);
|
260
|
-
rb_define_alias(fileattributeinfolist, "[]", "lookup");
|
261
|
-
rb_define_method(fileattributeinfolist, "add", fileattributeinfolist_add, 3);
|
262
|
-
rb_define_method(fileattributeinfolist, "each", fileattributeinfolist_each, 0);
|
263
111
|
}
|
Binary file
|
@@ -0,0 +1,89 @@
|
|
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
|
+
static GFileAttributeInfo *
|
24
|
+
fileattributeinfo_copy(const GFileAttributeInfo *info)
|
25
|
+
{
|
26
|
+
return (GFileAttributeInfo *)info;
|
27
|
+
}
|
28
|
+
|
29
|
+
static void
|
30
|
+
fileattributeinfo_free(G_GNUC_UNUSED GFileAttributeInfo *info)
|
31
|
+
{
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
GType
|
36
|
+
g_file_attribute_info_get_type(void)
|
37
|
+
{
|
38
|
+
static GType our_type = 0;
|
39
|
+
|
40
|
+
if (our_type == 0)
|
41
|
+
our_type = g_boxed_type_register_static("GFileAttributeInfo",
|
42
|
+
(GBoxedCopyFunc)fileattributeinfo_copy,
|
43
|
+
(GBoxedFreeFunc)fileattributeinfo_free);
|
44
|
+
|
45
|
+
return our_type;
|
46
|
+
}
|
47
|
+
|
48
|
+
#define RVAL2GFILEATTRIBUTEINFO(object) \
|
49
|
+
((GFileAttributeInfo *)(RVAL2BOXED(object, G_TYPE_FILE_ATTRIBUTE_INFO)))
|
50
|
+
|
51
|
+
#define _SELF(value) RVAL2GFILEATTRIBUTEINFO(value)
|
52
|
+
|
53
|
+
#define GFILEATTRIBUTEINFOFLAGS2RVAL(value) \
|
54
|
+
GFLAGS2RVAL((value), G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS)
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
fileattributeinfo_name(VALUE self)
|
58
|
+
{
|
59
|
+
return CSTR2RVAL(_SELF(self)->name);
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
fileattributeinfo_type(VALUE self)
|
64
|
+
{
|
65
|
+
return GFILEATTRIBUTETYPE2RVAL(_SELF(self)->type);
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
fileattributeinfo_flags(VALUE self)
|
70
|
+
{
|
71
|
+
return GFILEATTRIBUTEINFOFLAGS2RVAL(_SELF(self)->flags);
|
72
|
+
}
|
73
|
+
|
74
|
+
void
|
75
|
+
Init_gfileattributeinfo(VALUE glib)
|
76
|
+
{
|
77
|
+
VALUE fileattributeinfo;
|
78
|
+
|
79
|
+
fileattributeinfo = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO, "FileAttributeInfo", glib);
|
80
|
+
|
81
|
+
G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "Flags", fileattributeinfo);
|
82
|
+
G_DEF_CONSTANTS(fileattributeinfo, G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "G_FILE_ATTRIBUTE_INFO_");
|
83
|
+
|
84
|
+
rbgobj_boxed_not_copy_obj(G_TYPE_FILE_ATTRIBUTE_INFO);
|
85
|
+
|
86
|
+
rb_define_method(fileattributeinfo, "name", fileattributeinfo_name, 0);
|
87
|
+
rb_define_method(fileattributeinfo, "type", fileattributeinfo_type, 0);
|
88
|
+
rb_define_method(fileattributeinfo, "flags", fileattributeinfo_flags, 0);
|
89
|
+
}
|
Binary file
|