gio2 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/ext/gio2/extconf.rb +4 -42
  2. data/ext/gio2/gio2.c +18 -117
  3. data/ext/gio2/gio2.h +20 -339
  4. data/ext/gio2/rbgio.c +132 -0
  5. data/ext/gio2/rbgio2.h +156 -0
  6. data/ext/gio2/rbgio2conversions.h +154 -0
  7. data/ext/gio2/rbgio2private.h +147 -0
  8. data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
  9. data/ext/gio2/rbgioapplaunchcontext.c +81 -0
  10. data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
  11. data/ext/gio2/rbgioasyncresult.c +41 -0
  12. data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
  13. data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
  14. data/ext/gio2/rbgiocancellable.c +180 -0
  15. data/ext/gio2/rbgiocharsetconverter.c +57 -0
  16. data/ext/gio2/rbgiocontenttype.c +131 -0
  17. data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
  18. data/ext/gio2/rbgioconverterinputstream.c +43 -0
  19. data/ext/gio2/rbgioconverteroutputstream.c +43 -0
  20. data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
  21. data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
  22. data/ext/gio2/rbgiodesktopappinfo.c +87 -0
  23. data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
  24. data/ext/gio2/rbgioemblem.c +52 -0
  25. data/ext/gio2/rbgioemblemedicon.c +65 -0
  26. data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
  27. data/ext/gio2/rbgiofileattribute.c +114 -0
  28. data/ext/gio2/rbgiofileattributeinfo.c +86 -0
  29. data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
  30. data/ext/gio2/rbgiofileattributematcher.c +93 -0
  31. data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
  32. data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
  33. data/ext/gio2/rbgiofileicon.c +41 -0
  34. data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
  35. data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
  36. data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
  37. data/ext/gio2/rbgiofilemonitor.c +46 -0
  38. data/ext/gio2/rbgiofilenamecompleter.c +74 -0
  39. data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
  40. data/ext/gio2/rbgiofilterinputstream.c +28 -0
  41. data/ext/gio2/rbgiofilteroutputstream.c +28 -0
  42. data/ext/gio2/rbgioicon.c +69 -0
  43. data/ext/gio2/rbgioinetaddress.c +118 -0
  44. data/ext/gio2/rbgioinetsocketaddress.c +41 -0
  45. data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
  46. data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
  47. data/ext/gio2/rbgioio.c +73 -0
  48. data/ext/gio2/rbgioiomodule.c +45 -0
  49. data/ext/gio2/rbgioiomodules.c +47 -0
  50. data/ext/gio2/rbgioioscheduler.c +102 -0
  51. data/ext/gio2/rbgioioschedulerjob.c +121 -0
  52. data/ext/gio2/rbgioiostream.c +108 -0
  53. data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
  54. data/ext/gio2/rbgiomemoryinputstream.c +67 -0
  55. data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
  56. data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
  57. data/ext/gio2/rbgiomountoperation.c +53 -0
  58. data/ext/gio2/rbgionetworkaddress.c +59 -0
  59. data/ext/gio2/rbgionetworkservice.c +45 -0
  60. data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
  61. data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
  62. data/ext/gio2/rbgioseekable.c +91 -0
  63. data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
  64. data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
  65. data/ext/gio2/rbgiosocketaddress.c +34 -0
  66. data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
  67. data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
  68. data/ext/gio2/rbgiosocketconnectable.c +41 -0
  69. data/ext/gio2/rbgiosocketconnection.c +66 -0
  70. data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
  71. data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
  72. data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
  73. data/ext/gio2/rbgiosocketservice.c +66 -0
  74. data/ext/gio2/rbgiosrvtarget.c +76 -0
  75. data/ext/gio2/rbgiotcpconnection.c +28 -0
  76. data/ext/gio2/rbgiothemedicon.c +83 -0
  77. data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
  78. data/ext/gio2/rbgiounixconnection.c +71 -0
  79. data/ext/gio2/rbgiounixfdlist.c +115 -0
  80. data/ext/gio2/rbgiounixfdmessage.c +74 -0
  81. data/ext/gio2/rbgiounixinputstream.c +51 -0
  82. data/ext/gio2/rbgiounixmount.c +164 -0
  83. data/ext/gio2/rbgiounixmountmonitor.c +66 -0
  84. data/ext/gio2/rbgiounixmountpoint.c +136 -0
  85. data/ext/gio2/rbgiounixmountpoints.c +58 -0
  86. data/ext/gio2/rbgiounixmounts.c +58 -0
  87. data/ext/gio2/rbgiounixoutputstream.c +51 -0
  88. data/ext/gio2/rbgiounixsocketaddress.c +69 -0
  89. data/ext/gio2/rbgiovfs.c +84 -0
  90. data/ext/gio2/rbgiovolume.c +193 -0
  91. data/ext/gio2/rbgiovolumemonitor.c +77 -0
  92. data/ext/gio2/rbgiozlibcompressor.c +52 -0
  93. data/ext/gio2/rbgiozlibdecompressor.c +45 -0
  94. data/ext/gio2/util.c +57 -60
  95. data/lib/gio2/deprecated.rb +102 -0
  96. data/lib/gio2.rb +14 -12
  97. metadata +100 -88
  98. data/ChangeLog +0 -129
  99. data/ext/gio2/gapplaunchcontext.c +0 -79
  100. data/ext/gio2/gasyncresult.c +0 -39
  101. data/ext/gio2/gbufferedoutputstream.c +0 -48
  102. data/ext/gio2/gcancellable.c +0 -177
  103. data/ext/gio2/gcharsetconverter.c +0 -55
  104. data/ext/gio2/gcontenttype.c +0 -128
  105. data/ext/gio2/gconverterinputstream.c +0 -41
  106. data/ext/gio2/gconverteroutputstream.c +0 -41
  107. data/ext/gio2/gdesktopappinfo.c +0 -88
  108. data/ext/gio2/gemblem.c +0 -52
  109. data/ext/gio2/gemblemedicon.c +0 -63
  110. data/ext/gio2/gfileattribute.c +0 -111
  111. data/ext/gio2/gfileattributeinfo.c +0 -89
  112. data/ext/gio2/gfileattributeinfolist.c +0 -109
  113. data/ext/gio2/gfileattributematcher.c +0 -90
  114. data/ext/gio2/gfiledescriptorbased.c +0 -42
  115. data/ext/gio2/gfileicon.c +0 -39
  116. data/ext/gio2/gfilemonitor.c +0 -44
  117. data/ext/gio2/gfilenamecompleter.c +0 -72
  118. data/ext/gio2/gfilterinputstream.c +0 -27
  119. data/ext/gio2/gfilteroutputstream.c +0 -27
  120. data/ext/gio2/gicon.c +0 -67
  121. data/ext/gio2/ginetaddress.c +0 -116
  122. data/ext/gio2/ginetsocketaddress.c +0 -38
  123. data/ext/gio2/gioerror.c +0 -70
  124. data/ext/gio2/giomodule.c +0 -63
  125. data/ext/gio2/gioscheduler.c +0 -193
  126. data/ext/gio2/giostream.c +0 -106
  127. data/ext/gio2/gmemoryinputstream.c +0 -65
  128. data/ext/gio2/gmemoryoutputstream.c +0 -41
  129. data/ext/gio2/gmountoperation.c +0 -66
  130. data/ext/gio2/gnetworkaddress.c +0 -57
  131. data/ext/gio2/gnetworkservice.c +0 -43
  132. data/ext/gio2/gseekable.c +0 -89
  133. data/ext/gio2/gsimpleasyncresult.c +0 -153
  134. data/ext/gio2/gsocketaddress.c +0 -33
  135. data/ext/gio2/gsocketconnectable.c +0 -97
  136. data/ext/gio2/gsocketconnection.c +0 -75
  137. data/ext/gio2/gsocketcontrolmessage.c +0 -80
  138. data/ext/gio2/gsocketservice.c +0 -64
  139. data/ext/gio2/gsrvtarget.c +0 -77
  140. data/ext/gio2/gtcpconnection.c +0 -27
  141. data/ext/gio2/gthemedicon.c +0 -81
  142. data/ext/gio2/gthreadedsocketservice.c +0 -40
  143. data/ext/gio2/gunixconnection.c +0 -69
  144. data/ext/gio2/gunixfdlist.c +0 -112
  145. data/ext/gio2/gunixfdmessage.c +0 -72
  146. data/ext/gio2/gunixinputstream.c +0 -49
  147. data/ext/gio2/gunixmounts.c +0 -343
  148. data/ext/gio2/gunixoutputstream.c +0 -49
  149. data/ext/gio2/gunixsocketaddress.c +0 -67
  150. data/ext/gio2/gvfs.c +0 -82
  151. data/ext/gio2/gvolume.c +0 -191
  152. data/ext/gio2/gvolumemonitor.c +0 -75
  153. data/ext/gio2/gzlibcompressor.c +0 -50
  154. data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,42 +0,0 @@
1
- /*
2
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
3
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License.
9
- *
10
- * This library is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
- */
19
-
20
- #include "gio2.h"
21
-
22
- #ifdef HAVE_GIO_UNIX
23
- #include <gio/gfiledescriptorbased.h>
24
-
25
- #define _SELF(value) G_FILE_DESCRIPTOR_BASED(RVAL2GOBJ(value))
26
-
27
- static VALUE
28
- filedescriptorbased_get_fd(VALUE self)
29
- {
30
- return FD2RVAL(g_file_descriptor_based_get_fd(_SELF(self)));
31
- }
32
- #endif
33
-
34
- void
35
- Init_gfiledescriptorbased(G_GNUC_UNUSED VALUE glib)
36
- {
37
- #ifdef HAVE_GIO_UNIX
38
- VALUE filedescriptorbased = G_DEF_INTERFACE(G_TYPE_FILE_DESCRIPTOR_BASED, "FileDescriptorBased", glib);
39
-
40
- rb_define_method(filedescriptorbased, "fd", filedescriptorbased_get_fd, 0);
41
- #endif
42
- }
data/ext/gio2/gfileicon.c DELETED
@@ -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) G_FILE_ICON(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- fileicon_initialize(VALUE self, VALUE file)
27
- {
28
- G_INITIALIZE(self, g_file_icon_new(RVAL2GFILE(file)));
29
-
30
- return Qnil;
31
- }
32
-
33
- void
34
- Init_gfileicon(VALUE glib)
35
- {
36
- VALUE fileicon = G_DEF_CLASS(G_TYPE_FILE_ICON, "FileIcon", glib);
37
-
38
- rb_define_method(fileicon, "initialize", fileicon_initialize, 1);
39
- }
@@ -1,44 +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_FILE_MONITOR(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- filemonitor_cancel(VALUE self)
27
- {
28
- return CBOOL2RVAL(g_file_monitor_cancel(_SELF(self)));
29
- }
30
-
31
- void
32
- Init_gfilemonitor(VALUE glib)
33
- {
34
- VALUE filemonitor = G_DEF_CLASS(G_TYPE_FILE_MONITOR, "FileMonitor", glib);
35
-
36
- G_DEF_CLASS(G_TYPE_FILE_MONITOR_EVENT, "Event", filemonitor);
37
- G_DEF_CONSTANTS(filemonitor, G_TYPE_FILE_MONITOR_EVENT, "G_FILE_MONITOR_");
38
-
39
- G_DEF_CLASS(G_TYPE_FILE_MONITOR_FLAGS, "Flags", filemonitor);
40
- G_DEF_CONSTANTS(filemonitor, G_TYPE_FILE_MONITOR_FLAGS, "G_FILE_MONITOR_");
41
-
42
- rb_define_method(filemonitor, "cancel", filemonitor_cancel, 0);
43
- /* TODO: Do we need #emit_event? */
44
- }
@@ -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
- #define _SELF(value) G_FILENAME_COMPLETER(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- filenamecompleter_initialize(int argc, VALUE *argv, VALUE self)
27
- {
28
- VALUE dirs_only;
29
- GFilenameCompleter *completer;
30
-
31
- rb_scan_args(argc, argv, "01", &dirs_only);
32
- completer = g_filename_completer_new();
33
- g_filename_completer_set_dirs_only(completer, RVAL2CBOOL(dirs_only));
34
-
35
- G_INITIALIZE(self, completer);
36
-
37
- return Qnil;
38
- }
39
-
40
- static VALUE
41
- filenamecompleter_get_completion_suffix(VALUE self, VALUE initial_text)
42
- {
43
- return CSTR2RVAL_FREE(g_filename_completer_get_completion_suffix(_SELF(self),
44
- RVAL2CSTR(initial_text)));
45
- }
46
-
47
- static VALUE
48
- filenamecompleter_get_completions(VALUE self, VALUE initial_text)
49
- {
50
- return STRVECTOR2ARY_FREE(g_filename_completer_get_completions(_SELF(self),
51
- RVAL2CSTR(initial_text)));
52
- }
53
-
54
- static VALUE
55
- filenamecompleter_set_dirs_only(VALUE self, VALUE dirs_only)
56
- {
57
- g_filename_completer_set_dirs_only(_SELF(self), RVAL2CBOOL(dirs_only));
58
-
59
- return self;
60
- }
61
-
62
- void
63
- Init_gfilenamecompleter(VALUE glib)
64
- {
65
- VALUE filenamecompleter = G_DEF_CLASS(G_TYPE_FILENAME_COMPLETER, "FilenameCompleter", glib);
66
-
67
- rb_define_method(filenamecompleter, "initialize", filenamecompleter_initialize, -1);
68
- rb_define_method(filenamecompleter, "get_completion_suffix", filenamecompleter_get_completion_suffix, 1);
69
- rb_define_method(filenamecompleter, "get_completions", filenamecompleter_get_completions, 1);
70
- rb_define_method(filenamecompleter, "set_dirs_only", filenamecompleter_set_dirs_only, 1);
71
- G_DEF_SETTER(filenamecompleter, "dirs_only");
72
- }
@@ -1,27 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- void
24
- Init_gfilterinputstream(VALUE glib)
25
- {
26
- (void)G_DEF_CLASS(G_TYPE_FILTER_INPUT_STREAM, "FilterInputStream", glib);
27
- }
@@ -1,27 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- #include "gio2.h"
22
-
23
- void
24
- Init_gfilteroutputstream(VALUE glib)
25
- {
26
- (void)G_DEF_CLASS(G_TYPE_FILTER_OUTPUT_STREAM, "FilterOutputStream", glib);
27
- }
data/ext/gio2/gicon.c DELETED
@@ -1,67 +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) RVAL2GICON(value)
24
-
25
- static VALUE
26
- icon_new_for_string(G_GNUC_UNUSED VALUE self, VALUE string)
27
- {
28
- GError *error = NULL;
29
- GIcon *icon;
30
-
31
- icon = g_icon_new_for_string(RVAL2CSTR(string), &error);
32
- if (icon == NULL)
33
- rbgio_raise_error(error);
34
-
35
- return GOBJ2RVAL_UNREF(icon);
36
- }
37
-
38
- static VALUE
39
- icon_hash(VALUE self)
40
- {
41
- return GUINT2RVAL(g_icon_hash(_SELF(self)));
42
- }
43
-
44
- static VALUE
45
- icon_equal(VALUE self, VALUE other)
46
- {
47
- return CBOOL2RVAL(g_icon_equal(_SELF(self), _SELF(other)));
48
- }
49
-
50
- static VALUE
51
- icon_to_string(VALUE self)
52
- {
53
- return CSTR2RVAL_FREE(g_icon_to_string(_SELF(self)));
54
- }
55
-
56
- void
57
- Init_gicon(VALUE glib)
58
- {
59
- VALUE icon = G_DEF_INTERFACE(G_TYPE_ICON, "Icon", glib);
60
-
61
- rb_define_singleton_method(icon, "new_for_string", icon_new_for_string, 1);
62
-
63
- rb_define_method(icon, "hash", icon_hash, 0);
64
- rb_define_method(icon, "==", icon_equal, 1);
65
- rb_define_method(icon, "to_string", icon_to_string, 0);
66
- rb_define_alias(icon, "to_s", "to_string");
67
- }
@@ -1,116 +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) RVAL2GINETADDRESS(value)
24
-
25
- static VALUE
26
- inetaddress_new_from_string(G_GNUC_UNUSED VALUE self, VALUE string)
27
- {
28
- return GOBJ2RVAL_UNREF(g_inet_address_new_from_string(RVAL2CSTR(string)));
29
- }
30
-
31
- /* TODO: Should this take an array instead? */
32
- static VALUE
33
- inetaddress_new_from_bytes(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
34
- {
35
- VALUE rbbytes, rbfamily;
36
- guint8 *bytes;
37
- GSocketFamily family;
38
-
39
- rb_scan_args(argc, argv, "11", &rbbytes, &rbfamily);
40
- bytes = (guint8 *)RVAL2CSTR(rbbytes);
41
- family = RVAL2GSOCKETFAMILY(rbfamily);
42
-
43
- /* TODO: Should check encoding. */
44
- /* TODO: We can’t pass bytes as such, as it will be NULL-terminated. */
45
- /* TODO: Do we need to deal with G_SOCKET_FAMILY_UNIX? */
46
- switch (family) {
47
- case G_SOCKET_FAMILY_IPV4:
48
- if (RSTRING_LEN(rbbytes) != 4)
49
- rb_raise(rb_eArgError, "string containing 4 bytes expected");
50
- break;
51
- case G_SOCKET_FAMILY_IPV6:
52
- if (RSTRING_LEN(rbbytes) != 16)
53
- rb_raise(rb_eArgError, "string containing 16 bytes expected");
54
- break;
55
- case G_SOCKET_FAMILY_INVALID:
56
- case G_SOCKET_FAMILY_UNIX:
57
- rb_raise(rb_eArgError, "invalid family: %d", family);
58
- default:
59
- rb_raise(rb_eArgError, "unknown family: %d", family);
60
- break;
61
- }
62
-
63
- return GOBJ2RVAL_UNREF(g_inet_address_new_from_bytes(bytes, family));
64
- }
65
-
66
- static VALUE
67
- inetaddress_new_any(G_GNUC_UNUSED VALUE self, VALUE family)
68
- {
69
- return GOBJ2RVAL_UNREF(g_inet_address_new_any(RVAL2GSOCKETFAMILY(family)));
70
- }
71
-
72
- static VALUE
73
- inetaddress_new_loopback(G_GNUC_UNUSED VALUE self, VALUE family)
74
- {
75
- return GOBJ2RVAL_UNREF(g_inet_address_new_loopback(RVAL2GSOCKETFAMILY(family)));
76
- }
77
-
78
- /* TODO: Return array of bytes instead? */
79
- static VALUE
80
- inetaddress_to_bytes(VALUE self)
81
- {
82
- gsize size;
83
-
84
- size = g_inet_address_get_native_size(_SELF(self));
85
- return rb_str_new((const gchar *)g_inet_address_to_bytes(_SELF(self)),
86
- size);
87
- }
88
-
89
- static VALUE
90
- inetaddress_get_native_size(VALUE self)
91
- {
92
- return GSIZE2RVAL(g_inet_address_get_native_size(_SELF(self)));
93
- }
94
-
95
- static VALUE
96
- inetaddress_to_string(VALUE self)
97
- {
98
- return CSTR2RVAL_FREE(g_inet_address_to_string(_SELF(self)));
99
- }
100
-
101
- void
102
- Init_ginetaddress(VALUE glib)
103
- {
104
- VALUE inetaddress = G_DEF_INTERFACE(G_TYPE_INET_ADDRESS, "InetAddress", glib);
105
-
106
- rb_define_singleton_method(inetaddress, "new_from_string", inetaddress_new_from_string, 1);
107
- rb_define_singleton_method(inetaddress, "new_from_bytes", inetaddress_new_from_bytes, -1);
108
- rb_define_singleton_method(inetaddress, "new_any", inetaddress_new_any, 1);
109
- rb_define_singleton_method(inetaddress, "new_loopback", inetaddress_new_loopback, 1);
110
-
111
- rb_define_method(inetaddress, "to_bytes", inetaddress_to_bytes, 0);
112
- rb_define_method(inetaddress, "get_native_size", inetaddress_get_native_size, 0);
113
- rb_define_method(inetaddress, "to_string", inetaddress_to_string, 0);
114
- rb_define_alias(inetaddress, "to_str", "to_string");
115
- rb_define_alias(inetaddress, "to_s", "to_string");
116
- }
@@ -1,38 +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
- inetsocketaddress_initialize(VALUE self, VALUE address, VALUE port)
25
- {
26
- G_INITIALIZE(self, g_inet_socket_address_new(RVAL2GINETADDRESS(address),
27
- RVAL2GUINT16(port)));
28
-
29
- return Qnil;
30
- }
31
-
32
- void
33
- Init_ginetsocketaddress(VALUE glib)
34
- {
35
- VALUE inetsocketaddress = G_DEF_CLASS(G_TYPE_INET_SOCKET_ADDRESS, "InetSocketAddress", glib);
36
-
37
- rb_define_method(inetsocketaddress, "initialize", inetsocketaddress_initialize, 2);
38
- }
data/ext/gio2/gioerror.c DELETED
@@ -1,70 +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
- /* NOTE: g_io_error_from_errno doesn’t make sense from Ruby. */
24
-
25
- void
26
- Init_gioerror(VALUE glib)
27
- {
28
- VALUE io, error;
29
-
30
- io = rb_define_module_under(glib, "IO");
31
-
32
- error = rbgio_define_domain_error(io, "Error", G_IO_ERROR, "GIOErrorEnum", rb_eIOError);
33
-
34
- rbgio_define_error(io, "FailedError", G_IO_ERROR_FAILED, error);
35
- rbgio_define_error(io, "NotFoundError", G_IO_ERROR_NOT_FOUND, error);
36
- rbgio_define_error(io, "ExistsError", G_IO_ERROR_EXISTS, error);
37
- rbgio_define_error(io, "IsDirectoryError", G_IO_ERROR_IS_DIRECTORY, error);
38
- rbgio_define_error(io, "NotDirectoryError", G_IO_ERROR_NOT_DIRECTORY, error);
39
- rbgio_define_error(io, "NotEmptyError", G_IO_ERROR_NOT_EMPTY, error);
40
- rbgio_define_error(io, "NotRegularFileError", G_IO_ERROR_NOT_REGULAR_FILE, error);
41
- rbgio_define_error(io, "NotSymbolicLinkError", G_IO_ERROR_NOT_SYMBOLIC_LINK, error);
42
- rbgio_define_error(io, "NotMountableFileError", G_IO_ERROR_NOT_MOUNTABLE_FILE, error);
43
- rbgio_define_error(io, "FilenameTooLongError", G_IO_ERROR_FILENAME_TOO_LONG, error);
44
- rbgio_define_error(io, "InvalidFilenameError", G_IO_ERROR_INVALID_FILENAME, error);
45
- rbgio_define_error(io, "TooManyLinksError", G_IO_ERROR_TOO_MANY_LINKS, error);
46
- rbgio_define_error(io, "NoSpaceError", G_IO_ERROR_NO_SPACE, error);
47
- rbgio_define_error(io, "InvalidArgumentError", G_IO_ERROR_INVALID_ARGUMENT, error);
48
- rbgio_define_error(io, "PermissionDeniedError", G_IO_ERROR_PERMISSION_DENIED, error);
49
- rbgio_define_error(io, "NotSupportedError", G_IO_ERROR_NOT_SUPPORTED, error);
50
- rbgio_define_error(io, "NotMountedError", G_IO_ERROR_NOT_MOUNTED, error);
51
- rbgio_define_error(io, "AlreadyMountedError", G_IO_ERROR_ALREADY_MOUNTED, error);
52
- rbgio_define_error(io, "ClosedError", G_IO_ERROR_CLOSED, error);
53
- rbgio_define_error(io, "CancelledError", G_IO_ERROR_CANCELLED, error);
54
- rbgio_define_error(io, "PendingError", G_IO_ERROR_PENDING, error);
55
- rbgio_define_error(io, "ReadOnlyError", G_IO_ERROR_READ_ONLY, error);
56
- rbgio_define_error(io, "CantCreateBackupError", G_IO_ERROR_CANT_CREATE_BACKUP, error);
57
- rbgio_define_error(io, "WrongEtagError", G_IO_ERROR_WRONG_ETAG, error);
58
- rbgio_define_error(io, "TimedOutError", G_IO_ERROR_TIMED_OUT, error);
59
- rbgio_define_error(io, "WouldRecurseError", G_IO_ERROR_WOULD_RECURSE, error);
60
- rbgio_define_error(io, "BusyError", G_IO_ERROR_BUSY, error);
61
- rbgio_define_error(io, "WouldBlockError", G_IO_ERROR_WOULD_BLOCK, error);
62
- rbgio_define_error(io, "HostNotFoundError", G_IO_ERROR_HOST_NOT_FOUND, error);
63
- rbgio_define_error(io, "WouldMergeError", G_IO_ERROR_WOULD_MERGE, error);
64
- rbgio_define_error(io, "FailedHandledError", G_IO_ERROR_FAILED_HANDLED, error);
65
- rbgio_define_error(io, "TooManyOpenFilesError", G_IO_ERROR_TOO_MANY_OPEN_FILES, error);
66
- rbgio_define_error(io, "NotInitializedError", G_IO_ERROR_NOT_INITIALIZED, error);
67
- rbgio_define_error(io, "AddressInUseError", G_IO_ERROR_ADDRESS_IN_USE, error);
68
- rbgio_define_error(io, "PartialInputError", G_IO_ERROR_PARTIAL_INPUT, error);
69
- rbgio_define_error(io, "InvalidDataError", G_IO_ERROR_INVALID_DATA, error);
70
- }
data/ext/gio2/giomodule.c DELETED
@@ -1,63 +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_IO_MODULE(RVAL2GOBJ(value))
24
-
25
- static VALUE
26
- iomodule_initialize(VALUE self, VALUE filename)
27
- {
28
- G_INITIALIZE(self, g_io_module_new(RVAL2CSTR(filename)));
29
-
30
- return Qnil;
31
- }
32
-
33
- static VALUE
34
- iomodule_load_all_in_directory(G_GNUC_UNUSED VALUE self, VALUE dirname)
35
- {
36
- return GLIST2ARY_FREE(g_io_modules_load_all_in_directory(RVAL2CSTR(dirname)));
37
- }
38
-
39
- static VALUE
40
- iomodule_scan_all_in_directory(VALUE self, VALUE dirname)
41
- {
42
- g_io_modules_scan_all_in_directory(RVAL2CSTR(dirname));
43
-
44
- return self;
45
- }
46
-
47
- /* NOTE: No point in implementing g_io_module_query. */
48
-
49
- void
50
- Init_giomodule(VALUE glib)
51
- {
52
- VALUE iomodule, iomodules;
53
-
54
- iomodule = G_DEF_CLASS(G_IO_TYPE_MODULE, "IOModule", glib);
55
-
56
- rb_define_method(iomodule, "initialize", iomodule_initialize, 1);
57
-
58
- iomodules = rb_define_module_under(glib, "IOModules");
59
-
60
- rb_define_module_function(iomodules, "load_all_in_directory", iomodule_load_all_in_directory, 1);
61
- rb_define_module_function(iomodules, "scan_all_in_directory", iomodule_scan_all_in_directory, 1);
62
-
63
- }