glib2 4.3.8 → 4.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0c2e2040f0df1627b2664fff3df265629b9b622d34d35f246246d6dde604c84
4
- data.tar.gz: b373afa94a243519321eb03866691959d8c2bf6eb63dbce7d59d288cf0df9d4d
3
+ metadata.gz: 821b32784e11e3eb270992e7be9191987394c88101a2a3aaa91204d7060a3501
4
+ data.tar.gz: 4d3a46e07f0ed739684f94859d51ba3dbac5830a4bb5f2bed6f617bb5e508b8b
5
5
  SHA512:
6
- metadata.gz: ad10988ccbb9f9792195752bb7f39b7aa0b7e7ec31fe41fb332a74879b1dc1a267f78e239e94fd6e25625a90ae88d2c5abb6b8c0c282cb9c8b54cb833ad22a72
7
- data.tar.gz: 7098c0bdea81d6cc7c2cb430f9f67fa3166359f3a293f7fbefbb50f0f39a2eca4f3c9a6f6e06a3a32d978e1f2ade9bfe546fcb1a1f04d774714abd9ddb7206de
6
+ metadata.gz: 5719f7067032d3f55b041d0d00d11fc333c512a7c24f1f7e675dc6b0ad0cf919807f92de0e02baadd0f1213d908bd6b62d99506b0e3f0b629e159150b5663b12
7
+ data.tar.gz: 1ca574849cdda90ce2acc458becf5717aaeb1ef9a3fd5f7d1ff0220d0cf23a649f7cd159e515dcc77e181c96f9c9353a3bc692e1fd4d669fe899b84d45a74e9a
@@ -88,6 +88,14 @@ rbgi_base_info_instance2robj(gpointer instance, gpointer user_data)
88
88
  ID id_ConstantInfo;
89
89
  RUBY_CONST_ID(id_ConstantInfo, "ConstantInfo");
90
90
  klass = rb_const_get(rbg_mGLib(), id_ConstantInfo);
91
+ } else if (type == GI_TYPE_ENUM_INFO) {
92
+ ID id_EnumInfo;
93
+ RUBY_CONST_ID(id_EnumInfo, "EnumInfo");
94
+ klass = rb_const_get(rbg_mGLib(), id_EnumInfo);
95
+ } else if (type == GI_TYPE_FLAGS_INFO) {
96
+ ID id_FlagsInfo;
97
+ RUBY_CONST_ID(id_FlagsInfo, "FlagsInfo");
98
+ klass = rb_const_get(rbg_mGLib(), id_FlagsInfo);
91
99
  } else if (type == GI_TYPE_FUNCTION_INFO) {
92
100
  ID id_FunctionInfo;
93
101
  RUBY_CONST_ID(id_FunctionInfo, "FunctionInfo");
@@ -116,6 +124,10 @@ rbgi_base_info_instance2robj(gpointer instance, gpointer user_data)
116
124
  ID id_TypeInfo;
117
125
  RUBY_CONST_ID(id_TypeInfo, "TypeInfo");
118
126
  klass = rb_const_get(rbg_mGLib(), id_TypeInfo);
127
+ } else if (type == GI_TYPE_UNION_INFO) {
128
+ ID id_UnionInfo;
129
+ RUBY_CONST_ID(id_UnionInfo, "UnionInfo");
130
+ klass = rb_const_get(rbg_mGLib(), id_UnionInfo);
119
131
  } else if (type == GI_TYPE_VFUNC_INFO) {
120
132
  ID id_VFuncInfo;
121
133
  RUBY_CONST_ID(id_VFuncInfo, "VFuncInfo");
@@ -23,11 +23,13 @@
23
23
  #define RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags) \
24
24
  (RVAL2GFLAGS(rb_flags, GI_TYPE_REPOSITORY_LOAD_FLAGS))
25
25
 
26
- #define RVAL2GI_ARG_INFO(rb_info) GI_ARG_INFO(RVAL2GOBJ(rb_info))
27
- #define RVAL2GI_BASE_INFO(rb_info) GI_BASE_INFO(RVAL2GOBJ(rb_info))
28
- #define RVAL2GI_CALLABLE_INFO(rb_info) GI_CALLABLE_INFO(RVAL2GOBJ(rb_info))
29
- #define RVAL2GI_INTERFACE_INFO(rb_info) GI_INTERFACE_INFO(RVAL2GOBJ(rb_info))
30
- #define RVAL2GI_TYPE_INFO(rb_info) GI_TYPE_INFO(RVAL2GOBJ(rb_info))
26
+ #define RVAL2GI_ARG_INFO(rb_info) GI_ARG_INFO(RVAL2GOBJ(rb_info))
27
+ #define RVAL2GI_BASE_INFO(rb_info) GI_BASE_INFO(RVAL2GOBJ(rb_info))
28
+ #define RVAL2GI_CALLABLE_INFO(rb_info) GI_CALLABLE_INFO(RVAL2GOBJ(rb_info))
29
+ #define RVAL2GI_INTERFACE_INFO(rb_info) GI_INTERFACE_INFO(RVAL2GOBJ(rb_info))
30
+ #define RVAL2GI_REGISTERED_TYPE_INFO(rb_info) \
31
+ GI_REGISTERED_TYPE_INFO(RVAL2GOBJ(rb_info))
32
+ #define RVAL2GI_TYPE_INFO(rb_info) GI_TYPE_INFO(RVAL2GOBJ(rb_info))
31
33
 
32
34
  #define GI_ARRAY_TYPE2RVAL(type) (GENUM2RVAL(type, GI_TYPE_ARRAY_TYPE))
33
35
  #define GI_DIRECTION2RVAL(direction) (GENUM2RVAL(direction, GI_TYPE_DIRECTION))
@@ -33,6 +33,7 @@ G_GNUC_INTERNAL void rbgi_arg_info_init(VALUE mGLib);
33
33
  G_GNUC_INTERNAL void rbgi_callable_info_init(VALUE mGLib);
34
34
  G_GNUC_INTERNAL void rbgi_base_info_init(VALUE mGLib);
35
35
  G_GNUC_INTERNAL void rbgi_interface_info_init(VALUE mGLib);
36
+ G_GNUC_INTERNAL void rbgi_registered_type_info_init(VALUE mGLib);
36
37
  G_GNUC_INTERNAL void rbgi_repository_init(VALUE mGLib);
37
38
  G_GNUC_INTERNAL void rbgi_type_info_init(VALUE mGLib);
38
39
 
@@ -0,0 +1,70 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012-2026 Ruby-GNOME 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
+ #ifdef HAVE_GIREPOSITORY
22
+ #include "rbgi-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE rb_cGIRegisteredTypeInfo
25
+ #define SELF(self) (RVAL2GI_REGISTERED_TYPE_INFO(self))
26
+
27
+ static VALUE
28
+ rg_type_name(VALUE self)
29
+ {
30
+ GIRegisteredTypeInfo *info = SELF(self);
31
+ return CSTR2RVAL(gi_registered_type_info_get_type_name(info));
32
+ }
33
+
34
+ static VALUE
35
+ rg_type_init_function_name(VALUE self)
36
+ {
37
+ GIRegisteredTypeInfo *info = SELF(self);
38
+ return CSTR2RVAL(gi_registered_type_info_get_type_init_function_name(info));
39
+ }
40
+
41
+ static VALUE
42
+ rg_gtype(VALUE self)
43
+ {
44
+ GIRegisteredTypeInfo *info = SELF(self);
45
+ return rbgobj_gtype_new(gi_registered_type_info_get_g_type(info));
46
+ }
47
+
48
+ static VALUE
49
+ rg_boxed_p(VALUE self)
50
+ {
51
+ GIRegisteredTypeInfo *info = SELF(self);
52
+ return CBOOL2RVAL(gi_registered_type_info_is_boxed(info));
53
+ }
54
+
55
+ void
56
+ rbgi_registered_type_info_init(VALUE rb_mGLib)
57
+ {
58
+ VALUE RG_TARGET_NAMESPACE;
59
+
60
+ RG_TARGET_NAMESPACE =
61
+ G_DEF_CLASS(GI_TYPE_REGISTERED_TYPE_INFO,
62
+ "RegisteredTypeInfo",
63
+ rb_mGLib);
64
+
65
+ RG_DEF_METHOD(type_name, 0);
66
+ RG_DEF_METHOD(type_init_function_name, 0);
67
+ RG_DEF_METHOD(gtype, 0);
68
+ RG_DEF_METHOD_P(boxed, 0);
69
+ }
70
+ #endif
data/ext/glib2/rbglib.c CHANGED
@@ -1300,6 +1300,8 @@ union GDoubleIEEE754;
1300
1300
 
1301
1301
  #ifdef HAVE_GIREPOSITORY
1302
1302
  rbgi_base_info_init(rbg_mGLib());
1303
+ /* Parent classes must be defined before their child classes. */
1304
+ rbgi_registered_type_info_init(rbg_mGLib());
1303
1305
 
1304
1306
  rbgi_arg_info_init(rbg_mGLib());
1305
1307
  rbgi_callable_info_init(rbg_mGLib());
@@ -1307,6 +1309,12 @@ union GDoubleIEEE754;
1307
1309
  /* rbgi_constant_info_init(rbg_mGLib()); */
1308
1310
  G_DEF_CLASS(GI_TYPE_CONSTANT_INFO, "ConstantInfo", rbg_mGLib());
1309
1311
  /* TODO */
1312
+ /* rbgi_enum_info_init(rbg_mGLib()); */
1313
+ G_DEF_CLASS(GI_TYPE_ENUM_INFO, "EnumInfo", rbg_mGLib());
1314
+ /* TODO */
1315
+ /* rbgi_flags_info_init(rbg_mGLib()); */
1316
+ G_DEF_CLASS(GI_TYPE_FLAGS_INFO, "FlagsInfo", rbg_mGLib());
1317
+ /* TODO */
1310
1318
  /* rbgi_function_info_init(rbg_mGLib()); */
1311
1319
  G_DEF_CLASS(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rbg_mGLib());
1312
1320
  rbgi_interface_info_init(rbg_mGLib());
@@ -1324,6 +1332,9 @@ union GDoubleIEEE754;
1324
1332
  G_DEF_CLASS(GI_TYPE_STRUCT_INFO, "StructInfo", rbg_mGLib());
1325
1333
  rbgi_type_info_init(rbg_mGLib());
1326
1334
  /* TODO */
1335
+ /* rbgi_union_info_init(rbg_mGLib()); */
1336
+ G_DEF_CLASS(GI_TYPE_UNION_INFO, "UnionInfo", rbg_mGLib());
1337
+ /* TODO */
1327
1338
  /* rbgi_vfunc_info_init(rbg_mGLib()); */
1328
1339
  G_DEF_CLASS(GI_TYPE_VFUNC_INFO, "VFuncInfo", rbg_mGLib());
1329
1340
 
data/ext/glib2/rbglib.h CHANGED
@@ -32,8 +32,8 @@
32
32
  G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 4
35
- #define RBGLIB_MINOR_VERSION 3
36
- #define RBGLIB_MICRO_VERSION 8
35
+ #define RBGLIB_MINOR_VERSION 4
36
+ #define RBGLIB_MICRO_VERSION 0
37
37
 
38
38
  /* For Ruby < 3.0 */
39
39
  #ifndef RB_LL2NUM
@@ -0,0 +1,64 @@
1
+ # Copyright (C) 2019-2026 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
+ module GLib
18
+ class RegisteredTypeInfo
19
+ def try_convert(value)
20
+ return nil if value.nil?
21
+
22
+ klass = resolve_class
23
+ return value if klass.nil?
24
+
25
+ case value
26
+ when klass
27
+ value
28
+ else
29
+ if klass.respond_to?(:try_convert)
30
+ klass.try_convert(value)
31
+ else
32
+ nil
33
+ end
34
+ end
35
+ end
36
+
37
+ def match?(value)
38
+ return false if value.nil?
39
+
40
+ klass = resolve_class
41
+ return false if klass.nil?
42
+
43
+ value.is_a?(klass)
44
+ end
45
+
46
+ def description
47
+ "#{gtype.to_class}(#{gtype.name})"
48
+ end
49
+
50
+ private
51
+ def resolve_class
52
+ type = gtype
53
+ if type == GLib::Type::NONE
54
+ ns = namespace
55
+ return nil unless Object.const_defined?(ns)
56
+ mod = Object.const_get(ns)
57
+ return nil unless mod.const_defined?(name)
58
+ mod.const_get(name)
59
+ else
60
+ type.to_class
61
+ end
62
+ end
63
+ end
64
+ end
@@ -20,6 +20,10 @@ module GLib
20
20
  tag.try_convert(self, value)
21
21
  end
22
22
 
23
+ def match?(value)
24
+ tag.match?(self, value)
25
+ end
26
+
23
27
  def description
24
28
  tag.description(self)
25
29
  end
data/lib/glib2.rb CHANGED
@@ -348,6 +348,7 @@ require "glib2/variant-type"
348
348
  if GLib.const_defined?(:Repository)
349
349
  require_relative "glib2/callable-info"
350
350
  require_relative "glib2/interface-info"
351
+ require_relative "glib2/registered-type-info"
351
352
  require_relative "glib2/repository"
352
353
  require_relative "glib2/type-info"
353
354
  end
@@ -0,0 +1,94 @@
1
+ # Copyright (C) 2026 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 TestRegisteredTypeInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("Gio")
24
+ @info = @repository.find("Gio", "TlsServerConnection")
25
+ end
26
+
27
+ def test_ancestors
28
+ assert do
29
+ GLib::InterfaceInfo < GLib::RegisteredTypeInfo
30
+ end
31
+ end
32
+
33
+ def test_type_name
34
+ assert_equal("GTlsServerConnection", @info.type_name)
35
+ end
36
+
37
+ def test_type_init_function_name
38
+ assert_equal("g_tls_server_connection_get_type",
39
+ @info.type_init_function_name)
40
+ end
41
+
42
+ def test_gtype
43
+ assert_equal("GTlsServerConnection", @info.gtype.name)
44
+ end
45
+
46
+ def test_boxed_false
47
+ assert do
48
+ not @info.boxed?
49
+ end
50
+ end
51
+
52
+ def test_boxed_true
53
+ info = @repository.find("GLib", "Bytes")
54
+ assert do
55
+ info.boxed?
56
+ end
57
+ end
58
+
59
+ def test_enum_info
60
+ info = @repository.find("Gio", "FileAttributeType")
61
+ assert_equal("GFileAttributeType", info.type_name)
62
+ end
63
+
64
+ def test_flags_info
65
+ info = @repository.find("Gio", "FileCopyFlags")
66
+ assert_equal("GFileCopyFlags", info.type_name)
67
+ end
68
+
69
+ def test_union_info
70
+ info = @repository.find("GLib", "Mutex")
71
+ assert_nil(info.type_name)
72
+ end
73
+
74
+ def test_match
75
+ info = @repository.find("GLib", "Bytes")
76
+ assert do
77
+ info.match?(GLib::Bytes.new("data"))
78
+ end
79
+ end
80
+
81
+ def test_match_cast
82
+ info = @repository.find("GLib", "Bytes")
83
+ assert do
84
+ not info.match?("data")
85
+ end
86
+ end
87
+
88
+ def test_match_unresolved
89
+ info = @repository.find("GLib", "Cond")
90
+ assert do
91
+ not info.match?(Object.new)
92
+ end
93
+ end
94
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.8
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
@@ -58,6 +58,7 @@ files:
58
58
  - ext/glib2/rbgi-conversions.h
59
59
  - ext/glib2/rbgi-interface-info.c
60
60
  - ext/glib2/rbgi-private.h
61
+ - ext/glib2/rbgi-registered-type-info.c
61
62
  - ext/glib2/rbgi-repository.c
62
63
  - ext/glib2/rbgi-type-info.c
63
64
  - ext/glib2/rbglib-bytes.c
@@ -146,6 +147,7 @@ files:
146
147
  - lib/glib2/deprecated.rb
147
148
  - lib/glib2/interface-info.rb
148
149
  - lib/glib2/regex.rb
150
+ - lib/glib2/registered-type-info.rb
149
151
  - lib/glib2/repository.rb
150
152
  - lib/glib2/time-zone.rb
151
153
  - lib/glib2/type-info.rb
@@ -198,6 +200,7 @@ files:
198
200
  - test/test-pointer.rb
199
201
  - test/test-poll-fd.rb
200
202
  - test/test-regex.rb
203
+ - test/test-registered-type-info.rb
201
204
  - test/test-repository.rb
202
205
  - test/test-signal.rb
203
206
  - test/test-source.rb
@@ -245,7 +248,7 @@ requirements:
245
248
  - 'system: gobject-2.0>=2.56.0: macports: glib2'
246
249
  - 'system: gobject-2.0>=2.56.0: msys2: glib2'
247
250
  - 'system: gobject-2.0>=2.56.0: rhel: pkgconfig(gobject-2.0)'
248
- rubygems_version: 4.0.16
251
+ rubygems_version: 4.0.20
249
252
  specification_version: 4
250
253
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
251
254
  test_files: []