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,153 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) G_SIMPLE_ASYNC_RESULT(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- simpleasyncresult_initialize(VALUE self, VALUE object)
27
- {
28
- VALUE block;
29
-
30
- /* TODO: I have absolutely no idea if this makes sense. Should we even
31
- * be providing this method? */
32
- block = rb_block_proc();
33
- SAVE_BLOCK(block);
34
- G_INITIALIZE(self,
35
- g_simple_async_result_new(RVAL2GOBJ(object),
36
- rbgio_async_ready_callback,
37
- (gpointer)block,
38
- (gpointer)block));
39
-
40
- return Qnil;
41
- }
42
-
43
- /* NOTE: Can’t implement g_simple_async_result_new_error. */
44
-
45
- /* NOTE: Can’t implement g_simple_async_result_new_from_error. */
46
-
47
- /* NOTE: Can’t implement g_simple_async_result_set_op_res_gpointer. */
48
-
49
- /* NOTE: Can’t implement g_simple_async_result_get_op_res_gpointer. */
50
-
51
- static VALUE
52
- simpleasyncresult_set_op_res_gssize(VALUE self, VALUE op_res)
53
- {
54
- g_simple_async_result_set_op_res_gssize(_SELF(self),
55
- RVAL2GSSIZE(op_res));
56
-
57
- return self;
58
- }
59
-
60
- static VALUE
61
- simpleasyncresult_get_op_res_gssize(VALUE self)
62
- {
63
- return GSSIZE2RVAL(g_simple_async_result_get_op_res_gssize(_SELF(self)));
64
- }
65
-
66
- static VALUE
67
- simpleasyncresult_set_op_res_gboolean(VALUE self, VALUE op_res)
68
- {
69
- g_simple_async_result_set_op_res_gboolean(_SELF(self),
70
- RVAL2CBOOL(op_res));
71
-
72
- return self;
73
- }
74
-
75
- static VALUE
76
- simpleasyncresult_get_op_res_gboolean(VALUE self)
77
- {
78
- return CBOOL2RVAL(g_simple_async_result_get_op_res_gboolean(_SELF(self)));
79
- }
80
-
81
- static VALUE
82
- simpleasyncresult_get_source_tag(VALUE self)
83
- {
84
- return (VALUE)g_simple_async_result_get_source_tag(_SELF(self));
85
- }
86
-
87
- static VALUE
88
- simpleasyncresult_is_valid(VALUE self, VALUE source, VALUE source_tag)
89
- {
90
- return CBOOL2RVAL(g_simple_async_result_is_valid(RVAL2GASYNCRESULT(self),
91
- RVAL2GOBJ(source),
92
- (gpointer)source_tag));
93
- }
94
-
95
- static VALUE
96
- simpleasyncresult_set_handle_cancellation(VALUE self, VALUE handle_cancellation)
97
- {
98
- g_simple_async_result_set_handle_cancellation(_SELF(self),
99
- RVAL2CBOOL(handle_cancellation));
100
-
101
- return self;
102
- }
103
-
104
- static VALUE
105
- simpleasyncresult_complete(VALUE self)
106
- {
107
- g_simple_async_result_complete(_SELF(self));
108
-
109
- return self;
110
- }
111
-
112
- static VALUE
113
- simpleasyncresult_complete_in_idle(VALUE self)
114
- {
115
- g_simple_async_result_complete_in_idle(_SELF(self));
116
-
117
- return self;
118
- }
119
-
120
- /* TODO: Should we implement g_simple_async_result_run_in_thread? I’d say no,
121
- * but I’m not sure. */
122
-
123
- /* NOTE: Can’t implement g_simple_async_result_set_from_error. */
124
-
125
- /* NOTE: Can’t implement g_simple_async_result_propagate_error. */
126
-
127
- /* NOTE: Can’t implement g_simple_async_result_set_error. */
128
-
129
- /* NOTE: Can’t implement g_simple_async_result_set_error_va. */
130
-
131
- /* NOTE: Can’t implement g_simple_async_result_report_error_in_idle. */
132
-
133
- /* NOTE: Can’t implement g_simple_async_result_report_gerror_in_idle. */
134
-
135
- void
136
- Init_gsimpleasyncresult(VALUE glib)
137
- {
138
- VALUE simpleasyncresult = G_DEF_CLASS(G_TYPE_SIMPLE_ASYNC_RESULT, "SimpleAsyncResult", glib);
139
-
140
- rb_define_method(simpleasyncresult, "initialize", simpleasyncresult_initialize, 1);
141
- rb_define_method(simpleasyncresult, "set_op_res_gssize", simpleasyncresult_set_op_res_gssize, 1);
142
- G_DEF_SETTER(simpleasyncresult, "op_res_gssize");
143
- rb_define_method(simpleasyncresult, "op_res_gssize", simpleasyncresult_get_op_res_gssize, 0);
144
- rb_define_method(simpleasyncresult, "set_op_res_gboolean", simpleasyncresult_set_op_res_gboolean, 1);
145
- G_DEF_SETTER(simpleasyncresult, "op_res_gboolean");
146
- rb_define_method(simpleasyncresult, "op_res_gboolean", simpleasyncresult_get_op_res_gboolean, 0);
147
- rb_define_method(simpleasyncresult, "source_tag", simpleasyncresult_get_source_tag, 0);
148
- rb_define_method(simpleasyncresult, "valid?", simpleasyncresult_is_valid, 2);
149
- rb_define_method(simpleasyncresult, "set_handle_cancellation", simpleasyncresult_set_handle_cancellation, 1);
150
- G_DEF_SETTER(simpleasyncresult, "handle_cancellation");
151
- rb_define_method(simpleasyncresult, "complete", simpleasyncresult_complete, 0);
152
- rb_define_method(simpleasyncresult, "complete_in_idle", simpleasyncresult_complete_in_idle, 0);
153
- }
@@ -1,33 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- /* TODO: new_from_native? */
24
-
25
- /* TODO: to_native? */
26
-
27
- /* TODO: get_native_size? */
28
-
29
- void
30
- Init_gsocketaddress(VALUE glib)
31
- {
32
- (void)G_DEF_CLASS(G_TYPE_SOCKET_ADDRESS, "SocketAddress", glib);
33
- }
@@ -1,97 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) RVAL2GSOCKETCONNECTABLE(value)
24
-
25
- static VALUE
26
- socketconnectable_enumerate(VALUE self)
27
- {
28
- return GOBJ2RVAL(g_socket_connectable_enumerate(_SELF(self)));
29
- }
30
-
31
- #undef _SELF
32
- #define _SELF(value) G_SOCKET_ADDRESS_ENUMERATOR(RVAL2GOBJ(value))
33
-
34
- static VALUE
35
- socketaddressenumerator_next(int argc, VALUE *argv, VALUE self)
36
- {
37
- VALUE cancellable;
38
- GError *error = NULL;
39
- GSocketAddress *address;
40
-
41
- rb_scan_args(argc, argv, "01", &cancellable);
42
- address = g_socket_address_enumerator_next(_SELF(self),
43
- RVAL2GCANCELLABLE(cancellable),
44
- &error);
45
- if (error != NULL)
46
- rbgio_raise_error(error);
47
-
48
- return GOBJ2RVAL(address);
49
- }
50
-
51
- static VALUE
52
- socketaddressenumerator_next_async(int argc, VALUE *argv, VALUE self)
53
- {
54
- VALUE rbcancellable, block;
55
- GCancellable *cancellable;
56
-
57
- rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
58
- cancellable = RVAL2GCANCELLABLE(rbcancellable);
59
- SAVE_BLOCK(block);
60
- g_socket_address_enumerator_next_async(_SELF(self),
61
- cancellable,
62
- rbgio_async_ready_callback,
63
- (gpointer)block);
64
-
65
- return self;
66
- }
67
-
68
- static VALUE
69
- socketaddressenumerator_next_finish(VALUE self, VALUE result)
70
- {
71
- GError *error = NULL;
72
- GSocketAddress *address;
73
-
74
- address = g_socket_address_enumerator_next_finish(_SELF(self),
75
- RVAL2GASYNCRESULT(result),
76
- &error);
77
- if (address == NULL)
78
- rbgio_raise_error(error);
79
-
80
- return GOBJ2RVAL(address);
81
- }
82
-
83
- void
84
- Init_gsocketconnectable(VALUE glib)
85
- {
86
- VALUE socketconnectable, socketaddressenumerator;
87
-
88
- socketconnectable = G_DEF_INTERFACE(G_TYPE_SOCKET_CONNECTABLE, "SocketConnectable", glib);
89
-
90
- rb_define_method(socketconnectable, "enumerate", socketconnectable_enumerate, 0);
91
-
92
- socketaddressenumerator = G_DEF_CLASS(G_TYPE_SOCKET_ADDRESS_ENUMERATOR, "SocketAddressEnumerator", glib);
93
-
94
- rb_define_method(socketaddressenumerator, "next", socketaddressenumerator_next, -1);
95
- rb_define_method(socketaddressenumerator, "next_async", socketaddressenumerator_next_async, -1);
96
- rb_define_method(socketaddressenumerator, "next_finish", socketaddressenumerator_next_finish, 1);
97
- }
@@ -1,75 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) G_SOCKET_CONNECTION(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- socketconnection_get_local_address(VALUE self)
27
- {
28
- GError *error = NULL;
29
- GSocketAddress *address;
30
-
31
- address = g_socket_connection_get_local_address(_SELF(self), &error);
32
- if (address == NULL)
33
- rbgio_raise_error(error);
34
-
35
- return GOBJ2RVAL_UNREF(address);
36
- }
37
-
38
- static VALUE
39
- socketconnection_get_remote_address(VALUE self)
40
- {
41
- GError *error = NULL;
42
- GSocketAddress *address;
43
-
44
- address = g_socket_connection_get_remote_address(_SELF(self), &error);
45
- if (address == NULL)
46
- rbgio_raise_error(error);
47
-
48
- return GOBJ2RVAL_UNREF(address);
49
- }
50
-
51
- static VALUE
52
- socketconnectionfactory_create_connection(G_GNUC_UNUSED VALUE self, VALUE socket)
53
- {
54
- return GOBJ2RVAL_UNREF(g_socket_connection_factory_create_connection(RVAL2GSOCKET(socket)));
55
- }
56
-
57
- /* TODO: lookup_type */
58
-
59
- /* TODO: register_type */
60
-
61
- void
62
- Init_gsocketconnection(VALUE glib)
63
- {
64
- VALUE socketconnection, socketconnectionfactory;
65
-
66
- socketconnection = G_DEF_CLASS(G_TYPE_SOCKET_CONNECTION, "SocketConnection", glib);
67
-
68
- rb_define_method(socketconnection, "local_address", socketconnection_get_local_address, 0);
69
- rb_define_method(socketconnection, "remote_address", socketconnection_get_remote_address, 0);
70
-
71
- /* TODO: Perhaps just move this to SocketConnection? */
72
- socketconnectionfactory = rb_define_module_under(glib, "SocketConnectionFactory");
73
-
74
- rb_define_module_function(socketconnectionfactory, "create_connection", socketconnectionfactory_create_connection, 1);
75
- }
@@ -1,80 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) G_SOCKET_CONTROL_MESSAGE(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- socketcontrolmessage_deserialize(G_GNUC_UNUSED VALUE self, VALUE level, VALUE type, VALUE data)
27
- {
28
- StringValue(data);
29
- return GOBJ2RVAL(g_socket_control_message_deserialize(FIX2INT(level),
30
- FIX2INT(type),
31
- RSTRING_LEN(data),
32
- RSTRING_PTR(data)));
33
- }
34
-
35
- static VALUE
36
- socketcontrolmessage_get_level(VALUE self)
37
- {
38
- return INT2FIX(g_socket_control_message_get_level(_SELF(self)));
39
- }
40
-
41
- static VALUE
42
- socketcontrolmessage_get_msg_type(VALUE self)
43
- {
44
- return INT2FIX(g_socket_control_message_get_msg_type(_SELF(self)));
45
- }
46
-
47
- static VALUE
48
- socketcontrolmessage_get_size(VALUE self)
49
- {
50
- return GSIZE2RVAL(g_socket_control_message_get_size(_SELF(self)));
51
- }
52
-
53
- static VALUE
54
- socketcontrolmessage_serialize(VALUE self)
55
- {
56
- gsize size;
57
- VALUE result;
58
-
59
- /* TODO: Is tainting really necessary? Where does the message come
60
- * from? */
61
- size = g_socket_control_message_get_size(_SELF(self));
62
- result = rb_str_new(NULL, size);
63
- g_socket_control_message_serialize(_SELF(self), RSTRING_PTR(result));
64
- OBJ_TAINT(result);
65
-
66
- return result;
67
- }
68
-
69
- void
70
- Init_gsocketcontrolmessage(VALUE glib)
71
- {
72
- VALUE socketcontrolmessage = G_DEF_CLASS(G_TYPE_SOCKET_CONTROL_MESSAGE, "SocketControlMessage", glib);
73
-
74
- rb_define_singleton_method(socketcontrolmessage, "deserialize", socketcontrolmessage_deserialize, 3);
75
-
76
- rb_define_method(socketcontrolmessage, "level", socketcontrolmessage_get_level, 0);
77
- rb_define_method(socketcontrolmessage, "msg_type", socketcontrolmessage_get_msg_type, 0);
78
- rb_define_method(socketcontrolmessage, "size", socketcontrolmessage_get_size, 0);
79
- rb_define_method(socketcontrolmessage, "serialize", socketcontrolmessage_serialize, 0);
80
- }
@@ -1,64 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) G_SOCKET_SERVICE(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- socketservice_initialize(VALUE self)
27
- {
28
- G_INITIALIZE(self, g_socket_service_new());
29
-
30
- return Qnil;
31
- }
32
-
33
- static VALUE
34
- socketservice_start(VALUE self)
35
- {
36
- g_socket_service_start(_SELF(self));
37
-
38
- return self;
39
- }
40
-
41
- static VALUE
42
- socketservice_stop(VALUE self)
43
- {
44
- g_socket_service_stop(_SELF(self));
45
-
46
- return self;
47
- }
48
-
49
- static VALUE
50
- socketservice_is_active(VALUE self)
51
- {
52
- return CBOOL2RVAL(g_socket_service_is_active(_SELF(self)));
53
- }
54
-
55
- void
56
- Init_gsocketservice(VALUE glib)
57
- {
58
- VALUE socketservice = G_DEF_CLASS(G_TYPE_SOCKET_SERVICE, "SocketService", glib);
59
-
60
- rb_define_method(socketservice, "initialize", socketservice_initialize, 0);
61
- rb_define_method(socketservice, "start", socketservice_start, 0);
62
- rb_define_method(socketservice, "stop", socketservice_stop, 0);
63
- rb_define_method(socketservice, "active?", socketservice_is_active, 0);
64
- }
@@ -1,77 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define RVAL2GSRVTARGET(object) \
24
- ((GSrvTarget *)(RVAL2BOXED(object, G_TYPE_SRV_TARGET)))
25
-
26
- #define _SELF(value) RVAL2GSRVTARGET(value)
27
-
28
- static VALUE
29
- srvtarget_initialize(VALUE self, VALUE hostname, VALUE port, VALUE priority, VALUE weight)
30
- {
31
- /* TODO: Does this work with boxed? */
32
- /* TODO: hostname should be infected when returned. */
33
- G_INITIALIZE(self, g_srv_target_new(RVAL2CSTR(hostname),
34
- RVAL2GUINT16(port),
35
- RVAL2GUINT16(priority),
36
- RVAL2GUINT16(weight)));
37
-
38
- return Qnil;
39
- }
40
-
41
- static VALUE
42
- srvtarget_get_hostname(VALUE self)
43
- {
44
- return CSTR2RVAL(g_srv_target_get_hostname(_SELF(self)));
45
- }
46
-
47
- static VALUE
48
- srvtarget_get_port(VALUE self)
49
- {
50
- return GUINT162RVAL(g_srv_target_get_port(_SELF(self)));
51
- }
52
-
53
- static VALUE
54
- srvtarget_get_priority(VALUE self)
55
- {
56
- return GUINT162RVAL(g_srv_target_get_priority(_SELF(self)));
57
- }
58
-
59
- static VALUE
60
- srvtarget_get_weight(VALUE self)
61
- {
62
- return GUINT162RVAL(g_srv_target_get_weight(_SELF(self)));
63
- }
64
-
65
- /* TODO: srvtarget_list_sort */
66
-
67
- void
68
- Init_gsrvtarget(VALUE glib)
69
- {
70
- VALUE srvtarget = G_DEF_CLASS(G_TYPE_SRV_TARGET, "SrvTarget", glib);
71
-
72
- rb_define_method(srvtarget, "initialize", srvtarget_initialize, 4);
73
- rb_define_method(srvtarget, "hostname", srvtarget_get_hostname, 0);
74
- rb_define_method(srvtarget, "port", srvtarget_get_port, 0);
75
- rb_define_method(srvtarget, "priority", srvtarget_get_priority, 0);
76
- rb_define_method(srvtarget, "weight", srvtarget_get_weight, 0);
77
- }
@@ -1,27 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- void
24
- Init_gtcpconnection(VALUE glib)
25
- {
26
- (void)G_DEF_CLASS(G_TYPE_TCP_CONNECTION, "TcpConnection", glib);
27
- }
@@ -1,81 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- #define _SELF(value) G_THEMED_ICON(RVAL2GOBJ(value))
24
-
25
- /* TODO: Is this unnecessarily complicated? */
26
- static VALUE
27
- themedicon_initialize(int argc, VALUE *argv, VALUE self)
28
- {
29
- VALUE iconnames, with_default_fallbacks;
30
- GIcon *icon;
31
-
32
- rb_scan_args(argc, argv, "11", &iconnames, &with_default_fallbacks);
33
-
34
- if (TYPE(iconnames) != T_ARRAY) {
35
- const char *iconname = RVAL2CSTR(iconnames);
36
-
37
- icon = RVAL2CBOOL(with_default_fallbacks) ?
38
- g_themed_icon_new_with_default_fallbacks(iconname) :
39
- g_themed_icon_new(iconname);
40
-
41
- G_INITIALIZE(self, icon);
42
-
43
- return Qnil;
44
- }
45
-
46
- if (argc > 1)
47
- rb_raise(rb_eArgError,
48
- "only one argument allowed when first argument is an Array");
49
-
50
- icon = g_themed_icon_new_from_names(RVAL2STRV_DUP(iconnames), -1);
51
-
52
- G_INITIALIZE(self, icon);
53
-
54
- return Qnil;
55
- }
56
-
57
- static VALUE
58
- themedicon_prepend_name(VALUE self, VALUE iconname)
59
- {
60
- g_themed_icon_prepend_name(_SELF(self), RVAL2CSTR(iconname));
61
-
62
- return self;
63
- }
64
-
65
- static VALUE
66
- themedicon_append_name(VALUE self, VALUE iconname)
67
- {
68
- g_themed_icon_append_name(_SELF(self), RVAL2CSTR(iconname));
69
-
70
- return self;
71
- }
72
-
73
- void
74
- Init_gthemedicon(VALUE glib)
75
- {
76
- VALUE themedicon = G_DEF_INTERFACE(G_TYPE_THEMED_ICON, "ThemedIcon", glib);
77
-
78
- rb_define_method(themedicon, "initialize", themedicon_initialize, -1);
79
- rb_define_method(themedicon, "prepend_name", themedicon_prepend_name, 1);
80
- rb_define_method(themedicon, "append_name", themedicon_append_name, 1);
81
- }