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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,115 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixfdlist.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixFDList
28
+ #define _SELF(value) RVAL2GUNIXFDLIST(value)
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ VALUE rbfds;
34
+ long n;
35
+ gint *fds;
36
+ GUnixFDList *list;
37
+
38
+ rb_scan_args(argc, argv, "0*", &rbfds);
39
+ fds = RVAL2FDS(rbfds, n);
40
+ if (n == 0) {
41
+ G_INITIALIZE(self, g_unix_fd_list_new());
42
+ return Qnil;
43
+ }
44
+
45
+ list = g_unix_fd_list_new_from_array(fds, n);
46
+
47
+ g_free(fds);
48
+
49
+ G_INITIALIZE(self, list);
50
+
51
+ return Qnil;
52
+ }
53
+
54
+ static VALUE
55
+ rg_length(VALUE self)
56
+ {
57
+ return GINT2RVAL(g_unix_fd_list_get_length(_SELF(self)));
58
+ }
59
+
60
+ static VALUE
61
+ rg_get(VALUE self, VALUE index)
62
+ {
63
+ GError *error = NULL;
64
+ gint fd;
65
+
66
+ fd = g_unix_fd_list_get(_SELF(self), RVAL2GINT(index), &error);
67
+ if (fd == -1)
68
+ rbgio_raise_error(error);
69
+
70
+ /* TODO: This fd must be closed properly. How do we deal with that? */
71
+ return FD2RVAL(fd);
72
+ }
73
+
74
+ static VALUE
75
+ rg_peek_fds(VALUE self)
76
+ {
77
+ return GFDS2ARY(g_unix_fd_list_peek_fds(_SELF(self), NULL));
78
+ }
79
+
80
+ static VALUE
81
+ rg_steal_fds(VALUE self)
82
+ {
83
+ return GFDS2ARY_FREE(g_unix_fd_list_steal_fds(_SELF(self), NULL));
84
+ }
85
+
86
+ static VALUE
87
+ rg_append(VALUE self, VALUE fd)
88
+ {
89
+ GError *error = NULL;
90
+ int index;
91
+
92
+ index = g_unix_fd_list_append(_SELF(self), RVAL2FD(fd), &error);
93
+ if (index == -1)
94
+ rbgio_raise_error(error);
95
+
96
+ return self;
97
+ }
98
+ #endif
99
+
100
+ void
101
+ Init_gunixfdlist(G_GNUC_UNUSED VALUE mGio)
102
+ {
103
+ #ifdef HAVE_GIO_UNIX
104
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_FD_LIST, "UnixFDList", mGio);
105
+
106
+ RG_DEF_METHOD(initialize, -1);
107
+ RG_DEF_METHOD(length, 0);
108
+ RG_DEF_METHOD(get, 1);
109
+ RG_DEF_ALIAS("[]", "get");
110
+ RG_DEF_METHOD(peek_fds, 0);
111
+ RG_DEF_METHOD(steal_fds, 0);
112
+ RG_DEF_METHOD(append, 1);
113
+ RG_DEF_ALIAS("<<", "append");
114
+ #endif
115
+ }
@@ -0,0 +1,74 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixfdmessage.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixFDMessage
28
+ #define _SELF(value) RVAL2GUNIXFDMESSAGE(value)
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ VALUE fd_list;
34
+ GSocketControlMessage *message;
35
+
36
+ rb_scan_args(argc, argv, "01", &fd_list);
37
+ message = NIL_P(fd_list) ?
38
+ g_unix_fd_message_new() :
39
+ g_unix_fd_message_new_with_fd_list(RVAL2GUNIXFDLIST(fd_list));
40
+ G_INITIALIZE(self, message);
41
+
42
+ return Qnil;
43
+ }
44
+
45
+ static VALUE
46
+ rg_append_fd(VALUE self, VALUE fd)
47
+ {
48
+ GError *error = NULL;
49
+
50
+ if (!g_unix_fd_message_append_fd(_SELF(self), RVAL2FD(fd), &error))
51
+ rbgio_raise_error(error);
52
+
53
+ return self;
54
+ }
55
+
56
+ static VALUE
57
+ rg_steal_fds(VALUE self)
58
+ {
59
+ return GFDS2ARY_FREE(g_unix_fd_message_steal_fds(_SELF(self), NULL));
60
+ }
61
+ #endif
62
+
63
+ void
64
+ Init_gunixfdmessage(G_GNUC_UNUSED VALUE mGio)
65
+ {
66
+ #ifdef HAVE_GIO_UNIX
67
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_FD_MESSAGE, "UnixFDMessage", mGio);
68
+
69
+ RG_DEF_METHOD(initialize, -1);
70
+ RG_DEF_METHOD(append_fd, 1);
71
+ RG_DEF_ALIAS("<<", "append_fd");
72
+ RG_DEF_METHOD(steal_fds, 0);
73
+ #endif
74
+ }
@@ -0,0 +1,51 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixinputstream.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixInputStream
28
+ #define _SELF(value) RVAL2GUNIXINPUTSTREAM(value)
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ VALUE fd, close_fd;
34
+
35
+ rb_scan_args(argc, argv, "11", &fd, &close_fd);
36
+ G_INITIALIZE(self, g_unix_input_stream_new(RVAL2FD(fd),
37
+ RVAL2CBOOL(close_fd)));
38
+
39
+ return Qnil;
40
+ }
41
+ #endif
42
+
43
+ void
44
+ Init_gunixinputstream(G_GNUC_UNUSED VALUE mGio)
45
+ {
46
+ #ifdef HAVE_GIO_UNIX
47
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_INPUT_STREAM, "UnixInputStream", mGio);
48
+
49
+ RG_DEF_METHOD(initialize, -1);
50
+ #endif
51
+ }
@@ -0,0 +1,164 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixmounts.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixMount
28
+
29
+ static GUnixMountEntry *
30
+ unixmount_copy(const GUnixMountEntry *mount)
31
+ {
32
+ return (GUnixMountEntry *)mount;
33
+ }
34
+
35
+ static GType
36
+ g_unix_mount_entry_get_type(void)
37
+ {
38
+ static GType our_type = 0;
39
+
40
+ if (our_type == 0)
41
+ our_type = g_boxed_type_register_static("GUnixMountEntry",
42
+ (GBoxedCopyFunc)unixmount_copy,
43
+ (GBoxedFreeFunc)g_unix_mount_free);
44
+
45
+ return our_type;
46
+ }
47
+
48
+ #define G_TYPE_UNIX_MOUNT_ENTRY (g_unix_mount_entry_get_type())
49
+
50
+ #define _SELF(value) \
51
+ ((GUnixMountEntry *)(RVAL2BOXED((value), G_TYPE_UNIX_MOUNT_ENTRY)))
52
+
53
+ #define GUNIXMOUNTENTRY2RVAL(value) BOXED2RVAL((value), G_TYPE_UNIX_MOUNT_ENTRY)
54
+
55
+ static VALUE
56
+ rg_compare(VALUE self, VALUE other)
57
+ {
58
+ return INT2FIX(g_unix_mount_compare(_SELF(self), _SELF(other)));
59
+ }
60
+
61
+ static VALUE
62
+ rg_mount_path(VALUE self)
63
+ {
64
+ return CSTR2RVAL(g_unix_mount_get_mount_path(_SELF(self)));
65
+ }
66
+
67
+ static VALUE
68
+ rg_device_path(VALUE self)
69
+ {
70
+ return CSTR2RVAL(g_unix_mount_get_device_path(_SELF(self)));
71
+ }
72
+
73
+ static VALUE
74
+ rg_fs_type(VALUE self)
75
+ {
76
+ return CSTR2RVAL(g_unix_mount_get_fs_type(_SELF(self)));
77
+ }
78
+
79
+ static VALUE
80
+ rg_readonly_p(VALUE self)
81
+ {
82
+ return CBOOL2RVAL(g_unix_mount_is_readonly(_SELF(self)));
83
+ }
84
+
85
+ static VALUE
86
+ rg_system_internal_p(VALUE self)
87
+ {
88
+ return CBOOL2RVAL(g_unix_mount_is_system_internal(_SELF(self)));
89
+ }
90
+
91
+ static VALUE
92
+ rg_guess_icon(VALUE self)
93
+ {
94
+ return GOBJ2RVAL_UNREF(g_unix_mount_guess_icon(_SELF(self)));
95
+ }
96
+
97
+ static VALUE
98
+ rg_guess_name(VALUE self)
99
+ {
100
+ return CSTR2RVAL_FREE(g_unix_mount_guess_name(_SELF(self)));
101
+ }
102
+
103
+ static VALUE
104
+ rg_guess_can_eject_p(VALUE self)
105
+ {
106
+ return CBOOL2RVAL(g_unix_mount_guess_can_eject(_SELF(self)));
107
+ }
108
+
109
+ static VALUE
110
+ rg_guess_should_display_p(VALUE self)
111
+ {
112
+ return CBOOL2RVAL(g_unix_mount_guess_should_display(_SELF(self)));
113
+ }
114
+
115
+ static VALUE
116
+ rg_s_at(G_GNUC_UNUSED VALUE self, VALUE mount_path)
117
+ {
118
+ guint64 time_read;
119
+ GUnixMountEntry *mount;
120
+
121
+ mount = g_unix_mount_at(RVAL2CSTR(mount_path), &time_read);
122
+
123
+ return rb_assoc_new(GUNIXMOUNTENTRY2RVAL(mount),
124
+ GUINT642RVAL(time_read));
125
+ }
126
+
127
+ static VALUE
128
+ rg_s_mount_path_system_internal_p(G_GNUC_UNUSED VALUE self, VALUE mount_path)
129
+ {
130
+ return CBOOL2RVAL(g_unix_is_mount_path_system_internal(RVAL2CSTR(mount_path)));
131
+ }
132
+
133
+ #endif
134
+
135
+ void
136
+ Init_gunixmount(G_GNUC_UNUSED VALUE mGio)
137
+ {
138
+ #ifdef HAVE_GIO_UNIX
139
+ VALUE RG_TARGET_NAMESPACE;
140
+
141
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_ENTRY, "UnixMount", mGio);
142
+
143
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable);
144
+
145
+ /* TODO: This doesn't follow the naming conventions, but it seems
146
+ * overkill to have GLib::Unix just for mount_path_system_internal?. */
147
+ RG_DEF_SMETHOD_P(mount_path_system_internal, 1);
148
+ RG_DEF_SMETHOD(at, 1);
149
+
150
+ rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_ENTRY);
151
+
152
+ RG_DEF_METHOD(compare, 1);
153
+ RG_DEF_ALIAS("<=>", "compare");
154
+ RG_DEF_METHOD(mount_path, 0);
155
+ RG_DEF_METHOD(device_path, 0);
156
+ RG_DEF_METHOD(fs_type, 0);
157
+ RG_DEF_METHOD_P(readonly, 0);
158
+ RG_DEF_METHOD_P(system_internal, 0);
159
+ RG_DEF_METHOD(guess_icon, 0);
160
+ RG_DEF_METHOD(guess_name, 0);
161
+ RG_DEF_METHOD_P(guess_can_eject, 0);
162
+ RG_DEF_METHOD_P(guess_should_display, 0);
163
+ #endif
164
+ }
@@ -0,0 +1,66 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixmounts.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixMountMonitor
28
+ #define _SELF(value) RVAL2GUNIXMOUNTMONITOR(value)
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ VALUE limit_msec;
34
+ GUnixMountMonitor *monitor;
35
+
36
+ rb_scan_args(argc, argv, "01", &limit_msec);
37
+ monitor = g_unix_mount_monitor_new();
38
+ if (!NIL_P(limit_msec))
39
+ g_unix_mount_monitor_set_rate_limit(monitor,
40
+ FIX2INT(limit_msec));
41
+ G_INITIALIZE(self, monitor);
42
+
43
+ return Qnil;
44
+ }
45
+
46
+ static VALUE
47
+ rg_set_rate_limit(VALUE self, VALUE limit_msec)
48
+ {
49
+ g_unix_mount_monitor_set_rate_limit(_SELF(self), FIX2INT(limit_msec));
50
+
51
+ return self;
52
+ }
53
+
54
+ #endif
55
+
56
+ void
57
+ Init_gunixmountmonitor(G_GNUC_UNUSED VALUE mGio)
58
+ {
59
+ #ifdef HAVE_GIO_UNIX
60
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_MONITOR, "UnixMountMonitor", mGio);
61
+
62
+ RG_DEF_METHOD(initialize, -1);
63
+ RG_DEF_METHOD(set_rate_limit, 1);
64
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "rate_limit");
65
+ #endif
66
+ }
@@ -0,0 +1,136 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixmounts.h>
26
+
27
+ #define G_TYPE_UNIX_MOUNT_POINT (g_unix_mount_point_get_type())
28
+
29
+ #define RG_TARGET_NAMESPACE cUnixMountPoint
30
+ #define _SELF(value) \
31
+ ((GUnixMountPoint *)(RVAL2BOXED((value), G_TYPE_UNIX_MOUNT_POINT)))
32
+
33
+ static GUnixMountPoint *
34
+ unixmountpoint_copy(const GUnixMountPoint *mount_point)
35
+ {
36
+ return (GUnixMountPoint *)mount_point;
37
+ }
38
+
39
+ static GType
40
+ g_unix_mount_point_get_type(void)
41
+ {
42
+ static GType our_type = 0;
43
+
44
+ if (our_type == 0)
45
+ our_type = g_boxed_type_register_static("GUnixMountPoint",
46
+ (GBoxedCopyFunc)unixmountpoint_copy,
47
+ (GBoxedFreeFunc)g_unix_mount_point_free);
48
+
49
+ return our_type;
50
+ }
51
+
52
+ static VALUE
53
+ rg_compare(VALUE self, VALUE other)
54
+ {
55
+ return INT2FIX(g_unix_mount_point_compare(_SELF(self), _SELF(other)));
56
+ }
57
+
58
+ static VALUE
59
+ rg_mount_path(VALUE self)
60
+ {
61
+ return CSTR2RVAL(g_unix_mount_point_get_mount_path(_SELF(self)));
62
+ }
63
+
64
+ static VALUE
65
+ rg_device_path(VALUE self)
66
+ {
67
+ return CSTR2RVAL(g_unix_mount_point_get_device_path(_SELF(self)));
68
+ }
69
+
70
+ static VALUE
71
+ rg_fs_type(VALUE self)
72
+ {
73
+ return CSTR2RVAL(g_unix_mount_point_get_fs_type(_SELF(self)));
74
+ }
75
+
76
+ static VALUE
77
+ rg_readonly_p(VALUE self)
78
+ {
79
+ return CBOOL2RVAL(g_unix_mount_point_is_readonly(_SELF(self)));
80
+ }
81
+
82
+ static VALUE
83
+ rg_user_mountable_p(VALUE self)
84
+ {
85
+ return CBOOL2RVAL(g_unix_mount_point_is_user_mountable(_SELF(self)));
86
+ }
87
+
88
+ static VALUE
89
+ rg_loopback_p(VALUE self)
90
+ {
91
+ return CBOOL2RVAL(g_unix_mount_point_is_loopback(_SELF(self)));
92
+ }
93
+
94
+ static VALUE
95
+ rg_guess_icon(VALUE self)
96
+ {
97
+ return GOBJ2RVAL_UNREF(g_unix_mount_point_guess_icon(_SELF(self)));
98
+ }
99
+
100
+ static VALUE
101
+ rg_guess_name(VALUE self)
102
+ {
103
+ return CSTR2RVAL_FREE(g_unix_mount_point_guess_name(_SELF(self)));
104
+ }
105
+
106
+ static VALUE
107
+ rg_guess_can_eject_p(VALUE self)
108
+ {
109
+ return CBOOL2RVAL(g_unix_mount_point_guess_can_eject(_SELF(self)));
110
+ }
111
+
112
+ #endif
113
+
114
+ void
115
+ Init_gunixmountpoint(G_GNUC_UNUSED VALUE mGio)
116
+ {
117
+ #ifdef HAVE_GIO_UNIX
118
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_MOUNT_POINT, "UnixMountPoint", mGio);
119
+
120
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable);
121
+
122
+ rbgobj_boxed_not_copy_obj(G_TYPE_UNIX_MOUNT_POINT);
123
+
124
+ RG_DEF_METHOD(compare, 1);
125
+ RG_DEF_ALIAS("<=>", "compare");
126
+ RG_DEF_METHOD(mount_path, 0);
127
+ RG_DEF_METHOD(device_path, 0);
128
+ RG_DEF_METHOD(fs_type, 0);
129
+ RG_DEF_METHOD_P(readonly, 0);
130
+ RG_DEF_METHOD_P(user_mountable, 0);
131
+ RG_DEF_METHOD_P(loopback, 0);
132
+ RG_DEF_METHOD(guess_icon, 0);
133
+ RG_DEF_METHOD(guess_name, 0);
134
+ RG_DEF_METHOD_P(guess_can_eject, 0);
135
+ #endif
136
+ }
@@ -0,0 +1,58 @@
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
+ #ifdef HAVE_GIO_UNIX
25
+ #include <gio/gunixmounts.h>
26
+
27
+ #define RG_TARGET_NAMESPACE mUnixMountPoints
28
+
29
+ static VALUE
30
+ rg_m_get(G_GNUC_UNUSED VALUE self)
31
+ {
32
+ guint64 time_read;
33
+ GList *mount_points;
34
+
35
+ mount_points = g_unix_mount_points_get(&time_read);
36
+
37
+ return rb_assoc_new(GLIST2ARY_STR_FREE(mount_points),
38
+ GUINT642RVAL(time_read));
39
+ }
40
+
41
+ static VALUE
42
+ rg_m_changed_since_p(G_GNUC_UNUSED VALUE self, VALUE time_read)
43
+ {
44
+ return CBOOL2RVAL(g_unix_mount_points_changed_since(RVAL2GUINT64(time_read)));
45
+ }
46
+
47
+ #endif
48
+
49
+ void
50
+ Init_gunixmountpoints(G_GNUC_UNUSED VALUE mGio)
51
+ {
52
+ #ifdef HAVE_GIO_UNIX
53
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "UnixMountPoints");
54
+
55
+ RG_DEF_MODFUNC(get, 0);
56
+ RG_DEF_MODFUNC_P(changed_since, 1);
57
+ #endif
58
+ }