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
@@ -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 mUnixMounts
28
+
29
+ static VALUE
30
+ rg_m_get(G_GNUC_UNUSED VALUE self)
31
+ {
32
+ guint64 time_read;
33
+ GList *mounts;
34
+
35
+ mounts = g_unix_mounts_get(&time_read);
36
+
37
+ return rb_assoc_new(GLIST2ARY_STR_FREE(mounts),
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_mounts_changed_since(RVAL2GUINT64(time_read)));
45
+ }
46
+
47
+ #endif
48
+
49
+ void
50
+ Init_gunixmounts(G_GNUC_UNUSED VALUE mGio)
51
+ {
52
+ #ifdef HAVE_GIO_UNIX
53
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "UnixMounts");
54
+
55
+ RG_DEF_MODFUNC(get, 0);
56
+ RG_DEF_MODFUNC_P(changed_since, 1);
57
+ #endif
58
+ }
@@ -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/gunixoutputstream.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixOutputStream
28
+ #define _SELF(value) RVAL2GUNIXOUTPUTSTREAM(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_output_stream_new(RVAL2FD(fd),
37
+ RVAL2CBOOL(close_fd)));
38
+
39
+ return Qnil;
40
+ }
41
+ #endif
42
+
43
+ void
44
+ Init_gunixoutputstream(G_GNUC_UNUSED VALUE mGio)
45
+ {
46
+ #ifdef HAVE_GIO_UNIX
47
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_OUTPUT_STREAM, "UnixOutputStream", mGio);
48
+
49
+ RG_DEF_METHOD(initialize, -1);
50
+ #endif
51
+ }
@@ -0,0 +1,69 @@
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/gunixsocketaddress.h>
26
+
27
+ #define RG_TARGET_NAMESPACE cUnixSocketAddress
28
+ #define _SELF(value) RVAL2GUNIXSOCKETADDRESS(value)
29
+
30
+ static VALUE
31
+ rg_initialize(VALUE self, VALUE path)
32
+ {
33
+ G_INITIALIZE(self, g_unix_socket_address_new(RVAL2CSTR(path)));
34
+
35
+ return Qnil;
36
+ }
37
+
38
+ static VALUE
39
+ rg_s_new_abstract(G_GNUC_UNUSED VALUE self, VALUE path)
40
+ {
41
+ StringValue(path);
42
+ return GOBJ2RVAL_UNREF(g_unix_socket_address_new_abstract(RSTRING_PTR(path),
43
+ RSTRING_LEN(path)));
44
+ }
45
+
46
+ static VALUE
47
+ rg_s_abstract_names_supported_p(G_GNUC_UNUSED VALUE self)
48
+ {
49
+ return CBOOL2RVAL(g_unix_socket_address_abstract_names_supported());
50
+ }
51
+ #endif
52
+
53
+ void
54
+ Init_gunixsocketaddress(G_GNUC_UNUSED VALUE mGio)
55
+ {
56
+ #ifdef HAVE_GIO_UNIX
57
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_UNIX_SOCKET_ADDRESS, "UnixSocketAddress", mGio);
58
+
59
+ # if GLIB_CHECK_VERSION(2, 26, 0)
60
+ G_DEF_CLASS(G_TYPE_UNIX_SOCKET_ADDRESS_TYPE, "Type", RG_TARGET_NAMESPACE);
61
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNIX_SOCKET_ADDRESS_TYPE, "G_UNIX_SOCKET_ADDRESS_");
62
+ # endif
63
+
64
+ RG_DEF_SMETHOD(new_abstract, 1);
65
+ RG_DEF_SMETHOD_P(abstract_names_supported, 0);
66
+
67
+ RG_DEF_METHOD(initialize, 1);
68
+ #endif
69
+ }
@@ -0,0 +1,84 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgio2private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cVfs
25
+ #define _SELF(value) RVAL2GVFS(value)
26
+
27
+ static VALUE
28
+ rg_file_for_path(VALUE self, VALUE path)
29
+ {
30
+ return GOBJ2RVAL_UNREF(g_vfs_get_file_for_path(_SELF(self), RVAL2CSTR(path)));
31
+ }
32
+
33
+ static VALUE
34
+ rg_file_for_uri(VALUE self, VALUE uri)
35
+ {
36
+ return GOBJ2RVAL_UNREF(g_vfs_get_file_for_uri(_SELF(self), RVAL2CSTR(uri)));
37
+ }
38
+
39
+ static VALUE
40
+ rg_parse_name(VALUE self, VALUE parse_name)
41
+ {
42
+ return GOBJ2RVAL_UNREF(g_vfs_parse_name(_SELF(self), RVAL2CSTR(parse_name)));
43
+ }
44
+
45
+ static VALUE
46
+ rg_s_default(G_GNUC_UNUSED VALUE self)
47
+ {
48
+ return GOBJ2RVAL(g_vfs_get_default());
49
+ }
50
+
51
+ static VALUE
52
+ rg_s_local(G_GNUC_UNUSED VALUE self)
53
+ {
54
+ return GOBJ2RVAL(g_vfs_get_local());
55
+ }
56
+
57
+ static VALUE
58
+ rg_active_p(VALUE self)
59
+ {
60
+ return CBOOL2RVAL(g_vfs_is_active(_SELF(self)));
61
+ }
62
+
63
+ static VALUE
64
+ rg_supported_uri_schemes(VALUE self)
65
+ {
66
+ return STRV2RVAL((const gchar **)g_vfs_get_supported_uri_schemes(_SELF(self)));
67
+ }
68
+
69
+ void
70
+ Init_gvfs(VALUE mGio)
71
+ {
72
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VFS, "Vfs", mGio);
73
+
74
+ rb_define_const(RG_TARGET_NAMESPACE, "EXTENSION_POINT_NAME", CSTR2RVAL(G_VFS_EXTENSION_POINT_NAME));
75
+
76
+ RG_DEF_SMETHOD(default, 0);
77
+ RG_DEF_SMETHOD(local, 0);
78
+
79
+ RG_DEF_METHOD(file_for_path, 1);
80
+ RG_DEF_METHOD(file_for_uri, 1);
81
+ RG_DEF_METHOD(parse_name, 1);
82
+ RG_DEF_METHOD_P(active, 0);
83
+ RG_DEF_METHOD(supported_uri_schemes, 0);
84
+ }
@@ -0,0 +1,193 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgio2private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE mVolume
25
+ #define _SELF(value) RVAL2GVOLUME(value)
26
+
27
+ static VALUE
28
+ rg_name(VALUE self)
29
+ {
30
+ return CSTR2RVAL_FREE(g_volume_get_name(_SELF(self)));
31
+ }
32
+
33
+ static VALUE
34
+ rg_uuid(VALUE self)
35
+ {
36
+ return CSTR2RVAL_FREE(g_volume_get_uuid(_SELF(self)));
37
+ }
38
+
39
+ static VALUE
40
+ rg_icon(VALUE self)
41
+ {
42
+ return GOBJ2RVAL_UNREF(g_volume_get_icon(_SELF(self)));
43
+ }
44
+
45
+ static VALUE
46
+ rg_drive(VALUE self)
47
+ {
48
+ return GOBJ2RVAL_UNREF(g_volume_get_drive(_SELF(self)));
49
+ }
50
+
51
+ static VALUE
52
+ rg_get_mount(VALUE self)
53
+ {
54
+ return GOBJ2RVAL_UNREF(g_volume_get_mount(_SELF(self)));
55
+ }
56
+
57
+ static VALUE
58
+ rg_can_mount_p(VALUE self)
59
+ {
60
+ return CBOOL2RVAL(g_volume_can_mount(_SELF(self)));
61
+ }
62
+
63
+ static VALUE
64
+ rg_should_automount_p(VALUE self)
65
+ {
66
+ return CBOOL2RVAL(g_volume_should_automount(_SELF(self)));
67
+ }
68
+
69
+ static VALUE
70
+ rg_activation_root(VALUE self)
71
+ {
72
+ return GOBJ2RVAL_UNREF(g_volume_get_activation_root(_SELF(self)));
73
+ }
74
+
75
+ static VALUE
76
+ rg_mount(int argc, VALUE *argv, VALUE self)
77
+ {
78
+ VALUE rbflags, rbmount_operation, rbcancellable, block;
79
+ GMountMountFlags flags;
80
+ GMountOperation *mount_operation;
81
+ GCancellable *cancellable;
82
+
83
+ rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
84
+ flags = RVAL2GMOUNTMOUNTFLAGSDEFAULT(rbflags);
85
+ mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
86
+ cancellable = RVAL2GCANCELLABLE(rbcancellable);
87
+ SAVE_BLOCK(block);
88
+ g_volume_mount(_SELF(self),
89
+ flags,
90
+ mount_operation,
91
+ cancellable,
92
+ rbgio_async_ready_callback,
93
+ (gpointer)block);
94
+
95
+ return self;
96
+ }
97
+
98
+ typedef gboolean (*BooleanFinishMethod)(GVolume *,
99
+ GAsyncResult *,
100
+ GError **);
101
+
102
+ static VALUE
103
+ boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
104
+ {
105
+ GError *error = NULL;
106
+
107
+ if (!method(_SELF(self), RVAL2GASYNCRESULT(result), &error))
108
+ rbgio_raise_error(error);
109
+
110
+ return self;
111
+ }
112
+
113
+ static VALUE
114
+ rg_mount_finish(VALUE self, VALUE result)
115
+ {
116
+ return boolean_finish_method(g_volume_mount_finish, self, result);
117
+ }
118
+
119
+ static VALUE
120
+ rg_can_eject_p(VALUE self)
121
+ {
122
+ return CBOOL2RVAL(g_volume_can_eject(_SELF(self)));
123
+ }
124
+
125
+ static VALUE
126
+ rg_eject_with_operation(int argc, VALUE *argv, VALUE self)
127
+ {
128
+ VALUE rbflags, rbmount_operation, rbcancellable, block;
129
+ GMountUnmountFlags flags;
130
+ GMountOperation *mount_operation;
131
+ GCancellable *cancellable;
132
+
133
+ rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
134
+ flags = RVAL2GMOUNTUNMOUNTFLAGSDEFAULT(rbflags);
135
+ mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
136
+ cancellable = RVAL2GCANCELLABLE(rbcancellable);
137
+ SAVE_BLOCK(block);
138
+ g_volume_eject_with_operation(_SELF(self),
139
+ flags,
140
+ mount_operation,
141
+ cancellable,
142
+ rbgio_async_ready_callback,
143
+ (gpointer)block);
144
+
145
+ return self;
146
+ }
147
+
148
+ static VALUE
149
+ rg_eject_with_operation_finish(VALUE self, VALUE result)
150
+ {
151
+ return boolean_finish_method(g_volume_eject_with_operation_finish, self, result);
152
+ }
153
+
154
+ static VALUE
155
+ rg_enumerate_identifiers(VALUE self)
156
+ {
157
+ return STRV2RVAL_FREE(g_volume_enumerate_identifiers(_SELF(self)));
158
+ }
159
+
160
+ static VALUE
161
+ rg_get_identifier(VALUE self, VALUE kind)
162
+ {
163
+ return CSTR2RVAL_FREE(g_volume_get_identifier(_SELF(self), RVAL2CSTR(kind)));
164
+ }
165
+
166
+ void
167
+ Init_gvolume(VALUE mGio)
168
+ {
169
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_VOLUME, "Volume", mGio);
170
+
171
+ rb_define_const(RG_TARGET_NAMESPACE, "IDENTIFIER_KIND_HAL_UDI", CSTR2RVAL(G_VOLUME_IDENTIFIER_KIND_HAL_UDI));
172
+ rb_define_const(RG_TARGET_NAMESPACE, "IDENTIFIER_KIND_LABEL", CSTR2RVAL(G_VOLUME_IDENTIFIER_KIND_LABEL));
173
+ rb_define_const(RG_TARGET_NAMESPACE, "IDENTIFIER_KIND_NFS_MOUNT", CSTR2RVAL(G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT));
174
+ rb_define_const(RG_TARGET_NAMESPACE, "IDENTIFIER_KIND_UNIX_DEVICE", CSTR2RVAL(G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
175
+ rb_define_const(RG_TARGET_NAMESPACE, "IDENTIFIER_KIND_UUID", CSTR2RVAL(G_VOLUME_IDENTIFIER_KIND_UUID));
176
+
177
+ RG_DEF_METHOD(name, 0);
178
+ RG_DEF_METHOD(uuid, 0);
179
+ RG_DEF_METHOD(icon, 0);
180
+ RG_DEF_METHOD(drive, 0);
181
+ RG_DEF_METHOD(get_mount, 0);
182
+ RG_DEF_METHOD_P(can_mount, 0);
183
+ RG_DEF_METHOD_P(should_automount, 0);
184
+ RG_DEF_METHOD(activation_root, 0);
185
+ RG_DEF_METHOD(mount, -1);
186
+ RG_DEF_METHOD(mount_finish, 1);
187
+ RG_DEF_METHOD_P(can_eject, 0);
188
+ RG_DEF_METHOD(eject_with_operation, -1);
189
+ RG_DEF_METHOD(eject_with_operation_finish, 1);
190
+ RG_DEF_METHOD(enumerate_identifiers, -1);
191
+ RG_DEF_ALIAS("identifiers", "enumerate_identifiers");
192
+ RG_DEF_METHOD(get_identifier, 1);
193
+ }
@@ -0,0 +1,77 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgio2private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cVolumeMonitor
25
+ #define _SELF(value) RVAL2GVOLUMEMONITOR(value)
26
+
27
+ static VALUE
28
+ rg_s_get(G_GNUC_UNUSED VALUE self)
29
+ {
30
+ return GOBJ2RVAL_UNREF(g_volume_monitor_get());
31
+ }
32
+
33
+ static VALUE
34
+ rg_connected_drives(VALUE self)
35
+ {
36
+ return GLIST2ARY_FREE(g_volume_monitor_get_connected_drives(_SELF(self)));
37
+ }
38
+
39
+ static VALUE
40
+ rg_volumes(VALUE self)
41
+ {
42
+ return GLIST2ARY_FREE(g_volume_monitor_get_volumes(_SELF(self)));
43
+ }
44
+
45
+ static VALUE
46
+ rg_mounts(VALUE self)
47
+ {
48
+ return GLIST2ARY_FREE(g_volume_monitor_get_mounts(_SELF(self)));
49
+ }
50
+
51
+ static VALUE
52
+ rg_get_mount_for_uuid(VALUE self, VALUE value)
53
+ {
54
+ return GOBJ2RVAL_UNREF(g_volume_monitor_get_mount_for_uuid(_SELF(self), RVAL2CSTR(value)));
55
+ }
56
+
57
+ static VALUE
58
+ rg_get_volume_for_uuid(VALUE self, VALUE value)
59
+ {
60
+ return GOBJ2RVAL_UNREF(g_volume_monitor_get_volume_for_uuid(_SELF(self), RVAL2CSTR(value)));
61
+ }
62
+
63
+ void
64
+ Init_gvolumemonitor(VALUE mGio)
65
+ {
66
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VOLUME_MONITOR, "VolumeMonitor", mGio);
67
+
68
+ rb_define_const(RG_TARGET_NAMESPACE, "EXTENSION_POINT_NAME", CSTR2RVAL(G_VOLUME_MONITOR_EXTENSION_POINT_NAME));
69
+
70
+ RG_DEF_SMETHOD(get, 0);
71
+
72
+ RG_DEF_METHOD(connected_drives, 0);
73
+ RG_DEF_METHOD(volumes, 0);
74
+ RG_DEF_METHOD(mounts, 0);
75
+ RG_DEF_METHOD(get_mount_for_uuid, 0);
76
+ RG_DEF_METHOD(get_volume_for_uuid, 0);
77
+ }
@@ -0,0 +1,52 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgio2private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cZlibCompressor
25
+ #define _SELF(value) RVAL2GZLIBCOMPRESSOR(value)
26
+
27
+ #define RVAL2ZLIBCOMPRESSORLEVELDEFAULT(value) \
28
+ RVAL2TYPE_WITH_DEFAULT((value), FIX2INT, -1)
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ VALUE format, level;
34
+
35
+ rb_scan_args(argc, argv, "02", &format, &level);
36
+ G_INITIALIZE(self,
37
+ g_zlib_compressor_new(RVAL2GZLIBCOMPRESSORFORMATDEFAULT(format),
38
+ RVAL2GZLIBCOMPRESSORFORMATDEFAULT(level)));
39
+
40
+ return Qnil;
41
+ }
42
+
43
+ void
44
+ Init_gzlibcompressor(VALUE mGio)
45
+ {
46
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_ZLIB_COMPRESSOR, "ZlibCompressor", mGio);
47
+
48
+ G_DEF_CLASS(G_TYPE_ZLIB_COMPRESSOR_FORMAT, "Format", RG_TARGET_NAMESPACE);
49
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_ZLIB_COMPRESSOR_FORMAT, "G_ZLIB_");
50
+
51
+ RG_DEF_METHOD(initialize, -1);
52
+ }
@@ -0,0 +1,45 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgio2private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cZlibDecompressor
25
+ #define _SELF(value) RVAL2GZLIBDECOMPRESSOR(value)
26
+
27
+ static VALUE
28
+ rg_initialize(int argc, VALUE *argv, VALUE self)
29
+ {
30
+ VALUE format;
31
+
32
+ rb_scan_args(argc, argv, "01", &format);
33
+ G_INITIALIZE(self,
34
+ g_zlib_decompressor_new(RVAL2GZLIBCOMPRESSORFORMATDEFAULT(format)));
35
+
36
+ return Qnil;
37
+ }
38
+
39
+ void
40
+ Init_gzlibdecompressor(VALUE mGio)
41
+ {
42
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_ZLIB_DECOMPRESSOR, "ZlibDecompressor", mGio);
43
+
44
+ RG_DEF_METHOD(initialize, -1);
45
+ }