gio2 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +26 -9
- data/ext/gio2/extconf.rb +38 -28
- data/ext/gio2/rb-gio2-pollable-source.c +59 -0
- data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
- data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
- data/extconf.rb +22 -6
- data/lib/gio2.rb +38 -143
- data/lib/gio2/deprecated.rb +16 -0
- data/lib/gio2/inet-address.rb +33 -0
- data/lib/gio2/input-stream.rb +39 -0
- data/lib/gio2/loader.rb +244 -0
- data/lib/gio2/output-stream.rb +24 -0
- data/lib/gio2/pollable-input-stream.rb +51 -0
- data/lib/gio2/pollable-output-stream.rb +32 -0
- data/lib/gio2/resources.rb +62 -0
- data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
- data/test/fixture/resource/Rakefile +32 -0
- data/test/fixture/resource/logo.png +0 -0
- data/test/fixture/resource/ruby-gio2.gresource +0 -0
- data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
- data/test/gio2-test-utils.rb +21 -0
- data/test/gio2-test-utils/fixture.rb +24 -0
- data/test/gio2-test-utils/socket-client.rb +59 -0
- data/test/run-test.rb +45 -9
- data/test/test-buffered-input-stream.rb +23 -0
- data/test/test-charset-converter.rb +23 -0
- data/test/test-content-type.rb +31 -0
- data/test/test-data-input-stream.rb +21 -0
- data/test/test-file-enumerator.rb +26 -0
- data/test/test-file-monitor.rb +33 -0
- data/test/test-file.rb +28 -0
- data/test/test-inet-address.rb +34 -0
- data/test/test-input-stream.rb +36 -0
- data/test/test-output-stream.rb +39 -0
- data/test/test-pollable-input-stream.rb +54 -0
- data/test/test-pollable-output-stream.rb +53 -0
- data/test/test-resources.rb +58 -0
- metadata +49 -107
- data/README +0 -34
- data/ext/gio2/depend +0 -11
- data/ext/gio2/gio2.def +0 -2
- data/ext/gio2/gio2.h +0 -30
- data/ext/gio2/rbgio.c +0 -133
- data/ext/gio2/rbgio2.h +0 -158
- data/ext/gio2/rbgio2conversions.h +0 -154
- data/ext/gio2/rbgio2private.h +0 -148
- data/ext/gio2/rbgioappinfo.c +0 -317
- data/ext/gio2/rbgioapplaunchcontext.c +0 -81
- data/ext/gio2/rbgioasyncinitable.c +0 -246
- data/ext/gio2/rbgioasyncresult.c +0 -41
- data/ext/gio2/rbgiobufferedinputstream.c +0 -167
- data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
- data/ext/gio2/rbgiocancellable.c +0 -180
- data/ext/gio2/rbgiocharsetconverter.c +0 -57
- data/ext/gio2/rbgiocontenttype.c +0 -131
- data/ext/gio2/rbgioconverter.c +0 -113
- data/ext/gio2/rbgioconverterinputstream.c +0 -43
- data/ext/gio2/rbgioconverteroutputstream.c +0 -43
- data/ext/gio2/rbgiodatainputstream.c +0 -309
- data/ext/gio2/rbgiodataoutputstream.c +0 -186
- data/ext/gio2/rbgiodesktopappinfo.c +0 -87
- data/ext/gio2/rbgiodrive.c +0 -266
- data/ext/gio2/rbgioemblem.c +0 -52
- data/ext/gio2/rbgioemblemedicon.c +0 -65
- data/ext/gio2/rbgiofile.c +0 -2045
- data/ext/gio2/rbgiofileattribute.c +0 -114
- data/ext/gio2/rbgiofileattributeinfo.c +0 -86
- data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
- data/ext/gio2/rbgiofileattributematcher.c +0 -95
- data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
- data/ext/gio2/rbgiofileenumerator.c +0 -166
- data/ext/gio2/rbgiofileicon.c +0 -41
- data/ext/gio2/rbgiofileinfo.c +0 -617
- data/ext/gio2/rbgiofileinputstream.c +0 -91
- data/ext/gio2/rbgiofileiostream.c +0 -98
- data/ext/gio2/rbgiofilemonitor.c +0 -46
- data/ext/gio2/rbgiofilenamecompleter.c +0 -73
- data/ext/gio2/rbgiofileoutputstream.c +0 -98
- data/ext/gio2/rbgiofilterinputstream.c +0 -28
- data/ext/gio2/rbgioicon.c +0 -69
- data/ext/gio2/rbgioinetaddress.c +0 -118
- data/ext/gio2/rbgioinetsocketaddress.c +0 -41
- data/ext/gio2/rbgioinitable.c +0 -199
- data/ext/gio2/rbgioinputstream.c +0 -341
- data/ext/gio2/rbgioio.c +0 -73
- data/ext/gio2/rbgioiomodule.c +0 -45
- data/ext/gio2/rbgioiomodules.c +0 -47
- data/ext/gio2/rbgioioscheduler.c +0 -102
- data/ext/gio2/rbgioioschedulerjob.c +0 -121
- data/ext/gio2/rbgioiostream.c +0 -107
- data/ext/gio2/rbgioloadableicon.c +0 -92
- data/ext/gio2/rbgiomemoryinputstream.c +0 -67
- data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
- data/ext/gio2/rbgiomount.c +0 -286
- data/ext/gio2/rbgiomountoperation.c +0 -53
- data/ext/gio2/rbgionetworkaddress.c +0 -59
- data/ext/gio2/rbgionetworkservice.c +0 -45
- data/ext/gio2/rbgiooutputstream.c +0 -331
- data/ext/gio2/rbgioresolver.c +0 -230
- data/ext/gio2/rbgioseekable.c +0 -91
- data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
- data/ext/gio2/rbgiosocket.c +0 -390
- data/ext/gio2/rbgiosocketaddress.c +0 -34
- data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
- data/ext/gio2/rbgiosocketclient.c +0 -207
- data/ext/gio2/rbgiosocketconnectable.c +0 -41
- data/ext/gio2/rbgiosocketconnection.c +0 -66
- data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
- data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
- data/ext/gio2/rbgiosocketlistener.c +0 -246
- data/ext/gio2/rbgiosocketservice.c +0 -66
- data/ext/gio2/rbgiosrvtarget.c +0 -76
- data/ext/gio2/rbgiotcpconnection.c +0 -28
- data/ext/gio2/rbgiothemedicon.c +0 -83
- data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
- data/ext/gio2/rbgiotlscertificate.c +0 -89
- data/ext/gio2/rbgiounixconnection.c +0 -71
- data/ext/gio2/rbgiounixfdlist.c +0 -115
- data/ext/gio2/rbgiounixfdmessage.c +0 -74
- data/ext/gio2/rbgiounixinputstream.c +0 -51
- data/ext/gio2/rbgiounixmount.c +0 -164
- data/ext/gio2/rbgiounixmountmonitor.c +0 -65
- data/ext/gio2/rbgiounixmountpoint.c +0 -136
- data/ext/gio2/rbgiounixmountpoints.c +0 -58
- data/ext/gio2/rbgiounixmounts.c +0 -58
- data/ext/gio2/rbgiounixoutputstream.c +0 -51
- data/ext/gio2/rbgiounixsocketaddress.c +0 -69
- data/ext/gio2/rbgiovfs.c +0 -84
- data/ext/gio2/rbgiovolume.c +0 -193
- data/ext/gio2/rbgiovolumemonitor.c +0 -77
- data/ext/gio2/rbgiozlibcompressor.c +0 -52
- data/ext/gio2/rbgiozlibdecompressor.c +0 -45
- data/ext/gio2/util.c +0 -303
- data/test/test_bufferedinputstream.rb +0 -9
- data/test/test_charsetconverter.rb +0 -9
- data/test/test_datainputstream.rb +0 -7
- data/test/test_fileenumerator.rb +0 -8
- data/test/test_filemonitor.rb +0 -17
- data/test/test_inetaddress.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 727400ca8d8c8c2c18b815f816c2c69fe45a3cd3
|
|
4
|
+
data.tar.gz: cdb9a6bb8247a2b3866c19d0483b4ae995513e86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d19b437f8e328986b04df2ee253878bfcd321161aae010b80b11cf45f5525a6b6c0a1ca9875ff6186ada0793d62302f9b65c91fe49d4d0ee3d7170af2e1e8f94
|
|
7
|
+
data.tar.gz: c66b4183f0486484032ff78b62bb71d7aa7e461aedc8d686252ddf2028dab856db36df1e0c05eb91c68447ae207ab585e23ea6fdd2821426a9f55a3461af5ee5
|
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
|
|
20
|
+
require "gnome2/rake/package-task"
|
|
5
21
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
14
|
-
|
|
31
|
+
package_task.define
|
data/ext/gio2/extconf.rb
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
19
|
+
require "pathname"
|
|
6
20
|
|
|
7
21
|
base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
|
|
8
|
-
top_dir = base_dir.parent
|
|
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" +
|
|
25
|
+
mkmf_gnome2_dir = top_dir + "glib2" + "lib"
|
|
12
26
|
version_suffix = ""
|
|
13
27
|
unless mkmf_gnome2_dir.exist?
|
|
14
|
-
if /(-\d+\.\d+\.\d+)
|
|
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}" +
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
setup_win32(module_name, base_dir)
|
|
47
53
|
|
|
48
|
-
|
|
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(
|
|
51
|
-
|
|
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 <<
|
|
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)
|
|
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 "
|
|
21
|
+
#include "rb-gio2.h"
|
|
22
|
+
|
|
23
|
+
#define RG_TARGET_NAMESPACE rb_mGio
|
|
23
24
|
|
|
24
25
|
void
|
|
25
|
-
|
|
26
|
+
Init_gio2 (void)
|
|
26
27
|
{
|
|
27
|
-
|
|
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)
|
|
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
|
|
21
|
+
#include <gio/gio.h>
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
#include <rb-gobject-introspection.h>
|
|
25
24
|
|
|
26
|
-
void
|
|
27
|
-
|
|
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
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
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(<<-
|
|
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
|
-
|
|
64
|
+
MAKEFILE
|
|
49
65
|
end
|
data/lib/gio2.rb
CHANGED
|
@@ -1,161 +1,56 @@
|
|
|
1
|
-
|
|
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
|
+
require "gobject-introspection"
|
|
18
|
+
require "glib2"
|
|
2
19
|
|
|
3
20
|
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
|
|
4
21
|
vendor_dir = base_dir + "vendor" + "local"
|
|
5
22
|
vendor_bin_dir = vendor_dir + "bin"
|
|
6
23
|
GLib.prepend_dll_path(vendor_bin_dir)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require "#{major}.#{minor}/gio2.so"
|
|
10
|
-
rescue LoadError
|
|
11
|
-
require "gio2.so"
|
|
12
|
-
end
|
|
24
|
+
vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
|
|
25
|
+
GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
|
|
13
26
|
|
|
14
27
|
require "gio2/deprecated"
|
|
28
|
+
require "gio2/loader"
|
|
15
29
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def each
|
|
20
|
-
while line = read_line
|
|
21
|
-
yield line
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
alias each_line each
|
|
26
|
-
|
|
27
|
-
def each_async(io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil, &block)
|
|
28
|
-
each_async_loop io_priority, cancellable, block
|
|
29
|
-
self
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
alias each_line_async each_async
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def each_async_loop(io_priority, cancellable, block)
|
|
37
|
-
# TODO: Should we really pass in the object? I mean, how often is that
|
|
38
|
-
# useful? We can always get it with result.source_object as well.
|
|
39
|
-
read_line_async io_priority, cancellable do |result|
|
|
40
|
-
if line = read_line_finish(result)
|
|
41
|
-
block.call line
|
|
42
|
-
each_async_loop io_priority, cancellable, block
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# TODO: Add #each_byte?
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if Gio.const_defined? :DesktopAppInfo
|
|
51
|
-
class Gio::DesktopAppInfo
|
|
52
|
-
class << self
|
|
53
|
-
def desktop_env=(desktop_env)
|
|
54
|
-
set_desktop_env desktop_env
|
|
55
|
-
desktop_env
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
module Gio::File
|
|
62
|
-
include Enumerable
|
|
63
|
-
|
|
64
|
-
def eql?(other)
|
|
65
|
-
self === other and self == other
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
alias each enumerate_children
|
|
69
|
-
|
|
70
|
-
def each_async(num_files, attributes = nil, flags = nil,
|
|
71
|
-
io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil,
|
|
72
|
-
&block)
|
|
73
|
-
enumerate_children_async attributes, flags, io_priority, cancellable do |result|
|
|
74
|
-
enumerate_children_finish(result).each_async num_files, io_priority, cancellable, &block
|
|
75
|
-
end
|
|
76
|
-
self
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
class Gio::FileEnumerator
|
|
81
|
-
include Enumerable
|
|
30
|
+
module Gio
|
|
31
|
+
LOG_DOMAIN = "Gio"
|
|
32
|
+
GLib::Log.set_log_domain(LOG_DOMAIN)
|
|
82
33
|
|
|
83
|
-
|
|
84
|
-
return self.enum_for unless block_given?
|
|
85
|
-
while file = next_file(cancellable)
|
|
86
|
-
yield file
|
|
87
|
-
end
|
|
88
|
-
close
|
|
89
|
-
self
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# TODO: Return Enumerator unless block_given?
|
|
93
|
-
def each_async(num_files, io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil, &block)
|
|
94
|
-
each_async_loop num_files, io_priority, cancellable, block
|
|
34
|
+
class Error < StandardError
|
|
95
35
|
end
|
|
96
36
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
files.each do |file|
|
|
103
|
-
block.call file
|
|
104
|
-
end
|
|
105
|
-
if files.length > 0
|
|
106
|
-
each_async_loop num_files, io_priority, cancellable, block
|
|
37
|
+
class << self
|
|
38
|
+
def const_missing(name)
|
|
39
|
+
init
|
|
40
|
+
if const_defined?(name)
|
|
41
|
+
const_get(name)
|
|
107
42
|
else
|
|
108
|
-
|
|
43
|
+
super
|
|
109
44
|
end
|
|
110
45
|
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
46
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def eql?(other)
|
|
122
|
-
self === other and self == other
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
class Gio::InputStream
|
|
127
|
-
def pending=(pending)
|
|
128
|
-
pending ? set_pending : clear_pending
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
class Gio::Resolver
|
|
133
|
-
class << self
|
|
134
|
-
def default=(default)
|
|
135
|
-
set_default default
|
|
136
|
-
default
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
module Gio::SocketConnectable
|
|
142
|
-
include Enumerable
|
|
143
|
-
|
|
144
|
-
def each(cancellable = nil)
|
|
145
|
-
enumerator = enumerate
|
|
146
|
-
while address = enumerator.next(cancellable)
|
|
147
|
-
yield address
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
class Gio::UnixFDList
|
|
153
|
-
include Enumerable
|
|
154
|
-
|
|
155
|
-
def each
|
|
156
|
-
i = 0
|
|
157
|
-
while i < length
|
|
158
|
-
yield self[i]
|
|
47
|
+
def init
|
|
48
|
+
class << self
|
|
49
|
+
remove_method(:init)
|
|
50
|
+
remove_method(:const_missing)
|
|
51
|
+
end
|
|
52
|
+
loader = Loader.new(self)
|
|
53
|
+
loader.load("Gio")
|
|
159
54
|
end
|
|
160
55
|
end
|
|
161
56
|
end
|