glib2 3.4.6 → 3.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/glib2/rbglib.h +1 -1
- data/ext/glib2/rbglib_error.c +18 -1
- data/ext/glib2/rbglib_messages.c +4 -5
- data/ext/glib2/rbgobj_object.c +3 -1
- data/ext/glib2/rbgobj_signal.c +1 -1
- data/test/test-error.rb +41 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cffba9b11672f9cdf8f80f4a9df6fad0227fd33c0a884a1de7bacaa4c8e51a9c
|
4
|
+
data.tar.gz: e1bc46a3573d04e5e2dc2d13063837e957da5649d326d255d0417ef13d57c1ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b639b7b657da8950b889c91c6ab6617876ad92b0d6949e28f5d3cb727f5e9808a39d53c7a802217fde933d1d78c29bde0010f2a79c8cfdf965066275c5dbfd3c
|
7
|
+
data.tar.gz: 80b94efc748df78da77c809904256be846f7cbc2b85406de9e753d65ca0f79548d19d3c72ece9604b369ba291444c1a4e00786feb32e042b4d1d8a24cbf2a947
|
data/ext/glib2/rbglib.h
CHANGED
data/ext/glib2/rbglib_error.c
CHANGED
@@ -109,9 +109,13 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
109
109
|
{
|
110
110
|
VALUE error_class;
|
111
111
|
VALUE code_classes;
|
112
|
+
VALUE rb_domain = rb_str_new_cstr(g_quark_to_string(domain));
|
113
|
+
rbgutil_string_set_utf8_encoding(rb_domain);
|
112
114
|
|
113
115
|
error_class = rb_define_class_under(module, name, parent);
|
114
|
-
|
116
|
+
rb_ivar_set(error_class, id_code, Qnil);
|
117
|
+
rb_ivar_set(error_class, id_domain, rb_domain);
|
118
|
+
rb_prepend_module(error_class, error_info);
|
115
119
|
|
116
120
|
rb_hash_aset(gerror_table, UINT2NUM(domain), error_class);
|
117
121
|
|
@@ -142,6 +146,8 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
142
146
|
code_class_name,
|
143
147
|
error_class);
|
144
148
|
g_free(code_class_name);
|
149
|
+
rb_ivar_set(code_class, id_code, INT2NUM(entry->value));
|
150
|
+
rb_ivar_set(code_class, id_domain, rb_domain);
|
145
151
|
rb_hash_aset(code_classes, INT2NUM(entry->value), code_class);
|
146
152
|
}
|
147
153
|
|
@@ -151,6 +157,15 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
151
157
|
return error_class;
|
152
158
|
}
|
153
159
|
|
160
|
+
static VALUE
|
161
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
162
|
+
{
|
163
|
+
VALUE klass = rb_obj_class(self);
|
164
|
+
rb_ivar_set(self, id_code, rb_ivar_get(klass, id_code));
|
165
|
+
rb_ivar_set(self, id_domain, rb_ivar_get(klass, id_domain));
|
166
|
+
return rb_call_super(argc, argv);
|
167
|
+
}
|
168
|
+
|
154
169
|
static VALUE
|
155
170
|
rbg_error_to_ruby(const GValue *from)
|
156
171
|
{
|
@@ -168,9 +183,11 @@ Init_glib_error(void)
|
|
168
183
|
gerror_table = rb_hash_new();
|
169
184
|
rb_global_variable(&gerror_table);
|
170
185
|
|
186
|
+
#define RG_TARGET_NAMESPACE error_info
|
171
187
|
error_info = rb_define_module_under(mGLib, "ErrorInfo");
|
172
188
|
rb_define_attr(error_info, "code", TRUE, FALSE);
|
173
189
|
rb_define_attr(error_info, "domain", TRUE, FALSE);
|
190
|
+
RG_DEF_METHOD(initialize, -1);
|
174
191
|
|
175
192
|
generic_error = rb_define_class_under(mGLib, "Error", rb_eRuntimeError);
|
176
193
|
rb_include_module(generic_error, error_info);
|
data/ext/glib2/rbglib_messages.c
CHANGED
@@ -70,11 +70,10 @@ rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gcha
|
|
70
70
|
if (rb_during_gc()) {
|
71
71
|
g_printerr("\tfrom %s:%d\n", rb_sourcefile(), rb_sourceline());
|
72
72
|
} else {
|
73
|
-
VALUE backtrace;
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
rbg_printerr, Qnil);
|
73
|
+
VALUE backtrace = rb_funcall(rb_mKernel, rb_intern("caller"), 0);
|
74
|
+
ID id_each;
|
75
|
+
CONST_ID(id_each, "each");
|
76
|
+
rb_block_call(backtrace, id_each, 0, NULL, rbg_printerr, Qnil);
|
78
77
|
}
|
79
78
|
} else {
|
80
79
|
g_log_default_handler(log_domain, log_level, message, user_data);
|
data/ext/glib2/rbgobj_object.c
CHANGED
@@ -364,7 +364,9 @@ static VALUE
|
|
364
364
|
gobj_new_body(VALUE rb_arg)
|
365
365
|
{
|
366
366
|
struct param_setup_arg *arg = (struct param_setup_arg *)rb_arg;
|
367
|
-
|
367
|
+
ID id_each;
|
368
|
+
CONST_ID(id_each, "each");
|
369
|
+
rb_block_call(arg->params_hash, id_each, 0, NULL, _params_setup, (VALUE)arg);
|
368
370
|
return (VALUE)g_object_newv(G_TYPE_FROM_CLASS(arg->gclass),
|
369
371
|
arg->param_size, arg->params);
|
370
372
|
}
|
data/ext/glib2/rbgobj_signal.c
CHANGED
@@ -719,7 +719,7 @@ gobj_s_signal_handler_attach(VALUE klass,
|
|
719
719
|
{
|
720
720
|
const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass);
|
721
721
|
guint signal_id = rbgobj_signal_get_raw(rb_signal)->signal_id;
|
722
|
-
|
722
|
+
const gchar *handler_name = RVAL2CSTR(rb_handler_name);
|
723
723
|
VALUE proc = rb_block_proc();
|
724
724
|
GClosure* rclosure = g_rclosure_new(proc,
|
725
725
|
Qnil,
|
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.7
|
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-07-
|
11
|
+
date: 2021-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- test/test-bytes.rb
|
178
178
|
- test/test-date-time.rb
|
179
179
|
- test/test-enum.rb
|
180
|
+
- test/test-error.rb
|
180
181
|
- test/test-file-utils.rb
|
181
182
|
- test/test-flags.rb
|
182
183
|
- test/test-glib2.rb
|