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
data/ChangeLog DELETED
@@ -1,129 +0,0 @@
1
- 2011-09-16 Nikolai Weibull <now@bitwi.se>
2
-
3
- * lib/gio2.rb: Remove unused variable.
4
- * ext/gio2/gthemedicon.c: Fix argument number for
5
- GLib::ThemedIcon#initialize.
6
-
7
- 2011-09-15 Nikolai Weibull <now@bitwi.se>
8
-
9
- * ext/gio2/gsocket.c: Use G_REPLACE_GET_PROPERTY().
10
-
11
- 2011-09-12 Nikolai Weibull <now@bitwi.se>
12
-
13
- * ext/gio2/gio2.h: Fix RVAL2GSOCKETPROTOCOL and RVAL2GSOCKETTYPE
14
- * ext/gio2/gsocket.c: Fix #local_address and #remote_address
15
- property-overriding methods
16
- * ext/gio2/gvolume.c: Name doubly-named #mount method
17
- #mount/#get_mount.
18
-
19
- 2011-09-09 Nikolai Weibull <now@bitwi.se>
20
-
21
- * ext/gio2/gio2.h: Fix RVAL2GMOUNTMOUNTFLAGS.
22
-
23
- 2011-01-30 Kouhei Sutou <kou@cozmixng.org>
24
-
25
- * Rakefile, ext/gio2/extconf.rb: share depended packages
26
- vendor/local/.
27
- * ext/gio2/*.c: Fix all RVAL2CSTR calls.
28
-
29
- 2011-01-29 Kouhei Sutou <kou@cozmixng.org>
30
-
31
- * ext/gio2/gunixsocketaddress.c (Init_gunixsocketaddress): disable
32
- G_TYPE_UNIX_SOCKET_ADDRESS_TYPE on GIO 2.24 because it was appeared
33
- in GIO 2.26.
34
-
35
- * ext/gio2/gdatainputstream.c: disable read_upto related methods
36
- with GIO 2.24 because GIO 2.24 has those definition in *.c but no those
37
- declarations in *.h.
38
-
39
- 2011-01-22 Masaaki Aoyagi
40
-
41
- * Rakefile: change to use gnome2-raketask.rb.
42
-
43
- 2011-01-16 Nikolai Weibull
44
-
45
- * ext/gio2/gfileattribute.c: Split into files for each separate class
46
- and update names to match the rules of Ruby-GNOME2.
47
- * ext/gio2/*: Remove methods for getting and setting properties that
48
- are automatically generated.
49
- * lib/gio2.rb: Make GLib::UnixFDList Enumerable.
50
- * ext/gio2/*: Don’t use rb_undef_alloc_func. We would like to remove
51
- .new from these classes, but I don’t know of a way of doing so. Using
52
- rb_undef_alloc_func is incorrect, as it will make subclasses
53
- unallocatable.
54
- * ext/gio2/*: Fix some TODOs.
55
-
56
- 2010-11-12 Nikolai Weibull
57
-
58
- * *: Fix two compilation issues introduced in yesterdays bugfixing.
59
- * *: Update various other small things.
60
-
61
- 2010-11-11 Nikolai Weibull
62
-
63
- * *: Fix various minor bugs.
64
-
65
- 2010-10-23 Kouhei Sutou <kou@clear-code.com>
66
-
67
- * Rakefile: remove needless cairo dependency.
68
- Reported by OBATA Akio. Thanks!!!
69
-
70
- 2010-10-23 Kouhei Sutou <kou@cozmixng.org>
71
-
72
- * README: Ruby/GIO -> Ruby/GIO2.
73
-
74
- * ext/gio2/giomodule.c: remove needless g_io_module_load() and
75
- g_io_module_unload() bindings.
76
-
77
- 2010-10-08 Guillaume Cottenceau
78
-
79
- * RVAL2CSTR2 is deprecated, replace with RVAL2CSTR_ACCEPT_NIL
80
-
81
- * CSTR2RVAL2 is deprecated, replace with CSTR2RVAL_FREE
82
-
83
- 2010-10-27 Nikolai Weibull
84
-
85
- * ext/gio2/util.c (rbgio_define_domain_error): Add the Hash instance
86
- variable that we need for rbgio_raise_error.
87
-
88
- * ext/gio2/gfile.c: Do not undefine that which does not exist (File is
89
- a module, not a class, so it doesn’t have an alloc function).
90
-
91
- * lib/gio2.rb: Fix class/module “typos”.
92
-
93
- 2010-09-26 Kouhei Sutou <kou@cozmixng.org>
94
-
95
- * ext/gio2/util.c (rbgio_raise_error): don't us dynamic string
96
- as format string for security reason.
97
-
98
- * ext/gio2/depend (install): fix a typo in .pc name.
99
- [#3075619] Cann't install gio
100
- Reported by O01eg. Thanks!!!
101
-
102
- 2010-09-23 Kouhei Sutou <kou@cozmixng.org>
103
-
104
- * lib/gio2.rb: support bundled Windows DLL.
105
-
106
- * ./: make buildable.
107
-
108
- * src/: -> ext/gio2/.
109
-
110
- * src/lib/: -> lib/.
111
-
112
- * extconf.rb: support Ruby/GLib2 directory structure change.
113
-
114
- 2010-07-23 Nikolai Weibull
115
-
116
- * src/: Use GOBJ2RVAL_UNREF where appropriate.
117
-
118
- 2010-07-12 Nikolai Weibull
119
-
120
- * src/: Update to GIO 2.24.1.
121
-
122
- 2010-06-16 Nikolai Weibull
123
-
124
- * src/: Remove macro use.
125
-
126
- 2009-09-23 Kouhei Sutou <kou@cozmixng.org>
127
-
128
- * src/: add copyright header.
129
-
@@ -1,79 +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) RVAL2GAPPLAUNCHCONTEXT(value)
24
-
25
- static VALUE
26
- applaunchcontext_initialize(VALUE self)
27
- {
28
- G_INITIALIZE(self, g_app_launch_context_new());
29
-
30
- return Qnil;
31
- }
32
-
33
- typedef char *(*GetMethod)(GAppLaunchContext *, GAppInfo *, GList *);
34
-
35
- static VALUE
36
- get_value_by(GetMethod method, int argc, VALUE *argv, VALUE self)
37
- {
38
- VALUE info, rbfiles;
39
- GList *files;
40
- char *value;
41
-
42
- rb_scan_args(argc, argv, "11", &info, &rbfiles);
43
- files = GFILEARY2GLIST_ACCEPT_NIL(rbfiles);
44
- value = method(_SELF(self), RVAL2GAPPINFO(info), files);
45
- g_list_free(files);
46
-
47
- return CSTR2RVAL_FREE(value);
48
- }
49
-
50
- static VALUE
51
- applaunchcontext_get_display(int argc, VALUE *argv, VALUE self)
52
- {
53
- return get_value_by(g_app_launch_context_get_display, argc, argv, self);
54
- }
55
-
56
- static VALUE
57
- applaunchcontext_get_startup_notify_id(int argc, VALUE *argv, VALUE self)
58
- {
59
- return get_value_by(g_app_launch_context_get_startup_notify_id, argc, argv, self);
60
- }
61
-
62
- static VALUE
63
- applaunchcontext_launch_failed(VALUE self, VALUE sn_id)
64
- {
65
- g_app_launch_context_launch_failed(_SELF(self), RVAL2CSTR(sn_id));
66
-
67
- return self;
68
- }
69
-
70
- void
71
- Init_gapplaunchcontext(VALUE glib)
72
- {
73
- VALUE applaunchcontext = G_DEF_CLASS(G_TYPE_APP_LAUNCH_CONTEXT, "AppLaunchContext", glib);
74
-
75
- rb_define_method(applaunchcontext, "initialize", applaunchcontext_initialize, 0);
76
- rb_define_method(applaunchcontext, "get_display", applaunchcontext_get_display, -1);
77
- rb_define_method(applaunchcontext, "get_startup_notify_id", applaunchcontext_get_startup_notify_id, -1);
78
- rb_define_method(applaunchcontext, "launch_failed", applaunchcontext_launch_failed, 1);
79
- }
@@ -1,39 +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) RVAL2GASYNCRESULT(value)
24
-
25
- /* NOTE: g_async_result_get_user_data isn’t of any use from Ruby. */
26
-
27
- static VALUE
28
- asyncresult_get_source_object(VALUE self)
29
- {
30
- return GOBJ2RVAL_UNREF(g_async_result_get_source_object(_SELF(self)));
31
- }
32
-
33
- void
34
- Init_gasyncresult(VALUE glib)
35
- {
36
- VALUE asyncresult = G_DEF_INTERFACE(G_TYPE_ASYNC_RESULT, "AsyncResult", glib);
37
-
38
- rb_define_method(asyncresult, "source_object", asyncresult_get_source_object, 0);
39
- }
@@ -1,48 +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_BUFFERED_OUTPUT_STREAM(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- bufferedoutputstream_initialize(int argc, VALUE *argv, VALUE self)
27
- {
28
- VALUE rbbase_stream, size;
29
- GOutputStream *base_stream, *stream;
30
-
31
- rb_scan_args(argc, argv, "11", &rbbase_stream, &size);
32
- base_stream = RVAL2GOUTPUTSTREAM(rbbase_stream);
33
-
34
- stream = NIL_P(size) ?
35
- g_buffered_output_stream_new(base_stream) :
36
- g_buffered_output_stream_new_sized(base_stream, RVAL2GSIZE(size));
37
- G_INITIALIZE(self, stream);
38
-
39
- return Qnil;
40
- }
41
-
42
- void
43
- Init_gbufferedoutputstream(VALUE glib)
44
- {
45
- VALUE bufferedoutputstream = G_DEF_CLASS(G_TYPE_BUFFERED_OUTPUT_STREAM, "BufferedOutputStream", glib);
46
-
47
- rb_define_method(bufferedoutputstream, "initialize", bufferedoutputstream_initialize, -1);
48
- }
@@ -1,177 +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) RVAL2GCANCELLABLE(value)
24
-
25
- static VALUE
26
- cancellable_initialize(VALUE self)
27
- {
28
- G_INITIALIZE(self, g_cancellable_new());
29
-
30
- return Qnil;
31
- }
32
-
33
- static VALUE
34
- cancellable_is_cancelled(VALUE self)
35
- {
36
- return CBOOL2RVAL(g_cancellable_is_cancelled(_SELF(self)));
37
- }
38
-
39
- static VALUE
40
- cancellable_raise_error_if_cancelled(VALUE self)
41
- {
42
- GError *error = NULL;
43
-
44
- if (g_cancellable_set_error_if_cancelled(_SELF(self), &error))
45
- rbgio_raise_error(error);
46
-
47
- return self;
48
- }
49
-
50
- static VALUE
51
- cancellable_get_fd(VALUE self)
52
- {
53
- return FD2RVAL(g_cancellable_get_fd(_SELF(self)));
54
- }
55
-
56
- static VALUE
57
- cancellable_make_pollfd(VALUE self)
58
- {
59
- GPollFD *gfd = g_new(GPollFD, 1);
60
-
61
- g_cancellable_make_pollfd(_SELF(self), gfd);
62
-
63
- return BOXED2RVAL(gfd, G_TYPE_POLL_FD);
64
- }
65
-
66
- G_GNUC_NORETURN static VALUE
67
- cancellable_release_fd(VALUE self)
68
- {
69
- /* TODO: How do we implement this? Maybe not at all? */
70
- self = self;
71
- rb_raise(rb_eNotImpError, "release_fd has not been implemented yet");
72
- #if 0
73
- g_cancellable_release_fd(_SELF(self));
74
-
75
- return self;
76
- #endif
77
- }
78
-
79
- static VALUE
80
- cancellable_get_current(G_GNUC_UNUSED VALUE self)
81
- {
82
- return GOBJ2RVAL(g_cancellable_get_current());
83
- }
84
-
85
- static VALUE
86
- cancellable_pop_current(VALUE self)
87
- {
88
- g_cancellable_pop_current(_SELF(self));
89
-
90
- return self;
91
- }
92
-
93
- static VALUE
94
- cancellable_push_current(VALUE self)
95
- {
96
- g_cancellable_push_current(_SELF(self));
97
-
98
- return self;
99
- }
100
-
101
- static VALUE
102
- cancellable_reset(VALUE self)
103
- {
104
- g_cancellable_reset(_SELF(self));
105
-
106
- return self;
107
- }
108
-
109
- static VALUE
110
- cancellable_connect_callback_call(VALUE block)
111
- {
112
- static ID s_id_call;
113
-
114
- if (s_id_call == 0)
115
- s_id_call = rb_intern("call");
116
-
117
- rb_funcall(block, s_id_call, 0);
118
-
119
- return Qnil;
120
- }
121
-
122
- static void
123
- cancellable_connect_callback(gpointer block)
124
- {
125
- G_PROTECT_CALLBACK(cancellable_connect_callback_call, block);
126
- }
127
-
128
- static VALUE
129
- cancellable_connect(VALUE self)
130
- {
131
- VALUE block;
132
-
133
- block = rb_block_proc();
134
- G_RELATIVE(self, block);
135
-
136
- return GULONG2RVAL(g_cancellable_connect(_SELF(self),
137
- G_CALLBACK(cancellable_connect_callback),
138
- (gpointer)block,
139
- NULL));
140
- }
141
-
142
- static VALUE
143
- cancellable_disconnect(VALUE self, VALUE handler_id)
144
- {
145
- g_cancellable_disconnect(_SELF(self), RVAL2GULONG(handler_id));
146
-
147
- return self;
148
- }
149
-
150
- static VALUE
151
- cancellable_cancel(VALUE self)
152
- {
153
- g_cancellable_cancel(_SELF(self));
154
-
155
- return self;
156
- }
157
-
158
- void
159
- Init_gcancellable(VALUE glib)
160
- {
161
- VALUE cancellable = G_DEF_CLASS(G_TYPE_CANCELLABLE, "Cancellable", glib);
162
-
163
- rb_define_singleton_method(cancellable, "current", cancellable_get_current, 0);
164
-
165
- rb_define_method(cancellable, "initialize", cancellable_initialize, 0);
166
- rb_define_method(cancellable, "cancelled?", cancellable_is_cancelled, 0);
167
- rb_define_method(cancellable, "raise_error_if_cancelled", cancellable_raise_error_if_cancelled, 0);
168
- rb_define_method(cancellable, "fd", cancellable_get_fd, 0);
169
- rb_define_method(cancellable, "make_pollfd", cancellable_make_pollfd, 0);
170
- rb_define_method(cancellable, "release_fd", cancellable_release_fd, 0);
171
- rb_define_method(cancellable, "pop_current", cancellable_pop_current, 0);
172
- rb_define_method(cancellable, "push_current", cancellable_push_current, 0);
173
- rb_define_method(cancellable, "reset", cancellable_reset, 0);
174
- rb_define_method(cancellable, "connect", cancellable_connect, 0);
175
- rb_define_method(cancellable, "disconnect", cancellable_disconnect, 1);
176
- rb_define_method(cancellable, "cancel", cancellable_cancel, 0);
177
- }
@@ -1,55 +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_CHARSET_CONVERTER(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- charsetconverter_initialize(VALUE self, VALUE to, VALUE from)
27
- {
28
- GError *error = NULL;
29
- GCharsetConverter *converter;
30
-
31
- converter = g_charset_converter_new(RVAL2CSTR(to),
32
- RVAL2CSTR(from),
33
- &error);
34
- if (converter == NULL)
35
- rbgio_raise_error(error);
36
-
37
- G_INITIALIZE(self, converter);
38
-
39
- return Qnil;
40
- }
41
-
42
- static VALUE
43
- charsetconverter_get_num_fallbacks(VALUE self)
44
- {
45
- return GUINT2RVAL(g_charset_converter_get_num_fallbacks(_SELF(self)));
46
- }
47
-
48
- void
49
- Init_gcharsetconverter(VALUE glib)
50
- {
51
- VALUE charsetconverter = G_DEF_CLASS(G_TYPE_CHARSET_CONVERTER, "CharsetConverter", glib);
52
-
53
- rb_define_method(charsetconverter, "initialize", charsetconverter_initialize, 2);
54
- rb_define_method(charsetconverter, "num_fallbacks", charsetconverter_get_num_fallbacks, 0);
55
- }
@@ -1,128 +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
- contenttype_equals(G_GNUC_UNUSED VALUE self, VALUE arg1, VALUE arg2)
25
- {
26
- return CBOOL2RVAL(g_content_type_equals(RVAL2CSTR(arg1), RVAL2CSTR(arg2)));
27
- }
28
-
29
- static VALUE
30
- contenttype_is_a(G_GNUC_UNUSED VALUE self, VALUE arg1, VALUE arg2)
31
- {
32
- return CBOOL2RVAL(g_content_type_is_a(RVAL2CSTR(arg1), RVAL2CSTR(arg2)));
33
- }
34
-
35
- static VALUE
36
- contenttype_is_unknown(G_GNUC_UNUSED VALUE type)
37
- {
38
- return CBOOL2RVAL(g_content_type_is_unknown(RVAL2CSTR(type)));
39
- }
40
-
41
- static VALUE
42
- contenttype_get_description(G_GNUC_UNUSED VALUE type)
43
- {
44
- return CSTR2RVAL_FREE(g_content_type_get_description(RVAL2CSTR(type)));
45
- }
46
-
47
- static VALUE
48
- contenttype_get_mime_type(G_GNUC_UNUSED VALUE type)
49
- {
50
- return CSTR2RVAL_FREE(g_content_type_get_mime_type(RVAL2CSTR(type)));
51
- }
52
-
53
- static VALUE
54
- contenttype_get_icon(G_GNUC_UNUSED VALUE type)
55
- {
56
- return GOBJ2RVAL_UNREF(g_content_type_get_icon(RVAL2CSTR(type)));
57
- }
58
-
59
- static VALUE
60
- contenttype_can_be_executable(G_GNUC_UNUSED VALUE type)
61
- {
62
- return CBOOL2RVAL(g_content_type_can_be_executable(RVAL2CSTR(type)));
63
- }
64
-
65
- static VALUE
66
- contenttype_from_mime_type(G_GNUC_UNUSED VALUE type)
67
- {
68
- return CSTR2RVAL(g_content_type_from_mime_type(RVAL2CSTR(type)));
69
- }
70
-
71
- static VALUE
72
- contenttype_guess(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
73
- {
74
- VALUE rbfilename,
75
- rbdata;
76
- const char *filename;
77
- const guchar *data;
78
- gboolean result_uncertain;
79
- char *type;
80
-
81
- rb_scan_args(argc, argv, "02", &rbfilename, &rbdata);
82
-
83
- if (NIL_P(rbfilename) && NIL_P(rbdata))
84
- rb_raise(rb_eArgError,
85
- "Either filename or data can be nil but not both");
86
-
87
- filename = RVAL2CSTR_ACCEPT_NIL(rbfilename);
88
- data = (guchar *)RVAL2CSTR_ACCEPT_NIL(rbdata);
89
-
90
- type = g_content_type_guess(filename,
91
- data,
92
- (gsize)((data != NULL) ? RSTRING_LEN(rbdata) : 0),
93
- &result_uncertain);
94
-
95
- return rb_assoc_new(CSTR2RVAL_FREE(type), CBOOL2RVAL(result_uncertain));
96
- }
97
-
98
- static VALUE
99
- contenttype_guess_for_tree(G_GNUC_UNUSED VALUE self, VALUE root)
100
- {
101
- return STRVECTOR2ARY_FREE(g_content_type_guess_for_tree(RVAL2GFILE(root)));
102
- }
103
-
104
- static VALUE
105
- contenttype_get_registered(G_GNUC_UNUSED VALUE self)
106
- {
107
- return GLIST2ARY_STR_FREE(g_content_types_get_registered());
108
- }
109
-
110
- void
111
- Init_gcontenttype(VALUE glib)
112
- {
113
- VALUE contenttype = rb_define_module_under(glib, "ContentType");
114
-
115
- /* TODO: Should wrap this in a class. */
116
- rb_define_module_function(contenttype, "equals?", contenttype_equals, 2);
117
- /* TODO: This name isn’t great. */
118
- rb_define_module_function(contenttype, "is_a?", contenttype_is_a, 2);
119
- rb_define_module_function(contenttype, "unknown?", contenttype_is_unknown, 1);
120
- rb_define_module_function(contenttype, "get_description", contenttype_get_description, 1);
121
- rb_define_module_function(contenttype, "get_mime_type", contenttype_get_mime_type, 1);
122
- rb_define_module_function(contenttype, "get_icon", contenttype_get_icon, 1);
123
- rb_define_module_function(contenttype, "can_be_executable?", contenttype_can_be_executable, 1);
124
- rb_define_module_function(contenttype, "from_mime_type", contenttype_from_mime_type, 1);
125
- rb_define_module_function(contenttype, "guess", contenttype_guess, -1);
126
- rb_define_module_function(contenttype, "guess_for_tree", contenttype_guess_for_tree, 1);
127
- rb_define_module_function(contenttype, "registered", contenttype_get_registered, 0);
128
- }
@@ -1,41 +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_CONVERTER_INPUT_STREAM(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- converterinputstream_initialize(VALUE self, VALUE base_stream, VALUE converter)
27
- {
28
- G_INITIALIZE(self,
29
- g_converter_input_stream_new(RVAL2GINPUTSTREAM(base_stream),
30
- RVAL2GCONVERTER(converter)));
31
-
32
- return Qnil;
33
- }
34
-
35
- void
36
- Init_gconverterinputstream(VALUE glib)
37
- {
38
- VALUE converterinputstream = G_DEF_CLASS(G_TYPE_CONVERTER_INPUT_STREAM, "ConverterInputStream", glib);
39
-
40
- rb_define_method(converterinputstream, "initialize", converterinputstream_initialize, 2);
41
- }