glib2 3.4.9 → 3.5.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/ext/glib2/glib2.def +1 -0
- data/ext/glib2/rbglib-variant.c +4 -3
- data/ext/glib2/rbglib.h +2 -2
- data/ext/glib2/rbglib_error.c +24 -16
- data/ext/glib2/rbgobj_boxed.c +1 -1
- data/ext/glib2/rbgobj_closure.c +1 -1
- data/ext/glib2/rbgobj_enums.c +3 -2
- data/ext/glib2/rbgobj_flags.c +1 -1
- data/ext/glib2/rbgobj_object.c +1 -1
- data/ext/glib2/rbgobj_param.c +1 -1
- data/ext/glib2/rbgobj_signal.c +1 -1
- data/ext/glib2/rbgobj_type.c +1 -0
- data/ext/glib2/rbgobj_value.c +20 -1
- data/ext/glib2/rbgprivate.h +4 -0
- data/ext/glib2/rbgutil.h +3 -2
- data/ext/glib2/rbgutil_callback.c +8 -2
- data/lib/glib2.rb +23 -1
- data/lib/mkmf-gnome.rb +3 -2
- data/test/glib-test-utils.rb +6 -2
- data/test/test-spawn.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 135835c6036937932bed291b322562c6df79be9a0ef07610b9b01627fa9449d4
|
4
|
+
data.tar.gz: 0a07086fc4c87b2311fb608d2a27eedf3ceb1d9a24c0abc0caa061cfb7eacf1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4498dc7d5f612602a79519285dc5e026f9f8abd0d74754317ad451399d780749066b38872317edd2ddb08f1b3ecca48ece9b9264ec61c52241d05c6f572c62d2
|
7
|
+
data.tar.gz: 3b240df85066aaea0ea91dd0f91b05bef11d74906c3c733549d4aa833fb56c88df88baffd9e20f08339e8371de4d7fbaf55a3b1e75a68a563c29dddf1a1035c5
|
data/ext/glib2/glib2.def
CHANGED
data/ext/glib2/rbglib-variant.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2015-
|
3
|
+
* Copyright (C) 2015-2022 Ruby-GNOME Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -69,9 +69,10 @@ rbg_variant_to_ruby(GVariant *variant)
|
|
69
69
|
VALUE value = rbg_variant_to_ruby(val);
|
70
70
|
g_variant_unref(val);
|
71
71
|
return value;
|
72
|
-
} else if (g_variant_type_is_array(type)
|
72
|
+
} else if (g_variant_type_is_array(type) ||
|
73
|
+
g_variant_type_is_tuple(type)) {
|
73
74
|
gsize i, len = g_variant_n_children(variant);
|
74
|
-
VALUE ary =
|
75
|
+
VALUE ary = rb_ary_new_capa(len);
|
75
76
|
for (i = 0; i < len; i++) {
|
76
77
|
GVariant *val = g_variant_get_child_value(variant, i);
|
77
78
|
rb_ary_store(ary, i, rbg_variant_to_ruby(val));
|
data/ext/glib2/rbglib.h
CHANGED
data/ext/glib2/rbglib_error.c
CHANGED
@@ -23,8 +23,13 @@
|
|
23
23
|
#include <ctype.h>
|
24
24
|
|
25
25
|
static ID id_code;
|
26
|
+
static ID id_CODE;
|
27
|
+
static const char *name_CODE = "CODE";
|
26
28
|
static ID id_domain;
|
27
|
-
static ID
|
29
|
+
static ID id_DOMAIN;
|
30
|
+
static const char *name_DOMAIN = "DOMAIN";
|
31
|
+
static ID id_CODE_CLASSES;
|
32
|
+
static const char *name_CODE_CLASSES = "CODE_CLASSES";
|
28
33
|
static VALUE gerror_table;
|
29
34
|
static VALUE generic_error;
|
30
35
|
static VALUE error_info;
|
@@ -44,13 +49,9 @@ rbgerr_gerror2exception(GError *error)
|
|
44
49
|
exception_klass = rb_hash_aref(gerror_table, UINT2NUM(error->domain));
|
45
50
|
if (NIL_P(exception_klass)) {
|
46
51
|
exception_klass = generic_error;
|
47
|
-
} else {
|
48
|
-
VALUE
|
49
|
-
VALUE code_classes;
|
50
|
-
code_classes = rb_ivar_get(exception_klass, id_code_classes);
|
51
|
-
if (!NIL_P(code_classes)) {
|
52
|
-
code_class = rb_hash_aref(code_classes, INT2NUM(error->code));
|
53
|
-
}
|
52
|
+
} else if (rb_const_defined_at(exception_klass, id_CODE_CLASSES)) {
|
53
|
+
VALUE code_classes = rb_const_get(exception_klass, id_CODE_CLASSES);
|
54
|
+
VALUE code_class = rb_hash_aref(code_classes, INT2NUM(error->code));
|
54
55
|
if (!NIL_P(code_class)) {
|
55
56
|
exception_klass = code_class;
|
56
57
|
}
|
@@ -111,16 +112,17 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
111
112
|
VALUE code_classes;
|
112
113
|
VALUE rb_domain = rb_str_new_cstr(g_quark_to_string(domain));
|
113
114
|
rbgutil_string_set_utf8_encoding(rb_domain);
|
115
|
+
rb_obj_freeze(rb_domain);
|
114
116
|
|
115
117
|
error_class = rb_define_class_under(module, name, parent);
|
116
|
-
|
117
|
-
|
118
|
+
rb_define_const(error_class, name_CODE, Qnil);
|
119
|
+
rb_define_const(error_class, name_DOMAIN, rb_domain);
|
118
120
|
rb_prepend_module(error_class, error_info);
|
119
121
|
|
120
122
|
rb_hash_aset(gerror_table, UINT2NUM(domain), error_class);
|
121
123
|
|
122
124
|
code_classes = rb_hash_new();
|
123
|
-
|
125
|
+
rb_define_const(error_class, name_CODE_CLASSES, code_classes);
|
124
126
|
|
125
127
|
if (gtype != G_TYPE_INVALID) {
|
126
128
|
GEnumClass* gclass = g_type_class_ref(gtype);
|
@@ -146,14 +148,16 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
146
148
|
code_class_name,
|
147
149
|
error_class);
|
148
150
|
g_free(code_class_name);
|
149
|
-
|
150
|
-
|
151
|
+
rb_define_const(code_class, name_CODE, INT2NUM(entry->value));
|
152
|
+
rb_define_const(code_class, name_DOMAIN, rb_domain);
|
151
153
|
rb_hash_aset(code_classes, INT2NUM(entry->value), code_class);
|
152
154
|
}
|
153
155
|
|
154
156
|
g_type_class_unref(gclass);
|
155
157
|
}
|
156
158
|
|
159
|
+
rb_obj_freeze(code_classes);
|
160
|
+
|
157
161
|
return error_class;
|
158
162
|
}
|
159
163
|
|
@@ -161,8 +165,8 @@ static VALUE
|
|
161
165
|
rg_initialize(int argc, VALUE *argv, VALUE self)
|
162
166
|
{
|
163
167
|
VALUE klass = rb_obj_class(self);
|
164
|
-
rb_ivar_set(self, id_code,
|
165
|
-
rb_ivar_set(self, id_domain,
|
168
|
+
rb_ivar_set(self, id_code, rb_const_get(klass, id_CODE));
|
169
|
+
rb_ivar_set(self, id_domain, rb_const_get(klass, id_DOMAIN));
|
166
170
|
return rb_call_super(argc, argv);
|
167
171
|
}
|
168
172
|
|
@@ -178,8 +182,10 @@ void
|
|
178
182
|
Init_glib_error(void)
|
179
183
|
{
|
180
184
|
id_code = rb_intern("@code");
|
185
|
+
id_CODE = rb_intern(name_CODE);
|
181
186
|
id_domain = rb_intern("@domain");
|
182
|
-
|
187
|
+
id_DOMAIN = rb_intern(name_DOMAIN);
|
188
|
+
id_CODE_CLASSES = rb_intern(name_CODE_CLASSES);
|
183
189
|
gerror_table = rb_hash_new();
|
184
190
|
rb_global_variable(&gerror_table);
|
185
191
|
|
@@ -190,6 +196,8 @@ Init_glib_error(void)
|
|
190
196
|
RG_DEF_METHOD(initialize, -1);
|
191
197
|
|
192
198
|
generic_error = rb_define_class_under(mGLib, "Error", rb_eRuntimeError);
|
199
|
+
rb_define_const(generic_error, name_CODE, Qnil);
|
200
|
+
rb_define_const(generic_error, name_DOMAIN, Qnil);
|
193
201
|
rb_include_module(generic_error, error_info);
|
194
202
|
}
|
195
203
|
|
data/ext/glib2/rbgobj_boxed.c
CHANGED
data/ext/glib2/rbgobj_closure.c
CHANGED
data/ext/glib2/rbgobj_enums.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2004-2006 Ruby-GNOME Project Team
|
5
5
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
6
|
*
|
@@ -114,7 +114,7 @@ static const rb_data_type_t rg_glib_enum_type = {
|
|
114
114
|
},
|
115
115
|
NULL,
|
116
116
|
NULL,
|
117
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
117
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
118
118
|
};
|
119
119
|
|
120
120
|
static enum_holder *
|
@@ -191,6 +191,7 @@ rbgobj_init_enum_class(VALUE klass)
|
|
191
191
|
|
192
192
|
rb_raw_enum_value = INT2NUM(entry->value);
|
193
193
|
value = rb_funcall(klass, id_new, 1, rb_raw_enum_value);
|
194
|
+
rb_obj_freeze(value);
|
194
195
|
rb_hash_aset(values, rb_raw_enum_value, value);
|
195
196
|
const_nick_name = nick_to_const_name(entry->value_nick);
|
196
197
|
if (const_nick_name) {
|
data/ext/glib2/rbgobj_flags.c
CHANGED
data/ext/glib2/rbgobj_object.c
CHANGED
data/ext/glib2/rbgobj_param.c
CHANGED
data/ext/glib2/rbgobj_signal.c
CHANGED
data/ext/glib2/rbgobj_type.c
CHANGED
data/ext/glib2/rbgobj_value.c
CHANGED
@@ -129,6 +129,7 @@ rbgobj_gvalue_to_rvalue(const GValue* value)
|
|
129
129
|
continue;
|
130
130
|
return func(value);
|
131
131
|
}
|
132
|
+
return BOXED2RVAL(g_value_get_boxed(value), type);
|
132
133
|
}
|
133
134
|
case G_TYPE_VARIANT:
|
134
135
|
{
|
@@ -293,7 +294,24 @@ rbgobj_rvalue_to_gvalue(VALUE val, GValue* result)
|
|
293
294
|
}
|
294
295
|
case G_TYPE_OBJECT:
|
295
296
|
case G_TYPE_INTERFACE:
|
296
|
-
|
297
|
+
if (NIL_P(val)) {
|
298
|
+
g_value_set_object(result, NULL);
|
299
|
+
} else {
|
300
|
+
VALUE value_class = GTYPE2CLASS(type);
|
301
|
+
ID id_try_convert;
|
302
|
+
CONST_ID(id_try_convert, "try_convert");
|
303
|
+
if (!NIL_P(value_class) &&
|
304
|
+
rb_respond_to(value_class, id_try_convert)) {
|
305
|
+
VALUE converted_value = rb_funcall(value_class,
|
306
|
+
id_try_convert,
|
307
|
+
1,
|
308
|
+
val);
|
309
|
+
if (!NIL_P(converted_value)) {
|
310
|
+
val = converted_value;
|
311
|
+
}
|
312
|
+
}
|
313
|
+
g_value_set_object(result, RVAL2GOBJ(val));
|
314
|
+
}
|
297
315
|
return;
|
298
316
|
case G_TYPE_PARAM:
|
299
317
|
g_value_set_param(result, NIL_P(val) ? NULL : RVAL2GOBJ(val));
|
@@ -330,6 +348,7 @@ rbgobj_rvalue_to_gvalue(VALUE val, GValue* result)
|
|
330
348
|
func(val, result);
|
331
349
|
}
|
332
350
|
}
|
351
|
+
break;
|
333
352
|
}
|
334
353
|
}
|
335
354
|
|
data/ext/glib2/rbgprivate.h
CHANGED
data/ext/glib2/rbgutil.h
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-
|
4
|
-
* Copyright (C) 2002,2003
|
3
|
+
* Copyright (C) 2011-2022 Ruby-GNOME Project Team
|
4
|
+
* Copyright (C) 2002,2003 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
7
7
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -92,6 +92,7 @@ extern void rbg_define_singleton_method(VALUE obj, const char *name, VALUE (*fun
|
|
92
92
|
extern VALUE rbgutil_def_setters(VALUE klass);
|
93
93
|
extern void rbgutil_set_properties(VALUE self, VALUE hash);
|
94
94
|
extern VALUE rbgutil_protect(VALUE (*proc) (VALUE), VALUE data);
|
95
|
+
extern void rbgutil_on_callback_error(VALUE error);
|
95
96
|
extern VALUE rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg);
|
96
97
|
extern void rbgutil_start_callback_dispatch_thread(void);
|
97
98
|
extern void rbgutil_stop_callback_dispatch_thread(void);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2007-
|
3
|
+
* Copyright (C) 2007-2022 Ruby-GNOME Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -49,10 +49,16 @@ rbgutil_protect(VALUE (*func) (VALUE), VALUE data)
|
|
49
49
|
VALUE ret = rb_protect(func, data, &state);
|
50
50
|
VALUE e = rb_errinfo();
|
51
51
|
if (state && !NIL_P(e))
|
52
|
-
|
52
|
+
rbgutil_on_callback_error(e);
|
53
53
|
return ret;
|
54
54
|
}
|
55
55
|
|
56
|
+
void
|
57
|
+
rbgutil_on_callback_error(VALUE error)
|
58
|
+
{
|
59
|
+
rb_funcall(mGLib, id_exit_application, 2, error, INT2NUM(EXIT_FAILURE));
|
60
|
+
}
|
61
|
+
|
56
62
|
/**********************************************************************/
|
57
63
|
|
58
64
|
#ifdef HAVE_NATIVETHREAD
|
data/lib/glib2.rb
CHANGED
@@ -134,8 +134,30 @@ module GLib
|
|
134
134
|
class Instantiatable
|
135
135
|
class << self
|
136
136
|
def method_added(name)
|
137
|
-
super
|
137
|
+
result = super
|
138
|
+
check_new_method(name)
|
139
|
+
result
|
140
|
+
end
|
141
|
+
|
142
|
+
def include(*modules, &block)
|
143
|
+
result = super
|
144
|
+
modules.each do |mod|
|
145
|
+
next if mod.is_a?(Interface)
|
146
|
+
mod.public_instance_methods(false).each do |name|
|
147
|
+
check_new_method(name)
|
148
|
+
end
|
149
|
+
mod.protected_instance_methods(false).each do |name|
|
150
|
+
check_new_method(name)
|
151
|
+
end
|
152
|
+
mod.private_instance_methods(false).each do |name|
|
153
|
+
check_new_method(name)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
result
|
157
|
+
end
|
138
158
|
|
159
|
+
private
|
160
|
+
def check_new_method(name)
|
139
161
|
case name.to_s
|
140
162
|
when /\A#{Regexp.escape(SIGNAL_HANDLER_PREFIX)}/o
|
141
163
|
signal_name = $POSTMATCH
|
data/lib/mkmf-gnome.rb
CHANGED
@@ -72,9 +72,10 @@ def try_compiler_option(opt, &block)
|
|
72
72
|
end
|
73
73
|
|
74
74
|
try_compiler_option '-Wall'
|
75
|
-
|
75
|
+
# NOTE: This generates warnings for functions defined in ruby.h.
|
76
|
+
# try_compiler_option '-Waggregate-return'
|
76
77
|
try_compiler_option '-Wcast-align'
|
77
|
-
# NOTE:
|
78
|
+
# NOTE: This generates way too many false positives.
|
78
79
|
# try_compiler_option '-Wconversion'
|
79
80
|
try_compiler_option '-Wextra'
|
80
81
|
try_compiler_option '-Wformat=2'
|
data/test/glib-test-utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2022 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
|
@@ -33,7 +33,11 @@ module GLibTestUtils
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def only_not_windows
|
36
|
-
omit("Not for
|
36
|
+
omit("Not for Windows platform") if GLib.os_win32?
|
37
|
+
end
|
38
|
+
|
39
|
+
def only_not_scl
|
40
|
+
omit("Not for SCL environment") if ENV["SCL"]
|
37
41
|
end
|
38
42
|
|
39
43
|
def normalize_path(path)
|
data/test/test-spawn.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2022 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
|
@@ -35,6 +35,8 @@ class TestGLibSpawn < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_async_clear_environment
|
37
37
|
only_not_windows
|
38
|
+
only_not_scl
|
39
|
+
|
38
40
|
if RbConfig.respond_to?(:ruby)
|
39
41
|
ruby = RbConfig.ruby
|
40
42
|
else
|
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
|
+
version: 3.5.0
|
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:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.4.0.dev
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
|