gio2 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +26 -9
  3. data/ext/gio2/extconf.rb +38 -28
  4. data/ext/gio2/rb-gio2-pollable-source.c +59 -0
  5. data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
  6. data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
  7. data/extconf.rb +22 -6
  8. data/lib/1.9/gio2.so +0 -0
  9. data/lib/2.0/gio2.so +0 -0
  10. data/lib/2.1/gio2.so +0 -0
  11. data/lib/gio2/deprecated.rb +16 -0
  12. data/lib/gio2/inet-address.rb +33 -0
  13. data/lib/gio2/input-stream.rb +39 -0
  14. data/lib/gio2/loader.rb +244 -0
  15. data/lib/gio2/output-stream.rb +24 -0
  16. data/lib/gio2/pollable-input-stream.rb +51 -0
  17. data/lib/gio2/pollable-output-stream.rb +32 -0
  18. data/lib/gio2/resources.rb +62 -0
  19. data/lib/gio2.rb +38 -143
  20. data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
  21. data/test/fixture/resource/Rakefile +32 -0
  22. data/test/fixture/resource/logo.png +0 -0
  23. data/test/fixture/resource/ruby-gio2.gresource +0 -0
  24. data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
  25. data/test/gio2-test-utils/fixture.rb +24 -0
  26. data/test/gio2-test-utils/socket-client.rb +59 -0
  27. data/test/gio2-test-utils.rb +21 -0
  28. data/test/run-test.rb +45 -9
  29. data/test/test-buffered-input-stream.rb +23 -0
  30. data/test/test-charset-converter.rb +23 -0
  31. data/test/test-content-type.rb +31 -0
  32. data/test/test-data-input-stream.rb +21 -0
  33. data/test/test-file-enumerator.rb +26 -0
  34. data/test/test-file-monitor.rb +33 -0
  35. data/test/test-file.rb +28 -0
  36. data/test/test-inet-address.rb +34 -0
  37. data/test/test-input-stream.rb +36 -0
  38. data/test/test-output-stream.rb +39 -0
  39. data/test/test-pollable-input-stream.rb +54 -0
  40. data/test/test-pollable-output-stream.rb +53 -0
  41. data/test/test-resources.rb +58 -0
  42. metadata +49 -107
  43. data/README +0 -34
  44. data/ext/gio2/depend +0 -11
  45. data/ext/gio2/gio2.def +0 -2
  46. data/ext/gio2/gio2.h +0 -30
  47. data/ext/gio2/rbgio.c +0 -133
  48. data/ext/gio2/rbgio2.h +0 -158
  49. data/ext/gio2/rbgio2conversions.h +0 -154
  50. data/ext/gio2/rbgio2private.h +0 -148
  51. data/ext/gio2/rbgioappinfo.c +0 -317
  52. data/ext/gio2/rbgioapplaunchcontext.c +0 -81
  53. data/ext/gio2/rbgioasyncinitable.c +0 -246
  54. data/ext/gio2/rbgioasyncresult.c +0 -41
  55. data/ext/gio2/rbgiobufferedinputstream.c +0 -167
  56. data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
  57. data/ext/gio2/rbgiocancellable.c +0 -180
  58. data/ext/gio2/rbgiocharsetconverter.c +0 -57
  59. data/ext/gio2/rbgiocontenttype.c +0 -131
  60. data/ext/gio2/rbgioconverter.c +0 -113
  61. data/ext/gio2/rbgioconverterinputstream.c +0 -43
  62. data/ext/gio2/rbgioconverteroutputstream.c +0 -43
  63. data/ext/gio2/rbgiodatainputstream.c +0 -309
  64. data/ext/gio2/rbgiodataoutputstream.c +0 -186
  65. data/ext/gio2/rbgiodesktopappinfo.c +0 -87
  66. data/ext/gio2/rbgiodrive.c +0 -266
  67. data/ext/gio2/rbgioemblem.c +0 -52
  68. data/ext/gio2/rbgioemblemedicon.c +0 -65
  69. data/ext/gio2/rbgiofile.c +0 -2045
  70. data/ext/gio2/rbgiofileattribute.c +0 -114
  71. data/ext/gio2/rbgiofileattributeinfo.c +0 -86
  72. data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
  73. data/ext/gio2/rbgiofileattributematcher.c +0 -95
  74. data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
  75. data/ext/gio2/rbgiofileenumerator.c +0 -166
  76. data/ext/gio2/rbgiofileicon.c +0 -41
  77. data/ext/gio2/rbgiofileinfo.c +0 -617
  78. data/ext/gio2/rbgiofileinputstream.c +0 -91
  79. data/ext/gio2/rbgiofileiostream.c +0 -98
  80. data/ext/gio2/rbgiofilemonitor.c +0 -46
  81. data/ext/gio2/rbgiofilenamecompleter.c +0 -73
  82. data/ext/gio2/rbgiofileoutputstream.c +0 -98
  83. data/ext/gio2/rbgiofilterinputstream.c +0 -28
  84. data/ext/gio2/rbgioicon.c +0 -69
  85. data/ext/gio2/rbgioinetaddress.c +0 -118
  86. data/ext/gio2/rbgioinetsocketaddress.c +0 -41
  87. data/ext/gio2/rbgioinitable.c +0 -199
  88. data/ext/gio2/rbgioinputstream.c +0 -341
  89. data/ext/gio2/rbgioio.c +0 -73
  90. data/ext/gio2/rbgioiomodule.c +0 -45
  91. data/ext/gio2/rbgioiomodules.c +0 -47
  92. data/ext/gio2/rbgioioscheduler.c +0 -102
  93. data/ext/gio2/rbgioioschedulerjob.c +0 -121
  94. data/ext/gio2/rbgioiostream.c +0 -107
  95. data/ext/gio2/rbgioloadableicon.c +0 -92
  96. data/ext/gio2/rbgiomemoryinputstream.c +0 -67
  97. data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
  98. data/ext/gio2/rbgiomount.c +0 -286
  99. data/ext/gio2/rbgiomountoperation.c +0 -53
  100. data/ext/gio2/rbgionetworkaddress.c +0 -59
  101. data/ext/gio2/rbgionetworkservice.c +0 -45
  102. data/ext/gio2/rbgiooutputstream.c +0 -331
  103. data/ext/gio2/rbgioresolver.c +0 -230
  104. data/ext/gio2/rbgioseekable.c +0 -91
  105. data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
  106. data/ext/gio2/rbgiosocket.c +0 -390
  107. data/ext/gio2/rbgiosocketaddress.c +0 -34
  108. data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
  109. data/ext/gio2/rbgiosocketclient.c +0 -207
  110. data/ext/gio2/rbgiosocketconnectable.c +0 -41
  111. data/ext/gio2/rbgiosocketconnection.c +0 -66
  112. data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
  113. data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
  114. data/ext/gio2/rbgiosocketlistener.c +0 -246
  115. data/ext/gio2/rbgiosocketservice.c +0 -66
  116. data/ext/gio2/rbgiosrvtarget.c +0 -76
  117. data/ext/gio2/rbgiotcpconnection.c +0 -28
  118. data/ext/gio2/rbgiothemedicon.c +0 -83
  119. data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
  120. data/ext/gio2/rbgiotlscertificate.c +0 -89
  121. data/ext/gio2/rbgiounixconnection.c +0 -71
  122. data/ext/gio2/rbgiounixfdlist.c +0 -115
  123. data/ext/gio2/rbgiounixfdmessage.c +0 -74
  124. data/ext/gio2/rbgiounixinputstream.c +0 -51
  125. data/ext/gio2/rbgiounixmount.c +0 -164
  126. data/ext/gio2/rbgiounixmountmonitor.c +0 -65
  127. data/ext/gio2/rbgiounixmountpoint.c +0 -136
  128. data/ext/gio2/rbgiounixmountpoints.c +0 -58
  129. data/ext/gio2/rbgiounixmounts.c +0 -58
  130. data/ext/gio2/rbgiounixoutputstream.c +0 -51
  131. data/ext/gio2/rbgiounixsocketaddress.c +0 -69
  132. data/ext/gio2/rbgiovfs.c +0 -84
  133. data/ext/gio2/rbgiovolume.c +0 -193
  134. data/ext/gio2/rbgiovolumemonitor.c +0 -77
  135. data/ext/gio2/rbgiozlibcompressor.c +0 -52
  136. data/ext/gio2/rbgiozlibdecompressor.c +0 -45
  137. data/ext/gio2/util.c +0 -303
  138. data/test/test_bufferedinputstream.rb +0 -9
  139. data/test/test_charsetconverter.rb +0 -9
  140. data/test/test_datainputstream.rb +0 -7
  141. data/test/test_fileenumerator.rb +0 -8
  142. data/test/test_filemonitor.rb +0 -17
  143. data/test/test_inetaddress.rb +0 -8
@@ -1,617 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cFileInfo
25
- #define _SELF(value) RVAL2GFILEINFO(value)
26
-
27
- #define RVAL2FILEINFONAMESPACEDEFAULT(value) \
28
- RVAL2TYPE_WITH_DEFAULT((value), RVAL2CSTR, "*")
29
-
30
- static VALUE
31
- rg_initialize(VALUE self)
32
- {
33
- G_INITIALIZE(self, g_file_info_new());
34
-
35
- return Qnil;
36
- }
37
-
38
- static VALUE
39
- rg_dup(VALUE self)
40
- {
41
- return GOBJ2RVAL_UNREF(g_file_info_dup(_SELF(self)));
42
- }
43
-
44
- static VALUE
45
- rg_copy_into(VALUE self, VALUE other)
46
- {
47
- g_file_info_copy_into(_SELF(self), _SELF(other));
48
-
49
- return self;
50
- }
51
-
52
- static VALUE
53
- rg_has_attribute_p(VALUE self, VALUE attribute)
54
- {
55
- return CBOOL2RVAL(g_file_info_has_attribute(_SELF(self), RVAL2CSTR(attribute)));
56
- }
57
-
58
- static VALUE
59
- rg_has_namespace_p(VALUE self, VALUE namespace)
60
- {
61
- return CBOOL2RVAL(g_file_info_has_namespace(_SELF(self), RVAL2CSTR(namespace)));
62
- }
63
-
64
- static VALUE
65
- rg_set_attribute_status(VALUE self, VALUE attribute, VALUE status)
66
- {
67
- return CBOOL2RVAL(g_file_info_set_attribute_status(_SELF(self),
68
- RVAL2CSTR(attribute),
69
- RVAL2GFILEATTRIBUTESTATUS(status)));
70
- }
71
-
72
- static VALUE
73
- rg_list_attributes(int argc, VALUE *argv, VALUE self)
74
- {
75
- VALUE name_space;
76
-
77
- rb_scan_args(argc, argv, "01", &name_space);
78
-
79
- return STRV2RVAL_FREE(g_file_info_list_attributes(_SELF(self),
80
- RVAL2FILEINFONAMESPACEDEFAULT(name_space)));
81
- }
82
-
83
- static VALUE
84
- rg_get_attribute_type(VALUE self, VALUE attribute)
85
- {
86
- return GFILEATTRIBUTETYPE2RVAL(g_file_info_get_attribute_type(_SELF(self), RVAL2CSTR(attribute)));
87
- }
88
-
89
- static VALUE
90
- rg_remove_attribute(VALUE self, VALUE attribute)
91
- {
92
- g_file_info_remove_attribute(_SELF(self), RVAL2CSTR(attribute));
93
-
94
- return self;
95
- }
96
-
97
- static VALUE
98
- rg_get_attribute_as_string(VALUE self, VALUE attribute)
99
- {
100
- return CSTR2RVAL_FREE(g_file_info_get_attribute_as_string(_SELF(self), RVAL2CSTR(attribute)));
101
- }
102
-
103
- static VALUE
104
- file_attribute_to_value(GFileAttributeType type, gpointer value)
105
- {
106
- switch (type) {
107
- case G_FILE_ATTRIBUTE_TYPE_STRING:
108
- case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
109
- return CSTR2RVAL(value);
110
- case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
111
- return CBOOL2RVAL(*(gboolean *)value);
112
- case G_FILE_ATTRIBUTE_TYPE_UINT32:
113
- return GUINT322RVAL(*(guint32 *)value);
114
- case G_FILE_ATTRIBUTE_TYPE_INT32:
115
- return GINT322RVAL(*(gint32 *)value);
116
- case G_FILE_ATTRIBUTE_TYPE_UINT64:
117
- return GUINT642RVAL(*(guint64 *)value);
118
- case G_FILE_ATTRIBUTE_TYPE_INT64:
119
- return GINT642RVAL(*(gint64 *)value);
120
- case G_FILE_ATTRIBUTE_TYPE_OBJECT:
121
- return GOBJ2RVAL((GObject *)value);
122
- case G_FILE_ATTRIBUTE_TYPE_STRINGV:
123
- return STRV2RVAL_FREE((gchar **)value);
124
- case G_FILE_ATTRIBUTE_TYPE_INVALID:
125
- rb_raise(rb_eArgError, "invalid file attribute type");
126
- break;
127
- default:
128
- rb_raise(rb_eArgError, "unknown file attribute type");
129
- break;
130
- }
131
- }
132
-
133
- static VALUE
134
- rg_get_attribute_data(VALUE self, VALUE attribute)
135
- {
136
- GFileAttributeType type;
137
- gpointer value;
138
- GFileAttributeStatus status;
139
-
140
- if (!g_file_info_get_attribute_data(_SELF(self),
141
- RVAL2CSTR(attribute),
142
- &type,
143
- &value,
144
- &status))
145
- return Qnil;
146
-
147
- return rb_ary_new3(3,
148
- GFILEATTRIBUTETYPE2RVAL(type),
149
- file_attribute_to_value(type, value),
150
- GFILEATTRIBUTESTATUS2RVAL(status));
151
- }
152
-
153
- static VALUE
154
- rg_get_attribute_status(VALUE self, VALUE attribute)
155
- {
156
- return GFILEATTRIBUTESTATUS2RVAL(g_file_info_get_attribute_status(_SELF(self),
157
- RVAL2CSTR(attribute)));
158
- }
159
-
160
- static VALUE
161
- rg_get_attribute_string(VALUE self, VALUE attribute)
162
- {
163
- return CSTR2RVAL(g_file_info_get_attribute_string(_SELF(self),
164
- RVAL2CSTR(attribute)));
165
- }
166
-
167
- static VALUE
168
- rg_get_attribute_stringv(VALUE self, VALUE attribute)
169
- {
170
- return STRV2RVAL((const gchar **)g_file_info_get_attribute_stringv(_SELF(self),
171
- RVAL2CSTR(attribute)));
172
- }
173
-
174
- static VALUE
175
- rg_get_attribute_byte_string(VALUE self, VALUE attribute)
176
- {
177
- return CSTR2RVAL(g_file_info_get_attribute_byte_string(_SELF(self),
178
- RVAL2CSTR(attribute)));
179
- }
180
-
181
- static VALUE
182
- rg_get_attribute_boolean(VALUE self, VALUE attribute)
183
- {
184
- return CBOOL2RVAL(g_file_info_get_attribute_boolean(_SELF(self),
185
- RVAL2CSTR(attribute)));
186
- }
187
-
188
- static VALUE
189
- rg_get_attribute_uint32(VALUE self, VALUE attribute)
190
- {
191
- return GUINT322RVAL(g_file_info_get_attribute_uint32(_SELF(self),
192
- RVAL2CSTR(attribute)));
193
- }
194
-
195
- static VALUE
196
- rg_get_attribute_int32(VALUE self, VALUE attribute)
197
- {
198
- return GINT322RVAL(g_file_info_get_attribute_int32(_SELF(self),
199
- RVAL2CSTR(attribute)));
200
- }
201
-
202
- static VALUE
203
- rg_get_attribute_uint64(VALUE self, VALUE attribute)
204
- {
205
- return GUINT642RVAL(g_file_info_get_attribute_uint64(_SELF(self),
206
- RVAL2CSTR(attribute)));
207
- }
208
-
209
- static VALUE
210
- rg_get_attribute_int64(VALUE self, VALUE attribute)
211
- {
212
- return GINT642RVAL(g_file_info_get_attribute_int64(_SELF(self),
213
- RVAL2CSTR(attribute)));
214
- }
215
-
216
- static VALUE
217
- rg_get_attribute_object(VALUE self, VALUE attribute)
218
- {
219
- return GOBJ2RVAL(g_file_info_get_attribute_object(_SELF(self),
220
- RVAL2CSTR(attribute)));
221
- }
222
-
223
- static VALUE
224
- rg_get_attribute_value(VALUE self, VALUE attribute)
225
- {
226
- GFileAttributeType type;
227
- gpointer value;
228
- GFileAttributeStatus status;
229
-
230
- if (!g_file_info_get_attribute_data(_SELF(self),
231
- RVAL2CSTR(attribute),
232
- &type,
233
- &value,
234
- &status))
235
- return Qnil;
236
-
237
- return file_attribute_to_value(type, value);
238
- }
239
-
240
- static VALUE
241
- rg_set_attribute_string(VALUE self, VALUE attribute, VALUE value)
242
- {
243
- g_file_info_set_attribute_string(_SELF(self),
244
- RVAL2CSTR(attribute),
245
- RVAL2CSTR(value));
246
-
247
- return self;
248
- }
249
-
250
- static VALUE
251
- rg_set_attribute_byte_string(VALUE self, VALUE attribute, VALUE value)
252
- {
253
- g_file_info_set_attribute_byte_string(_SELF(self),
254
- RVAL2CSTR(attribute),
255
- RVAL2CSTR(value));
256
-
257
- return self;
258
- }
259
-
260
- static VALUE
261
- rg_set_attribute_boolean(VALUE self, VALUE attribute, VALUE value)
262
- {
263
- g_file_info_set_attribute_boolean(_SELF(self),
264
- RVAL2CSTR(attribute),
265
- RVAL2CBOOL(value));
266
-
267
- return self;
268
- }
269
-
270
- static VALUE
271
- rg_set_attribute_uint32(VALUE self, VALUE attribute, VALUE value)
272
- {
273
- g_file_info_set_attribute_uint32(_SELF(self),
274
- RVAL2CSTR(attribute),
275
- RVAL2GUINT32(value));
276
-
277
- return self;
278
- }
279
-
280
- static VALUE
281
- rg_set_attribute_int32(VALUE self, VALUE attribute, VALUE value)
282
- {
283
- g_file_info_set_attribute_int32(_SELF(self),
284
- RVAL2CSTR(attribute),
285
- RVAL2GINT32(value));
286
-
287
- return self;
288
- }
289
-
290
- static VALUE
291
- rg_set_attribute_uint64(VALUE self, VALUE attribute, VALUE value)
292
- {
293
- g_file_info_set_attribute_uint64(_SELF(self),
294
- RVAL2CSTR(attribute),
295
- RVAL2GUINT64(value));
296
-
297
- return self;
298
- }
299
-
300
- static VALUE
301
- rg_set_attribute_int64(VALUE self, VALUE attribute, VALUE value)
302
- {
303
- g_file_info_set_attribute_int64(_SELF(self),
304
- RVAL2CSTR(attribute),
305
- RVAL2GINT64(value));
306
-
307
- return self;
308
- }
309
-
310
- static VALUE
311
- rg_set_attribute_object(VALUE self, VALUE attribute, VALUE value)
312
- {
313
- g_file_info_set_attribute_object(_SELF(self),
314
- RVAL2CSTR(attribute),
315
- RVAL2GOBJ(value));
316
-
317
- return self;
318
- }
319
-
320
- static VALUE
321
- rg_clear_status(VALUE self)
322
- {
323
- g_file_info_clear_status(_SELF(self));
324
-
325
- return self;
326
- }
327
-
328
- static VALUE
329
- rg_file_type(VALUE self)
330
- {
331
- return GFILETYPE2RVAL(g_file_info_get_file_type(_SELF(self)));
332
- }
333
-
334
- static VALUE
335
- rg_hidden_p(VALUE self)
336
- {
337
- return CBOOL2RVAL(g_file_info_get_is_hidden(_SELF(self)));
338
- }
339
-
340
- static VALUE
341
- rg_backup_p(VALUE self)
342
- {
343
- return CBOOL2RVAL(g_file_info_get_is_backup(_SELF(self)));
344
- }
345
-
346
- static VALUE
347
- rg_symlink_p(VALUE self)
348
- {
349
- return CBOOL2RVAL(g_file_info_get_is_symlink(_SELF(self)));
350
- }
351
-
352
- static VALUE
353
- rg_name(VALUE self)
354
- {
355
- return CSTR2RVAL(g_file_info_get_name(_SELF(self)));
356
- }
357
-
358
- static VALUE
359
- rg_display_name(VALUE self)
360
- {
361
- return CSTR2RVAL(g_file_info_get_display_name(_SELF(self)));
362
- }
363
-
364
- static VALUE
365
- rg_edit_name(VALUE self)
366
- {
367
- return CSTR2RVAL(g_file_info_get_edit_name(_SELF(self)));
368
- }
369
-
370
- static VALUE
371
- rg_icon(VALUE self)
372
- {
373
- return GOBJ2RVAL(g_file_info_get_icon(_SELF(self)));
374
- }
375
-
376
- static VALUE
377
- rg_content_type(VALUE self)
378
- {
379
- return CSTR2RVAL(g_file_info_get_content_type(_SELF(self)));
380
- }
381
-
382
- static VALUE
383
- rg_size(VALUE self)
384
- {
385
- return GOFFSET2RVAL(g_file_info_get_size(_SELF(self)));
386
- }
387
-
388
- static VALUE
389
- rg_modification_time(VALUE self)
390
- {
391
- GTimeVal time;
392
-
393
- g_file_info_get_modification_time(_SELF(self), &time);
394
-
395
- return GTIMEVAL2RVAL(&time);
396
- }
397
-
398
- static VALUE
399
- rg_symlink_target(VALUE self)
400
- {
401
- return CSTR2RVAL(g_file_info_get_symlink_target(_SELF(self)));
402
- }
403
-
404
- static VALUE
405
- rg_etag(VALUE self)
406
- {
407
- return CSTR2RVAL(g_file_info_get_etag(_SELF(self)));
408
- }
409
-
410
- static VALUE
411
- rg_sort_order(VALUE self)
412
- {
413
- return GINT322RVAL(g_file_info_get_sort_order(_SELF(self)));
414
- }
415
-
416
- static VALUE
417
- rg_set_attribute_mask(VALUE self, VALUE rbmask)
418
- {
419
- gboolean should_unref;
420
- GFileAttributeMatcher *mask;
421
-
422
- if (NIL_P(rbmask)) {
423
- g_file_info_unset_attribute_mask(_SELF(self));
424
- return self;
425
- }
426
-
427
- if (TYPE(rbmask) == T_STRING) {
428
- mask = g_file_attribute_matcher_new(RVAL2CSTR(rbmask));
429
- should_unref = TRUE;
430
- } else {
431
- mask = RVAL2GFILEATTRIBUTEMATCHER(rbmask);
432
- should_unref = FALSE;
433
- }
434
-
435
- g_file_info_set_attribute_mask(_SELF(self), mask);
436
-
437
- if (should_unref)
438
- g_file_attribute_matcher_unref(mask);
439
-
440
- return self;
441
- }
442
-
443
- static VALUE
444
- rg_unset_attribute_mask(VALUE self)
445
- {
446
- g_file_info_unset_attribute_mask(_SELF(self));
447
-
448
- return self;
449
- }
450
-
451
- static VALUE
452
- rg_set_file_type(VALUE self, VALUE value)
453
- {
454
- g_file_info_set_file_type(_SELF(self), RVAL2GFILETYPE(value));
455
-
456
- return self;
457
- }
458
-
459
- static VALUE
460
- rg_set_hidden(VALUE self, VALUE value)
461
- {
462
- g_file_info_set_is_hidden(_SELF(self), RVAL2CBOOL(value));
463
-
464
- return self;
465
- }
466
-
467
- static VALUE
468
- rg_set_symlink(VALUE self, VALUE value)
469
- {
470
- g_file_info_set_is_symlink(_SELF(self), RVAL2CBOOL(value));
471
-
472
- return self;
473
- }
474
-
475
- static VALUE
476
- rg_set_name(VALUE self, VALUE value)
477
- {
478
- g_file_info_set_name(_SELF(self), RVAL2CSTR(value));
479
-
480
- return self;
481
- }
482
-
483
- static VALUE
484
- rg_set_display_name(VALUE self, VALUE value)
485
- {
486
- g_file_info_set_display_name(_SELF(self), RVAL2CSTR(value));
487
-
488
- return self;
489
- }
490
-
491
- static VALUE
492
- rg_set_edit_name(VALUE self, VALUE value)
493
- {
494
- g_file_info_set_edit_name(_SELF(self), RVAL2CSTR(value));
495
-
496
- return self;
497
- }
498
-
499
- static VALUE
500
- rg_set_icon(VALUE self, VALUE value)
501
- {
502
- g_file_info_set_icon(_SELF(self), RVAL2GICON(value));
503
-
504
- return self;
505
- }
506
-
507
- static VALUE
508
- rg_set_content_type(VALUE self, VALUE value)
509
- {
510
- g_file_info_set_content_type(_SELF(self), RVAL2CSTR(value));
511
-
512
- return self;
513
- }
514
-
515
- static VALUE
516
- rg_set_size(VALUE self, VALUE value)
517
- {
518
- g_file_info_set_size(_SELF(self), RVAL2GOFFSET(value));
519
-
520
- return self;
521
- }
522
-
523
- static VALUE
524
- rg_set_modification_time(VALUE self, VALUE rbtime)
525
- {
526
- GTimeVal time;
527
-
528
- rbgio_rval_to_gtimeval(rbtime, &time);
529
-
530
- g_file_info_set_modification_time(_SELF(self), &time);
531
-
532
- return self;
533
- }
534
-
535
- static VALUE
536
- rg_set_symlink_target(VALUE self, VALUE value)
537
- {
538
- g_file_info_set_symlink_target(_SELF(self), RVAL2CSTR(value));
539
-
540
- return self;
541
- }
542
-
543
- static VALUE
544
- rg_set_sort_order(VALUE self, VALUE value)
545
- {
546
- g_file_info_set_sort_order(_SELF(self), RVAL2GINT32(value));
547
-
548
- return self;
549
- }
550
-
551
- void
552
- Init_gfileinfo(VALUE mGio)
553
- {
554
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_FILE_INFO, "FileInfo", mGio);
555
-
556
- RG_DEF_METHOD(initialize, 0);
557
- RG_DEF_METHOD(dup, 0);
558
- RG_DEF_METHOD(copy_into, 1);
559
- RG_DEF_METHOD_P(has_attribute, 1);
560
- RG_DEF_METHOD_P(has_namespace, 1);
561
- RG_DEF_METHOD(list_attributes, -1);
562
- RG_DEF_ALIAS("attributes", "list_attributes");
563
- RG_DEF_METHOD(get_attribute_type, 1);
564
- RG_DEF_METHOD(remove_attribute, 1);
565
- RG_DEF_METHOD(get_attribute_as_string, 1);
566
- RG_DEF_METHOD(get_attribute_data, 1);
567
- RG_DEF_METHOD(get_attribute_status, 1);
568
- RG_DEF_METHOD(get_attribute_string, 1);
569
- RG_DEF_METHOD(get_attribute_stringv, 1);
570
- RG_DEF_METHOD(get_attribute_byte_string, 1);
571
- RG_DEF_METHOD(get_attribute_boolean, 1);
572
- RG_DEF_METHOD(get_attribute_uint32, 1);
573
- RG_DEF_METHOD(get_attribute_int32, 1);
574
- RG_DEF_METHOD(get_attribute_uint64, 1);
575
- RG_DEF_METHOD(get_attribute_int64, 1);
576
- RG_DEF_METHOD(get_attribute_object, 1);
577
- RG_DEF_METHOD(get_attribute_value, 1);
578
- RG_DEF_ALIAS("[]", "get_attribute_value");
579
- RG_DEF_METHOD(set_attribute_status, 2);
580
- RG_DEF_METHOD(set_attribute_string, 2);
581
- RG_DEF_METHOD(set_attribute_byte_string, 2);
582
- RG_DEF_METHOD(set_attribute_boolean, 2);
583
- RG_DEF_METHOD(set_attribute_uint32, 2);
584
- RG_DEF_METHOD(set_attribute_int32, 2);
585
- RG_DEF_METHOD(set_attribute_uint64, 2);
586
- RG_DEF_METHOD(set_attribute_int64, 2);
587
- RG_DEF_METHOD(set_attribute_object, 2);
588
- RG_DEF_METHOD(clear_status, 0);
589
- RG_DEF_METHOD(file_type, 0);
590
- RG_DEF_METHOD_P(hidden, 0);
591
- RG_DEF_METHOD_P(backup, 0);
592
- RG_DEF_METHOD_P(symlink, 0);
593
- RG_DEF_METHOD(name, 0);
594
- RG_DEF_METHOD(display_name, 0);
595
- RG_DEF_METHOD(edit_name, 0);
596
- RG_DEF_METHOD(icon, 0);
597
- RG_DEF_METHOD(content_type, 0);
598
- RG_DEF_METHOD(size, 0);
599
- RG_DEF_METHOD(modification_time, 0);
600
- RG_DEF_METHOD(symlink_target, 0);
601
- RG_DEF_METHOD(etag, 0);
602
- RG_DEF_METHOD(sort_order, 0);
603
- RG_DEF_METHOD(set_attribute_mask, 1);
604
- RG_DEF_METHOD(unset_attribute_mask, 0);
605
- RG_DEF_METHOD(set_file_type, 1);
606
- RG_DEF_METHOD(set_hidden, 1);
607
- RG_DEF_METHOD(set_symlink, 1);
608
- RG_DEF_METHOD(set_name, 1);
609
- RG_DEF_METHOD(set_display_name, 1);
610
- RG_DEF_METHOD(set_edit_name, 1);
611
- RG_DEF_METHOD(set_icon, 1);
612
- RG_DEF_METHOD(set_content_type, 1);
613
- RG_DEF_METHOD(set_size, 1);
614
- RG_DEF_METHOD(set_modification_time, 1);
615
- RG_DEF_METHOD(set_symlink_target, 1);
616
- RG_DEF_METHOD(set_sort_order, 1);
617
- }
@@ -1,91 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cFileInputStream
25
- #define _SELF(value) RVAL2GFILEINPUTSTREAM(value)
26
-
27
- static VALUE
28
- rg_query_info(int argc, VALUE *argv, VALUE self)
29
- {
30
- VALUE attributes, cancellable;
31
- GError *error = NULL;
32
- GFileInfo *info;
33
-
34
- rb_scan_args(argc, argv, "02", &attributes, &cancellable);
35
- info = g_file_input_stream_query_info(_SELF(self),
36
- RVAL2ATTRIBUTESDEFAULT(attributes),
37
- RVAL2GCANCELLABLE(cancellable),
38
- &error);
39
- if (info == NULL)
40
- rbgio_raise_error(error);
41
-
42
- return GOBJ2RVAL_UNREF(info);
43
- }
44
-
45
- static VALUE
46
- rg_query_info_async(int argc, VALUE *argv, VALUE self)
47
- {
48
- VALUE rbattributes, rbio_priority, rbcancellable, block;
49
- const char *attributes;
50
- int io_priority;
51
- GCancellable *cancellable;
52
-
53
- rb_scan_args(argc, argv, "03&", &rbattributes, &rbio_priority, &rbcancellable, &block);
54
- attributes = RVAL2ATTRIBUTESDEFAULT(rbattributes);
55
- io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
56
- cancellable = RVAL2GCANCELLABLE(rbcancellable);
57
- SAVE_BLOCK(block);
58
- g_file_input_stream_query_info_async(_SELF(self),
59
- attributes,
60
- io_priority,
61
- cancellable,
62
- rbgio_async_ready_callback,
63
- (gpointer)block);
64
-
65
- return self;
66
- }
67
-
68
- static VALUE
69
- rg_query_info_finish(VALUE self, VALUE result)
70
- {
71
- GError *error = NULL;
72
- GFileInfo *info;
73
-
74
- info = g_file_input_stream_query_info_finish(_SELF(self),
75
- RVAL2GASYNCRESULT(result),
76
- &error);
77
- if (info == NULL)
78
- rbgio_raise_error(error);
79
-
80
- return GOBJ2RVAL_UNREF(info);
81
- }
82
-
83
- void
84
- Init_gfileinputstream(VALUE mGio)
85
- {
86
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_FILE_INPUT_STREAM, "FileInputStream", mGio);
87
-
88
- RG_DEF_METHOD(query_info, -1);
89
- RG_DEF_METHOD(query_info_async, -1);
90
- RG_DEF_METHOD(query_info_finish, 1);
91
- }