glib2 3.4.4 → 3.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/glib2/glib-enum-types.c +1233 -0
- data/ext/glib2/glib-enum-types.h +154 -0
- data/ext/glib2/glib2.def +1 -0
- data/ext/glib2/rbglib.h +9 -2
- data/ext/glib2/rbglib_error.c +21 -2
- data/ext/glib2/rbglib_messages.c +4 -5
- data/ext/glib2/rbgobj_object.c +3 -1
- data/ext/glib2/rbgobj_signal.c +24 -45
- data/ext/glib2/rbgobj_typeinterface.c +38 -2
- data/lib/glib2.rb +32 -3
- data/lib/mkmf-gnome.rb +1 -1
- data/test/test-error.rb +41 -0
- metadata +5 -2
data/lib/glib2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2005-
|
1
|
+
# Copyright (C) 2005-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -117,17 +117,46 @@ end
|
|
117
117
|
require "glib2.so"
|
118
118
|
|
119
119
|
module GLib
|
120
|
+
SIGNAL_HANDLER_PREFIX = "signal_do_"
|
121
|
+
VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX = "virtual_do_"
|
122
|
+
|
120
123
|
module MetaInterface
|
121
124
|
class << self
|
122
|
-
def signal_callback(klass,
|
125
|
+
def signal_callback(klass, name)
|
123
126
|
lambda do |instance, *args|
|
124
|
-
|
127
|
+
method_name = "#{SIGNAL_HANDLER_PREFIX}#{name}"
|
128
|
+
klass.instance_method(method_name).bind(instance).call(*args)
|
125
129
|
end
|
126
130
|
end
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
130
134
|
class Instantiatable
|
135
|
+
class << self
|
136
|
+
def method_added(name)
|
137
|
+
super
|
138
|
+
|
139
|
+
case name.to_s
|
140
|
+
when /\A#{Regexp.escape(SIGNAL_HANDLER_PREFIX)}/o
|
141
|
+
signal_name = $POSTMATCH
|
142
|
+
begin
|
143
|
+
signal_ = signal(signal_name)
|
144
|
+
rescue NoSignalError
|
145
|
+
return
|
146
|
+
end
|
147
|
+
return unless signal_.class != self
|
148
|
+
signal_handler_attach(signal_, name.to_s) do |instance, *args|
|
149
|
+
instance.__send__(name, *args)
|
150
|
+
end
|
151
|
+
when /\A#{Regexp.escape(VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX)}/o
|
152
|
+
ancestors.each do |klass|
|
153
|
+
next unless klass.respond_to?(:implement_virtual_function)
|
154
|
+
return if klass.implement_virtual_function(self, name)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
131
160
|
private
|
132
161
|
def create_signal_handler(signal_name, callback)
|
133
162
|
callback
|
data/lib/mkmf-gnome.rb
CHANGED
data/test/test-error.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (C) 2021 Ruby-GNOME 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
|
+
class TestError < Test::Unit::TestCase
|
18
|
+
sub_test_case("error class") do
|
19
|
+
def test_code
|
20
|
+
assert_equal(nil,
|
21
|
+
GLib::BookmarkFileError.new.code)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_domain
|
25
|
+
assert_equal("g-bookmark-file-error-quark",
|
26
|
+
GLib::BookmarkFileError.new.domain)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
sub_test_case("error code class") do
|
31
|
+
def test_code
|
32
|
+
assert_equal(GLib::BookmarkFileError::READ,
|
33
|
+
GLib::BookmarkFileError::Read.new.code)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_domain
|
37
|
+
assert_equal("g-bookmark-file-error-quark",
|
38
|
+
GLib::BookmarkFileError::Read.new.domain)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|
@@ -65,6 +65,8 @@ files:
|
|
65
65
|
- Rakefile
|
66
66
|
- ext/glib2/depend
|
67
67
|
- ext/glib2/extconf.rb
|
68
|
+
- ext/glib2/glib-enum-types.c
|
69
|
+
- ext/glib2/glib-enum-types.h
|
68
70
|
- ext/glib2/glib2.def
|
69
71
|
- ext/glib2/rbgcompat.h
|
70
72
|
- ext/glib2/rbglib-bytes.c
|
@@ -175,6 +177,7 @@ files:
|
|
175
177
|
- test/test-bytes.rb
|
176
178
|
- test/test-date-time.rb
|
177
179
|
- test/test-enum.rb
|
180
|
+
- test/test-error.rb
|
178
181
|
- test/test-file-utils.rb
|
179
182
|
- test/test-flags.rb
|
180
183
|
- test/test-glib2.rb
|