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,65 @@
|
|
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_MEMORY_OUTPUT_STREAM(RVAL2GOBJ(value))
|
24
|
+
|
25
|
+
/* TODO: Take string argument? */
|
26
|
+
static VALUE
|
27
|
+
memoryoutputstream_initialize(VALUE self)
|
28
|
+
{
|
29
|
+
G_INITIALIZE(self, g_memory_output_stream_new(NULL,
|
30
|
+
0,
|
31
|
+
g_realloc,
|
32
|
+
g_free));
|
33
|
+
|
34
|
+
return Qnil;
|
35
|
+
}
|
36
|
+
|
37
|
+
/* TODO: Is there a way to avoid duplicating the result? */
|
38
|
+
static VALUE
|
39
|
+
memoryoutputstream_get_data(VALUE self)
|
40
|
+
{
|
41
|
+
return CSTR2RVAL(g_memory_output_stream_get_data(_SELF(self)));
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
memoryoutputstream_get_size(VALUE self)
|
46
|
+
{
|
47
|
+
return GSIZE2RVAL(g_memory_output_stream_get_size(_SELF(self)));
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
memoryoutputstream_get_data_size(VALUE self)
|
52
|
+
{
|
53
|
+
return GSIZE2RVAL(g_memory_output_stream_get_data_size(_SELF(self)));
|
54
|
+
}
|
55
|
+
|
56
|
+
void
|
57
|
+
Init_gmemoryoutputstream(VALUE glib)
|
58
|
+
{
|
59
|
+
VALUE memoryoutputstream = G_DEF_CLASS(G_TYPE_MEMORY_OUTPUT_STREAM, "MemoryOutputStream", glib);
|
60
|
+
|
61
|
+
rb_define_method(memoryoutputstream, "initialize", memoryoutputstream_initialize, 0);
|
62
|
+
rb_define_method(memoryoutputstream, "data", memoryoutputstream_get_data, 0);
|
63
|
+
rb_define_method(memoryoutputstream, "size", memoryoutputstream_get_size, 0);
|
64
|
+
rb_define_method(memoryoutputstream, "data_size", memoryoutputstream_get_data_size, 0);
|
65
|
+
}
|
data/ext/gio2/gmount.c
ADDED
@@ -0,0 +1,283 @@
|
|
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) RVAL2GMOUNT(value)
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
mount_get_name(VALUE self)
|
27
|
+
{
|
28
|
+
return CSTR2RVAL_FREE(g_mount_get_name(_SELF(self)));
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
mount_get_uuid(VALUE self)
|
33
|
+
{
|
34
|
+
return CSTR2RVAL_FREE(g_mount_get_uuid(_SELF(self)));
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
mount_get_icon(VALUE self)
|
39
|
+
{
|
40
|
+
return GOBJ2RVAL_UNREF(g_mount_get_icon(_SELF(self)));
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
mount_get_drive(VALUE self)
|
45
|
+
{
|
46
|
+
return GOBJ2RVAL_UNREF(g_mount_get_drive(_SELF(self)));
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
mount_get_root(VALUE self)
|
51
|
+
{
|
52
|
+
return GOBJ2RVAL_UNREF(g_mount_get_root(_SELF(self)));
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
mount_get_volume(VALUE self)
|
57
|
+
{
|
58
|
+
return GOBJ2RVAL_UNREF(g_mount_get_volume(_SELF(self)));
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
mount_get_default_location(VALUE self)
|
63
|
+
{
|
64
|
+
return GOBJ2RVAL_UNREF(g_mount_get_default_location(_SELF(self)));
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
mount_can_unmount(VALUE self)
|
69
|
+
{
|
70
|
+
return CBOOL2RVAL(g_mount_can_unmount(_SELF(self)));
|
71
|
+
}
|
72
|
+
|
73
|
+
typedef void (*UnmountEjectMethod)(GMount *,
|
74
|
+
GMountUnmountFlags,
|
75
|
+
GMountOperation *,
|
76
|
+
GCancellable *,
|
77
|
+
GAsyncReadyCallback,
|
78
|
+
gpointer);
|
79
|
+
|
80
|
+
static VALUE
|
81
|
+
unmount_eject_method(UnmountEjectMethod method, int argc, VALUE *argv, VALUE self)
|
82
|
+
{
|
83
|
+
VALUE rbflags, rbmount_operation, rbcancellable, block;
|
84
|
+
GMountUnmountFlags flags;
|
85
|
+
GMountOperation *mount_operation;
|
86
|
+
GCancellable *cancellable;
|
87
|
+
|
88
|
+
rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
|
89
|
+
flags = RVAL2GMOUNTUNMOUNTFLAGSDEFAULT(rbflags);
|
90
|
+
mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
|
91
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
92
|
+
SAVE_BLOCK(block);
|
93
|
+
method(_SELF(self),
|
94
|
+
flags,
|
95
|
+
mount_operation,
|
96
|
+
cancellable,
|
97
|
+
rbgio_async_ready_callback,
|
98
|
+
(gpointer)block);
|
99
|
+
|
100
|
+
return self;
|
101
|
+
}
|
102
|
+
|
103
|
+
static VALUE
|
104
|
+
mount_unmount_with_operation(int argc, VALUE *argv, VALUE self)
|
105
|
+
{
|
106
|
+
return unmount_eject_method(g_mount_unmount_with_operation, argc, argv, self);
|
107
|
+
}
|
108
|
+
|
109
|
+
typedef gboolean (*BooleanFinishMethod)(GMount *,
|
110
|
+
GAsyncResult *,
|
111
|
+
GError **);
|
112
|
+
|
113
|
+
static VALUE
|
114
|
+
boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
|
115
|
+
{
|
116
|
+
GError *error = NULL;
|
117
|
+
|
118
|
+
if (!method(_SELF(self), RVAL2GASYNCRESULT(result), &error))
|
119
|
+
rbgio_raise_error(error);
|
120
|
+
|
121
|
+
return self;
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
mount_unmount_with_operation_finish(VALUE self, VALUE result)
|
126
|
+
{
|
127
|
+
return boolean_finish_method(g_mount_unmount_with_operation_finish, self, result);
|
128
|
+
}
|
129
|
+
|
130
|
+
static VALUE
|
131
|
+
mount_remount(int argc, VALUE *argv, VALUE self)
|
132
|
+
{
|
133
|
+
VALUE rbflags, rbmount_operation, rbcancellable, block;
|
134
|
+
GMountMountFlags flags;
|
135
|
+
GMountOperation *mount_operation;
|
136
|
+
GCancellable *cancellable;
|
137
|
+
|
138
|
+
rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
|
139
|
+
flags = RVAL2GMOUNTMOUNTFLAGSDEFAULT(rbflags);
|
140
|
+
mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
|
141
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
142
|
+
SAVE_BLOCK(block);
|
143
|
+
g_mount_remount(_SELF(self),
|
144
|
+
flags,
|
145
|
+
mount_operation,
|
146
|
+
cancellable,
|
147
|
+
rbgio_async_ready_callback,
|
148
|
+
(gpointer)block);
|
149
|
+
|
150
|
+
return self;
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
mount_remount_finish(VALUE self, VALUE result)
|
155
|
+
{
|
156
|
+
return boolean_finish_method(g_mount_remount_finish, self, result);
|
157
|
+
}
|
158
|
+
|
159
|
+
static VALUE
|
160
|
+
mount_can_eject(VALUE self)
|
161
|
+
{
|
162
|
+
return CBOOL2RVAL(g_mount_can_eject(_SELF(self)));
|
163
|
+
}
|
164
|
+
|
165
|
+
static VALUE
|
166
|
+
mount_eject_with_operation(int argc, VALUE *argv, VALUE self)
|
167
|
+
{
|
168
|
+
return unmount_eject_method(g_mount_eject_with_operation, argc, argv, self);
|
169
|
+
}
|
170
|
+
|
171
|
+
static VALUE
|
172
|
+
mount_eject_with_operation_finish(VALUE self, VALUE result)
|
173
|
+
{
|
174
|
+
return boolean_finish_method(g_mount_eject_with_operation_finish, self, result);
|
175
|
+
}
|
176
|
+
|
177
|
+
static VALUE
|
178
|
+
mount_guess_content_type(int argc, VALUE *argv, VALUE self)
|
179
|
+
{
|
180
|
+
VALUE rbforce_rescan, rbcancellable, block;
|
181
|
+
gboolean force_rescan;
|
182
|
+
GCancellable *cancellable;
|
183
|
+
|
184
|
+
rb_scan_args(argc, argv, "02&", &rbforce_rescan, &rbcancellable, &block);
|
185
|
+
force_rescan = RVAL2CBOOL(rbforce_rescan);
|
186
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
187
|
+
SAVE_BLOCK(block);
|
188
|
+
g_mount_guess_content_type(_SELF(self),
|
189
|
+
force_rescan,
|
190
|
+
cancellable,
|
191
|
+
rbgio_async_ready_callback,
|
192
|
+
(gpointer)block);
|
193
|
+
|
194
|
+
return self;
|
195
|
+
}
|
196
|
+
|
197
|
+
static VALUE
|
198
|
+
mount_guess_content_type_finish(VALUE self, VALUE result)
|
199
|
+
{
|
200
|
+
GError *error = NULL;
|
201
|
+
gchar **content_types;
|
202
|
+
|
203
|
+
content_types = g_mount_guess_content_type_finish(_SELF(self),
|
204
|
+
RVAL2GASYNCRESULT(result),
|
205
|
+
&error);
|
206
|
+
if (content_types == NULL)
|
207
|
+
rbgio_raise_error(error);
|
208
|
+
|
209
|
+
return STRVECTOR2ARY_FREE(content_types);
|
210
|
+
}
|
211
|
+
|
212
|
+
static VALUE
|
213
|
+
mount_guess_content_type_sync(int argc, VALUE *argv, VALUE self)
|
214
|
+
{
|
215
|
+
VALUE force_rescan, cancellable;
|
216
|
+
GError *error = NULL;
|
217
|
+
gchar **content_types;
|
218
|
+
|
219
|
+
rb_scan_args(argc, argv, "02", &force_rescan, &cancellable);
|
220
|
+
content_types = g_mount_guess_content_type_sync(_SELF(self),
|
221
|
+
RVAL2CBOOL(force_rescan),
|
222
|
+
RVAL2GCANCELLABLE(cancellable),
|
223
|
+
&error);
|
224
|
+
if (content_types == NULL)
|
225
|
+
rbgio_raise_error(error);
|
226
|
+
|
227
|
+
return STRVECTOR2ARY_FREE(content_types);
|
228
|
+
}
|
229
|
+
|
230
|
+
static VALUE
|
231
|
+
mount_is_shadowed(VALUE self)
|
232
|
+
{
|
233
|
+
return CBOOL2RVAL(g_mount_is_shadowed(_SELF(self)));
|
234
|
+
}
|
235
|
+
|
236
|
+
static VALUE
|
237
|
+
mount_shadow(VALUE self)
|
238
|
+
{
|
239
|
+
g_mount_shadow(_SELF(self));
|
240
|
+
|
241
|
+
return self;
|
242
|
+
}
|
243
|
+
|
244
|
+
static VALUE
|
245
|
+
mount_unshadow(VALUE self)
|
246
|
+
{
|
247
|
+
g_mount_unshadow(_SELF(self));
|
248
|
+
|
249
|
+
return self;
|
250
|
+
}
|
251
|
+
|
252
|
+
void
|
253
|
+
Init_gmount(VALUE glib)
|
254
|
+
{
|
255
|
+
VALUE mount = G_DEF_INTERFACE(G_TYPE_MOUNT, "Mount", glib);
|
256
|
+
|
257
|
+
G_DEF_CLASS(G_TYPE_MOUNT_MOUNT_FLAGS, "MountFlags", mount);
|
258
|
+
G_DEF_CONSTANTS(mount, G_TYPE_MOUNT_MOUNT_FLAGS, "G_MOUNT_");
|
259
|
+
G_DEF_CLASS(G_TYPE_MOUNT_UNMOUNT_FLAGS, "UnmountFlags", mount);
|
260
|
+
G_DEF_CONSTANTS(mount, G_TYPE_MOUNT_UNMOUNT_FLAGS, "G_MOUNT_");
|
261
|
+
|
262
|
+
rb_define_method(mount, "name", mount_get_name, 0);
|
263
|
+
rb_define_method(mount, "uuid", mount_get_uuid, 0);
|
264
|
+
rb_define_method(mount, "icon", mount_get_icon, 0);
|
265
|
+
rb_define_method(mount, "drive", mount_get_drive, 0);
|
266
|
+
rb_define_method(mount, "root", mount_get_root, 0);
|
267
|
+
rb_define_method(mount, "volume", mount_get_volume, 0);
|
268
|
+
rb_define_method(mount, "default_location", mount_get_default_location, 0);
|
269
|
+
rb_define_method(mount, "can_unmount?", mount_can_unmount, 0);
|
270
|
+
rb_define_method(mount, "unmount_with_operation", mount_unmount_with_operation, -1);
|
271
|
+
rb_define_method(mount, "unmount_with_operation_finish", mount_unmount_with_operation_finish, 1);
|
272
|
+
rb_define_method(mount, "remount", mount_remount, -1);
|
273
|
+
rb_define_method(mount, "remount_finish", mount_remount_finish, 1);
|
274
|
+
rb_define_method(mount, "can_eject?", mount_can_eject, 0);
|
275
|
+
rb_define_method(mount, "eject_with_operation", mount_eject_with_operation, -1);
|
276
|
+
rb_define_method(mount, "eject_with_operation_finish", mount_eject_with_operation_finish, 1);
|
277
|
+
rb_define_method(mount, "guess_content_type", mount_guess_content_type, -1);
|
278
|
+
rb_define_method(mount, "guess_content_type_finish", mount_guess_content_type_finish, 1);
|
279
|
+
rb_define_method(mount, "guess_content_type_sync", mount_guess_content_type_sync, -1);
|
280
|
+
rb_define_method(mount, "shadowed?", mount_is_shadowed, 0);
|
281
|
+
rb_define_method(mount, "shadow", mount_shadow, 0);
|
282
|
+
rb_define_method(mount, "unshadow", mount_unshadow, 0);
|
283
|
+
}
|
@@ -0,0 +1,168 @@
|
|
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) RVAL2GMOUNTOPERATION(value)
|
24
|
+
|
25
|
+
#define GPASSWORDSAVE2RVAL(value) \
|
26
|
+
GENUM2RVAL((value), G_TYPE_PASSWORD_SAVE)
|
27
|
+
|
28
|
+
#define RVAL2GPASSWORDSAVE(value) \
|
29
|
+
RVAL2GENUM((value), G_TYPE_PASSWORD_SAVE)
|
30
|
+
|
31
|
+
#define RVAL2GMOUNTOPERATIONRESULT(value) \
|
32
|
+
RVAL2GENUM((value), G_TYPE_MOUNT_OPERATION_RESULT)
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
mountoperation_initialize(VALUE self)
|
36
|
+
{
|
37
|
+
G_INITIALIZE(self, g_mount_operation_new());
|
38
|
+
|
39
|
+
return Qnil;
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE
|
43
|
+
mountoperation_get_username(VALUE self)
|
44
|
+
{
|
45
|
+
return CSTR2RVAL(g_mount_operation_get_username(_SELF(self)));
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
mountoperation_set_username(VALUE self, VALUE value)
|
50
|
+
{
|
51
|
+
g_mount_operation_set_username(_SELF(self), RVAL2CSTR(value));
|
52
|
+
|
53
|
+
return self;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
mountoperation_get_password(VALUE self)
|
58
|
+
{
|
59
|
+
return CSTR2RVAL(g_mount_operation_get_password(_SELF(self)));
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
mountoperation_set_password(VALUE self, VALUE value)
|
64
|
+
{
|
65
|
+
g_mount_operation_set_password(_SELF(self), RVAL2CSTR(value));
|
66
|
+
|
67
|
+
return self;
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
mountoperation_get_anonymous(VALUE self)
|
72
|
+
{
|
73
|
+
return CBOOL2RVAL(g_mount_operation_get_anonymous(_SELF(self)));
|
74
|
+
}
|
75
|
+
|
76
|
+
static VALUE
|
77
|
+
mountoperation_set_anonymous(VALUE self, VALUE value)
|
78
|
+
{
|
79
|
+
g_mount_operation_set_anonymous(_SELF(self), RVAL2CBOOL(value));
|
80
|
+
|
81
|
+
return self;
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
mountoperation_get_domain(VALUE self)
|
86
|
+
{
|
87
|
+
return CSTR2RVAL(g_mount_operation_get_domain(_SELF(self)));
|
88
|
+
}
|
89
|
+
|
90
|
+
static VALUE
|
91
|
+
mountoperation_set_domain(VALUE self, VALUE value)
|
92
|
+
{
|
93
|
+
g_mount_operation_set_domain(_SELF(self), RVAL2CSTR(value));
|
94
|
+
|
95
|
+
return self;
|
96
|
+
}
|
97
|
+
|
98
|
+
static VALUE
|
99
|
+
mountoperation_get_password_save(VALUE self)
|
100
|
+
{
|
101
|
+
return GPASSWORDSAVE2RVAL(g_mount_operation_get_password_save(_SELF(self)));
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
mountoperation_set_password_save(VALUE self, VALUE value)
|
106
|
+
{
|
107
|
+
g_mount_operation_set_password_save(_SELF(self), RVAL2GPASSWORDSAVE(value));
|
108
|
+
|
109
|
+
return self;
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
mountoperation_get_choice(VALUE self)
|
114
|
+
{
|
115
|
+
return INT2NUM(g_mount_operation_get_choice(_SELF(self)));
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
mountoperation_set_choice(VALUE self, VALUE value)
|
120
|
+
{
|
121
|
+
g_mount_operation_set_choice(_SELF(self), NUM2INT(value));
|
122
|
+
|
123
|
+
return self;
|
124
|
+
}
|
125
|
+
|
126
|
+
static VALUE
|
127
|
+
mountoperation_reply(VALUE self, VALUE value)
|
128
|
+
{
|
129
|
+
g_mount_operation_reply(_SELF(self), RVAL2GMOUNTOPERATIONRESULT(value));
|
130
|
+
|
131
|
+
return self;
|
132
|
+
}
|
133
|
+
|
134
|
+
void
|
135
|
+
Init_gmountoperation(VALUE glib)
|
136
|
+
{
|
137
|
+
VALUE mountoperation = G_DEF_CLASS(G_TYPE_MOUNT_OPERATION, "MountOperation", glib);
|
138
|
+
|
139
|
+
/* TODO: Are these necessary? */
|
140
|
+
G_DEF_CLASS(G_TYPE_MOUNT_OPERATION_RESULT, "Result", mountoperation);
|
141
|
+
G_DEF_CONSTANTS(mountoperation, G_TYPE_MOUNT_OPERATION_RESULT, "G_MOUNT_OPERATION_");
|
142
|
+
|
143
|
+
G_DEF_CLASS(G_TYPE_ASK_PASSWORD_FLAGS, "AskPasswordFlags", glib);
|
144
|
+
G_DEF_CONSTANTS(glib, G_TYPE_ASK_PASSWORD_FLAGS, "G_");
|
145
|
+
G_DEF_CLASS(G_TYPE_PASSWORD_SAVE, "PasswordSave", glib);
|
146
|
+
G_DEF_CONSTANTS(glib, G_TYPE_PASSWORD_SAVE, "G_");
|
147
|
+
|
148
|
+
rb_define_method(mountoperation, "initialize", mountoperation_initialize, 0);
|
149
|
+
rb_define_method(mountoperation, "username", mountoperation_get_username, 0);
|
150
|
+
rb_define_method(mountoperation, "set_username", mountoperation_set_username, 1);
|
151
|
+
G_DEF_SETTER(mountoperation, "username");
|
152
|
+
rb_define_method(mountoperation, "password", mountoperation_get_password, 0);
|
153
|
+
rb_define_method(mountoperation, "set_password", mountoperation_set_password, 1);
|
154
|
+
G_DEF_SETTER(mountoperation, "password");
|
155
|
+
rb_define_method(mountoperation, "anonymous", mountoperation_get_anonymous, 0);
|
156
|
+
rb_define_method(mountoperation, "set_anonymous", mountoperation_set_anonymous, 1);
|
157
|
+
G_DEF_SETTER(mountoperation, "anonymous");
|
158
|
+
rb_define_method(mountoperation, "domain", mountoperation_get_domain, 0);
|
159
|
+
rb_define_method(mountoperation, "set_domain", mountoperation_set_domain, 1);
|
160
|
+
G_DEF_SETTER(mountoperation, "domain");
|
161
|
+
rb_define_method(mountoperation, "password_save", mountoperation_get_password_save, 0);
|
162
|
+
rb_define_method(mountoperation, "set_password_save", mountoperation_set_password_save, 1);
|
163
|
+
G_DEF_SETTER(mountoperation, "password_save");
|
164
|
+
rb_define_method(mountoperation, "choice", mountoperation_get_choice, 0);
|
165
|
+
rb_define_method(mountoperation, "set_choice", mountoperation_set_choice, 1);
|
166
|
+
G_DEF_SETTER(mountoperation, "choice");
|
167
|
+
rb_define_method(mountoperation, "reply", mountoperation_reply, 1);
|
168
|
+
}
|