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,92 @@
|
|
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_INPUT_STREAM(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
fileinputstream_query_info(int argc, VALUE *argv, VALUE self)
|
28
|
+
{
|
29
|
+
VALUE attributes, cancellable;
|
30
|
+
GError *error = NULL;
|
31
|
+
GFileInfo *info;
|
32
|
+
|
33
|
+
rb_scan_args(argc, argv, "02", &attributes, &cancellable);
|
34
|
+
info = g_file_input_stream_query_info(_SELF(self),
|
35
|
+
RVAL2ATTRIBUTESDEFAULT(attributes),
|
36
|
+
RVAL2GCANCELLABLE(cancellable),
|
37
|
+
&error);
|
38
|
+
if (info == NULL)
|
39
|
+
rbgio_raise_error(error);
|
40
|
+
|
41
|
+
return GOBJ2RVAL_UNREF(info);
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
fileinputstream_query_info_async(int argc, VALUE *argv, VALUE self)
|
46
|
+
{
|
47
|
+
VALUE rbattributes, rbio_priority, rbcancellable, block;
|
48
|
+
const char *attributes;
|
49
|
+
int io_priority;
|
50
|
+
GCancellable *cancellable;
|
51
|
+
|
52
|
+
rb_scan_args(argc, argv, "03&", &rbattributes, &rbio_priority, &rbcancellable, &block);
|
53
|
+
attributes = RVAL2ATTRIBUTESDEFAULT(rbattributes);
|
54
|
+
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
55
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
56
|
+
SAVE_BLOCK(block);
|
57
|
+
g_file_input_stream_query_info_async(_SELF(self),
|
58
|
+
attributes,
|
59
|
+
io_priority,
|
60
|
+
cancellable,
|
61
|
+
rbgio_async_ready_callback,
|
62
|
+
(gpointer)block);
|
63
|
+
|
64
|
+
return self;
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
fileinputstream_query_info_finish(VALUE self, VALUE result)
|
69
|
+
{
|
70
|
+
GError *error = NULL;
|
71
|
+
GFileInfo *info;
|
72
|
+
|
73
|
+
info = g_file_input_stream_query_info_finish(_SELF(self),
|
74
|
+
RVAL2GASYNCRESULT(result),
|
75
|
+
&error);
|
76
|
+
if (info == NULL)
|
77
|
+
rbgio_raise_error(error);
|
78
|
+
|
79
|
+
return GOBJ2RVAL_UNREF(info);
|
80
|
+
}
|
81
|
+
|
82
|
+
void
|
83
|
+
Init_gfileinputstream(VALUE glib)
|
84
|
+
{
|
85
|
+
VALUE fileinputstream = G_DEF_CLASS(G_TYPE_FILE_INPUT_STREAM, "FileInputStream", glib);
|
86
|
+
|
87
|
+
rb_undef_alloc_func(fileinputstream);
|
88
|
+
|
89
|
+
rb_define_method(fileinputstream, "query_info", fileinputstream_query_info, -1);
|
90
|
+
rb_define_method(fileinputstream, "query_info_async", fileinputstream_query_info_async, -1);
|
91
|
+
rb_define_method(fileinputstream, "query_info_finish", fileinputstream_query_info_finish, 1);
|
92
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
2
|
+
/*
|
3
|
+
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
4
|
+
* Copyright (C) 2010 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_IO_STREAM(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
fileiostream_get_etag(VALUE self)
|
27
|
+
{
|
28
|
+
return CSTR2RVAL(g_file_io_stream_get_etag(_SELF(self)));
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
fileiostream_query_info(int argc, VALUE *argv, VALUE self)
|
33
|
+
{
|
34
|
+
VALUE attributes, cancellable;
|
35
|
+
GError *error = NULL;
|
36
|
+
GFileInfo *info;
|
37
|
+
|
38
|
+
rb_scan_args(argc, argv, "02", &attributes, &cancellable);
|
39
|
+
info = g_file_io_stream_query_info(_SELF(self),
|
40
|
+
RVAL2ATTRIBUTESDEFAULT(attributes),
|
41
|
+
RVAL2GCANCELLABLE(cancellable),
|
42
|
+
&error);
|
43
|
+
if (info == NULL)
|
44
|
+
rbgio_raise_error(error);
|
45
|
+
|
46
|
+
return GOBJ2RVAL_UNREF(info);
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
fileiostream_query_info_async(int argc, VALUE *argv, VALUE self)
|
51
|
+
{
|
52
|
+
VALUE rbattributes, rbio_priority, rbcancellable, block;
|
53
|
+
const char *attributes;
|
54
|
+
int io_priority;
|
55
|
+
GCancellable *cancellable;
|
56
|
+
|
57
|
+
rb_scan_args(argc, argv, "03&", &rbattributes, &rbio_priority, &rbcancellable, &block);
|
58
|
+
attributes = RVAL2ATTRIBUTESDEFAULT(rbattributes);
|
59
|
+
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
60
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
61
|
+
SAVE_BLOCK(block);
|
62
|
+
g_file_io_stream_query_info_async(_SELF(self),
|
63
|
+
attributes,
|
64
|
+
io_priority,
|
65
|
+
cancellable,
|
66
|
+
rbgio_async_ready_callback,
|
67
|
+
(gpointer)block);
|
68
|
+
|
69
|
+
return self;
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
fileiostream_query_info_finish(VALUE self, VALUE result)
|
74
|
+
{
|
75
|
+
GError *error = NULL;
|
76
|
+
GFileInfo *info;
|
77
|
+
|
78
|
+
info = g_file_io_stream_query_info_finish(_SELF(self),
|
79
|
+
RVAL2GASYNCRESULT(result),
|
80
|
+
&error);
|
81
|
+
if (info == NULL)
|
82
|
+
rbgio_raise_error(error);
|
83
|
+
|
84
|
+
return GOBJ2RVAL_UNREF(info);
|
85
|
+
}
|
86
|
+
|
87
|
+
void
|
88
|
+
Init_gfileiostream(VALUE glib)
|
89
|
+
{
|
90
|
+
VALUE fileiostream = G_DEF_CLASS(G_TYPE_FILE_IO_STREAM, "FileIOStream", glib);
|
91
|
+
|
92
|
+
rb_undef_alloc_func(fileiostream);
|
93
|
+
|
94
|
+
rb_define_method(fileiostream, "etag", fileiostream_get_etag, 0);
|
95
|
+
rb_define_method(fileiostream, "query_info", fileiostream_query_info, -1);
|
96
|
+
rb_define_method(fileiostream, "query_info_async", fileiostream_query_info_async, -1);
|
97
|
+
rb_define_method(fileiostream, "query_info_finish", fileiostream_query_info_finish, 1);
|
98
|
+
}
|
@@ -0,0 +1,63 @@
|
|
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_MONITOR(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
filemonitor_cancel(VALUE self)
|
27
|
+
{
|
28
|
+
return CBOOL2RVAL(g_file_monitor_cancel(_SELF(self)));
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
filemonitor_is_cancelled(VALUE self)
|
33
|
+
{
|
34
|
+
return CBOOL2RVAL(g_file_monitor_is_cancelled(_SELF(self)));
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
filemonitor_set_rate_limit(VALUE self, VALUE rate_limit)
|
39
|
+
{
|
40
|
+
g_file_monitor_set_rate_limit(_SELF(self), FIX2INT(rate_limit));
|
41
|
+
|
42
|
+
return self;
|
43
|
+
}
|
44
|
+
|
45
|
+
void
|
46
|
+
Init_gfilemonitor(VALUE glib)
|
47
|
+
{
|
48
|
+
VALUE filemonitor = G_DEF_CLASS(G_TYPE_FILE_MONITOR, "FileMonitor", glib);
|
49
|
+
|
50
|
+
G_DEF_CLASS(G_TYPE_FILE_MONITOR_EVENT, "Event", filemonitor);
|
51
|
+
G_DEF_CONSTANTS(filemonitor, G_TYPE_FILE_MONITOR_EVENT, "G_FILE_MONITOR_");
|
52
|
+
|
53
|
+
G_DEF_CLASS(G_TYPE_FILE_MONITOR_FLAGS, "Flags", filemonitor);
|
54
|
+
G_DEF_CONSTANTS(filemonitor, G_TYPE_FILE_MONITOR_FLAGS, "G_FILE_MONITOR_");
|
55
|
+
|
56
|
+
rb_undef_alloc_func(filemonitor);
|
57
|
+
|
58
|
+
rb_define_method(filemonitor, "cancel", filemonitor_cancel, 0);
|
59
|
+
rb_define_method(filemonitor, "cancelled?", filemonitor_is_cancelled, 0);
|
60
|
+
rb_define_method(filemonitor, "set_rate_limit", filemonitor_set_rate_limit, 1);
|
61
|
+
G_DEF_SETTER(filemonitor, "rate_limit");
|
62
|
+
/* TODO: Do we need #emit_event? */
|
63
|
+
}
|
@@ -0,0 +1,72 @@
|
|
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_FILENAME_COMPLETER(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
filenamecompleter_initialize(int argc, VALUE *argv, VALUE self)
|
27
|
+
{
|
28
|
+
VALUE dirs_only;
|
29
|
+
GFilenameCompleter *completer;
|
30
|
+
|
31
|
+
rb_scan_args(argc, argv, "01", &dirs_only);
|
32
|
+
completer = g_filename_completer_new();
|
33
|
+
g_filename_completer_set_dirs_only(completer, RVAL2CBOOL(dirs_only));
|
34
|
+
|
35
|
+
G_INITIALIZE(self, completer);
|
36
|
+
|
37
|
+
return Qnil;
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE
|
41
|
+
filenamecompleter_get_completion_suffix(VALUE self, VALUE initial_text)
|
42
|
+
{
|
43
|
+
return CSTR2RVAL_FREE(g_filename_completer_get_completion_suffix(_SELF(self),
|
44
|
+
RVAL2CSTR(initial_text)));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
filenamecompleter_get_completions(VALUE self, VALUE initial_text)
|
49
|
+
{
|
50
|
+
return STRVECTOR2ARY_FREE(g_filename_completer_get_completions(_SELF(self),
|
51
|
+
RVAL2CSTR(initial_text)));
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
filenamecompleter_set_dirs_only(VALUE self, VALUE dirs_only)
|
56
|
+
{
|
57
|
+
g_filename_completer_set_dirs_only(_SELF(self), RVAL2CBOOL(dirs_only));
|
58
|
+
|
59
|
+
return self;
|
60
|
+
}
|
61
|
+
|
62
|
+
void
|
63
|
+
Init_gfilenamecompleter(VALUE glib)
|
64
|
+
{
|
65
|
+
VALUE filenamecompleter = G_DEF_CLASS(G_TYPE_FILENAME_COMPLETER, "FilenameCompleter", glib);
|
66
|
+
|
67
|
+
rb_define_method(filenamecompleter, "initialize", filenamecompleter_initialize, -1);
|
68
|
+
rb_define_method(filenamecompleter, "get_completion_suffix", filenamecompleter_get_completion_suffix, 1);
|
69
|
+
rb_define_method(filenamecompleter, "get_completions", filenamecompleter_get_completions, 1);
|
70
|
+
rb_define_method(filenamecompleter, "set_dirs_only", filenamecompleter_set_dirs_only, 1);
|
71
|
+
G_DEF_SETTER(filenamecompleter, "dirs_only");
|
72
|
+
}
|
@@ -0,0 +1,100 @@
|
|
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_OUTPUT_STREAM(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
fileoutputstream_query_info(int argc, VALUE *argv, VALUE self)
|
27
|
+
{
|
28
|
+
VALUE attributes, cancellable;
|
29
|
+
GError *error = NULL;
|
30
|
+
GFileInfo *info;
|
31
|
+
|
32
|
+
rb_scan_args(argc, argv, "02", &attributes, &cancellable);
|
33
|
+
info = g_file_output_stream_query_info(_SELF(self),
|
34
|
+
RVAL2ATTRIBUTESDEFAULT(attributes),
|
35
|
+
RVAL2GCANCELLABLE(cancellable),
|
36
|
+
&error);
|
37
|
+
if (info == NULL)
|
38
|
+
rbgio_raise_error(error);
|
39
|
+
|
40
|
+
return GOBJ2RVAL_UNREF(info);
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
fileoutputstream_query_info_async(int argc, VALUE *argv, VALUE self)
|
45
|
+
{
|
46
|
+
VALUE rbattributes, rbio_priority, rbcancellable, block;
|
47
|
+
const char *attributes;
|
48
|
+
int io_priority;
|
49
|
+
GCancellable *cancellable;
|
50
|
+
|
51
|
+
rb_scan_args(argc, argv, "03&", &rbattributes, &rbio_priority, &rbcancellable, &block);
|
52
|
+
attributes = RVAL2ATTRIBUTESDEFAULT(rbattributes);
|
53
|
+
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
54
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
55
|
+
SAVE_BLOCK(block);
|
56
|
+
g_file_output_stream_query_info_async(_SELF(self),
|
57
|
+
attributes,
|
58
|
+
io_priority,
|
59
|
+
cancellable,
|
60
|
+
rbgio_async_ready_callback,
|
61
|
+
(gpointer)block);
|
62
|
+
|
63
|
+
return self;
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE
|
67
|
+
fileoutputstream_query_info_finish(VALUE self, VALUE result)
|
68
|
+
{
|
69
|
+
GError *error = NULL;
|
70
|
+
GFileInfo *info;
|
71
|
+
|
72
|
+
info = g_file_output_stream_query_info_finish(_SELF(self),
|
73
|
+
RVAL2GASYNCRESULT(result),
|
74
|
+
&error);
|
75
|
+
if (info == NULL)
|
76
|
+
rbgio_raise_error(error);
|
77
|
+
|
78
|
+
return GOBJ2RVAL_UNREF(info);
|
79
|
+
}
|
80
|
+
|
81
|
+
static VALUE
|
82
|
+
fileoutputstream_get_etag(VALUE self)
|
83
|
+
{
|
84
|
+
return CSTR2RVAL(g_file_output_stream_get_etag(_SELF(self)));
|
85
|
+
}
|
86
|
+
|
87
|
+
void
|
88
|
+
Init_gfileoutputstream(VALUE glib)
|
89
|
+
{
|
90
|
+
VALUE fileoutputstream = G_DEF_CLASS(G_TYPE_FILE_OUTPUT_STREAM,
|
91
|
+
"FileOutputStream",
|
92
|
+
glib);
|
93
|
+
|
94
|
+
rb_undef_alloc_func(fileoutputstream);
|
95
|
+
|
96
|
+
rb_define_method(fileoutputstream, "query_info", fileoutputstream_query_info, -1);
|
97
|
+
rb_define_method(fileoutputstream, "query_info_async", fileoutputstream_query_info_async, -1);
|
98
|
+
rb_define_method(fileoutputstream, "query_info_finish", fileoutputstream_query_info_finish, 1);
|
99
|
+
rb_define_method(fileoutputstream, "etag", fileoutputstream_get_etag, 0);
|
100
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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_FILTER_INPUT_STREAM(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
filterinputstream_get_base_stream(VALUE self)
|
27
|
+
{
|
28
|
+
return GOBJ2RVAL(g_filter_input_stream_get_base_stream(_SELF(self)));
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
filterinputstream_get_close_base_stream(VALUE self)
|
33
|
+
{
|
34
|
+
return CBOOL2RVAL(g_filter_input_stream_get_close_base_stream(_SELF(self)));
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
filterinputstream_set_close_base_stream(VALUE self, VALUE close_base)
|
39
|
+
{
|
40
|
+
g_filter_input_stream_set_close_base_stream(_SELF(self), RVAL2CBOOL(close_base));
|
41
|
+
|
42
|
+
return self;
|
43
|
+
}
|
44
|
+
|
45
|
+
void
|
46
|
+
Init_gfilterinputstream(VALUE glib)
|
47
|
+
{
|
48
|
+
VALUE filterinputstream = G_DEF_CLASS(G_TYPE_FILTER_INPUT_STREAM, "FilterInputStream", glib);
|
49
|
+
|
50
|
+
rb_undef_alloc_func(filterinputstream);
|
51
|
+
|
52
|
+
rb_define_method(filterinputstream, "base_stream", filterinputstream_get_base_stream, 0);
|
53
|
+
rb_define_method(filterinputstream, "close_base_stream?", filterinputstream_get_close_base_stream, 0);
|
54
|
+
rb_define_method(filterinputstream, "set_close_base_stream", filterinputstream_set_close_base_stream, 1);
|
55
|
+
G_DEF_SETTER(filterinputstream, "close_base_stream");
|
56
|
+
}
|