gio2 1.0.3-x86-mingw32 → 1.1.0-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. data/ext/gio2/extconf.rb +4 -42
  2. data/ext/gio2/gio2.c +18 -117
  3. data/ext/gio2/gio2.h +20 -339
  4. data/ext/gio2/rbgio.c +132 -0
  5. data/ext/gio2/rbgio2.h +156 -0
  6. data/ext/gio2/rbgio2conversions.h +154 -0
  7. data/ext/gio2/rbgio2private.h +147 -0
  8. data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
  9. data/ext/gio2/rbgioapplaunchcontext.c +81 -0
  10. data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
  11. data/ext/gio2/rbgioasyncresult.c +41 -0
  12. data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
  13. data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
  14. data/ext/gio2/rbgiocancellable.c +180 -0
  15. data/ext/gio2/rbgiocharsetconverter.c +57 -0
  16. data/ext/gio2/rbgiocontenttype.c +131 -0
  17. data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
  18. data/ext/gio2/rbgioconverterinputstream.c +43 -0
  19. data/ext/gio2/rbgioconverteroutputstream.c +43 -0
  20. data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
  21. data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
  22. data/ext/gio2/rbgiodesktopappinfo.c +87 -0
  23. data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
  24. data/ext/gio2/rbgioemblem.c +52 -0
  25. data/ext/gio2/rbgioemblemedicon.c +65 -0
  26. data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
  27. data/ext/gio2/rbgiofileattribute.c +114 -0
  28. data/ext/gio2/rbgiofileattributeinfo.c +86 -0
  29. data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
  30. data/ext/gio2/rbgiofileattributematcher.c +93 -0
  31. data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
  32. data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
  33. data/ext/gio2/rbgiofileicon.c +41 -0
  34. data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
  35. data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
  36. data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
  37. data/ext/gio2/rbgiofilemonitor.c +46 -0
  38. data/ext/gio2/rbgiofilenamecompleter.c +74 -0
  39. data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
  40. data/ext/gio2/rbgiofilterinputstream.c +28 -0
  41. data/ext/gio2/rbgiofilteroutputstream.c +28 -0
  42. data/ext/gio2/rbgioicon.c +69 -0
  43. data/ext/gio2/rbgioinetaddress.c +118 -0
  44. data/ext/gio2/rbgioinetsocketaddress.c +41 -0
  45. data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
  46. data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
  47. data/ext/gio2/rbgioio.c +73 -0
  48. data/ext/gio2/rbgioiomodule.c +45 -0
  49. data/ext/gio2/rbgioiomodules.c +47 -0
  50. data/ext/gio2/rbgioioscheduler.c +102 -0
  51. data/ext/gio2/rbgioioschedulerjob.c +121 -0
  52. data/ext/gio2/rbgioiostream.c +108 -0
  53. data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
  54. data/ext/gio2/rbgiomemoryinputstream.c +67 -0
  55. data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
  56. data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
  57. data/ext/gio2/rbgiomountoperation.c +53 -0
  58. data/ext/gio2/rbgionetworkaddress.c +59 -0
  59. data/ext/gio2/rbgionetworkservice.c +45 -0
  60. data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
  61. data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
  62. data/ext/gio2/rbgioseekable.c +91 -0
  63. data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
  64. data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
  65. data/ext/gio2/rbgiosocketaddress.c +34 -0
  66. data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
  67. data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
  68. data/ext/gio2/rbgiosocketconnectable.c +41 -0
  69. data/ext/gio2/rbgiosocketconnection.c +66 -0
  70. data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
  71. data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
  72. data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
  73. data/ext/gio2/rbgiosocketservice.c +66 -0
  74. data/ext/gio2/rbgiosrvtarget.c +76 -0
  75. data/ext/gio2/rbgiotcpconnection.c +28 -0
  76. data/ext/gio2/rbgiothemedicon.c +83 -0
  77. data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
  78. data/ext/gio2/rbgiounixconnection.c +71 -0
  79. data/ext/gio2/rbgiounixfdlist.c +115 -0
  80. data/ext/gio2/rbgiounixfdmessage.c +74 -0
  81. data/ext/gio2/rbgiounixinputstream.c +51 -0
  82. data/ext/gio2/rbgiounixmount.c +164 -0
  83. data/ext/gio2/rbgiounixmountmonitor.c +66 -0
  84. data/ext/gio2/rbgiounixmountpoint.c +136 -0
  85. data/ext/gio2/rbgiounixmountpoints.c +58 -0
  86. data/ext/gio2/rbgiounixmounts.c +58 -0
  87. data/ext/gio2/rbgiounixoutputstream.c +51 -0
  88. data/ext/gio2/rbgiounixsocketaddress.c +69 -0
  89. data/ext/gio2/rbgiovfs.c +84 -0
  90. data/ext/gio2/rbgiovolume.c +193 -0
  91. data/ext/gio2/rbgiovolumemonitor.c +77 -0
  92. data/ext/gio2/rbgiozlibcompressor.c +52 -0
  93. data/ext/gio2/rbgiozlibdecompressor.c +45 -0
  94. data/ext/gio2/util.c +57 -60
  95. data/lib/1.8/gio2.so +0 -0
  96. data/lib/1.9/gio2.so +0 -0
  97. data/lib/gio2/deprecated.rb +102 -0
  98. data/lib/gio2.rb +14 -12
  99. metadata +100 -88
  100. data/ChangeLog +0 -129
  101. data/ext/gio2/gapplaunchcontext.c +0 -79
  102. data/ext/gio2/gasyncresult.c +0 -39
  103. data/ext/gio2/gbufferedoutputstream.c +0 -48
  104. data/ext/gio2/gcancellable.c +0 -177
  105. data/ext/gio2/gcharsetconverter.c +0 -55
  106. data/ext/gio2/gcontenttype.c +0 -128
  107. data/ext/gio2/gconverterinputstream.c +0 -41
  108. data/ext/gio2/gconverteroutputstream.c +0 -41
  109. data/ext/gio2/gdesktopappinfo.c +0 -88
  110. data/ext/gio2/gemblem.c +0 -52
  111. data/ext/gio2/gemblemedicon.c +0 -63
  112. data/ext/gio2/gfileattribute.c +0 -111
  113. data/ext/gio2/gfileattributeinfo.c +0 -89
  114. data/ext/gio2/gfileattributeinfolist.c +0 -109
  115. data/ext/gio2/gfileattributematcher.c +0 -90
  116. data/ext/gio2/gfiledescriptorbased.c +0 -42
  117. data/ext/gio2/gfileicon.c +0 -39
  118. data/ext/gio2/gfilemonitor.c +0 -44
  119. data/ext/gio2/gfilenamecompleter.c +0 -72
  120. data/ext/gio2/gfilterinputstream.c +0 -27
  121. data/ext/gio2/gfilteroutputstream.c +0 -27
  122. data/ext/gio2/gicon.c +0 -67
  123. data/ext/gio2/ginetaddress.c +0 -116
  124. data/ext/gio2/ginetsocketaddress.c +0 -38
  125. data/ext/gio2/gioerror.c +0 -70
  126. data/ext/gio2/giomodule.c +0 -63
  127. data/ext/gio2/gioscheduler.c +0 -193
  128. data/ext/gio2/giostream.c +0 -106
  129. data/ext/gio2/gmemoryinputstream.c +0 -65
  130. data/ext/gio2/gmemoryoutputstream.c +0 -41
  131. data/ext/gio2/gmountoperation.c +0 -66
  132. data/ext/gio2/gnetworkaddress.c +0 -57
  133. data/ext/gio2/gnetworkservice.c +0 -43
  134. data/ext/gio2/gseekable.c +0 -89
  135. data/ext/gio2/gsimpleasyncresult.c +0 -153
  136. data/ext/gio2/gsocketaddress.c +0 -33
  137. data/ext/gio2/gsocketconnectable.c +0 -97
  138. data/ext/gio2/gsocketconnection.c +0 -75
  139. data/ext/gio2/gsocketcontrolmessage.c +0 -80
  140. data/ext/gio2/gsocketservice.c +0 -64
  141. data/ext/gio2/gsrvtarget.c +0 -77
  142. data/ext/gio2/gtcpconnection.c +0 -27
  143. data/ext/gio2/gthemedicon.c +0 -81
  144. data/ext/gio2/gthreadedsocketservice.c +0 -40
  145. data/ext/gio2/gunixconnection.c +0 -69
  146. data/ext/gio2/gunixfdlist.c +0 -112
  147. data/ext/gio2/gunixfdmessage.c +0 -72
  148. data/ext/gio2/gunixinputstream.c +0 -49
  149. data/ext/gio2/gunixmounts.c +0 -343
  150. data/ext/gio2/gunixoutputstream.c +0 -49
  151. data/ext/gio2/gunixsocketaddress.c +0 -67
  152. data/ext/gio2/gvfs.c +0 -82
  153. data/ext/gio2/gvolume.c +0 -191
  154. data/ext/gio2/gvolumemonitor.c +0 -75
  155. data/ext/gio2/gzlibcompressor.c +0 -50
  156. data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,29 +1,31 @@
1
- /* -*- c-file-style: "ruby" -*- */
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
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.
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
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.
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
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
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
19
20
  */
20
21
 
21
- #include "gio2.h"
22
+ #include "rbgio2private.h"
22
23
 
23
- #define _SELF(value) G_INITABLE(RVAL2GOBJ(value))
24
+ #define RG_TARGET_NAMESPACE mInitable
25
+ #define _SELF(value) RVAL2GINITABLE(value)
24
26
 
25
27
  static VALUE
26
- initable_init(int argc, VALUE *argv, VALUE self)
28
+ rg_init(int argc, VALUE *argv, VALUE self)
27
29
  {
28
30
  VALUE cancellable;
29
31
  GError *error = NULL;
@@ -105,6 +107,8 @@ rbgio_ginitable_new_ensure(struct rbgio_ginitable_new_data *data)
105
107
  if (G_IS_VALUE(&data->parameters[i].value))
106
108
  g_value_unset(&data->parameters[i].value);
107
109
 
110
+ g_free(data->parameters);
111
+
108
112
  return Qnil;
109
113
  }
110
114
 
@@ -146,7 +150,7 @@ rbgio_ginitable_new(GType type, VALUE parameters, VALUE cancellable)
146
150
  data.rbparameters = parameters;
147
151
  data.index = 0;
148
152
  data.n_parameters = RVAL2GUINT(rb_funcall(parameters, s_id_length, 0));
149
- data.parameters = ALLOCA_N(GParameter, data.n_parameters);
153
+ data.parameters = g_new(GParameter, data.n_parameters);
150
154
  data.error = NULL;
151
155
 
152
156
  object = (GObject *)rb_ensure(rbgio_ginitable_new_body, (VALUE)&data,
@@ -157,12 +161,12 @@ rbgio_ginitable_new(GType type, VALUE parameters, VALUE cancellable)
157
161
  return object;
158
162
  }
159
163
 
160
- /* NOTE: We dont implement g_initable_new. */
164
+ /* NOTE: We don't implement g_initable_new. */
161
165
 
162
- /* NOTE: We dont implement g_initable_new_valist. */
166
+ /* NOTE: We don't implement g_initable_new_valist. */
163
167
 
164
168
  static VALUE
165
- initable_initialize(int argc, VALUE *argv, VALUE self)
169
+ rg_m_new(int argc, VALUE *argv, VALUE self)
166
170
  {
167
171
  const RGObjClassInfo* info;
168
172
  VALUE cancellable, parameters;
@@ -185,11 +189,11 @@ initable_initialize(int argc, VALUE *argv, VALUE self)
185
189
  }
186
190
 
187
191
  void
188
- Init_ginitable(VALUE glib)
192
+ Init_ginitable(VALUE mGio)
189
193
  {
190
- VALUE initable = G_DEF_INTERFACE(G_TYPE_INITABLE, "Initable", glib);
194
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_INITABLE, "Initable", mGio);
191
195
 
192
- rb_define_module_function(initable, "new", initable_initialize, -1);
196
+ RG_DEF_MODFUNC(new, -1);
193
197
 
194
- rb_define_method(initable, "init", initable_init, -1);
198
+ RG_DEF_METHOD(init, -1);
195
199
  }
@@ -1,31 +1,33 @@
1
- /* -*- c-file-style: "ruby" -*- */
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
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.
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
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.
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
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
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
19
20
  */
20
21
 
21
- #include "gio2.h"
22
+ #include "rbgio2private.h"
22
23
 
24
+ #define RG_TARGET_NAMESPACE cInputStream
23
25
  #define _SELF(value) RVAL2GINPUTSTREAM(value)
24
26
 
25
27
  static VALUE s_cReadAsyncResult;
26
28
 
27
29
  static VALUE
28
- inputstream_read(int argc, VALUE *argv, VALUE self)
30
+ rg_read(int argc, VALUE *argv, VALUE self)
29
31
  {
30
32
  VALUE rbcount, cancellable, result;
31
33
  gsize count;
@@ -51,7 +53,7 @@ inputstream_read(int argc, VALUE *argv, VALUE self)
51
53
  }
52
54
 
53
55
  static VALUE
54
- inputstream_read_all(int argc, VALUE *argv, VALUE self)
56
+ rg_read_all(int argc, VALUE *argv, VALUE self)
55
57
  {
56
58
  VALUE rbcount, cancellable, result;
57
59
  gsize count;
@@ -77,7 +79,7 @@ inputstream_read_all(int argc, VALUE *argv, VALUE self)
77
79
  }
78
80
 
79
81
  static VALUE
80
- inputstream_skip(int argc, VALUE *argv, VALUE self)
82
+ rg_skip(int argc, VALUE *argv, VALUE self)
81
83
  {
82
84
  VALUE count, cancellable;
83
85
  GError *error = NULL;
@@ -95,7 +97,7 @@ inputstream_skip(int argc, VALUE *argv, VALUE self)
95
97
  }
96
98
 
97
99
  static VALUE
98
- inputstream_close(int argc, VALUE *argv, VALUE self)
100
+ rg_close(int argc, VALUE *argv, VALUE self)
99
101
  {
100
102
  VALUE cancellable;
101
103
  GError *error = NULL;
@@ -169,7 +171,7 @@ read_async_callback(G_GNUC_UNUSED GObject *source,
169
171
  }
170
172
 
171
173
  static VALUE
172
- inputstream_read_async(int argc, VALUE *argv, VALUE self)
174
+ rg_read_async(int argc, VALUE *argv, VALUE self)
173
175
  {
174
176
  VALUE rbcount, rbio_priority, rbcancellable, block, data;
175
177
  gsize count;
@@ -194,7 +196,7 @@ inputstream_read_async(int argc, VALUE *argv, VALUE self)
194
196
  }
195
197
 
196
198
  static VALUE
197
- inputstream_read_finish(VALUE self, VALUE rbresult)
199
+ rg_read_finish(VALUE self, VALUE rbresult)
198
200
  {
199
201
  struct read_async_result *result;
200
202
  GError *error = NULL;
@@ -215,7 +217,7 @@ inputstream_read_finish(VALUE self, VALUE rbresult)
215
217
  }
216
218
 
217
219
  static VALUE
218
- inputstream_skip_async(int argc, VALUE *argv, VALUE self)
220
+ rg_skip_async(int argc, VALUE *argv, VALUE self)
219
221
  {
220
222
  VALUE rbcount, rbio_priority, rbcancellable, block;
221
223
  gsize count;
@@ -238,7 +240,7 @@ inputstream_skip_async(int argc, VALUE *argv, VALUE self)
238
240
  }
239
241
 
240
242
  static VALUE
241
- inputstream_skip_finish(VALUE self, VALUE result)
243
+ rg_skip_finish(VALUE self, VALUE result)
242
244
  {
243
245
  GError *error = NULL;
244
246
  gssize skipped_bytes;
@@ -253,7 +255,7 @@ inputstream_skip_finish(VALUE self, VALUE result)
253
255
  }
254
256
 
255
257
  static VALUE
256
- inputstream_close_async(int argc, VALUE *argv, VALUE self)
258
+ rg_close_async(int argc, VALUE *argv, VALUE self)
257
259
  {
258
260
  VALUE rbio_priority, rbcancellable, block;
259
261
  int io_priority;
@@ -273,7 +275,7 @@ inputstream_close_async(int argc, VALUE *argv, VALUE self)
273
275
  }
274
276
 
275
277
  static VALUE
276
- inputstream_close_finish(VALUE self, VALUE result)
278
+ rg_close_finish(VALUE self, VALUE result)
277
279
  {
278
280
  GError *error = NULL;
279
281
  if (!g_input_stream_skip_finish(_SELF(self),
@@ -285,19 +287,19 @@ inputstream_close_finish(VALUE self, VALUE result)
285
287
  }
286
288
 
287
289
  static VALUE
288
- inputstream_is_closed(VALUE self)
290
+ rg_closed_p(VALUE self)
289
291
  {
290
292
  return CBOOL2RVAL(g_input_stream_is_closed(_SELF(self)));
291
293
  }
292
294
 
293
295
  static VALUE
294
- inputstream_has_pending(VALUE self)
296
+ rg_has_pending_p(VALUE self)
295
297
  {
296
298
  return CBOOL2RVAL(g_input_stream_has_pending(_SELF(self)));
297
299
  }
298
300
 
299
301
  static VALUE
300
- inputstream_set_pending(VALUE self)
302
+ rg_set_pending(VALUE self)
301
303
  {
302
304
  GError *error = NULL;
303
305
 
@@ -308,7 +310,7 @@ inputstream_set_pending(VALUE self)
308
310
  }
309
311
 
310
312
  static VALUE
311
- inputstream_clear_pending(VALUE self)
313
+ rg_clear_pending(VALUE self)
312
314
  {
313
315
  g_input_stream_clear_pending(_SELF(self));
314
316
 
@@ -316,24 +318,24 @@ inputstream_clear_pending(VALUE self)
316
318
  }
317
319
 
318
320
  void
319
- Init_ginputstream(VALUE glib)
321
+ Init_ginputstream(VALUE mGio)
320
322
  {
321
- VALUE inputstream = G_DEF_CLASS(G_TYPE_INPUT_STREAM, "InputStream", glib);
322
-
323
- s_cReadAsyncResult = rb_define_class_under(inputstream, "ReadAsyncResult", rb_cObject);
324
-
325
- rb_define_method(inputstream, "read", inputstream_read, -1);
326
- rb_define_method(inputstream, "read_all", inputstream_read_all, -1);
327
- rb_define_method(inputstream, "skip", inputstream_skip, -1);
328
- rb_define_method(inputstream, "close", inputstream_close, -1);
329
- rb_define_method(inputstream, "read_async", inputstream_read_async, -1);
330
- rb_define_method(inputstream, "read_finish", inputstream_read_finish, 1);
331
- rb_define_method(inputstream, "skip_async", inputstream_skip_async, -1);
332
- rb_define_method(inputstream, "skip_finish", inputstream_skip_finish, 1);
333
- rb_define_method(inputstream, "close_async", inputstream_close_async, -1);
334
- rb_define_method(inputstream, "close_finish", inputstream_close_finish, 1);
335
- rb_define_method(inputstream, "closed?", inputstream_is_closed, 0);
336
- rb_define_method(inputstream, "has_pending?", inputstream_has_pending, 0);
337
- rb_define_method(inputstream, "set_pending", inputstream_set_pending, 0);
338
- rb_define_method(inputstream, "clear_pending", inputstream_clear_pending, 0);
323
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_INPUT_STREAM, "InputStream", mGio);
324
+
325
+ s_cReadAsyncResult = rb_define_class_under(RG_TARGET_NAMESPACE, "ReadAsyncResult", rb_cObject);
326
+
327
+ RG_DEF_METHOD(read, -1);
328
+ RG_DEF_METHOD(read_all, -1);
329
+ RG_DEF_METHOD(skip, -1);
330
+ RG_DEF_METHOD(close, -1);
331
+ RG_DEF_METHOD(read_async, -1);
332
+ RG_DEF_METHOD(read_finish, 1);
333
+ RG_DEF_METHOD(skip_async, -1);
334
+ RG_DEF_METHOD(skip_finish, 1);
335
+ RG_DEF_METHOD(close_async, -1);
336
+ RG_DEF_METHOD(close_finish, 1);
337
+ RG_DEF_METHOD_P(closed, 0);
338
+ RG_DEF_METHOD_P(has_pending, 0);
339
+ RG_DEF_METHOD(set_pending, 0);
340
+ RG_DEF_METHOD(clear_pending, 0);
339
341
  }
@@ -0,0 +1,73 @@
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 mIO
25
+
26
+ /* NOTE: g_io_error_from_errno doesn't make sense from Ruby. */
27
+
28
+ void
29
+ Init_gioerror(VALUE mGio)
30
+ {
31
+ VALUE RG_TARGET_NAMESPACE, error;
32
+
33
+ RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IO");
34
+
35
+ error = rbgio_define_domain_error(RG_TARGET_NAMESPACE, "Error", G_IO_ERROR, "GIOErrorEnum", rb_eIOError);
36
+
37
+ rbgio_define_error(RG_TARGET_NAMESPACE, "FailedError", G_IO_ERROR_FAILED, error);
38
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotFoundError", G_IO_ERROR_NOT_FOUND, error);
39
+ rbgio_define_error(RG_TARGET_NAMESPACE, "ExistsError", G_IO_ERROR_EXISTS, error);
40
+ rbgio_define_error(RG_TARGET_NAMESPACE, "IsDirectoryError", G_IO_ERROR_IS_DIRECTORY, error);
41
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotDirectoryError", G_IO_ERROR_NOT_DIRECTORY, error);
42
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotEmptyError", G_IO_ERROR_NOT_EMPTY, error);
43
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotRegularFileError", G_IO_ERROR_NOT_REGULAR_FILE, error);
44
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotSymbolicLinkError", G_IO_ERROR_NOT_SYMBOLIC_LINK, error);
45
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotMountableFileError", G_IO_ERROR_NOT_MOUNTABLE_FILE, error);
46
+ rbgio_define_error(RG_TARGET_NAMESPACE, "FilenameTooLongError", G_IO_ERROR_FILENAME_TOO_LONG, error);
47
+ rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidFilenameError", G_IO_ERROR_INVALID_FILENAME, error);
48
+ rbgio_define_error(RG_TARGET_NAMESPACE, "TooManyLinksError", G_IO_ERROR_TOO_MANY_LINKS, error);
49
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NoSpaceError", G_IO_ERROR_NO_SPACE, error);
50
+ rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidArgumentError", G_IO_ERROR_INVALID_ARGUMENT, error);
51
+ rbgio_define_error(RG_TARGET_NAMESPACE, "PermissionDeniedError", G_IO_ERROR_PERMISSION_DENIED, error);
52
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotSupportedError", G_IO_ERROR_NOT_SUPPORTED, error);
53
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotMountedError", G_IO_ERROR_NOT_MOUNTED, error);
54
+ rbgio_define_error(RG_TARGET_NAMESPACE, "AlreadyMountedError", G_IO_ERROR_ALREADY_MOUNTED, error);
55
+ rbgio_define_error(RG_TARGET_NAMESPACE, "ClosedError", G_IO_ERROR_CLOSED, error);
56
+ rbgio_define_error(RG_TARGET_NAMESPACE, "CancelledError", G_IO_ERROR_CANCELLED, error);
57
+ rbgio_define_error(RG_TARGET_NAMESPACE, "PendingError", G_IO_ERROR_PENDING, error);
58
+ rbgio_define_error(RG_TARGET_NAMESPACE, "ReadOnlyError", G_IO_ERROR_READ_ONLY, error);
59
+ rbgio_define_error(RG_TARGET_NAMESPACE, "CantCreateBackupError", G_IO_ERROR_CANT_CREATE_BACKUP, error);
60
+ rbgio_define_error(RG_TARGET_NAMESPACE, "WrongEtagError", G_IO_ERROR_WRONG_ETAG, error);
61
+ rbgio_define_error(RG_TARGET_NAMESPACE, "TimedOutError", G_IO_ERROR_TIMED_OUT, error);
62
+ rbgio_define_error(RG_TARGET_NAMESPACE, "WouldRecurseError", G_IO_ERROR_WOULD_RECURSE, error);
63
+ rbgio_define_error(RG_TARGET_NAMESPACE, "BusyError", G_IO_ERROR_BUSY, error);
64
+ rbgio_define_error(RG_TARGET_NAMESPACE, "WouldBlockError", G_IO_ERROR_WOULD_BLOCK, error);
65
+ rbgio_define_error(RG_TARGET_NAMESPACE, "HostNotFoundError", G_IO_ERROR_HOST_NOT_FOUND, error);
66
+ rbgio_define_error(RG_TARGET_NAMESPACE, "WouldMergeError", G_IO_ERROR_WOULD_MERGE, error);
67
+ rbgio_define_error(RG_TARGET_NAMESPACE, "FailedHandledError", G_IO_ERROR_FAILED_HANDLED, error);
68
+ rbgio_define_error(RG_TARGET_NAMESPACE, "TooManyOpenFilesError", G_IO_ERROR_TOO_MANY_OPEN_FILES, error);
69
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotInitializedError", G_IO_ERROR_NOT_INITIALIZED, error);
70
+ rbgio_define_error(RG_TARGET_NAMESPACE, "AddressInUseError", G_IO_ERROR_ADDRESS_IN_USE, error);
71
+ rbgio_define_error(RG_TARGET_NAMESPACE, "PartialInputError", G_IO_ERROR_PARTIAL_INPUT, error);
72
+ rbgio_define_error(RG_TARGET_NAMESPACE, "InvalidDataError", G_IO_ERROR_INVALID_DATA, error);
73
+ }
@@ -0,0 +1,45 @@
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 cIOModule
25
+ #define _SELF(value) RVAL2GIOMODULE(value)
26
+
27
+ static VALUE
28
+ rg_initialize(VALUE self, VALUE filename)
29
+ {
30
+ G_INITIALIZE(self, g_io_module_new(RVAL2CSTR(filename)));
31
+
32
+ return Qnil;
33
+ }
34
+
35
+ /* NOTE: No point in implementing g_io_module_query. */
36
+
37
+ void
38
+ Init_giomodule(VALUE mGio)
39
+ {
40
+ VALUE RG_TARGET_NAMESPACE;
41
+
42
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_IO_TYPE_MODULE, "IOModule", mGio);
43
+
44
+ RG_DEF_METHOD(initialize, 1);
45
+ }
@@ -0,0 +1,47 @@
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 mIOModules
25
+
26
+ static VALUE
27
+ rg_m_load_all_in_directory(G_GNUC_UNUSED VALUE self, VALUE dirname)
28
+ {
29
+ return GLIST2ARY_FREE(g_io_modules_load_all_in_directory(RVAL2CSTR(dirname)));
30
+ }
31
+
32
+ static VALUE
33
+ rg_m_scan_all_in_directory(VALUE self, VALUE dirname)
34
+ {
35
+ g_io_modules_scan_all_in_directory(RVAL2CSTR(dirname));
36
+
37
+ return self;
38
+ }
39
+
40
+ void
41
+ Init_giomodules(VALUE mGio)
42
+ {
43
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IOModules");
44
+
45
+ RG_DEF_MODFUNC(load_all_in_directory, 1);
46
+ RG_DEF_MODFUNC(scan_all_in_directory, 1);
47
+ }
@@ -0,0 +1,102 @@
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 mIOScheduler
25
+
26
+ struct ioscheduler_job_callback_data
27
+ {
28
+ GIOSchedulerJob *job;
29
+ GCancellable *cancellable;
30
+ gpointer data;
31
+ };
32
+
33
+ static VALUE
34
+ ioscheduler_job_callback_call(VALUE data)
35
+ {
36
+ static VALUE s_id_call;
37
+ struct ioscheduler_job_callback_data *real;
38
+
39
+ if (s_id_call == 0)
40
+ s_id_call = rb_intern("call");
41
+
42
+ real = (struct ioscheduler_job_callback_data *)data;
43
+
44
+ /* TODO: Totally unsure if _UNREF is correct here or not. */
45
+ return rb_funcall(USE_BLOCK_AND_SAVE(real->data), s_id_call, 2,
46
+ GOBJ2RVAL_UNREF(real->job),
47
+ GOBJ2RVAL_UNREF(real->cancellable));
48
+ }
49
+
50
+ static gboolean
51
+ ioscheduler_job_callback(GIOSchedulerJob *job,
52
+ GCancellable *cancellable,
53
+ gpointer data)
54
+ {
55
+ struct ioscheduler_job_callback_data real = { job, cancellable, data };
56
+
57
+ return RVAL2CBOOL(G_PROTECT_CALLBACK(ioscheduler_job_callback_call,
58
+ &real));
59
+ }
60
+
61
+ static void
62
+ ioscheduler_job_callback_free(gpointer data)
63
+ {
64
+ USE_BLOCK((VALUE)data);
65
+ }
66
+
67
+ static VALUE
68
+ rg_s_push_job(int argc, VALUE *argv, VALUE self)
69
+ {
70
+ VALUE rbio_priority, rbcancellable, block;
71
+ gint io_priority;
72
+ GCancellable *cancellable;
73
+
74
+ rb_scan_args(argc, argv, "02", &rbio_priority, &rbcancellable);
75
+ io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
76
+ cancellable = RVAL2GCANCELLABLE(rbcancellable);
77
+ block = rb_block_proc();
78
+ SAVE_BLOCK(block);
79
+ g_io_scheduler_push_job(ioscheduler_job_callback,
80
+ (gpointer)block,
81
+ ioscheduler_job_callback_free,
82
+ io_priority,
83
+ cancellable);
84
+
85
+ return self;
86
+ }
87
+
88
+ static VALUE
89
+ rg_s_cancel_all_jobs(VALUE self)
90
+ {
91
+ g_io_scheduler_cancel_all_jobs();
92
+
93
+ return self;
94
+ }
95
+
96
+ void
97
+ Init_gioscheduler(VALUE mGio)
98
+ {
99
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "IOScheduler");
100
+ RG_DEF_SMETHOD(push_job, -1);
101
+ RG_DEF_SMETHOD(cancel_all_jobs, 0);
102
+ }