gio2 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) 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/gio2/deprecated.rb +102 -0
  96. data/lib/gio2.rb +14 -12
  97. metadata +100 -88
  98. data/ChangeLog +0 -129
  99. data/ext/gio2/gapplaunchcontext.c +0 -79
  100. data/ext/gio2/gasyncresult.c +0 -39
  101. data/ext/gio2/gbufferedoutputstream.c +0 -48
  102. data/ext/gio2/gcancellable.c +0 -177
  103. data/ext/gio2/gcharsetconverter.c +0 -55
  104. data/ext/gio2/gcontenttype.c +0 -128
  105. data/ext/gio2/gconverterinputstream.c +0 -41
  106. data/ext/gio2/gconverteroutputstream.c +0 -41
  107. data/ext/gio2/gdesktopappinfo.c +0 -88
  108. data/ext/gio2/gemblem.c +0 -52
  109. data/ext/gio2/gemblemedicon.c +0 -63
  110. data/ext/gio2/gfileattribute.c +0 -111
  111. data/ext/gio2/gfileattributeinfo.c +0 -89
  112. data/ext/gio2/gfileattributeinfolist.c +0 -109
  113. data/ext/gio2/gfileattributematcher.c +0 -90
  114. data/ext/gio2/gfiledescriptorbased.c +0 -42
  115. data/ext/gio2/gfileicon.c +0 -39
  116. data/ext/gio2/gfilemonitor.c +0 -44
  117. data/ext/gio2/gfilenamecompleter.c +0 -72
  118. data/ext/gio2/gfilterinputstream.c +0 -27
  119. data/ext/gio2/gfilteroutputstream.c +0 -27
  120. data/ext/gio2/gicon.c +0 -67
  121. data/ext/gio2/ginetaddress.c +0 -116
  122. data/ext/gio2/ginetsocketaddress.c +0 -38
  123. data/ext/gio2/gioerror.c +0 -70
  124. data/ext/gio2/giomodule.c +0 -63
  125. data/ext/gio2/gioscheduler.c +0 -193
  126. data/ext/gio2/giostream.c +0 -106
  127. data/ext/gio2/gmemoryinputstream.c +0 -65
  128. data/ext/gio2/gmemoryoutputstream.c +0 -41
  129. data/ext/gio2/gmountoperation.c +0 -66
  130. data/ext/gio2/gnetworkaddress.c +0 -57
  131. data/ext/gio2/gnetworkservice.c +0 -43
  132. data/ext/gio2/gseekable.c +0 -89
  133. data/ext/gio2/gsimpleasyncresult.c +0 -153
  134. data/ext/gio2/gsocketaddress.c +0 -33
  135. data/ext/gio2/gsocketconnectable.c +0 -97
  136. data/ext/gio2/gsocketconnection.c +0 -75
  137. data/ext/gio2/gsocketcontrolmessage.c +0 -80
  138. data/ext/gio2/gsocketservice.c +0 -64
  139. data/ext/gio2/gsrvtarget.c +0 -77
  140. data/ext/gio2/gtcpconnection.c +0 -27
  141. data/ext/gio2/gthemedicon.c +0 -81
  142. data/ext/gio2/gthreadedsocketservice.c +0 -40
  143. data/ext/gio2/gunixconnection.c +0 -69
  144. data/ext/gio2/gunixfdlist.c +0 -112
  145. data/ext/gio2/gunixfdmessage.c +0 -72
  146. data/ext/gio2/gunixinputstream.c +0 -49
  147. data/ext/gio2/gunixmounts.c +0 -343
  148. data/ext/gio2/gunixoutputstream.c +0 -49
  149. data/ext/gio2/gunixsocketaddress.c +0 -67
  150. data/ext/gio2/gvfs.c +0 -82
  151. data/ext/gio2/gvolume.c +0 -191
  152. data/ext/gio2/gvolumemonitor.c +0 -75
  153. data/ext/gio2/gzlibcompressor.c +0 -50
  154. data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,37 +1,36 @@
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 cOutputStream
23
25
  #define _SELF(value) RVAL2GOUTPUTSTREAM(value)
24
26
 
25
- #define RVAL2GOUTPUTSTREAMSPLICEFLAGS(value) \
26
- RVAL2GFLAGS((value), G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS)
27
-
28
27
  #define RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(value) \
29
28
  RVAL2TYPE_WITH_DEFAULT((value), \
30
29
  RVAL2GOUTPUTSTREAMSPLICEFLAGS, \
31
30
  G_OUTPUT_STREAM_SPLICE_NONE)
32
31
 
33
32
  static VALUE
34
- outputstream_write(int argc, VALUE *argv, VALUE self)
33
+ rg_write(int argc, VALUE *argv, VALUE self)
35
34
  {
36
35
  VALUE rbbuffer, cancellable;
37
36
  const char *buffer;
@@ -52,7 +51,7 @@ outputstream_write(int argc, VALUE *argv, VALUE self)
52
51
  }
53
52
 
54
53
  static VALUE
55
- outputstream_write_all(int argc, VALUE *argv, VALUE self)
54
+ rg_write_all(int argc, VALUE *argv, VALUE self)
56
55
  {
57
56
  VALUE rbbuffer, cancellable;
58
57
  const char *buffer;
@@ -73,7 +72,7 @@ outputstream_write_all(int argc, VALUE *argv, VALUE self)
73
72
  }
74
73
 
75
74
  static VALUE
76
- outputstream_splice(int argc, VALUE *argv, VALUE self)
75
+ rg_splice(int argc, VALUE *argv, VALUE self)
77
76
  {
78
77
  VALUE source, flags, cancellable;
79
78
  GError *error = NULL;
@@ -107,23 +106,23 @@ cancellable_method(CancellableMethod method, int argc, VALUE *argv, VALUE self)
107
106
  }
108
107
 
109
108
  static VALUE
110
- outputstream_flush(int argc, VALUE *argv, VALUE self)
109
+ rg_flush(int argc, VALUE *argv, VALUE self)
111
110
  {
112
111
  return cancellable_method(g_output_stream_flush, argc, argv, self);
113
112
  }
114
113
 
115
114
  static VALUE
116
- outputstream_close(int argc, VALUE *argv, VALUE self)
115
+ rg_close(int argc, VALUE *argv, VALUE self)
117
116
  {
118
117
  return cancellable_method(g_output_stream_close, argc, argv, self);
119
118
  }
120
119
 
121
120
  /* TODO: Does it make sense to use buffer and count? We should probably
122
- * provide a better wrapper that simply pumps out buffer while count hasnt
121
+ * provide a better wrapper that simply pumps out buffer while count hasn't
123
122
  * been reached, calling the callback with the bytes written, then with the
124
123
  * result. */
125
124
  static VALUE
126
- outputstream_write_async(int argc, VALUE *argv, VALUE self)
125
+ rg_write_async(int argc, VALUE *argv, VALUE self)
127
126
  {
128
127
  VALUE rbbuffer, rbcount, rbio_priority, rbcancellable, block;
129
128
  const gchar *buffer;
@@ -164,13 +163,13 @@ ssize_finish_method(SSizeFinishMethod method, VALUE self, VALUE result)
164
163
  }
165
164
 
166
165
  static VALUE
167
- outputstream_write_finish(VALUE self, VALUE result)
166
+ rg_write_finish(VALUE self, VALUE result)
168
167
  {
169
168
  return ssize_finish_method(g_output_stream_write_finish, self, result);
170
169
  }
171
170
 
172
171
  static VALUE
173
- outputstream_splice_async(int argc, VALUE *argv, VALUE self)
172
+ rg_splice_async(int argc, VALUE *argv, VALUE self)
174
173
  {
175
174
  VALUE rbsource, rbflags, rbio_priority, rbcancellable, block;
176
175
  GInputStream *source;
@@ -196,13 +195,13 @@ outputstream_splice_async(int argc, VALUE *argv, VALUE self)
196
195
  }
197
196
 
198
197
  static VALUE
199
- outputstream_splice_finish(VALUE self, VALUE result)
198
+ rg_splice_finish(VALUE self, VALUE result)
200
199
  {
201
200
  return ssize_finish_method(g_output_stream_splice_finish, self, result);
202
201
  }
203
202
 
204
203
  static VALUE
205
- outputstream_flush_async(int argc, VALUE *argv, VALUE self)
204
+ rg_flush_async(int argc, VALUE *argv, VALUE self)
206
205
  {
207
206
  VALUE rbio_priority, rbcancellable, block;
208
207
  int io_priority;
@@ -235,13 +234,13 @@ boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
235
234
  }
236
235
 
237
236
  static VALUE
238
- outputstream_flush_finish(VALUE self, VALUE result)
237
+ rg_flush_finish(VALUE self, VALUE result)
239
238
  {
240
239
  return boolean_finish_method(g_output_stream_flush_finish, self, result);
241
240
  }
242
241
 
243
242
  static VALUE
244
- outputstream_close_async(int argc, VALUE *argv, VALUE self)
243
+ rg_close_async(int argc, VALUE *argv, VALUE self)
245
244
  {
246
245
  VALUE rbio_priority, rbcancellable, block;
247
246
  int io_priority;
@@ -261,31 +260,31 @@ outputstream_close_async(int argc, VALUE *argv, VALUE self)
261
260
  }
262
261
 
263
262
  static VALUE
264
- outputstream_close_finish(VALUE self, VALUE result)
263
+ rg_close_finish(VALUE self, VALUE result)
265
264
  {
266
265
  return boolean_finish_method(g_output_stream_close_finish, self, result);
267
266
  }
268
267
 
269
268
  static VALUE
270
- outputstream_is_closing(VALUE self)
269
+ rg_closing_p(VALUE self)
271
270
  {
272
271
  return CBOOL2RVAL(g_output_stream_is_closing(_SELF(self)));
273
272
  }
274
273
 
275
274
  static VALUE
276
- outputstream_is_closed(VALUE self)
275
+ rg_closed_p(VALUE self)
277
276
  {
278
277
  return CBOOL2RVAL(g_output_stream_is_closed(_SELF(self)));
279
278
  }
280
279
 
281
280
  static VALUE
282
- outputstream_has_pending(VALUE self)
281
+ rg_has_pending_p(VALUE self)
283
282
  {
284
283
  return CBOOL2RVAL(g_output_stream_has_pending(_SELF(self)));
285
284
  }
286
285
 
287
286
  static VALUE
288
- outputstream_set_pending(VALUE self)
287
+ rg_set_pending(VALUE self)
289
288
  {
290
289
  GError *error = NULL;
291
290
 
@@ -296,7 +295,7 @@ outputstream_set_pending(VALUE self)
296
295
  }
297
296
 
298
297
  static VALUE
299
- outputstream_clear_pending(VALUE self)
298
+ rg_clear_pending(VALUE self)
300
299
  {
301
300
  g_output_stream_clear_pending(_SELF(self));
302
301
 
@@ -304,30 +303,30 @@ outputstream_clear_pending(VALUE self)
304
303
  }
305
304
 
306
305
  void
307
- Init_goutputstream(VALUE glib)
306
+ Init_goutputstream(VALUE mGio)
308
307
  {
309
- VALUE outputstream = G_DEF_CLASS(G_TYPE_OUTPUT_STREAM, "OutputStream", glib);
310
-
311
- G_DEF_CLASS(G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "SpliceFlags", outputstream);
312
- G_DEF_CONSTANTS(outputstream, G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "G_OUTPUT_STREAM_");
313
-
314
- rb_define_method(outputstream, "write", outputstream_write, -1);
315
- rb_define_method(outputstream, "write_all", outputstream_write_all, -1);
316
- rb_define_method(outputstream, "splice", outputstream_splice, -1);
317
- rb_define_method(outputstream, "flush", outputstream_flush, -1);
318
- rb_define_method(outputstream, "close", outputstream_close, -1);
319
- rb_define_method(outputstream, "write_async", outputstream_write_async, -1);
320
- rb_define_method(outputstream, "write_finish", outputstream_write_finish, 1);
321
- rb_define_method(outputstream, "splice_async", outputstream_splice_async, -1);
322
- rb_define_method(outputstream, "splice_finish", outputstream_splice_finish, 1);
323
- rb_define_method(outputstream, "flush_async", outputstream_flush_async, -1);
324
- rb_define_method(outputstream, "flush_finish", outputstream_flush_finish, 1);
325
- rb_define_method(outputstream, "close_async", outputstream_close_async, -1);
326
- rb_define_method(outputstream, "close_finish", outputstream_close_finish, 0);
327
- rb_define_method(outputstream, "closing?", outputstream_is_closing, 0);
328
- rb_define_method(outputstream, "closed?", outputstream_is_closed, 0);
329
- rb_define_method(outputstream, "has_pending?", outputstream_has_pending, 0);
330
- rb_define_method(outputstream, "set_pending", outputstream_set_pending, 0);
331
- G_DEF_SETTER(outputstream, "pending");
332
- rb_define_method(outputstream, "clear_pending", outputstream_clear_pending, 0);
308
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_OUTPUT_STREAM, "OutputStream", mGio);
309
+
310
+ G_DEF_CLASS(G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "SpliceFlags", RG_TARGET_NAMESPACE);
311
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, "G_OUTPUT_STREAM_");
312
+
313
+ RG_DEF_METHOD(write, -1);
314
+ RG_DEF_METHOD(write_all, -1);
315
+ RG_DEF_METHOD(splice, -1);
316
+ RG_DEF_METHOD(flush, -1);
317
+ RG_DEF_METHOD(close, -1);
318
+ RG_DEF_METHOD(write_async, -1);
319
+ RG_DEF_METHOD(write_finish, 1);
320
+ RG_DEF_METHOD(splice_async, -1);
321
+ RG_DEF_METHOD(splice_finish, 1);
322
+ RG_DEF_METHOD(flush_async, -1);
323
+ RG_DEF_METHOD(flush_finish, 1);
324
+ RG_DEF_METHOD(close_async, -1);
325
+ RG_DEF_METHOD(close_finish, 0);
326
+ RG_DEF_METHOD_P(closing, 0);
327
+ RG_DEF_METHOD_P(closed, 0);
328
+ RG_DEF_METHOD_P(has_pending, 0);
329
+ RG_DEF_METHOD(set_pending, 0);
330
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "pending");
331
+ RG_DEF_METHOD(clear_pending, 0);
333
332
  }
@@ -1,35 +1,37 @@
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_RESOLVER(RVAL2GOBJ(value))
24
+ #define RG_TARGET_NAMESPACE cResolver
25
+ #define _SELF(value) RVAL2GRESOLVER(value)
24
26
 
25
27
  static VALUE
26
- resolver_get_default(G_GNUC_UNUSED VALUE self)
28
+ rg_s_default(G_GNUC_UNUSED VALUE self)
27
29
  {
28
30
  return GOBJ2RVAL_UNREF(g_resolver_get_default());
29
31
  }
30
32
 
31
33
  static VALUE
32
- resolver_set_default(G_GNUC_UNUSED VALUE self, VALUE resolver)
34
+ rg_s_set_default(G_GNUC_UNUSED VALUE self, VALUE resolver)
33
35
  {
34
36
  g_resolver_set_default(_SELF(resolver));
35
37
 
@@ -37,7 +39,7 @@ resolver_set_default(G_GNUC_UNUSED VALUE self, VALUE resolver)
37
39
  }
38
40
 
39
41
  static VALUE
40
- resolver_lookup_by_name(VALUE self, VALUE hostname, VALUE cancellable)
42
+ rg_lookup_by_name(VALUE self, VALUE hostname, VALUE cancellable)
41
43
  {
42
44
  GError *error = NULL;
43
45
  GList *addresses;
@@ -53,7 +55,7 @@ resolver_lookup_by_name(VALUE self, VALUE hostname, VALUE cancellable)
53
55
  }
54
56
 
55
57
  static VALUE
56
- resolver_lookup_by_name_async(int argc, VALUE *argv, VALUE self)
58
+ rg_lookup_by_name_async(int argc, VALUE *argv, VALUE self)
57
59
  {
58
60
  VALUE rbhostname, rbcancellable, block;
59
61
  const gchar *hostname;
@@ -73,7 +75,7 @@ resolver_lookup_by_name_async(int argc, VALUE *argv, VALUE self)
73
75
  }
74
76
 
75
77
  static VALUE
76
- resolver_lookup_by_name_finish(VALUE self, VALUE result)
78
+ rg_lookup_by_name_finish(VALUE self, VALUE result)
77
79
  {
78
80
  GError *error = NULL;
79
81
  GList *addresses;
@@ -88,7 +90,7 @@ resolver_lookup_by_name_finish(VALUE self, VALUE result)
88
90
  }
89
91
 
90
92
  static VALUE
91
- resolver_lookup_by_address(int argc, VALUE *argv, VALUE self)
93
+ rg_lookup_by_address(int argc, VALUE *argv, VALUE self)
92
94
  {
93
95
  VALUE address, cancellable;
94
96
  GError *error = NULL;
@@ -106,7 +108,7 @@ resolver_lookup_by_address(int argc, VALUE *argv, VALUE self)
106
108
  }
107
109
 
108
110
  static VALUE
109
- resolver_lookup_by_address_async(int argc, VALUE *argv, VALUE self)
111
+ rg_lookup_by_address_async(int argc, VALUE *argv, VALUE self)
110
112
  {
111
113
  VALUE rbaddress, rbcancellable, block;
112
114
  GInetAddress *address;
@@ -126,7 +128,7 @@ resolver_lookup_by_address_async(int argc, VALUE *argv, VALUE self)
126
128
  }
127
129
 
128
130
  static VALUE
129
- resolver_lookup_by_address_finish(VALUE self, VALUE result)
131
+ rg_lookup_by_address_finish(VALUE self, VALUE result)
130
132
  {
131
133
  GError *error = NULL;
132
134
  gchar *hostname;
@@ -141,7 +143,7 @@ resolver_lookup_by_address_finish(VALUE self, VALUE result)
141
143
  }
142
144
 
143
145
  static VALUE
144
- resolver_lookup_service(int argc, VALUE *argv, VALUE self)
146
+ rg_lookup_service(int argc, VALUE *argv, VALUE self)
145
147
  {
146
148
  VALUE service, protocol, domain, cancellable;
147
149
  GError *error = NULL;
@@ -161,7 +163,7 @@ resolver_lookup_service(int argc, VALUE *argv, VALUE self)
161
163
  }
162
164
 
163
165
  static VALUE
164
- resolver_lookup_service_async(int argc, VALUE *argv, VALUE self)
166
+ rg_lookup_service_async(int argc, VALUE *argv, VALUE self)
165
167
  {
166
168
  VALUE rbservice, rbprotocol, rbdomain, rbcancellable, block;
167
169
  const gchar *service;
@@ -187,7 +189,7 @@ resolver_lookup_service_async(int argc, VALUE *argv, VALUE self)
187
189
  }
188
190
 
189
191
  static VALUE
190
- resolver_lookup_service_finish(VALUE self, VALUE result)
192
+ rg_lookup_service_finish(VALUE self, VALUE result)
191
193
  {
192
194
  GError *error = NULL;
193
195
  GList *targets;
@@ -200,29 +202,29 @@ resolver_lookup_service_finish(VALUE self, VALUE result)
200
202
  }
201
203
 
202
204
  void
203
- Init_gresolver(VALUE glib)
205
+ Init_gresolver(VALUE mGio)
204
206
  {
205
- VALUE resolver, error;
206
-
207
- resolver = G_DEF_CLASS(G_TYPE_RESOLVER, "Resolver", glib);
207
+ VALUE RG_TARGET_NAMESPACE, error;
208
208
 
209
- rb_define_singleton_method(resolver, "default", resolver_get_default, 0);
210
- rb_define_singleton_method(resolver, "set_default", resolver_set_default, 1);
209
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_RESOLVER, "Resolver", mGio);
210
+
211
+ RG_DEF_SMETHOD(default, 0);
212
+ RG_DEF_SMETHOD(set_default, 1);
211
213
 
212
214
  /* TODO: Taint result of these methods? */
213
- rb_define_method(resolver, "lookup_by_name", resolver_lookup_by_name, 2);
214
- rb_define_method(resolver, "lookup_by_name_async", resolver_lookup_by_name_async, -1);
215
- rb_define_method(resolver, "lookup_by_name_finish", resolver_lookup_by_name_finish, 1);
216
- rb_define_method(resolver, "lookup_by_address", resolver_lookup_by_address, -1);
217
- rb_define_method(resolver, "lookup_by_address_async", resolver_lookup_by_address_async, -1);
218
- rb_define_method(resolver, "lookup_by_address_finish", resolver_lookup_by_address_finish, 1);
219
- rb_define_method(resolver, "lookup_service", resolver_lookup_service, -1);
220
- rb_define_method(resolver, "lookup_service_async", resolver_lookup_service_async, -1);
221
- rb_define_method(resolver, "lookup_service_finish", resolver_lookup_service_finish, 1);
222
-
223
- error = rbgio_define_domain_error(resolver, "Error", G_RESOLVER_ERROR, "GResolverErrorEnum", rb_eIOError);
224
-
225
- rbgio_define_error(resolver, "NotFoundError", G_RESOLVER_ERROR_NOT_FOUND, error);
226
- rbgio_define_error(resolver, "TemporaryFailureError", G_RESOLVER_ERROR_TEMPORARY_FAILURE, error);
227
- rbgio_define_error(resolver, "InternalError", G_RESOLVER_ERROR_INTERNAL, error);
215
+ RG_DEF_METHOD(lookup_by_name, 2);
216
+ RG_DEF_METHOD(lookup_by_name_async, -1);
217
+ RG_DEF_METHOD(lookup_by_name_finish, 1);
218
+ RG_DEF_METHOD(lookup_by_address, -1);
219
+ RG_DEF_METHOD(lookup_by_address_async, -1);
220
+ RG_DEF_METHOD(lookup_by_address_finish, 1);
221
+ RG_DEF_METHOD(lookup_service, -1);
222
+ RG_DEF_METHOD(lookup_service_async, -1);
223
+ RG_DEF_METHOD(lookup_service_finish, 1);
224
+
225
+ error = rbgio_define_domain_error(RG_TARGET_NAMESPACE, "Error", G_RESOLVER_ERROR, "GResolverErrorEnum", rb_eIOError);
226
+
227
+ rbgio_define_error(RG_TARGET_NAMESPACE, "NotFoundError", G_RESOLVER_ERROR_NOT_FOUND, error);
228
+ rbgio_define_error(RG_TARGET_NAMESPACE, "TemporaryFailureError", G_RESOLVER_ERROR_TEMPORARY_FAILURE, error);
229
+ rbgio_define_error(RG_TARGET_NAMESPACE, "InternalError", G_RESOLVER_ERROR_INTERNAL, error);
228
230
  }
@@ -0,0 +1,91 @@
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 mSeekable
25
+ #define _SELF(value) RVAL2GSEEKABLE(value)
26
+
27
+ #define RVAL2GSEEKTYPEDEFAULT(value) \
28
+ RVAL2TYPE_WITH_DEFAULT((value), NUM2INT, G_SEEK_CUR)
29
+
30
+ static VALUE
31
+ rg_tell(VALUE self)
32
+ {
33
+ return GOFFSET2RVAL(g_seekable_tell(_SELF(self)));
34
+ }
35
+
36
+ static VALUE
37
+ rg_can_seek_p(VALUE self)
38
+ {
39
+ return CBOOL2RVAL(g_seekable_can_seek(_SELF(self)));
40
+ }
41
+
42
+ static VALUE
43
+ rg_seek(int argc, VALUE *argv, VALUE self)
44
+ {
45
+ VALUE offset, type, cancellable;
46
+ GError *error = NULL;
47
+
48
+ rb_scan_args(argc, argv, "12", &offset, &type, &cancellable);
49
+ if (!g_seekable_seek(_SELF(self),
50
+ RVAL2GOFFSET(offset),
51
+ RVAL2GSEEKTYPEDEFAULT(type),
52
+ RVAL2GCANCELLABLE(cancellable),
53
+ &error))
54
+ rbgio_raise_error(error);
55
+
56
+ return self;
57
+ }
58
+
59
+ static VALUE
60
+ rg_can_truncate_p(VALUE self)
61
+ {
62
+ return CBOOL2RVAL(g_seekable_can_truncate(_SELF(self)));
63
+ }
64
+
65
+ static VALUE
66
+ rg_truncate(int argc, VALUE *argv, VALUE self)
67
+ {
68
+ VALUE offset, cancellable;
69
+ GError *error = NULL;
70
+
71
+ rb_scan_args(argc, argv, "11", &offset, &cancellable);
72
+ if (!g_seekable_truncate(_SELF(self),
73
+ RVAL2GOFFSET(offset),
74
+ RVAL2GCANCELLABLE(cancellable),
75
+ &error))
76
+ rbgio_raise_error(error);
77
+
78
+ return self;
79
+ }
80
+
81
+ void
82
+ Init_gseekable(VALUE mGio)
83
+ {
84
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_SEEKABLE, "Seekable", mGio);
85
+
86
+ RG_DEF_METHOD(tell, 0);
87
+ RG_DEF_METHOD_P(can_seek, 0);
88
+ RG_DEF_METHOD(seek, -1);
89
+ RG_DEF_METHOD_P(can_truncate, 0);
90
+ RG_DEF_METHOD(truncate, -1);
91
+ }
@@ -0,0 +1,155 @@
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 cSimpleAsyncResult
25
+ #define _SELF(value) RVAL2GSIMPLEASYNCRESULT(value)
26
+
27
+ static VALUE
28
+ rg_initialize(VALUE self, VALUE object)
29
+ {
30
+ VALUE block;
31
+
32
+ /* TODO: I have absolutely no idea if this makes sense. Should we even
33
+ * be providing this method? */
34
+ block = rb_block_proc();
35
+ SAVE_BLOCK(block);
36
+ G_INITIALIZE(self,
37
+ g_simple_async_result_new(RVAL2GOBJ(object),
38
+ rbgio_async_ready_callback,
39
+ (gpointer)block,
40
+ (gpointer)block));
41
+
42
+ return Qnil;
43
+ }
44
+
45
+ /* NOTE: Can't implement g_simple_async_result_new_error. */
46
+
47
+ /* NOTE: Can't implement g_simple_async_result_new_from_error. */
48
+
49
+ /* NOTE: Can't implement g_simple_async_result_set_op_res_gpointer. */
50
+
51
+ /* NOTE: Can't implement g_simple_async_result_get_op_res_gpointer. */
52
+
53
+ static VALUE
54
+ rg_set_op_res_gssize(VALUE self, VALUE op_res)
55
+ {
56
+ g_simple_async_result_set_op_res_gssize(_SELF(self),
57
+ RVAL2GSSIZE(op_res));
58
+
59
+ return self;
60
+ }
61
+
62
+ static VALUE
63
+ rg_op_res_gssize(VALUE self)
64
+ {
65
+ return GSSIZE2RVAL(g_simple_async_result_get_op_res_gssize(_SELF(self)));
66
+ }
67
+
68
+ static VALUE
69
+ rg_set_op_res_gboolean(VALUE self, VALUE op_res)
70
+ {
71
+ g_simple_async_result_set_op_res_gboolean(_SELF(self),
72
+ RVAL2CBOOL(op_res));
73
+
74
+ return self;
75
+ }
76
+
77
+ static VALUE
78
+ rg_op_res_gboolean(VALUE self)
79
+ {
80
+ return CBOOL2RVAL(g_simple_async_result_get_op_res_gboolean(_SELF(self)));
81
+ }
82
+
83
+ static VALUE
84
+ rg_source_tag(VALUE self)
85
+ {
86
+ return (VALUE)g_simple_async_result_get_source_tag(_SELF(self));
87
+ }
88
+
89
+ static VALUE
90
+ rg_valid_p(VALUE self, VALUE source, VALUE source_tag)
91
+ {
92
+ return CBOOL2RVAL(g_simple_async_result_is_valid(RVAL2GASYNCRESULT(self),
93
+ RVAL2GOBJ(source),
94
+ (gpointer)source_tag));
95
+ }
96
+
97
+ static VALUE
98
+ rg_set_handle_cancellation(VALUE self, VALUE handle_cancellation)
99
+ {
100
+ g_simple_async_result_set_handle_cancellation(_SELF(self),
101
+ RVAL2CBOOL(handle_cancellation));
102
+
103
+ return self;
104
+ }
105
+
106
+ static VALUE
107
+ rg_complete(VALUE self)
108
+ {
109
+ g_simple_async_result_complete(_SELF(self));
110
+
111
+ return self;
112
+ }
113
+
114
+ static VALUE
115
+ rg_complete_in_idle(VALUE self)
116
+ {
117
+ g_simple_async_result_complete_in_idle(_SELF(self));
118
+
119
+ return self;
120
+ }
121
+
122
+ /* TODO: Should we implement g_simple_async_result_run_in_thread? I'd say no,
123
+ * but I'm not sure. */
124
+
125
+ /* NOTE: Can't implement g_simple_async_result_set_from_error. */
126
+
127
+ /* NOTE: Can't implement g_simple_async_result_propagate_error. */
128
+
129
+ /* NOTE: Can't implement g_simple_async_result_set_error. */
130
+
131
+ /* NOTE: Can't implement g_simple_async_result_set_error_va. */
132
+
133
+ /* NOTE: Can't implement g_simple_async_result_report_error_in_idle. */
134
+
135
+ /* NOTE: Can't implement g_simple_async_result_report_gerror_in_idle. */
136
+
137
+ void
138
+ Init_gsimpleasyncresult(VALUE mGio)
139
+ {
140
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SIMPLE_ASYNC_RESULT, "SimpleAsyncResult", mGio);
141
+
142
+ RG_DEF_METHOD(initialize, 1);
143
+ RG_DEF_METHOD(set_op_res_gssize, 1);
144
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "op_res_gssize");
145
+ RG_DEF_METHOD(op_res_gssize, 0);
146
+ RG_DEF_METHOD(set_op_res_gboolean, 1);
147
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "op_res_gboolean");
148
+ RG_DEF_METHOD(op_res_gboolean, 0);
149
+ RG_DEF_METHOD(source_tag, 0);
150
+ RG_DEF_METHOD_P(valid, 2);
151
+ RG_DEF_METHOD(set_handle_cancellation, 1);
152
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "handle_cancellation");
153
+ RG_DEF_METHOD(complete, 0);
154
+ RG_DEF_METHOD(complete_in_idle, 0);
155
+ }