gio2 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +26 -9
  3. data/ext/gio2/extconf.rb +38 -28
  4. data/ext/gio2/rb-gio2-pollable-source.c +59 -0
  5. data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
  6. data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
  7. data/extconf.rb +22 -6
  8. data/lib/1.9/gio2.so +0 -0
  9. data/lib/2.0/gio2.so +0 -0
  10. data/lib/2.1/gio2.so +0 -0
  11. data/lib/gio2/deprecated.rb +16 -0
  12. data/lib/gio2/inet-address.rb +33 -0
  13. data/lib/gio2/input-stream.rb +39 -0
  14. data/lib/gio2/loader.rb +244 -0
  15. data/lib/gio2/output-stream.rb +24 -0
  16. data/lib/gio2/pollable-input-stream.rb +51 -0
  17. data/lib/gio2/pollable-output-stream.rb +32 -0
  18. data/lib/gio2/resources.rb +62 -0
  19. data/lib/gio2.rb +38 -143
  20. data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
  21. data/test/fixture/resource/Rakefile +32 -0
  22. data/test/fixture/resource/logo.png +0 -0
  23. data/test/fixture/resource/ruby-gio2.gresource +0 -0
  24. data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
  25. data/test/gio2-test-utils/fixture.rb +24 -0
  26. data/test/gio2-test-utils/socket-client.rb +59 -0
  27. data/test/gio2-test-utils.rb +21 -0
  28. data/test/run-test.rb +45 -9
  29. data/test/test-buffered-input-stream.rb +23 -0
  30. data/test/test-charset-converter.rb +23 -0
  31. data/test/test-content-type.rb +31 -0
  32. data/test/test-data-input-stream.rb +21 -0
  33. data/test/test-file-enumerator.rb +26 -0
  34. data/test/test-file-monitor.rb +33 -0
  35. data/test/test-file.rb +28 -0
  36. data/test/test-inet-address.rb +34 -0
  37. data/test/test-input-stream.rb +36 -0
  38. data/test/test-output-stream.rb +39 -0
  39. data/test/test-pollable-input-stream.rb +54 -0
  40. data/test/test-pollable-output-stream.rb +53 -0
  41. data/test/test-resources.rb +58 -0
  42. metadata +49 -107
  43. data/README +0 -34
  44. data/ext/gio2/depend +0 -11
  45. data/ext/gio2/gio2.def +0 -2
  46. data/ext/gio2/gio2.h +0 -30
  47. data/ext/gio2/rbgio.c +0 -133
  48. data/ext/gio2/rbgio2.h +0 -158
  49. data/ext/gio2/rbgio2conversions.h +0 -154
  50. data/ext/gio2/rbgio2private.h +0 -148
  51. data/ext/gio2/rbgioappinfo.c +0 -317
  52. data/ext/gio2/rbgioapplaunchcontext.c +0 -81
  53. data/ext/gio2/rbgioasyncinitable.c +0 -246
  54. data/ext/gio2/rbgioasyncresult.c +0 -41
  55. data/ext/gio2/rbgiobufferedinputstream.c +0 -167
  56. data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
  57. data/ext/gio2/rbgiocancellable.c +0 -180
  58. data/ext/gio2/rbgiocharsetconverter.c +0 -57
  59. data/ext/gio2/rbgiocontenttype.c +0 -131
  60. data/ext/gio2/rbgioconverter.c +0 -113
  61. data/ext/gio2/rbgioconverterinputstream.c +0 -43
  62. data/ext/gio2/rbgioconverteroutputstream.c +0 -43
  63. data/ext/gio2/rbgiodatainputstream.c +0 -309
  64. data/ext/gio2/rbgiodataoutputstream.c +0 -186
  65. data/ext/gio2/rbgiodesktopappinfo.c +0 -87
  66. data/ext/gio2/rbgiodrive.c +0 -266
  67. data/ext/gio2/rbgioemblem.c +0 -52
  68. data/ext/gio2/rbgioemblemedicon.c +0 -65
  69. data/ext/gio2/rbgiofile.c +0 -2045
  70. data/ext/gio2/rbgiofileattribute.c +0 -114
  71. data/ext/gio2/rbgiofileattributeinfo.c +0 -86
  72. data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
  73. data/ext/gio2/rbgiofileattributematcher.c +0 -95
  74. data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
  75. data/ext/gio2/rbgiofileenumerator.c +0 -166
  76. data/ext/gio2/rbgiofileicon.c +0 -41
  77. data/ext/gio2/rbgiofileinfo.c +0 -617
  78. data/ext/gio2/rbgiofileinputstream.c +0 -91
  79. data/ext/gio2/rbgiofileiostream.c +0 -98
  80. data/ext/gio2/rbgiofilemonitor.c +0 -46
  81. data/ext/gio2/rbgiofilenamecompleter.c +0 -73
  82. data/ext/gio2/rbgiofileoutputstream.c +0 -98
  83. data/ext/gio2/rbgiofilterinputstream.c +0 -28
  84. data/ext/gio2/rbgioicon.c +0 -69
  85. data/ext/gio2/rbgioinetaddress.c +0 -118
  86. data/ext/gio2/rbgioinetsocketaddress.c +0 -41
  87. data/ext/gio2/rbgioinitable.c +0 -199
  88. data/ext/gio2/rbgioinputstream.c +0 -341
  89. data/ext/gio2/rbgioio.c +0 -73
  90. data/ext/gio2/rbgioiomodule.c +0 -45
  91. data/ext/gio2/rbgioiomodules.c +0 -47
  92. data/ext/gio2/rbgioioscheduler.c +0 -102
  93. data/ext/gio2/rbgioioschedulerjob.c +0 -121
  94. data/ext/gio2/rbgioiostream.c +0 -107
  95. data/ext/gio2/rbgioloadableicon.c +0 -92
  96. data/ext/gio2/rbgiomemoryinputstream.c +0 -67
  97. data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
  98. data/ext/gio2/rbgiomount.c +0 -286
  99. data/ext/gio2/rbgiomountoperation.c +0 -53
  100. data/ext/gio2/rbgionetworkaddress.c +0 -59
  101. data/ext/gio2/rbgionetworkservice.c +0 -45
  102. data/ext/gio2/rbgiooutputstream.c +0 -331
  103. data/ext/gio2/rbgioresolver.c +0 -230
  104. data/ext/gio2/rbgioseekable.c +0 -91
  105. data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
  106. data/ext/gio2/rbgiosocket.c +0 -390
  107. data/ext/gio2/rbgiosocketaddress.c +0 -34
  108. data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
  109. data/ext/gio2/rbgiosocketclient.c +0 -207
  110. data/ext/gio2/rbgiosocketconnectable.c +0 -41
  111. data/ext/gio2/rbgiosocketconnection.c +0 -66
  112. data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
  113. data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
  114. data/ext/gio2/rbgiosocketlistener.c +0 -246
  115. data/ext/gio2/rbgiosocketservice.c +0 -66
  116. data/ext/gio2/rbgiosrvtarget.c +0 -76
  117. data/ext/gio2/rbgiotcpconnection.c +0 -28
  118. data/ext/gio2/rbgiothemedicon.c +0 -83
  119. data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
  120. data/ext/gio2/rbgiotlscertificate.c +0 -89
  121. data/ext/gio2/rbgiounixconnection.c +0 -71
  122. data/ext/gio2/rbgiounixfdlist.c +0 -115
  123. data/ext/gio2/rbgiounixfdmessage.c +0 -74
  124. data/ext/gio2/rbgiounixinputstream.c +0 -51
  125. data/ext/gio2/rbgiounixmount.c +0 -164
  126. data/ext/gio2/rbgiounixmountmonitor.c +0 -65
  127. data/ext/gio2/rbgiounixmountpoint.c +0 -136
  128. data/ext/gio2/rbgiounixmountpoints.c +0 -58
  129. data/ext/gio2/rbgiounixmounts.c +0 -58
  130. data/ext/gio2/rbgiounixoutputstream.c +0 -51
  131. data/ext/gio2/rbgiounixsocketaddress.c +0 -69
  132. data/ext/gio2/rbgiovfs.c +0 -84
  133. data/ext/gio2/rbgiovolume.c +0 -193
  134. data/ext/gio2/rbgiovolumemonitor.c +0 -77
  135. data/ext/gio2/rbgiozlibcompressor.c +0 -52
  136. data/ext/gio2/rbgiozlibdecompressor.c +0 -45
  137. data/ext/gio2/util.c +0 -303
  138. data/test/test_bufferedinputstream.rb +0 -9
  139. data/test/test_charsetconverter.rb +0 -9
  140. data/test/test_datainputstream.rb +0 -7
  141. data/test/test_fileenumerator.rb +0 -8
  142. data/test/test_filemonitor.rb +0 -17
  143. data/test/test_inetaddress.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd0f98643eda3c74225706dcfd1a0b058f785a5f
4
- data.tar.gz: 688bf8e2822404f4dc22e0b372f9b29dba6ee8e0
3
+ metadata.gz: 0746c69a296006601f79942a1d468055e77bc38c
4
+ data.tar.gz: d654b3f11305b94f94b1dc0346aa6b53f7c0ac72
5
5
  SHA512:
6
- metadata.gz: 1b17b3ff9e7c6c75dac2d611d9bac6046b8a1e95c1c4013fc5f3b34e3ea2a53c42286abf75ec2b05bda6e98d5a967f5759f7e382390e98e66878986335151788
7
- data.tar.gz: 5772b6a934ad67ceae0b165b192e51bb71a04f95a4380190ea1a34e2996d62cda67f44bc3ac360b06781b126b1e7cfaebfe828a646085a265b648b1c0ca38c99
6
+ metadata.gz: c7b9dfec88a8ec99d58c126f2482d142c54309a49de450ba07b040090c0abfbef0cab1026095b0bbcd349e6eb288e400e23f5e641308858a57f9ca854d7f3bd2
7
+ data.tar.gz: 29bb5369887ed27bf38ab351f2ff8eac3f7756cb5cea95ee275325f65dfd0c1441aa9cd36b9fc6ce6078acc70034e6894e9c937e090bdb2e60e600b2d107c9ba
data/Rakefile CHANGED
@@ -1,14 +1,31 @@
1
1
  # -*- ruby -*-
2
+ #
3
+ # Copyright (C) 2011-2013 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2
18
 
3
19
  $LOAD_PATH.unshift("./../glib2/lib")
4
- require 'gnome2-raketask'
20
+ require "gnome2/rake/package-task"
5
21
 
6
- package = GNOME2Package.new do |_package|
7
- _package.summary = "Ruby/GIO2 is a Ruby binding of gio-2.x."
8
- _package.description = "Ruby/GIO2 is a Ruby binding of gio-2.x."
9
- _package.dependency.gem.runtime = ["glib2"]
10
- _package.win32.packages = []
11
- _package.win32.dependencies = []
22
+ package_task = GNOME2::Rake::PackageTask.new do |package|
23
+ package.summary = "Ruby/GIO2 is a Ruby binding of gio-2.x."
24
+ package.description = "Ruby/GIO2 is a Ruby binding of gio-2.x."
25
+ package.dependency.gem.runtime = ["glib2", "gobject-introspection"]
26
+ package.windows.packages = []
27
+ package.windows.dependencies = []
28
+ package.windows.build_dependencies = ["glib2", "gobject-introspection"]
29
+ package.windows.gobject_introspection_dependencies = ["glib2"]
12
30
  end
13
- package.define_tasks
14
-
31
+ package_task.define
data/ext/gio2/extconf.rb CHANGED
@@ -1,19 +1,33 @@
1
- =begin
2
- extconf.rb for Ruby/GIO extention library
3
- =end
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4
18
 
5
- require 'pathname'
19
+ require "pathname"
6
20
 
7
21
  base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
8
- top_dir = base_dir.parent.expand_path
22
+ top_dir = base_dir.parent
9
23
  top_build_dir = Pathname(".").parent.parent.parent.expand_path
10
24
 
11
- mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
25
+ mkmf_gnome2_dir = top_dir + "glib2" + "lib"
12
26
  version_suffix = ""
13
27
  unless mkmf_gnome2_dir.exist?
14
- if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
28
+ if /(-\d+\.\d+\.\d+)\z/ =~ base_dir.basename.to_s
15
29
  version_suffix = $1
16
- mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
30
+ mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + "lib"
17
31
  end
18
32
  end
19
33
 
@@ -22,40 +36,36 @@ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
22
36
  module_name = "gio2"
23
37
  package_id = "gio-2.0"
24
38
 
25
- begin
26
- require 'mkmf-gnome2'
27
- rescue LoadError
28
- require 'rubygems'
29
- gem 'glib2'
30
- require 'mkmf-gnome2'
31
- end
32
-
33
- ruby_header = 'ruby.h'
34
- have_func 'rb_exec_recursive', ruby_header
35
- have_func 'rb_errinfo', ruby_header
39
+ require "mkmf-gnome2"
36
40
 
37
- ["glib2"].each do |package|
41
+ ["glib2", "gobject-introspection"].each do |package|
38
42
  directory = "#{package}#{version_suffix}"
39
- build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
43
+ build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}"
44
+ package_library_name = package.gsub(/-/, "_")
45
+ build_dir = "#{build_base_path}/#{package_library_name}/#{RUBY_VERSION}"
40
46
  add_depend_package(package, "#{directory}/ext/#{package}",
41
47
  top_dir.to_s,
42
48
  :top_build_dir => top_build_dir.to_s,
43
49
  :target_build_dir => build_dir)
44
50
  end
45
51
 
46
- win32 = setup_win32(module_name, base_dir)
52
+ setup_win32(module_name, base_dir)
47
53
 
48
- defines = '-DRUBY_GIO2_COMPILATION'
54
+ unless required_pkg_config_package(package_id,
55
+ :debian => "libglib2.0-dev",
56
+ :redhat => "glib2-devel",
57
+ :homebrew => "glib",
58
+ :macports => "glib2")
59
+ exit(false)
60
+ end
49
61
 
50
- PKGConfig.have_package(package_id) or exit 1
51
- unless win32
52
- PKGConfig.have_package('gio-unix-2.0') and defines += ' -DHAVE_GIO_UNIX'
62
+ unless PKGConfig.have_package("gobject-introspection-1.0")
63
+ exit(false)
53
64
  end
54
- PKGConfig.have_package('gobject-2.0') or exit 1
55
65
 
56
66
  create_pkg_config_file("Ruby/GIO2", package_id)
57
67
 
58
- $defs << defines
68
+ $defs << "-DRUBY_GIO2_COMPILATION"
59
69
  create_makefile(module_name)
60
70
 
61
71
  pkg_config_dir = with_config("pkg-config-dir")
@@ -0,0 +1,59 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2014 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gio2.h"
22
+
23
+ #define RG_TARGET_NAMESPACE mPollableSource
24
+
25
+ #define _SELF(self) ((GSource *)RVAL2BOXED(self, G_TYPE_SOURCE))
26
+
27
+ static gboolean
28
+ source_func(GObject *pollable_stream, gpointer user_data)
29
+ {
30
+ VALUE callback = (VALUE)user_data;
31
+ ID id_call;
32
+ id_call = rb_intern("call");
33
+ return RVAL2CBOOL(rb_funcall(callback, id_call,
34
+ 1, GOBJ2RVAL(pollable_stream)));
35
+ }
36
+
37
+ static VALUE
38
+ rg_set_callback(VALUE self)
39
+ {
40
+ VALUE callback;
41
+
42
+ callback = rb_block_proc();
43
+ G_RELATIVE(self, callback);
44
+ g_source_set_callback(_SELF(self),
45
+ (GSourceFunc)source_func,
46
+ (gpointer)callback,
47
+ (GDestroyNotify)NULL);
48
+ return self;
49
+ }
50
+
51
+ void
52
+ rb_gio2_init_pollable_source (VALUE mGio)
53
+ {
54
+ VALUE RG_TARGET_NAMESPACE;
55
+
56
+ RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "PollableSource");
57
+
58
+ RG_DEF_METHOD(set_callback, 0);
59
+ }
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2014 Ruby-GNOME2 Project Team
5
4
  *
6
5
  * This library is free software; you can redistribute it and/or
7
6
  * modify it under the terms of the GNU Lesser General Public
@@ -19,10 +18,15 @@
19
18
  * MA 02110-1301 USA
20
19
  */
21
20
 
22
- #include "rbgio2private.h"
21
+ #include "rb-gio2.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_mGio
23
24
 
24
25
  void
25
- Init_gfilteroutputstream(VALUE mGio)
26
+ Init_gio2 (void)
26
27
  {
27
- (void)G_DEF_CLASS(G_TYPE_FILTER_OUTPUT_STREAM, "FilterOutputStream", mGio);
28
+ VALUE RG_TARGET_NAMESPACE;
29
+
30
+ RG_TARGET_NAMESPACE = rb_define_module("Gio");
31
+ rb_gio2_init_pollable_source(RG_TARGET_NAMESPACE);
28
32
  }
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2014 Ruby-GNOME2 Project Team
5
4
  *
6
5
  * This library is free software; you can redistribute it and/or
7
6
  * modify it under the terms of the GNU Lesser General Public
@@ -19,13 +18,9 @@
19
18
  * MA 02110-1301 USA
20
19
  */
21
20
 
22
- #include "rbgio2private.h"
21
+ #include <gio/gio.h>
23
22
 
24
- void Init_gio2(void);
23
+ #include <rb-gobject-introspection.h>
25
24
 
26
- void
27
- Init_gio2(void)
28
- {
29
- Init_util();
30
- Init_gio();
31
- }
25
+ extern void Init_gio2 (void);
26
+ G_GNUC_INTERNAL extern void rb_gio2_init_pollable_source (VALUE rb_mGio);
data/extconf.rb CHANGED
@@ -1,9 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2
18
 
3
- require 'pathname'
4
- require 'mkmf'
5
- require 'rbconfig'
6
- require 'fileutils'
19
+ require "pathname"
20
+ require "mkmf"
21
+ require "rbconfig"
22
+ require "fileutils"
7
23
 
8
24
  package = "gio2"
9
25
 
@@ -24,7 +40,7 @@ create_makefile(package)
24
40
  FileUtils.mv("Makefile", "Makefile.lib")
25
41
 
26
42
  File.open("Makefile", "w") do |makefile|
27
- makefile.puts(<<-EOM)
43
+ makefile.puts(<<-MAKEFILE)
28
44
  all:
29
45
  (cd ext/#{package} && $(MAKE))
30
46
  $(MAKE) -f Makefile.lib
@@ -45,5 +61,5 @@ distclean:
45
61
  (cd ext/#{package} && $(MAKE) distclean)
46
62
  $(MAKE) -f Makefile.lib distclean
47
63
  @rm -f Makefile.lib
48
- EOM
64
+ MAKEFILE
49
65
  end
data/lib/1.9/gio2.so CHANGED
Binary file
data/lib/2.0/gio2.so CHANGED
Binary file
data/lib/2.1/gio2.so CHANGED
Binary file
@@ -1,3 +1,19 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
1
17
  module GLib
2
18
  extend GLib::Deprecatable
3
19
  define_deprecated_const :AppInfo, 'Gio::AppInfo'
@@ -0,0 +1,33 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gio
18
+ class InetAddress
19
+ class << self
20
+ def any(family)
21
+ address = allocate
22
+ address.__send__(:initialize_new_any, family)
23
+ address
24
+ end
25
+
26
+ def loopback(family)
27
+ address = allocate
28
+ address.__send__(:initialize_new_loopback, family)
29
+ address
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gio
18
+ class InputStream
19
+ alias_method :read_raw, :read
20
+ def read(size=nil)
21
+ if size.nil?
22
+ all = "".force_encoding("ASCII-8BIT")
23
+ buffer_size = 8192
24
+ buffer = " ".force_encoding("ASCII-8BIT") * buffer_size
25
+ loop do
26
+ read_bytes = read_raw(buffer, buffer.bytesize)
27
+ all << buffer.byteslice(0, read_bytes)
28
+ break if read_bytes != buffer_size
29
+ end
30
+ all
31
+ else
32
+ buffer = " " * size
33
+ read_bytes = read_raw(buffer, buffer.bytesize)
34
+ buffer.replace(buffer.byteslice(0, read_bytes))
35
+ buffer
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,244 @@
1
+ # Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gio
18
+ class Loader < GObjectIntrospection::Loader
19
+ private
20
+ def pre_load(repository, namespace)
21
+ define_content_type_class
22
+ define_mime_type_class
23
+ define_resources_module
24
+ @content_type_guess_for_tree_info = nil
25
+ end
26
+
27
+ def post_load(repository, namespace)
28
+ if @content_type_guess_for_tree_info
29
+ content_type_class = @content_type_class
30
+ info = @content_type_guess_for_tree_info
31
+ file_module = @base_module.const_get("File")
32
+ file_module.__send__(:define_method, "guess_content_types") do
33
+ info.invoke(:arguments => [self]).collect do |type|
34
+ content_type_class.new(type)
35
+ end
36
+ end
37
+ end
38
+ require_extension
39
+ require_libraries
40
+ end
41
+
42
+ def require_extension
43
+ begin
44
+ major, minor, _ = RUBY_VERSION.split(/\./)
45
+ require "#{major}.#{minor}/gio2.so"
46
+ rescue LoadError
47
+ require "gio2.so"
48
+ end
49
+ end
50
+
51
+ def require_libraries
52
+ require "gio2/resources"
53
+ require "gio2/inet-address"
54
+ require "gio2/input-stream"
55
+ require "gio2/output-stream"
56
+ require "gio2/pollable-input-stream"
57
+ require "gio2/pollable-output-stream"
58
+ end
59
+
60
+ def define_content_type_class
61
+ @content_type_class = Class.new do
62
+ def initialize(type)
63
+ @type = type
64
+ end
65
+
66
+ def to_s
67
+ @type
68
+ end
69
+ end
70
+ @base_module.const_set("ContentType", @content_type_class)
71
+ end
72
+
73
+ def define_mime_type_class
74
+ @mime_type_class = Class.new do
75
+ def initialize(type)
76
+ @type = type
77
+ end
78
+
79
+ def to_s
80
+ @type
81
+ end
82
+ end
83
+ @base_module.const_set("MimeType", @mime_type_class)
84
+ end
85
+
86
+ def define_resources_module
87
+ @resources_module = Module.new
88
+ @base_module.const_set("Resources", @resources_module)
89
+ end
90
+
91
+ def load_function_info(info)
92
+ name = info.name
93
+ case name
94
+ when "init"
95
+ # ignore
96
+ when /\Acontent_type_/
97
+ load_function_info_content_type(info)
98
+ when "content_types_get_registered"
99
+ @content_type_class.define_singleton_method(:registered) do
100
+ info.invoke(:arguments => []).collect do |type|
101
+ new(type)
102
+ end
103
+ end
104
+ when /\Aresources_/
105
+ load_function_info_resources(info)
106
+ else
107
+ super
108
+ end
109
+ end
110
+
111
+ def load_function_info_content_type(info)
112
+ name = info.name.gsub(/\Acontent_type_/, "")
113
+ case name
114
+ when "equals", "is_a"
115
+ case name
116
+ when "equals"
117
+ method_name = "=="
118
+ when "is_a"
119
+ method_name = "#{name}?"
120
+ end
121
+ @content_type_class.__send__(:define_method, method_name) do |other|
122
+ if other.is_a?(self.class)
123
+ other = other.to_s
124
+ end
125
+ if other.is_a?(String)
126
+ info.invoke(:arguments => [to_s, other])
127
+ else
128
+ false
129
+ end
130
+ end
131
+ when "from_mime_type"
132
+ @mime_type_class.__send__(:define_method, "content_type") do
133
+ info.invoke(:arguments => [to_s])
134
+ end
135
+ when "get_mime_type"
136
+ mime_type_class = @mime_type_class
137
+ @content_type_class.__send__(:define_method, "mime_type") do
138
+ mime_type = info.invoke(:arguments => [to_s])
139
+ if mime_type
140
+ mime_type_class.new(mime_type)
141
+ else
142
+ nil
143
+ end
144
+ end
145
+ when "guess_for_tree"
146
+ @content_type_guess_for_tree_info = info
147
+ when "guess"
148
+ validate = lambda do |arguments|
149
+ method_name = "#{@content_type_class}.#{name}"
150
+ validate_arguments(info, method_name, arguments)
151
+ end
152
+ @content_type_class.define_singleton_method(:guess) do |*arguments|
153
+ validate.call(arguments)
154
+ info.invoke(:arguments => arguments)
155
+ end
156
+ else
157
+ case name
158
+ when /\Acan_be_/
159
+ method_name = "#{$1}?"
160
+ when /\Ais_/
161
+ method_name = "#{$POSTMATCH}?"
162
+ when /\Aget_/
163
+ method_name = $POSTMATCH
164
+ else
165
+ method_name = name
166
+ end
167
+ @content_type_class.__send__(:define_method, method_name) do
168
+ info.invoke(:arguments => [to_s])
169
+ end
170
+ end
171
+ end
172
+
173
+
174
+ def load_function_info_resources(info)
175
+ method_name = info.name.gsub(/\Aresources_/, "")
176
+ receiver = @resources_module
177
+ validate = lambda do |arguments|
178
+ validate_arguments(info, "#{receiver}.#{method_name}", arguments)
179
+ end
180
+ receiver.define_singleton_method(method_name) do |*arguments|
181
+ validate.call(arguments)
182
+ info.invoke(:arguments => arguments)
183
+ end
184
+ end
185
+
186
+ def load_function_infos(infos, klass)
187
+ case klass.name
188
+ when "Gio::File"
189
+ load_function_infos_file(infos, klass)
190
+ super
191
+ else
192
+ super
193
+ end
194
+ end
195
+
196
+ def load_function_infos_file(infos, klass)
197
+ new_for_commandline_arg_infos = []
198
+
199
+ infos.each do |info|
200
+ name = info.name
201
+ case name
202
+ when /\Anew_for_commandline_arg/
203
+ new_for_commandline_arg_infos << info
204
+ when /\Anew_(?:for_)?/
205
+ method_name = $POSTMATCH
206
+ define_singleton_method(klass, method_name, info)
207
+ else
208
+ define_singleton_method(klass, name, info)
209
+ end
210
+ end
211
+
212
+ define_file_commandline_arg(new_for_commandline_arg_infos, klass)
213
+ end
214
+
215
+ def define_file_commandline_arg(infos, klass)
216
+ method_name = "commandline_arg"
217
+ find_info = lambda do |arguments|
218
+ find_suitable_callable_info(infos, arguments)
219
+ end
220
+ validate = lambda do |info, arguments|
221
+ validate_arguments(info, "#{klass}.#{method_name}", arguments)
222
+ end
223
+ klass.__send__(:define_method, method_name) do |*arguments|
224
+ info = find_info.call(arguments)
225
+ validate.call(info, arguments)
226
+ info.invoke(:arguments => arguments)
227
+ end
228
+ end
229
+
230
+ def error_class_name(info)
231
+ name = info.name
232
+ case name
233
+ when /Enum\z/
234
+ $PREMATCH
235
+ else
236
+ name
237
+ end
238
+ end
239
+
240
+ def error_parent_class(info)
241
+ Error
242
+ end
243
+ end
244
+ end
@@ -0,0 +1,24 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gio
18
+ class OutputStream
19
+ alias_method :write_raw, :write
20
+ def write(data)
21
+ write_raw(data, data.bytesize)
22
+ end
23
+ end
24
+ end