gio2 0.90.5 → 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/ChangeLog +41 -0
  2. data/Rakefile +9 -70
  3. data/ext/gio2/Makefile +162 -0
  4. data/ext/gio2/extconf.rb +9 -9
  5. data/ext/gio2/gappinfo.o +0 -0
  6. data/ext/gio2/gapplaunchcontext.o +0 -0
  7. data/ext/gio2/gasyncinitable.c +0 -1
  8. data/ext/gio2/gasyncinitable.o +0 -0
  9. data/ext/gio2/gasyncresult.o +0 -0
  10. data/ext/gio2/gbufferedinputstream.c +0 -19
  11. data/ext/gio2/gbufferedinputstream.o +0 -0
  12. data/ext/gio2/gbufferedoutputstream.c +0 -34
  13. data/ext/gio2/gbufferedoutputstream.o +0 -0
  14. data/ext/gio2/gcancellable.o +0 -0
  15. data/ext/gio2/gcharsetconverter.c +0 -17
  16. data/ext/gio2/gcharsetconverter.o +0 -0
  17. data/ext/gio2/gcontenttype.c +1 -8
  18. data/ext/gio2/gcontenttype.o +0 -0
  19. data/ext/gio2/gconverter.o +0 -0
  20. data/ext/gio2/gconverterinputstream.c +0 -7
  21. data/ext/gio2/gconverterinputstream.o +0 -0
  22. data/ext/gio2/gconverteroutputstream.c +0 -7
  23. data/ext/gio2/gconverteroutputstream.o +0 -0
  24. data/ext/gio2/gdatainputstream.c +34 -57
  25. data/ext/gio2/gdatainputstream.o +0 -0
  26. data/ext/gio2/gdataoutputstream.c +0 -18
  27. data/ext/gio2/gdataoutputstream.o +0 -0
  28. data/ext/gio2/gdesktopappinfo.c +0 -2
  29. data/ext/gio2/gdesktopappinfo.o +0 -0
  30. data/ext/gio2/gdrive.o +0 -0
  31. data/ext/gio2/gemblem.c +0 -19
  32. data/ext/gio2/gemblem.o +0 -0
  33. data/ext/gio2/gemblemedicon.o +0 -0
  34. data/ext/gio2/gfile.c +4 -6
  35. data/ext/gio2/gfile.o +0 -0
  36. data/ext/gio2/gfileattribute.c +3 -155
  37. data/ext/gio2/gfileattribute.o +0 -0
  38. data/ext/gio2/gfileattributeinfo.c +89 -0
  39. data/ext/gio2/gfileattributeinfo.o +0 -0
  40. data/ext/gio2/gfileattributeinfolist.c +109 -0
  41. data/ext/gio2/gfileattributeinfolist.o +0 -0
  42. data/ext/gio2/gfileattributematcher.o +0 -0
  43. data/ext/gio2/gfiledescriptorbased.o +0 -0
  44. data/ext/gio2/gfileenumerator.c +0 -2
  45. data/ext/gio2/gfileenumerator.o +0 -0
  46. data/ext/gio2/gfileicon.c +0 -7
  47. data/ext/gio2/gfileicon.o +0 -0
  48. data/ext/gio2/gfileinfo.c +4 -11
  49. data/ext/gio2/gfileinfo.o +0 -0
  50. data/ext/gio2/gfileinputstream.c +0 -2
  51. data/ext/gio2/gfileinputstream.o +0 -0
  52. data/ext/gio2/gfileiostream.c +0 -2
  53. data/ext/gio2/gfileiostream.o +0 -0
  54. data/ext/gio2/gfilemonitor.c +0 -19
  55. data/ext/gio2/gfilemonitor.o +0 -0
  56. data/ext/gio2/gfilenamecompleter.o +0 -0
  57. data/ext/gio2/gfileoutputstream.c +1 -5
  58. data/ext/gio2/gfileoutputstream.o +0 -0
  59. data/ext/gio2/gfilterinputstream.c +1 -30
  60. data/ext/gio2/gfilterinputstream.o +0 -0
  61. data/ext/gio2/gfilteroutputstream.c +1 -30
  62. data/ext/gio2/gfilteroutputstream.o +0 -0
  63. data/ext/gio2/gicon.c +0 -2
  64. data/ext/gio2/gicon.o +0 -0
  65. data/ext/gio2/ginetaddress.c +0 -72
  66. data/ext/gio2/ginetaddress.o +0 -0
  67. data/ext/gio2/ginetsocketaddress.c +0 -16
  68. data/ext/gio2/ginetsocketaddress.o +0 -0
  69. data/ext/gio2/ginitable.o +0 -0
  70. data/ext/gio2/ginputstream.c +0 -2
  71. data/ext/gio2/ginputstream.o +0 -0
  72. data/ext/gio2/gio2.c +11 -1
  73. data/ext/gio2/gio2.h +9 -1
  74. data/ext/gio2/gio2.o +0 -0
  75. data/ext/gio2/gio2.so +0 -0
  76. data/ext/gio2/gioerror.c +4 -1
  77. data/ext/gio2/gioerror.o +0 -0
  78. data/ext/gio2/giomodule.c +2 -2
  79. data/ext/gio2/giomodule.o +0 -0
  80. data/ext/gio2/gioscheduler.c +4 -6
  81. data/ext/gio2/gioscheduler.o +0 -0
  82. data/ext/gio2/giostream.c +0 -23
  83. data/ext/gio2/giostream.o +0 -0
  84. data/ext/gio2/gloadableicon.c +0 -1
  85. data/ext/gio2/gloadableicon.o +0 -0
  86. data/ext/gio2/gmemoryinputstream.o +0 -0
  87. data/ext/gio2/gmemoryoutputstream.c +0 -24
  88. data/ext/gio2/gmemoryoutputstream.o +0 -0
  89. data/ext/gio2/gmount.c +1 -0
  90. data/ext/gio2/gmount.o +0 -0
  91. data/ext/gio2/gmountoperation.c +1 -103
  92. data/ext/gio2/gmountoperation.o +0 -0
  93. data/ext/gio2/gnetworkaddress.c +0 -14
  94. data/ext/gio2/gnetworkaddress.o +0 -0
  95. data/ext/gio2/gnetworkservice.c +0 -21
  96. data/ext/gio2/gnetworkservice.o +0 -0
  97. data/ext/gio2/goutputstream.c +8 -18
  98. data/ext/gio2/goutputstream.o +0 -0
  99. data/ext/gio2/gresolver.c +0 -2
  100. data/ext/gio2/gresolver.o +0 -0
  101. data/ext/gio2/gseekable.o +0 -0
  102. data/ext/gio2/gsimpleasyncresult.o +0 -0
  103. data/ext/gio2/gsocket.c +2 -80
  104. data/ext/gio2/gsocket.o +0 -0
  105. data/ext/gio2/gsocketaddress.c +1 -13
  106. data/ext/gio2/gsocketaddress.o +0 -0
  107. data/ext/gio2/gsocketclient.c +0 -68
  108. data/ext/gio2/gsocketclient.o +0 -0
  109. data/ext/gio2/gsocketconnectable.o +0 -0
  110. data/ext/gio2/gsocketconnection.c +1 -8
  111. data/ext/gio2/gsocketconnection.o +0 -0
  112. data/ext/gio2/gsocketcontrolmessage.c +0 -2
  113. data/ext/gio2/gsocketcontrolmessage.o +0 -0
  114. data/ext/gio2/gsocketlistener.c +27 -21
  115. data/ext/gio2/gsocketlistener.o +0 -0
  116. data/ext/gio2/gsocketservice.o +0 -0
  117. data/ext/gio2/gsrvtarget.o +0 -0
  118. data/ext/gio2/gtcpconnection.c +1 -22
  119. data/ext/gio2/gtcpconnection.o +0 -0
  120. data/ext/gio2/gthemedicon.o +0 -0
  121. data/ext/gio2/gthreadedsocketservice.c +6 -5
  122. data/ext/gio2/gthreadedsocketservice.o +0 -0
  123. data/ext/gio2/gunixconnection.o +0 -0
  124. data/ext/gio2/gunixfdlist.c +1 -1
  125. data/ext/gio2/gunixfdlist.o +0 -0
  126. data/ext/gio2/gunixfdmessage.c +0 -9
  127. data/ext/gio2/gunixfdmessage.o +0 -0
  128. data/ext/gio2/gunixinputstream.c +0 -24
  129. data/ext/gio2/gunixinputstream.o +0 -0
  130. data/ext/gio2/gunixmounts.c +1 -4
  131. data/ext/gio2/gunixmounts.o +0 -0
  132. data/ext/gio2/gunixoutputstream.c +0 -24
  133. data/ext/gio2/gunixoutputstream.o +0 -0
  134. data/ext/gio2/gunixsocketaddress.c +5 -17
  135. data/ext/gio2/gunixsocketaddress.o +0 -0
  136. data/ext/gio2/gvfs.c +0 -2
  137. data/ext/gio2/gvfs.o +0 -0
  138. data/ext/gio2/gvolume.o +0 -0
  139. data/ext/gio2/gvolumemonitor.c +0 -2
  140. data/ext/gio2/gvolumemonitor.o +0 -0
  141. data/ext/gio2/gzlibcompressor.c +3 -0
  142. data/ext/gio2/gzlibcompressor.o +0 -0
  143. data/ext/gio2/gzlibdecompressor.o +0 -0
  144. data/ext/gio2/ruby-gio2.pc +3 -0
  145. data/ext/gio2/util.c +3 -0
  146. data/ext/gio2/util.o +0 -0
  147. data/lib/gio2.rb +19 -1
  148. data/test/load-test.rb +14 -0
  149. data/test/test_bufferedinputstream.rb +2 -0
  150. data/test/test_charsetconverter.rb +2 -0
  151. data/test/test_datainputstream.rb +7 -0
  152. data/test/test_fileenumerator.rb +8 -0
  153. data/test/test_filemonitor.rb +2 -0
  154. data/test/test_inetaddress.rb +8 -0
  155. metadata +173 -79
@@ -100,17 +100,21 @@ socketlistener_add_any_inet_port(int argc, VALUE *argv, VALUE self)
100
100
  static VALUE
101
101
  socketlistener_accept(int argc, VALUE *argv, VALUE self)
102
102
  {
103
- VALUE source_object, cancellable;
103
+ VALUE cancellable;
104
+ GObject *source_object;
104
105
  GError *error = NULL;
105
106
  GSocketConnection *connection;
106
107
 
107
- rb_scan_args(argc, argv, "02", &source_object, &cancellable);
108
- connection = g_socket_listener_accept(_SELF(self), RVAL2GOBJ(source_object),
109
- RVAL2GCANCELLABLE(cancellable), &error);
108
+ rb_scan_args(argc, argv, "01", &cancellable);
109
+ connection = g_socket_listener_accept(_SELF(self),
110
+ &source_object,
111
+ RVAL2GCANCELLABLE(cancellable),
112
+ &error);
110
113
  if (connection == NULL)
111
114
  rbgio_raise_error(error);
112
115
 
113
- return GOBJ2RVAL_UNREF(connection);
116
+ return rb_assoc_new(GOBJ2RVAL_UNREF(connection),
117
+ GOBJ2RVAL(source_object));
114
118
  }
115
119
 
116
120
  static VALUE
@@ -131,39 +135,41 @@ socketlistener_accept_async(int argc, VALUE *argv, VALUE self)
131
135
  }
132
136
 
133
137
  static VALUE
134
- socketlistener_accept_finish(int argc, VALUE *argv, VALUE self)
138
+ socketlistener_accept_finish(VALUE self, VALUE result)
135
139
  {
136
- VALUE result, source_object;
140
+ GObject *source_object;
137
141
  GError *error = NULL;
138
142
  GSocketConnection *connection;
139
143
 
140
- rb_scan_args(argc, argv, "11", &result, &source_object);
141
144
  connection = g_socket_listener_accept_finish(_SELF(self),
142
145
  RVAL2GASYNCRESULT(result),
143
- RVAL2GOBJ(source_object),
146
+ &source_object,
144
147
  &error);
145
148
  if (connection == NULL)
146
149
  rbgio_raise_error(error);
147
150
 
148
- return GOBJ2RVAL_UNREF(connection);
151
+ return rb_assoc_new(GOBJ2RVAL_UNREF(connection),
152
+ GOBJ2RVAL(source_object));
149
153
  }
150
154
 
151
155
  static VALUE
152
156
  socketlistener_accept_socket(int argc, VALUE *argv, VALUE self)
153
157
  {
154
- VALUE source_object, cancellable;
158
+ VALUE cancellable;
159
+ GObject *source_object;
155
160
  GError *error = NULL;
156
161
  GSocket *socket;
157
162
 
158
- rb_scan_args(argc, argv, "02", &source_object, &cancellable);
163
+ rb_scan_args(argc, argv, "01", &cancellable);
159
164
  socket = g_socket_listener_accept_socket(_SELF(self),
160
- RVAL2GOBJ(source_object),
165
+ &source_object,
161
166
  RVAL2GCANCELLABLE(cancellable),
162
167
  &error);
163
168
  if (socket == NULL)
164
169
  rbgio_raise_error(error);
165
170
 
166
- return GOBJ2RVAL_UNREF(socket);
171
+ return rb_assoc_new(GOBJ2RVAL_UNREF(socket),
172
+ GOBJ2RVAL(source_object));
167
173
  }
168
174
 
169
175
  static VALUE
@@ -184,21 +190,21 @@ socketlistener_accept_socket_async(int argc, VALUE *argv, VALUE self)
184
190
  }
185
191
 
186
192
  static VALUE
187
- socketlistener_accept_socket_finish(int argc, VALUE *argv, VALUE self)
193
+ socketlistener_accept_socket_finish(VALUE self, VALUE result)
188
194
  {
189
- VALUE result, source_object;
195
+ GObject *source_object;
190
196
  GError *error = NULL;
191
197
  GSocket *socket;
192
198
 
193
- rb_scan_args(argc, argv, "11", &result, &source_object);
194
199
  socket = g_socket_listener_accept_socket_finish(_SELF(self),
195
200
  RVAL2GASYNCRESULT(result),
196
- RVAL2GOBJ(source_object),
201
+ &source_object,
197
202
  &error);
198
203
  if (socket == NULL)
199
204
  rbgio_raise_error(error);
200
205
 
201
- return GOBJ2RVAL_UNREF(socket);
206
+ return rb_assoc_new(GOBJ2RVAL_UNREF(socket),
207
+ GOBJ2RVAL(source_object));
202
208
  }
203
209
 
204
210
  static VALUE
@@ -229,10 +235,10 @@ Init_gsocketlistener(VALUE glib)
229
235
  rb_define_method(socketlistener, "add_any_inet_port", socketlistener_add_any_inet_port, -1);
230
236
  rb_define_method(socketlistener, "accept", socketlistener_accept, -1);
231
237
  rb_define_method(socketlistener, "accept_async", socketlistener_accept_async, -1);
232
- rb_define_method(socketlistener, "accept_finish", socketlistener_accept_finish, -1);
238
+ rb_define_method(socketlistener, "accept_finish", socketlistener_accept_finish, 1);
233
239
  rb_define_method(socketlistener, "accept_socket", socketlistener_accept_socket, -1);
234
240
  rb_define_method(socketlistener, "accept_socket_async", socketlistener_accept_socket_async, -1);
235
- rb_define_method(socketlistener, "accept_socket_finish", socketlistener_accept_socket_finish, -1);
241
+ rb_define_method(socketlistener, "accept_socket_finish", socketlistener_accept_socket_finish, 1);
236
242
  rb_define_method(socketlistener, "close", socketlistener_close, 0);
237
243
  rb_define_method(socketlistener, "set_backlog", socketlistener_set_backlog, 1);
238
244
  G_DEF_SETTER(socketlistener, "backlog");
Binary file
Binary file
Binary file
@@ -20,29 +20,8 @@
20
20
 
21
21
  #include "gio2.h"
22
22
 
23
- #define _SELF(value) G_TCP_CONNECTION(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- tcpconnection_set_graceful_disconnect(VALUE self, VALUE graceful_disconnect)
27
- {
28
- g_tcp_connection_set_graceful_disconnect(_SELF(self),
29
- RVAL2CBOOL(graceful_disconnect));
30
-
31
- return self;
32
- }
33
-
34
- static VALUE
35
- tcpconnection_get_graceful_disconnect(VALUE self)
36
- {
37
- return CBOOL2RVAL(g_tcp_connection_get_graceful_disconnect(_SELF(self)));
38
- }
39
-
40
23
  void
41
24
  Init_gtcpconnection(VALUE glib)
42
25
  {
43
- VALUE tcpconnection = G_DEF_CLASS(G_TYPE_TCP_CONNECTION, "TcpConnection", glib);
44
-
45
- rb_define_method(tcpconnection, "set_graceful_disconnect", tcpconnection_set_graceful_disconnect, 1);
46
- G_DEF_SETTER(tcpconnection, "graceful_disconnect");
47
- rb_define_method(tcpconnection, "graceful_disconnect?", tcpconnection_get_graceful_disconnect, 0);
26
+ (void)G_DEF_CLASS(G_TYPE_TCP_CONNECTION, "TcpConnection", glib);
48
27
  }
Binary file
Binary file
@@ -20,12 +20,13 @@
20
20
 
21
21
  #include "gio2.h"
22
22
 
23
- #define _SELF(value) G_THREADED_SOCKET_SERVICE(RVAL2GOBJ(value))
24
-
25
23
  static VALUE
26
- threadedsocketservice_initialize(VALUE self)
24
+ threadedsocketservice_initialize(VALUE self, VALUE max_threads)
27
25
  {
28
- G_INITIALIZE(self, g_socket_service_new());
26
+ G_INITIALIZE(self,
27
+ g_threaded_socket_service_new(RVAL2TYPE_WITH_DEFAULT(max_threads,
28
+ RVAL2GINT,
29
+ 10)));
29
30
 
30
31
  return Qnil;
31
32
  }
@@ -35,5 +36,5 @@ Init_gthreadedsocketservice(VALUE glib)
35
36
  {
36
37
  VALUE threadedsocketservice = G_DEF_CLASS(G_TYPE_THREADED_SOCKET_SERVICE, "ThreadedSocketService", glib);
37
38
 
38
- rb_define_method(threadedsocketservice, "initialize", threadedsocketservice_initialize, 0);
39
+ rb_define_method(threadedsocketservice, "initialize", threadedsocketservice_initialize, -1);
39
40
  }
Binary file
Binary file
@@ -98,7 +98,7 @@ void
98
98
  Init_gunixfdlist(G_GNUC_UNUSED VALUE glib)
99
99
  {
100
100
  #ifdef HAVE_GIO_UNIX
101
- VALUE unixfdlist = G_DEF_CLASS(G_TYPE_UNIX_FD_LIST, "UnixFdList", glib);
101
+ VALUE unixfdlist = G_DEF_CLASS(G_TYPE_UNIX_FD_LIST, "UnixFDList", glib);
102
102
 
103
103
  rb_define_method(unixfdlist, "initialize", unixfdlist_initialize, -1);
104
104
  rb_define_method(unixfdlist, "length", unixfdlist_get_length, 0);
Binary file
@@ -40,14 +40,6 @@ unixfdmessage_initialize(int argc, VALUE *argv, VALUE self)
40
40
  return Qnil;
41
41
  }
42
42
 
43
- static VALUE
44
- unixfdmessage_get_fd_list(VALUE self)
45
- {
46
- /* TODO: Should we relate the return value with self? It’s apparently
47
- * valid as long as self is valid. */
48
- return GOBJ2RVAL(g_unix_fd_message_get_fd_list(_SELF(self)));
49
- }
50
-
51
43
  static VALUE
52
44
  unixfdmessage_append_fd(VALUE self, VALUE fd)
53
45
  {
@@ -73,7 +65,6 @@ Init_gunixfdmessage(G_GNUC_UNUSED VALUE glib)
73
65
  VALUE unixfdmessage = G_DEF_CLASS(G_TYPE_UNIX_FD_MESSAGE, "UnixFDMessage", glib);
74
66
 
75
67
  rb_define_method(unixfdmessage, "initialize", unixfdmessage_initialize, -1);
76
- rb_define_method(unixfdmessage, "fd_list", unixfdmessage_get_fd_list, 0);
77
68
  rb_define_method(unixfdmessage, "append_fd", unixfdmessage_append_fd, 1);
78
69
  rb_define_alias(unixfdmessage, "<<", "append_fd");
79
70
  rb_define_method(unixfdmessage, "steal_fds", unixfdmessage_steal_fds, 0);
Binary file
@@ -36,26 +36,6 @@ unixinputstream_initialize(int argc, VALUE *argv, VALUE self)
36
36
 
37
37
  return Qnil;
38
38
  }
39
-
40
- static VALUE
41
- unixinputstream_set_close_fd(VALUE self, VALUE close_fd)
42
- {
43
- g_unix_input_stream_set_close_fd(_SELF(self), RVAL2CBOOL(close_fd));
44
-
45
- return self;
46
- }
47
-
48
- static VALUE
49
- unixinputstream_get_close_fd(VALUE self)
50
- {
51
- return CBOOL2RVAL(g_unix_input_stream_get_close_fd(_SELF(self)));
52
- }
53
-
54
- static VALUE
55
- unixinputstream_get_fd(VALUE self)
56
- {
57
- return FD2RVAL(g_unix_input_stream_get_fd(_SELF(self)));
58
- }
59
39
  #endif
60
40
 
61
41
  void
@@ -65,9 +45,5 @@ Init_gunixinputstream(G_GNUC_UNUSED VALUE glib)
65
45
  VALUE unixinputstream = G_DEF_CLASS(G_TYPE_UNIX_INPUT_STREAM, "UnixInputStream", glib);
66
46
 
67
47
  rb_define_method(unixinputstream, "initialize", unixinputstream_initialize, -1);
68
- rb_define_method(unixinputstream, "set_close_fd", unixinputstream_set_close_fd, 1);
69
- G_DEF_SETTER(unixinputstream, "close_fd");
70
- rb_define_method(unixinputstream, "close_fd?", unixinputstream_get_close_fd, 0);
71
- rb_define_method(unixinputstream, "fd", unixinputstream_get_fd, 0);
72
48
  #endif
73
49
  }
Binary file
@@ -290,10 +290,8 @@ Init_gunixmounts(G_GNUC_UNUSED VALUE glib)
290
290
  /* TODO: This doesn’t follow the naming conventions, but it seems
291
291
  * overkill to have GLib::Unix just for mount_path_system_internal?. */
292
292
  rb_define_singleton_method(unixmount, "mount_path_system_internal?", unix_is_mount_path_system_internal, 1);
293
+ rb_define_singleton_method(unixmount, "at", unixmount_at, 1);
293
294
 
294
- rb_define_method(unixmount, "at", unixmount_at, 1);
295
-
296
- rb_undef_alloc_func(unixmount);
297
295
  rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_ENTRY);
298
296
 
299
297
  rb_define_method(unixmount, "compare", unixmount_compare, 1);
@@ -312,7 +310,6 @@ Init_gunixmounts(G_GNUC_UNUSED VALUE glib)
312
310
 
313
311
  rb_include_module(unixmountpoint, rb_mComparable);
314
312
 
315
- rb_undef_alloc_func(unixmountpoint);
316
313
  rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_POINT);
317
314
 
318
315
  rb_define_method(unixmountpoint, "compare", unixmountpoint_compare, 1);
Binary file
@@ -36,26 +36,6 @@ unixoutputstream_initialize(int argc, VALUE *argv, VALUE self)
36
36
 
37
37
  return Qnil;
38
38
  }
39
-
40
- static VALUE
41
- unixoutputstream_set_close_fd(VALUE self, VALUE close_fd)
42
- {
43
- g_unix_output_stream_set_close_fd(_SELF(self), RVAL2CBOOL(close_fd));
44
-
45
- return self;
46
- }
47
-
48
- static VALUE
49
- unixoutputstream_get_close_fd(VALUE self)
50
- {
51
- return CBOOL2RVAL(g_unix_output_stream_get_close_fd(_SELF(self)));
52
- }
53
-
54
- static VALUE
55
- unixoutputstream_get_fd(VALUE self)
56
- {
57
- return FD2RVAL(g_unix_output_stream_get_fd(_SELF(self)));
58
- }
59
39
  #endif
60
40
 
61
41
  void
@@ -65,9 +45,5 @@ Init_gunixoutputstream(G_GNUC_UNUSED VALUE glib)
65
45
  VALUE unixoutputstream = G_DEF_CLASS(G_TYPE_UNIX_OUTPUT_STREAM, "UnixOutputStream", glib);
66
46
 
67
47
  rb_define_method(unixoutputstream, "initialize", unixoutputstream_initialize, -1);
68
- rb_define_method(unixoutputstream, "set_close_fd", unixoutputstream_set_close_fd, 1);
69
- G_DEF_SETTER(unixoutputstream, "close_fd");
70
- rb_define_method(unixoutputstream, "close_fd?", unixoutputstream_get_close_fd, 0);
71
- rb_define_method(unixoutputstream, "fd", unixoutputstream_get_fd, 0);
72
48
  #endif
73
49
  }
Binary file
@@ -41,21 +41,6 @@ unixsocketaddress_new_abstract(G_GNUC_UNUSED VALUE self, VALUE path)
41
41
  RSTRING_LEN(path)));
42
42
  }
43
43
 
44
- static VALUE
45
- unixsocketaddress_get_is_abstract(VALUE self)
46
- {
47
- return CBOOL2RVAL(g_unix_socket_address_get_is_abstract(_SELF(self)));
48
- }
49
-
50
- static VALUE
51
- unixsocketaddress_get_path(VALUE self)
52
- {
53
- return rb_str_new(g_unix_socket_address_get_path(_SELF(self)),
54
- g_unix_socket_address_get_path_len(_SELF(self)));
55
- }
56
-
57
- /* TODO: get_path_len is pointless in Ruby, right? */
58
-
59
44
  static VALUE
60
45
  unixsocketaddress_abstract_names_supported(G_GNUC_UNUSED VALUE self)
61
46
  {
@@ -69,11 +54,14 @@ Init_gunixsocketaddress(G_GNUC_UNUSED VALUE glib)
69
54
  #ifdef HAVE_GIO_UNIX
70
55
  VALUE unixsocketaddress = G_DEF_CLASS(G_TYPE_UNIX_SOCKET_ADDRESS, "UnixSocketAddress", glib);
71
56
 
57
+ # if GLIB_CHECK_VERSION(2, 26, 0)
58
+ G_DEF_CLASS(G_TYPE_UNIX_SOCKET_ADDRESS_TYPE, "Type", unixsocketaddress);
59
+ G_DEF_CONSTANTS(unixsocketaddress, G_TYPE_UNIX_SOCKET_ADDRESS_TYPE, "G_UNIX_SOCKET_ADDRESS_");
60
+ # endif
61
+
72
62
  rb_define_singleton_method(unixsocketaddress, "new_abstract", unixsocketaddress_new_abstract, 1);
73
63
  rb_define_singleton_method(unixsocketaddress, "abstract_names_supported?", unixsocketaddress_abstract_names_supported, 0);
74
64
 
75
65
  rb_define_method(unixsocketaddress, "initialize", unixsocketaddress_initialize, 1);
76
- rb_define_method(unixsocketaddress, "abstract?", unixsocketaddress_get_is_abstract, 0);
77
- rb_define_method(unixsocketaddress, "path", unixsocketaddress_get_path, 0);
78
66
  #endif
79
67
  }
Binary file
data/ext/gio2/gvfs.c CHANGED
@@ -74,8 +74,6 @@ Init_gvfs(VALUE glib)
74
74
  rb_define_singleton_method(vfs, "default", vfs_get_default, 0);
75
75
  rb_define_singleton_method(vfs, "local", vfs_get_local, 0);
76
76
 
77
- rb_undef_alloc_func(vfs);
78
-
79
77
  rb_define_method(vfs, "file_for_path", vfs_get_file_for_path, 1);
80
78
  rb_define_method(vfs, "file_for_uri", vfs_get_file_for_uri, 1);
81
79
  rb_define_method(vfs, "parse_name", vfs_parse_name, 1);
data/ext/gio2/gvfs.o ADDED
Binary file
Binary file
@@ -65,8 +65,6 @@ Init_gvolumemonitor(VALUE glib)
65
65
 
66
66
  rb_define_const(volumemonitor, "EXTENSION_POINT_NAME", CSTR2RVAL(G_VOLUME_MONITOR_EXTENSION_POINT_NAME));
67
67
 
68
- rb_undef_alloc_func(volumemonitor);
69
-
70
68
  rb_define_singleton_method(volumemonitor, "get", volumemonitor_get, 0);
71
69
 
72
70
  rb_define_method(volumemonitor, "connected_drives", volumemonitor_get_connected_drives, 0);
Binary file
@@ -43,5 +43,8 @@ Init_gzlibcompressor(VALUE glib)
43
43
  {
44
44
  VALUE zlibcompressor = G_DEF_CLASS(G_TYPE_ZLIB_COMPRESSOR, "ZlibCompressor", glib);
45
45
 
46
+ G_DEF_CLASS(G_TYPE_ZLIB_COMPRESSOR_FORMAT, "Format", zlibcompressor);
47
+ G_DEF_CONSTANTS(zlibcompressor, G_TYPE_ZLIB_COMPRESSOR_FORMAT, "G_ZLIB_");
48
+
46
49
  rb_define_method(zlibcompressor, "initialize", zlibcompressor_initialize, -1);
47
50
  }
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ Name: Ruby/GIO2
2
+ Description: Ruby bindings for glib I/O library
3
+ Version: 0.90.6
data/ext/gio2/util.c CHANGED
@@ -170,6 +170,9 @@ rbgio_str_vector_to_ary(const gchar * const *vector)
170
170
  {
171
171
  int i, n;
172
172
  VALUE ary;
173
+
174
+ if (vector == NULL)
175
+ return Qnil;
173
176
 
174
177
  for (i = n = 0; vector[i] != NULL; i++)
175
178
  n++;
data/ext/gio2/util.o ADDED
Binary file
data/lib/gio2.rb CHANGED
@@ -12,6 +12,8 @@ rescue LoadError
12
12
  end
13
13
 
14
14
  class GLib::DataInputStream
15
+ include Enumerable
16
+
15
17
  def each
16
18
  while line = read_line
17
19
  yield line
@@ -55,6 +57,8 @@ if GLib.const_defined? :DesktopAppInfo
55
57
  end
56
58
 
57
59
  module GLib::File
60
+ include Enumerable
61
+
58
62
  def eql?(other)
59
63
  self === other and self == other
60
64
  end
@@ -72,7 +76,10 @@ module GLib::File
72
76
  end
73
77
 
74
78
  class GLib::FileEnumerator
79
+ include Enumerable
80
+
75
81
  def each(cancellable = nil)
82
+ return self.enum_for unless block_given?
76
83
  while file = next_file(cancellable)
77
84
  yield file
78
85
  end
@@ -80,9 +87,9 @@ class GLib::FileEnumerator
80
87
  self
81
88
  end
82
89
 
90
+ # TODO: Return Enumerator unless block_given?
83
91
  def each_async(num_files, io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil, &block)
84
92
  each_async_loop num_files, io_priority, cancellable, block
85
- self
86
93
  end
87
94
 
88
95
  private
@@ -139,3 +146,14 @@ module GLib::SocketConnectable
139
146
  end
140
147
  end
141
148
  end
149
+
150
+ class GLib::UnixFDList
151
+ include Enumerable
152
+
153
+ def each
154
+ i = 0
155
+ while i < length
156
+ yield self[i]
157
+ end
158
+ end
159
+ end
data/test/load-test.rb ADDED
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ base = File.dirname(File.expand_path(__FILE__))
4
+ root = File.dirname(File.dirname(base))
5
+ ['glib2', 'gio2'].each do |lib|
6
+ ['ext/%s' % lib, 'lib'].each do |sub|
7
+ $LOAD_PATH.unshift File.join(root, lib, sub)
8
+ end
9
+ end
10
+
11
+ require 'gio2'
12
+ require File.join(root, 'glib2/test/glib-test-init')
13
+
14
+ exit Test::Unit::AutoRunner.run(true, base)
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+
@@ -0,0 +1,7 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestDataInputStream < Test::Unit::TestCase
4
+ def test_byte_order_property
5
+ assert_equal GLib::DATA_STREAM_BYTE_ORDER_BIG_ENDIAN, GLib::DataInputStream.new(GLib::MemoryInputStream.new).byte_order
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestFileEnumerator < Test::Unit::TestCase
4
+ def test_responds_to_properties
5
+ a = GLib::File.new_for_path('/').enumerate_children
6
+ assert a.respond_to?(:container)
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestInetAddress < Test::Unit::TestCase
4
+ def test_responds_to_properties
5
+ a = GLib::InetAddress.new_any(GLib::Socket::FAMILY_IPV4)
6
+ assert a.respond_to?(:any?)
7
+ end
8
+ end