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,40 +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
- static VALUE
24
- threadedsocketservice_initialize(VALUE self, VALUE max_threads)
25
- {
26
- G_INITIALIZE(self,
27
- g_threaded_socket_service_new(RVAL2TYPE_WITH_DEFAULT(max_threads,
28
- RVAL2GINT,
29
- 10)));
30
-
31
- return Qnil;
32
- }
33
-
34
- void
35
- Init_gthreadedsocketservice(VALUE glib)
36
- {
37
- VALUE threadedsocketservice = G_DEF_CLASS(G_TYPE_THREADED_SOCKET_SERVICE, "ThreadedSocketService", glib);
38
-
39
- rb_define_method(threadedsocketservice, "initialize", threadedsocketservice_initialize, -1);
40
- }
@@ -1,69 +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
- #ifdef HAVE_GIO_UNIX
24
- #include <gio/gunixconnection.h>
25
-
26
- #define _SELF(value) G_UNIX_CONNECTION(RVAL2GOBJ(value))
27
-
28
- static VALUE
29
- unixconnection_receive_fd(int argc, VALUE *argv, VALUE self)
30
- {
31
- VALUE cancellable;
32
- GError *error = NULL;
33
- gint fd;
34
-
35
- rb_scan_args(argc, argv, "01", &cancellable);
36
- fd = g_unix_connection_receive_fd(_SELF(self),
37
- RVAL2GCANCELLABLE(cancellable),
38
- &error);
39
- if (fd == -1)
40
- rbgio_raise_error(error);
41
-
42
- return FD2RVAL(fd);
43
- }
44
-
45
- static VALUE
46
- unixconnection_send_fd(int argc, VALUE *argv, VALUE self)
47
- {
48
- VALUE fd, cancellable;
49
- GError *error = NULL;
50
-
51
- rb_scan_args(argc, argv, "11", &fd, &cancellable);
52
- if (!g_unix_connection_send_fd(_SELF(self), RVAL2FD(fd),
53
- RVAL2GCANCELLABLE(cancellable), &error))
54
- rbgio_raise_error(error);
55
-
56
- return self;
57
- }
58
- #endif
59
-
60
- void
61
- Init_gunixconnection(G_GNUC_UNUSED VALUE glib)
62
- {
63
- #ifdef HAVE_GIO_UNIX
64
- VALUE unixconnection = G_DEF_CLASS(G_TYPE_UNIX_CONNECTION, "UnixConnection", glib);
65
-
66
- rb_define_method(unixconnection, "receive_fd", unixconnection_receive_fd, -1);
67
- rb_define_method(unixconnection, "send_fd", unixconnection_send_fd, -1);
68
- #endif
69
- }
@@ -1,112 +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
- #ifdef HAVE_GIO_UNIX
24
- #include <gio/gunixfdlist.h>
25
-
26
- #define _SELF(value) RVAL2GUNIXFDLIST(value)
27
-
28
- static VALUE
29
- unixfdlist_initialize(int argc, VALUE *argv, VALUE self)
30
- {
31
- VALUE rbfds;
32
- gint i, n_fds;
33
- gint *fds;
34
-
35
- rb_scan_args(argc, argv, "0*", &rbfds);
36
- n_fds = RARRAY_LEN(rbfds);
37
- if (n_fds == 0) {
38
- G_INITIALIZE(self, g_unix_fd_list_new());
39
- return Qnil;
40
- }
41
-
42
- fds = ALLOCA_N(gint, n_fds);
43
- for (i = 0; i < n_fds; i++)
44
- fds[0] = RVAL2FD(RARRAY_PTR(rbfds)[i]);
45
-
46
- G_INITIALIZE(self, g_unix_fd_list_new_from_array(fds, n_fds));
47
-
48
- return Qnil;
49
- }
50
-
51
- static VALUE
52
- unixfdlist_get_length(VALUE self)
53
- {
54
- return GINT2RVAL(g_unix_fd_list_get_length(_SELF(self)));
55
- }
56
-
57
- static VALUE
58
- unixfdlist_get(VALUE self, VALUE index)
59
- {
60
- GError *error = NULL;
61
- gint fd;
62
-
63
- fd = g_unix_fd_list_get(_SELF(self), RVAL2GINT(index), &error);
64
- if (fd == -1)
65
- rbgio_raise_error(error);
66
-
67
- /* TODO: This fd must be closed properly. How do we deal with that? */
68
- return FD2RVAL(fd);
69
- }
70
-
71
- static VALUE
72
- unixfdlist_peek_fds(VALUE self)
73
- {
74
- return GFDS2ARY(g_unix_fd_list_peek_fds(_SELF(self), NULL));
75
- }
76
-
77
- static VALUE
78
- unixfdlist_steal_fds(VALUE self)
79
- {
80
- return GFDS2ARY_FREE(g_unix_fd_list_steal_fds(_SELF(self), NULL));
81
- }
82
-
83
- static VALUE
84
- unixfdlist_append(VALUE self, VALUE fd)
85
- {
86
- GError *error = NULL;
87
- int index;
88
-
89
- index = g_unix_fd_list_append(_SELF(self), RVAL2FD(fd), &error);
90
- if (index == -1)
91
- rbgio_raise_error(error);
92
-
93
- return self;
94
- }
95
- #endif
96
-
97
- void
98
- Init_gunixfdlist(G_GNUC_UNUSED VALUE glib)
99
- {
100
- #ifdef HAVE_GIO_UNIX
101
- VALUE unixfdlist = G_DEF_CLASS(G_TYPE_UNIX_FD_LIST, "UnixFDList", glib);
102
-
103
- rb_define_method(unixfdlist, "initialize", unixfdlist_initialize, -1);
104
- rb_define_method(unixfdlist, "length", unixfdlist_get_length, 0);
105
- rb_define_method(unixfdlist, "get", unixfdlist_get, 1);
106
- rb_define_alias(unixfdlist, "[]", "get");
107
- rb_define_method(unixfdlist, "peek_fds", unixfdlist_peek_fds, 0);
108
- rb_define_method(unixfdlist, "steal_fds", unixfdlist_steal_fds, 0);
109
- rb_define_method(unixfdlist, "append", unixfdlist_append, 1);
110
- rb_define_alias(unixfdlist, "<<", "append");
111
- #endif
112
- }
@@ -1,72 +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
- #ifdef HAVE_GIO_UNIX
24
- #include <gio/gunixfdmessage.h>
25
-
26
- #define _SELF(value) G_UNIX_FD_MESSAGE(RVAL2GOBJ(value))
27
-
28
- static VALUE
29
- unixfdmessage_initialize(int argc, VALUE *argv, VALUE self)
30
- {
31
- VALUE fd_list;
32
- GSocketControlMessage *message;
33
-
34
- rb_scan_args(argc, argv, "01", &fd_list);
35
- message = NIL_P(fd_list) ?
36
- g_unix_fd_message_new() :
37
- g_unix_fd_message_new_with_fd_list(RVAL2GUNIXFDLIST(fd_list));
38
- G_INITIALIZE(self, message);
39
-
40
- return Qnil;
41
- }
42
-
43
- static VALUE
44
- unixfdmessage_append_fd(VALUE self, VALUE fd)
45
- {
46
- GError *error = NULL;
47
-
48
- if (!g_unix_fd_message_append_fd(_SELF(self), RVAL2FD(fd), &error))
49
- rbgio_raise_error(error);
50
-
51
- return self;
52
- }
53
-
54
- static VALUE
55
- unixfdmessage_steal_fds(VALUE self)
56
- {
57
- return GFDS2ARY_FREE(g_unix_fd_message_steal_fds(_SELF(self), NULL));
58
- }
59
- #endif
60
-
61
- void
62
- Init_gunixfdmessage(G_GNUC_UNUSED VALUE glib)
63
- {
64
- #ifdef HAVE_GIO_UNIX
65
- VALUE unixfdmessage = G_DEF_CLASS(G_TYPE_UNIX_FD_MESSAGE, "UnixFDMessage", glib);
66
-
67
- rb_define_method(unixfdmessage, "initialize", unixfdmessage_initialize, -1);
68
- rb_define_method(unixfdmessage, "append_fd", unixfdmessage_append_fd, 1);
69
- rb_define_alias(unixfdmessage, "<<", "append_fd");
70
- rb_define_method(unixfdmessage, "steal_fds", unixfdmessage_steal_fds, 0);
71
- #endif
72
- }
@@ -1,49 +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
- #ifdef HAVE_GIO_UNIX
24
- #include <gio/gunixinputstream.h>
25
-
26
- #define _SELF(value) G_UNIX_INPUT_STREAM(RVAL2GOBJ(value))
27
-
28
- static VALUE
29
- unixinputstream_initialize(int argc, VALUE *argv, VALUE self)
30
- {
31
- VALUE fd, close_fd;
32
-
33
- rb_scan_args(argc, argv, "11", &fd, &close_fd);
34
- G_INITIALIZE(self, g_unix_input_stream_new(RVAL2FD(fd),
35
- RVAL2CBOOL(close_fd)));
36
-
37
- return Qnil;
38
- }
39
- #endif
40
-
41
- void
42
- Init_gunixinputstream(G_GNUC_UNUSED VALUE glib)
43
- {
44
- #ifdef HAVE_GIO_UNIX
45
- VALUE unixinputstream = G_DEF_CLASS(G_TYPE_UNIX_INPUT_STREAM, "UnixInputStream", glib);
46
-
47
- rb_define_method(unixinputstream, "initialize", unixinputstream_initialize, -1);
48
- #endif
49
- }
@@ -1,343 +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
- #ifdef HAVE_GIO_UNIX
24
- #include <gio/gunixmounts.h>
25
-
26
- static GUnixMountEntry *
27
- unixmount_copy(const GUnixMountEntry *mount)
28
- {
29
- return (GUnixMountEntry *)mount;
30
- }
31
-
32
- static GType
33
- g_unix_mount_entry_get_type(void)
34
- {
35
- static GType our_type = 0;
36
-
37
- if (our_type == 0)
38
- our_type = g_boxed_type_register_static("GUnixMountEntry",
39
- (GBoxedCopyFunc)unixmount_copy,
40
- (GBoxedFreeFunc)g_unix_mount_free);
41
-
42
- return our_type;
43
- }
44
-
45
- #define G_TYPE_UNIX_MOUNT_ENTRY (g_unix_mount_entry_get_type())
46
-
47
- #define _SELF(value) \
48
- ((GUnixMountEntry *)(RVAL2BOXED((value), G_TYPE_UNIX_MOUNT_ENTRY)))
49
-
50
- #define GUNIXMOUNTENTRY2RVAL(value) BOXED2RVAL((value), G_TYPE_UNIX_MOUNT_ENTRY)
51
-
52
- static VALUE
53
- unixmount_compare(VALUE self, VALUE other)
54
- {
55
- return INT2FIX(g_unix_mount_compare(_SELF(self), _SELF(other)));
56
- }
57
-
58
- static VALUE
59
- unixmount_get_mount_path(VALUE self)
60
- {
61
- return CSTR2RVAL(g_unix_mount_get_mount_path(_SELF(self)));
62
- }
63
-
64
- static VALUE
65
- unixmount_get_device_path(VALUE self)
66
- {
67
- return CSTR2RVAL(g_unix_mount_get_device_path(_SELF(self)));
68
- }
69
-
70
- static VALUE
71
- unixmount_get_fs_type(VALUE self)
72
- {
73
- return CSTR2RVAL(g_unix_mount_get_fs_type(_SELF(self)));
74
- }
75
-
76
- static VALUE
77
- unixmount_is_readonly(VALUE self)
78
- {
79
- return CBOOL2RVAL(g_unix_mount_is_readonly(_SELF(self)));
80
- }
81
-
82
- static VALUE
83
- unixmount_is_system_internal(VALUE self)
84
- {
85
- return CBOOL2RVAL(g_unix_mount_is_system_internal(_SELF(self)));
86
- }
87
-
88
- static VALUE
89
- unixmount_guess_icon(VALUE self)
90
- {
91
- return GOBJ2RVAL_UNREF(g_unix_mount_guess_icon(_SELF(self)));
92
- }
93
-
94
- static VALUE
95
- unixmount_guess_name(VALUE self)
96
- {
97
- return CSTR2RVAL_FREE(g_unix_mount_guess_name(_SELF(self)));
98
- }
99
-
100
- static VALUE
101
- unixmount_guess_can_eject(VALUE self)
102
- {
103
- return CBOOL2RVAL(g_unix_mount_guess_can_eject(_SELF(self)));
104
- }
105
-
106
- static VALUE
107
- unixmount_guess_should_display(VALUE self)
108
- {
109
- return CBOOL2RVAL(g_unix_mount_guess_should_display(_SELF(self)));
110
- }
111
-
112
- static GUnixMountPoint *
113
- unixmountpoint_copy(const GUnixMountPoint *mount_point)
114
- {
115
- return (GUnixMountPoint *)mount_point;
116
- }
117
-
118
- static GType
119
- g_unix_mount_point_get_type(void)
120
- {
121
- static GType our_type = 0;
122
-
123
- if (our_type == 0)
124
- our_type = g_boxed_type_register_static("GUnixMountPoint",
125
- (GBoxedCopyFunc)unixmountpoint_copy,
126
- (GBoxedFreeFunc)g_unix_mount_point_free);
127
-
128
- return our_type;
129
- }
130
-
131
- #define G_TYPE_UNIX_MOUNT_POINT (g_unix_mount_point_get_type())
132
-
133
- #undef _SELF
134
- #define _SELF(value) \
135
- ((GUnixMountPoint *)(RVAL2BOXED((value), G_TYPE_UNIX_MOUNT_POINT)))
136
-
137
- static VALUE
138
- unixmountpoint_compare(VALUE self, VALUE other)
139
- {
140
- return INT2FIX(g_unix_mount_point_compare(_SELF(self), _SELF(other)));
141
- }
142
-
143
- static VALUE
144
- unixmountpoint_get_mount_path(VALUE self)
145
- {
146
- return CSTR2RVAL(g_unix_mount_point_get_mount_path(_SELF(self)));
147
- }
148
-
149
- static VALUE
150
- unixmountpoint_get_device_path(VALUE self)
151
- {
152
- return CSTR2RVAL(g_unix_mount_point_get_device_path(_SELF(self)));
153
- }
154
-
155
- static VALUE
156
- unixmountpoint_get_fs_type(VALUE self)
157
- {
158
- return CSTR2RVAL(g_unix_mount_point_get_fs_type(_SELF(self)));
159
- }
160
-
161
- static VALUE
162
- unixmountpoint_is_readonly(VALUE self)
163
- {
164
- return CBOOL2RVAL(g_unix_mount_point_is_readonly(_SELF(self)));
165
- }
166
-
167
- static VALUE
168
- unixmountpoint_is_user_mountable(VALUE self)
169
- {
170
- return CBOOL2RVAL(g_unix_mount_point_is_user_mountable(_SELF(self)));
171
- }
172
-
173
- static VALUE
174
- unixmountpoint_is_loopback(VALUE self)
175
- {
176
- return CBOOL2RVAL(g_unix_mount_point_is_loopback(_SELF(self)));
177
- }
178
-
179
- static VALUE
180
- unixmountpoint_guess_icon(VALUE self)
181
- {
182
- return GOBJ2RVAL_UNREF(g_unix_mount_point_guess_icon(_SELF(self)));
183
- }
184
-
185
- static VALUE
186
- unixmountpoint_guess_name(VALUE self)
187
- {
188
- return CSTR2RVAL_FREE(g_unix_mount_point_guess_name(_SELF(self)));
189
- }
190
-
191
- static VALUE
192
- unixmountpoint_guess_can_eject(VALUE self)
193
- {
194
- return CBOOL2RVAL(g_unix_mount_point_guess_can_eject(_SELF(self)));
195
- }
196
-
197
- static VALUE
198
- unixmountpoints_get(G_GNUC_UNUSED VALUE self)
199
- {
200
- guint64 time_read;
201
- GList *mount_points;
202
-
203
- mount_points = g_unix_mount_points_get(&time_read);
204
-
205
- return rb_assoc_new(GLIST2ARY_STR_FREE(mount_points),
206
- GUINT642RVAL(time_read));
207
- }
208
-
209
- static VALUE
210
- unixmounts_get(G_GNUC_UNUSED VALUE self)
211
- {
212
- guint64 time_read;
213
- GList *mounts;
214
-
215
- mounts = g_unix_mounts_get(&time_read);
216
-
217
- return rb_assoc_new(GLIST2ARY_STR_FREE(mounts),
218
- GUINT642RVAL(time_read));
219
- }
220
-
221
- static VALUE
222
- unixmount_at(G_GNUC_UNUSED VALUE self, VALUE mount_path)
223
- {
224
- guint64 time_read;
225
- GUnixMountEntry *mount;
226
-
227
- mount = g_unix_mount_at(RVAL2CSTR(mount_path), &time_read);
228
-
229
- return rb_assoc_new(GUNIXMOUNTENTRY2RVAL(mount),
230
- GUINT642RVAL(time_read));
231
- }
232
-
233
- static VALUE
234
- unixmounts_changed_since(G_GNUC_UNUSED VALUE self, VALUE time_read)
235
- {
236
- return CBOOL2RVAL(g_unix_mounts_changed_since(RVAL2GUINT64(time_read)));
237
- }
238
-
239
- static VALUE
240
- unixmountpoints_changed_since(G_GNUC_UNUSED VALUE self, VALUE time_read)
241
- {
242
- return CBOOL2RVAL(g_unix_mount_points_changed_since(RVAL2GUINT64(time_read)));
243
- }
244
-
245
- #undef _SELF
246
- #define _SELF(value) G_UNIX_MOUNT_MONITOR(RVAL2GOBJ(value))
247
-
248
- static VALUE
249
- unixmountmonitor_initialize(int argc, VALUE *argv, VALUE self)
250
- {
251
- VALUE limit_msec;
252
- GUnixMountMonitor *monitor;
253
-
254
- rb_scan_args(argc, argv, "01", &limit_msec);
255
- monitor = g_unix_mount_monitor_new();
256
- if (!NIL_P(limit_msec))
257
- g_unix_mount_monitor_set_rate_limit(monitor,
258
- FIX2INT(limit_msec));
259
- G_INITIALIZE(self, monitor);
260
-
261
- return Qnil;
262
- }
263
-
264
- static VALUE
265
- unixmountmonitor_set_rate_limit(VALUE self, VALUE limit_msec)
266
- {
267
- g_unix_mount_monitor_set_rate_limit(_SELF(self), FIX2INT(limit_msec));
268
-
269
- return self;
270
- }
271
-
272
- static VALUE
273
- unix_is_mount_path_system_internal(G_GNUC_UNUSED VALUE self, VALUE mount_path)
274
- {
275
- return CBOOL2RVAL(g_unix_is_mount_path_system_internal(RVAL2CSTR(mount_path)));
276
- }
277
-
278
- #endif
279
-
280
- void
281
- Init_gunixmounts(G_GNUC_UNUSED VALUE glib)
282
- {
283
- #ifdef HAVE_GIO_UNIX
284
- VALUE unixmount, unixmountpoint, unixmountpoints, unixmounts, unixmountmonitor;
285
-
286
- unixmount = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_ENTRY, "UnixMount", glib);
287
-
288
- rb_include_module(unixmount, rb_mComparable);
289
-
290
- /* TODO: This doesn’t follow the naming conventions, but it seems
291
- * overkill to have GLib::Unix just for mount_path_system_internal?. */
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);
294
-
295
- rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_ENTRY);
296
-
297
- rb_define_method(unixmount, "compare", unixmount_compare, 1);
298
- rb_define_alias(unixmount, "<=>", "compare");
299
- rb_define_method(unixmount, "mount_path", unixmount_get_mount_path, 0);
300
- rb_define_method(unixmount, "device_path", unixmount_get_device_path, 0);
301
- rb_define_method(unixmount, "fs_type", unixmount_get_fs_type, 0);
302
- rb_define_method(unixmount, "readonly?", unixmount_is_readonly, 0);
303
- rb_define_method(unixmount, "system_internal?", unixmount_is_system_internal, 0);
304
- rb_define_method(unixmount, "guess_icon", unixmount_guess_icon, 0);
305
- rb_define_method(unixmount, "guess_name", unixmount_guess_name, 0);
306
- rb_define_method(unixmount, "guess_can_eject?", unixmount_guess_can_eject, 0);
307
- rb_define_method(unixmount, "guess_should_display?", unixmount_guess_should_display, 0);
308
-
309
- unixmountpoint = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_POINT, "UnixMountPoint", glib);
310
-
311
- rb_include_module(unixmountpoint, rb_mComparable);
312
-
313
- rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_POINT);
314
-
315
- rb_define_method(unixmountpoint, "compare", unixmountpoint_compare, 1);
316
- rb_define_alias(unixmountpoint, "<=>", "compare");
317
- rb_define_method(unixmountpoint, "mount_path", unixmountpoint_get_mount_path, 0);
318
- rb_define_method(unixmountpoint, "device_path", unixmountpoint_get_device_path, 0);
319
- rb_define_method(unixmountpoint, "fs_type", unixmountpoint_get_fs_type, 0);
320
- rb_define_method(unixmountpoint, "readonly?", unixmountpoint_is_readonly, 0);
321
- rb_define_method(unixmountpoint, "user_mountable?", unixmountpoint_is_user_mountable, 0);
322
- rb_define_method(unixmountpoint, "loopback?", unixmountpoint_is_loopback, 0);
323
- rb_define_method(unixmountpoint, "guess_icon", unixmountpoint_guess_icon, 0);
324
- rb_define_method(unixmountpoint, "guess_name", unixmountpoint_guess_name, 0);
325
- rb_define_method(unixmountpoint, "guess_can_eject?", unixmountpoint_guess_can_eject, 0);
326
-
327
- unixmountpoints = rb_define_module_under(glib, "UnixMountPoints");
328
-
329
- rb_define_module_function(unixmountpoints, "get", unixmountpoints_get, 0);
330
- rb_define_module_function(unixmountpoints, "changed_since?", unixmountpoints_changed_since, 1);
331
-
332
- unixmounts = rb_define_module_under(glib, "UnixMounts");
333
-
334
- rb_define_module_function(unixmounts, "get", unixmounts_get, 0);
335
- rb_define_module_function(unixmounts, "changed_since?", unixmounts_changed_since, 1);
336
-
337
- unixmountmonitor = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_MONITOR, "UnixMountMonitor", glib);
338
-
339
- rb_define_method(unixmountmonitor, "initialize", unixmountmonitor_initialize, -1);
340
- rb_define_method(unixmountmonitor, "set_rate_limit", unixmountmonitor_set_rate_limit, 1);
341
- G_DEF_SETTER(unixmountmonitor, "rate_limit");
342
- #endif
343
- }