glib2 4.2.0 → 4.2.2
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 +2 -2
- data/ext/glib2/rbglib_timezone.c +12 -1
- data/ext/glib2/rbgobj_boxed.c +6 -1
- data/ext/glib2/rbgobj_flags.c +6 -1
- data/ext/glib2/rbgobj_object.c +9 -16
- data/ext/glib2/rbgobj_signal.c +10 -6
- data/ext/glib2/rbgobj_type.c +17 -12
- data/ext/glib2/rbgobj_typeinstance.c +1 -2
- data/ext/glib2/rbgobj_typeinterface.c +6 -2
- data/ext/glib2/rbgprivate.h +6 -4
- data/ext/glib2/rbgutil.c +13 -2
- data/ext/glib2/rbgutil.h +4 -2
- data/lib/glib2/time-zone.rb +30 -0
- data/lib/glib2.rb +5 -4
- data/sample/timer.rb +2 -2
- data/test/test-regex.rb +17 -17
- data/test/test-time-zone.rb +7 -1
- data/test/test-type.rb +9 -1
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b563bb7a7fbbf025f7adff7f364a2aadf65f3699ddfce16188c91899c840b7d
|
4
|
+
data.tar.gz: ed5e98fee96ef1aa521a66a1cc076ed6fe9c840bee3c2148bdb1ec6513643b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8b48c4d83df2e02af8cef030b4b3c6b94ce03be7d3626bcc075c38ddee2c711f51a61e5efabfce4be421a1b66e5e99c01c063e341db934a0247e90d41718b8c
|
7
|
+
data.tar.gz: bd24a6e77f2b3bd515f1e0b28a4571cc0851922fd8afc4b4ca29f00ab9ba851b37de5d75f2f57722187b2fcf5a0384b1e2a78bf6ba423816e64214a1a98abfd1
|
data/ext/glib2/rbglib.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2002-
|
3
|
+
* Copyright (C) 2002-2024 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
|
33
33
|
|
34
34
|
#define RBGLIB_MAJOR_VERSION 4
|
35
35
|
#define RBGLIB_MINOR_VERSION 2
|
36
|
-
#define RBGLIB_MICRO_VERSION
|
36
|
+
#define RBGLIB_MICRO_VERSION 2
|
37
37
|
|
38
38
|
#ifndef RB_ZALLOC
|
39
39
|
# ifdef ZALLOC
|
data/ext/glib2/rbglib_timezone.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2016-
|
2
|
+
* Copyright (C) 2016-2024 Ruby-GNOME Project Team
|
3
3
|
*
|
4
4
|
* This library is free software; you can redistribute it and/or
|
5
5
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -69,6 +69,14 @@ rg_offset(VALUE self, VALUE rb_interval)
|
|
69
69
|
return INT2NUM(g_time_zone_get_offset(_SELF(self), interval));
|
70
70
|
}
|
71
71
|
|
72
|
+
#if GLIB_CHECK_VERSION(2, 58, 0)
|
73
|
+
static VALUE
|
74
|
+
rg_identifier(VALUE self)
|
75
|
+
{
|
76
|
+
return CSTR2RVAL(g_time_zone_get_identifier(_SELF(self)));
|
77
|
+
}
|
78
|
+
#endif
|
79
|
+
|
72
80
|
void
|
73
81
|
Init_glib_time_zone(void)
|
74
82
|
{
|
@@ -79,4 +87,7 @@ Init_glib_time_zone(void)
|
|
79
87
|
RG_DEF_SMETHOD(utc, 0);
|
80
88
|
RG_DEF_METHOD(abbreviation, 1);
|
81
89
|
RG_DEF_METHOD(offset, 1);
|
90
|
+
#if GLIB_CHECK_VERSION(2, 58, 0)
|
91
|
+
RG_DEF_METHOD(identifier, 0);
|
92
|
+
#endif
|
82
93
|
}
|
data/ext/glib2/rbgobj_boxed.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-2023 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -320,6 +320,11 @@ Init_gobject_gboxed(void)
|
|
320
320
|
|
321
321
|
rb_define_alloc_func(RG_TARGET_NAMESPACE, rbgobj_boxed_alloc_func);
|
322
322
|
rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
|
323
|
+
rbg_define_singleton_method(RG_TARGET_NAMESPACE,
|
324
|
+
"to_s",
|
325
|
+
rbgutil_generic_s_to_s_gtype_name_fallback,
|
326
|
+
0);
|
327
|
+
RG_DEF_SALIAS("inspect", "to_s");
|
323
328
|
rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0);
|
324
329
|
RG_DEF_METHOD(initialize, 0);
|
325
330
|
RG_DEF_METHOD(inspect, 0);
|
data/ext/glib2/rbgobj_flags.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2004-
|
3
|
+
* Copyright (C) 2004-2023 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -547,6 +547,11 @@ Init_gobject_gflags(void)
|
|
547
547
|
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_FLAGS, "Flags", rbg_mGLib());
|
548
548
|
|
549
549
|
rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
|
550
|
+
rbg_define_singleton_method(RG_TARGET_NAMESPACE,
|
551
|
+
"to_s",
|
552
|
+
rbgutil_generic_s_to_s_gtype_name_fallback,
|
553
|
+
0);
|
554
|
+
RG_DEF_SALIAS("inspect", "to_s");
|
550
555
|
rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0);
|
551
556
|
|
552
557
|
RG_DEF_SMETHOD(mask, 0);
|
data/ext/glib2/rbgobj_object.c
CHANGED
@@ -42,7 +42,7 @@ rbg_is_object(VALUE object)
|
|
42
42
|
return RVAL2CBOOL(rb_obj_is_kind_of(object, RG_TARGET_NAMESPACE));
|
43
43
|
}
|
44
44
|
|
45
|
-
/*
|
45
|
+
/* deprecated */
|
46
46
|
void
|
47
47
|
rbgobj_add_abstract_but_create_instance_class(G_GNUC_UNUSED GType gtype)
|
48
48
|
{
|
@@ -326,7 +326,7 @@ rg_s_new_bang(int argc, VALUE *argv, VALUE self)
|
|
326
326
|
}
|
327
327
|
|
328
328
|
static VALUE
|
329
|
-
rg_s_init(
|
329
|
+
rg_s_init(VALUE self)
|
330
330
|
{
|
331
331
|
return RUBY_Qnil;
|
332
332
|
}
|
@@ -699,23 +699,16 @@ static VALUE
|
|
699
699
|
rg_inspect(VALUE self)
|
700
700
|
{
|
701
701
|
gobj_holder* holder;
|
702
|
-
const char *class_name;
|
703
|
-
char *s;
|
704
|
-
VALUE result;
|
705
702
|
|
706
703
|
TypedData_Get_Struct(self, gobj_holder, &rg_glib_object_type, holder);
|
707
704
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
result = rb_str_new2(s);
|
716
|
-
g_free(s);
|
717
|
-
|
718
|
-
return result;
|
705
|
+
if (holder->destroyed) {
|
706
|
+
return rb_sprintf("#<%" PRIsVALUE ":%p destroyed>",
|
707
|
+
rb_obj_class(self), (void *)self);
|
708
|
+
} else {
|
709
|
+
return rb_sprintf("#<%" PRIsVALUE ":%p ptr=%p>",
|
710
|
+
rb_obj_class(self), (void *)self, holder->gobj);
|
711
|
+
}
|
719
712
|
}
|
720
713
|
|
721
714
|
static VALUE
|
data/ext/glib2/rbgobj_signal.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2002-
|
3
|
+
* Copyright (C) 2002-2023 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
static ID id_connected_closures;
|
27
27
|
static VALUE RG_TARGET_NAMESPACE;
|
28
|
+
VALUE rbgobj_mMetaSignal;
|
28
29
|
VALUE rbgobj_signal_wrap(guint sig_id);
|
29
30
|
|
30
31
|
/**********************************************************************/
|
@@ -244,7 +245,7 @@ gobj_s_define_signal(int argc, VALUE* argv, VALUE self)
|
|
244
245
|
signal_flags = RVAL2GFLAGS(rbsignal_flags, G_TYPE_SIGNAL_FLAGS);
|
245
246
|
|
246
247
|
{
|
247
|
-
VALUE proc = rb_funcall(
|
248
|
+
VALUE proc = rb_funcall(rbgobj_mMetaSignal,
|
248
249
|
rb_intern("signal_callback"),
|
249
250
|
2,
|
250
251
|
self,
|
@@ -1054,10 +1055,13 @@ Init_gobject_gsignal(void)
|
|
1054
1055
|
rbg_signal_call_func_table = g_hash_table_new(g_direct_hash, g_direct_equal);
|
1055
1056
|
g_mutex_init(&rbg_signal_call_func_table_mutex);
|
1056
1057
|
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
rbg_define_method(
|
1058
|
+
rbgobj_mMetaSignal = rb_define_module_under(rbg_mGLib(), "MetaSignal");
|
1059
|
+
rbg_define_method(rbgobj_mMetaSignal, "define_signal", gobj_s_define_signal, -1);
|
1060
|
+
rb_define_alias(rbgobj_mMetaSignal, "signal_new", "define_signal");
|
1061
|
+
rbg_define_method(rbgobj_mMetaSignal, "signals", gobj_s_signals, -1);
|
1062
|
+
rbg_define_method(rbgobj_mMetaSignal, "signal", gobj_s_signal, 1);
|
1063
|
+
rb_extend_object(rbgobj_cObject, rbgobj_mMetaSignal);
|
1064
|
+
rb_extend_object(rbgobj_mInterface, rbgobj_mMetaSignal);
|
1061
1065
|
|
1062
1066
|
rbg_define_method(cInstantiatable, "signal_has_handler_pending?",
|
1063
1067
|
gobj_sig_has_handler_pending, -1);
|
data/ext/glib2/rbgobj_type.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2002-
|
3
|
+
* Copyright (C) 2002-2023 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -613,7 +613,7 @@ VALUE
|
|
613
613
|
rbgobj_gtype_new(GType gtype)
|
614
614
|
{
|
615
615
|
VALUE result = rb_obj_alloc(RG_TARGET_NAMESPACE);
|
616
|
-
VALUE arg = SIZET2NUM(gtype);
|
616
|
+
VALUE arg = (gtype == G_TYPE_INVALID ? RUBY_Qnil : SIZET2NUM(gtype));
|
617
617
|
rb_obj_call_init(result, 1, &arg);
|
618
618
|
return result;
|
619
619
|
}
|
@@ -632,7 +632,7 @@ rg_s_try_convert(VALUE self, VALUE value)
|
|
632
632
|
CONST_ID(id_new, "new");
|
633
633
|
|
634
634
|
if (NIL_P(value))
|
635
|
-
return
|
635
|
+
return rb_funcall(self, id_new, 1, value);
|
636
636
|
|
637
637
|
if (RVAL2CBOOL(rb_obj_is_kind_of(value, RG_TARGET_NAMESPACE)))
|
638
638
|
return value;
|
@@ -685,16 +685,20 @@ rg_initialize(VALUE self, VALUE type)
|
|
685
685
|
{
|
686
686
|
GType gtype;
|
687
687
|
|
688
|
-
if (
|
689
|
-
gtype =
|
690
|
-
if (!g_type_name(gtype))
|
691
|
-
gtype = G_TYPE_INVALID;
|
688
|
+
if (RB_NIL_P(type)) {
|
689
|
+
gtype = G_TYPE_INVALID;
|
692
690
|
} else {
|
693
|
-
|
694
|
-
|
691
|
+
if (RVAL2CBOOL(rb_obj_is_kind_of(type, rb_cInteger))) {
|
692
|
+
gtype = NUM2SIZET(type);
|
693
|
+
if (!g_type_name(gtype))
|
694
|
+
gtype = G_TYPE_INVALID;
|
695
|
+
} else {
|
696
|
+
gtype = g_type_from_name(StringValuePtr(type));
|
697
|
+
}
|
695
698
|
|
696
|
-
|
697
|
-
|
699
|
+
if (G_TYPE_INVALID == gtype)
|
700
|
+
rb_raise(rb_eArgError, "invalid GType: %+" PRIsVALUE, type);
|
701
|
+
}
|
698
702
|
|
699
703
|
rb_ivar_set(self, id_gtype, SIZET2NUM(gtype));
|
700
704
|
|
@@ -1005,7 +1009,7 @@ Init_gobject_gtype(void)
|
|
1005
1009
|
|
1006
1010
|
RG_DEF_SMETHOD(try_convert, 1);
|
1007
1011
|
|
1008
|
-
|
1012
|
+
RG_DEF_SALIAS("[]", "new");
|
1009
1013
|
RG_DEF_METHOD(initialize, 1);
|
1010
1014
|
RG_DEF_METHOD(inspect, 0);
|
1011
1015
|
RG_DEF_METHOD_OPERATOR("<=>", type_compare, 1);
|
@@ -1047,6 +1051,7 @@ Init_gobject_gtype(void)
|
|
1047
1051
|
{
|
1048
1052
|
VALUE ary = rb_ary_new();
|
1049
1053
|
rb_define_const(RG_TARGET_NAMESPACE, "FUNDAMENTAL_MAX", INT2FIX(G_TYPE_FUNDAMENTAL_MAX));
|
1054
|
+
_def_fundamental_type(ary, G_TYPE_INVALID, "INVALID");
|
1050
1055
|
_def_fundamental_type(ary, G_TYPE_NONE, "NONE");
|
1051
1056
|
_def_fundamental_type(ary, G_TYPE_INTERFACE, "INTERFACE");
|
1052
1057
|
_def_fundamental_type(ary, G_TYPE_CHAR, "CHAR");
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2002-2023 Ruby-GNOME Project Team
|
5
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
5
|
*
|
7
6
|
* This library is free software; you can redistribute it and/or
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2002-2006 Ruby-GNOME Project Team
|
3
|
+
* Copyright (C) 2002-2023 Ruby-GNOME Project Team
|
5
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
5
|
*
|
7
6
|
* This library is free software; you can redistribute it and/or
|
@@ -175,6 +174,11 @@ Init_gobject_typeinterface(void)
|
|
175
174
|
{
|
176
175
|
RG_TARGET_NAMESPACE = rb_define_module_under(rbg_mGLib(), "MetaInterface");
|
177
176
|
rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
|
177
|
+
rbg_define_method(RG_TARGET_NAMESPACE,
|
178
|
+
"to_s",
|
179
|
+
rbgutil_generic_s_to_s_gtype_name_fallback,
|
180
|
+
0);
|
181
|
+
RG_DEF_ALIAS("inspect", "to_s");
|
178
182
|
RG_DEF_METHOD(append_features, 1);
|
179
183
|
RG_DEF_METHOD(included, 1);
|
180
184
|
RG_DEF_METHOD(install_property, 1);
|
data/ext/glib2/rbgprivate.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2007-
|
3
|
+
* Copyright (C) 2007-2024 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
|
@@ -21,15 +21,14 @@
|
|
21
21
|
#pragma once
|
22
22
|
|
23
23
|
/*
|
24
|
-
* CentOS 7: GLib 2.
|
24
|
+
* CentOS 7: GLib 2.56
|
25
25
|
* AlmaLinux 8: GLib 2.56
|
26
26
|
* AlmaLinux 9: GLib 2.68
|
27
|
-
* Ubuntu 18.04: GLib 2.56
|
28
27
|
* Ubuntu 20.04: GLib 2.64
|
29
28
|
* Ubuntu 22.04: GLib 2.72
|
30
29
|
*/
|
31
30
|
#ifndef GLIB_VERSION_MIN_REQUIRED
|
32
|
-
# define GLIB_VERSION_MIN_REQUIRED
|
31
|
+
# define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56
|
33
32
|
#endif
|
34
33
|
|
35
34
|
#define G_LOG_DOMAIN "Ruby/GLib2"
|
@@ -80,6 +79,7 @@ extern VALUE rbgobj_cObject;
|
|
80
79
|
|
81
80
|
extern VALUE rbgobj_cInstantiatable;
|
82
81
|
extern VALUE rbgobj_mMetaInterface;
|
82
|
+
extern VALUE rbgobj_mMetaSignal;
|
83
83
|
#define cInstantiatable rbgobj_cInstantiatable
|
84
84
|
#define mMetaInterface rbgobj_mMetaInterface
|
85
85
|
|
@@ -108,6 +108,8 @@ VALUE rbgutil_generic_gtype(VALUE self);
|
|
108
108
|
#define generic_s_gtype rbgutil_generic_s_gtype
|
109
109
|
#define generic_gtype rbgutil_generic_gtype
|
110
110
|
|
111
|
+
VALUE rbgutil_generic_s_to_s_gtype_name_fallback(VALUE klass);
|
112
|
+
|
111
113
|
extern gboolean rbgobj_convert_has_type(GType type);
|
112
114
|
extern RGConvertTable *rbgobj_convert_lookup(GType type);
|
113
115
|
|
data/ext/glib2/rbgutil.c
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-2004
|
3
|
+
* Copyright (C) 2011-2023 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2004 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
|
@@ -132,6 +132,17 @@ rbgutil_generic_gtype(VALUE self)
|
|
132
132
|
return generic_s_gtype(CLASS_OF(self));
|
133
133
|
}
|
134
134
|
|
135
|
+
VALUE
|
136
|
+
rbgutil_generic_s_to_s_gtype_name_fallback(VALUE klass)
|
137
|
+
{
|
138
|
+
VALUE rb_name = rb_funcall(klass, rb_intern("name"), 0);
|
139
|
+
if (NIL_P(rb_name)) {
|
140
|
+
return rb_str_new_cstr(g_type_name(CLASS2GTYPE(klass)));
|
141
|
+
} else {
|
142
|
+
return rb_call_super(0, NULL);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
135
146
|
VALUE
|
136
147
|
rbgutil_string_set_utf8_encoding(VALUE string)
|
137
148
|
{
|
data/ext/glib2/rbgutil.h
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-2023 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -55,6 +55,8 @@ G_BEGIN_DECLS
|
|
55
55
|
#define RG_DEF_ATTR(attr, read, write, ex) \
|
56
56
|
rb_attr(RG_TARGET_NAMESPACE, rb_intern(attr), read, write, ex)
|
57
57
|
#define RG_DEF_ALIAS(new, old) rb_define_alias(RG_TARGET_NAMESPACE, new, old)
|
58
|
+
#define RG_DEF_SALIAS(new, old) \
|
59
|
+
rb_define_alias(rb_class_of(RG_TARGET_NAMESPACE), new, old)
|
58
60
|
#define RG_DEF_PRIVATE_METHOD(method, argc) \
|
59
61
|
rbg_define_private_method(RG_TARGET_NAMESPACE, #method, rg_ ## method, argc)
|
60
62
|
|
@@ -108,7 +110,7 @@ extern GSource *rbg_interrupt_source_new(void);
|
|
108
110
|
|
109
111
|
extern gchar *rbg_name_to_nick(const gchar *name);
|
110
112
|
|
111
|
-
extern void *rbg_memzero(void *
|
113
|
+
extern void *rbg_memzero(void *pointer, size_t size);
|
112
114
|
|
113
115
|
/*< protected >*/
|
114
116
|
RUBY_GLIB2_VAR ID rbgutil_id_module_eval;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (C) 2024 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 TimeZone
|
19
|
+
class << self
|
20
|
+
def try_convert(value)
|
21
|
+
case value
|
22
|
+
when String
|
23
|
+
new(value)
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/glib2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2005-
|
1
|
+
# Copyright (C) 2005-2024 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
|
@@ -120,7 +120,7 @@ module GLib
|
|
120
120
|
SIGNAL_HANDLER_PREFIX = "signal_do_"
|
121
121
|
VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX = "virtual_do_"
|
122
122
|
|
123
|
-
module
|
123
|
+
module MetaSignal
|
124
124
|
class << self
|
125
125
|
def signal_callback(klass, name)
|
126
126
|
lambda do |instance, *args|
|
@@ -187,8 +187,8 @@ module GLib
|
|
187
187
|
|
188
188
|
class Type
|
189
189
|
|
190
|
-
def
|
191
|
-
[self] + children.map{|t| t.
|
190
|
+
def descendants
|
191
|
+
[self] + children.map{|t| t.descendants }.flatten
|
192
192
|
end
|
193
193
|
|
194
194
|
def ancestors
|
@@ -340,6 +340,7 @@ require "glib2/deprecated"
|
|
340
340
|
|
341
341
|
require "glib2/date-time"
|
342
342
|
require "glib2/regex"
|
343
|
+
require "glib2/time-zone"
|
343
344
|
require "glib2/variant"
|
344
345
|
|
345
346
|
=begin
|
data/sample/timer.rb
CHANGED
@@ -22,10 +22,10 @@ sleep(3)
|
|
22
22
|
|
23
23
|
puts "after 3 sec (status = running) : #{timer.elapsed}"
|
24
24
|
timer.stop
|
25
|
-
puts "stop (status =
|
25
|
+
puts "stop (status = stopped) : #{timer.elapsed}"
|
26
26
|
|
27
27
|
sleep(3)
|
28
|
-
puts "after 3 sec (status =
|
28
|
+
puts "after 3 sec (status = stopped) : #{timer.elapsed}"
|
29
29
|
|
30
30
|
timer.continue
|
31
31
|
puts "continue (status = running) : #{timer.elapsed}"
|
data/test/test-regex.rb
CHANGED
@@ -48,33 +48,33 @@ class TestRegex < Test::Unit::TestCase
|
|
48
48
|
test "no options" do
|
49
49
|
regex = GLib::Regex.new("\s")
|
50
50
|
string_to_split = "a bc"
|
51
|
-
|
52
|
-
assert_equal(["a", "bc"],
|
51
|
+
split_strings = regex.split(string_to_split)
|
52
|
+
assert_equal(["a", "bc"], split_strings)
|
53
53
|
end
|
54
54
|
|
55
55
|
test "start_position" do
|
56
56
|
regex = GLib::Regex.new("\s")
|
57
57
|
string_to_split = "a bc"
|
58
|
-
|
59
|
-
assert_equal(["bc"],
|
58
|
+
split_strings = regex.split(string_to_split, :start_position => 2)
|
59
|
+
assert_equal(["bc"], split_strings)
|
60
60
|
end
|
61
61
|
|
62
62
|
test "max_tokens" do
|
63
63
|
regex = GLib::Regex.new("\s")
|
64
64
|
string_to_split = "a bc de fg"
|
65
|
-
|
66
|
-
assert_equal(["a", "bc de fg"],
|
65
|
+
split_strings = regex.split(string_to_split, :max_tokens => 2)
|
66
|
+
assert_equal(["a", "bc de fg"], split_strings)
|
67
67
|
end
|
68
68
|
|
69
69
|
test "match_options" do
|
70
70
|
regex = GLib::Regex.new("a?b?")
|
71
71
|
string_to_split = "toto ab"
|
72
|
-
|
72
|
+
split_strings = regex.split(string_to_split)
|
73
73
|
assert_equal(["t", "o", "t", "o", " "],
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
assert_equal(["toto ", ""],
|
74
|
+
split_strings)
|
75
|
+
split_strings = regex.split(string_to_split,
|
76
|
+
:match_options => :notempty)
|
77
|
+
assert_equal(["toto ", ""], split_strings)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -237,18 +237,18 @@ class TestRegex < Test::Unit::TestCase
|
|
237
237
|
|
238
238
|
sub_test_case "split simple" do
|
239
239
|
test "no options" do
|
240
|
-
|
241
|
-
assert_equal(["a", "bc"],
|
240
|
+
split_strings = GLib::Regex.split("\s", "a bc")
|
241
|
+
assert_equal(["a", "bc"], split_strings)
|
242
242
|
end
|
243
243
|
|
244
244
|
test "match_options" do
|
245
|
-
|
246
|
-
assert_equal(["t", "o", "t", "o", " "],
|
245
|
+
split_strings = GLib::Regex.split("a?b?", "toto ab")
|
246
|
+
assert_equal(["t", "o", "t", "o", " "], split_strings)
|
247
247
|
|
248
|
-
|
248
|
+
split_strings = GLib::Regex.split("a?b?",
|
249
249
|
"toto ab",
|
250
250
|
:match_options => :notempty)
|
251
|
-
assert_equal(["toto ", ""],
|
251
|
+
assert_equal(["toto ", ""], split_strings)
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
data/test/test-time-zone.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016-
|
1
|
+
# Copyright (C) 2016-2024 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
|
@@ -30,4 +30,10 @@ class TestTimeZone < Test::Unit::TestCase
|
|
30
30
|
assert_equal(utc_1.offset(0), utc_2.offset(0))
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
def test_identifier
|
35
|
+
only_glib_version(2, 58, 0)
|
36
|
+
utc = GLib::TimeZone.new("UTC")
|
37
|
+
assert_equal("UTC", utc.identifier)
|
38
|
+
end
|
33
39
|
end
|
data/test/test-type.rb
CHANGED
@@ -17,7 +17,8 @@
|
|
17
17
|
class TestGLibType < Test::Unit::TestCase
|
18
18
|
sub_test_case(".try_convert") do
|
19
19
|
def test_nil
|
20
|
-
|
20
|
+
assert_equal(GLib::Type::INVALID,
|
21
|
+
GLib::Type.try_convert(nil))
|
21
22
|
end
|
22
23
|
|
23
24
|
def test_type
|
@@ -48,4 +49,11 @@ class TestGLibType < Test::Unit::TestCase
|
|
48
49
|
assert_nil(GLib::Type.try_convert([]))
|
49
50
|
end
|
50
51
|
end
|
52
|
+
|
53
|
+
sub_test_case(".[]") do
|
54
|
+
def test_nil
|
55
|
+
assert_equal(GLib::Type::INVALID,
|
56
|
+
GLib::Type[nil])
|
57
|
+
end
|
58
|
+
end
|
51
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: pkg-config
|
@@ -148,6 +147,7 @@ files:
|
|
148
147
|
- lib/glib2/deprecatable.rb
|
149
148
|
- lib/glib2/deprecated.rb
|
150
149
|
- lib/glib2/regex.rb
|
150
|
+
- lib/glib2/time-zone.rb
|
151
151
|
- lib/glib2/variant.rb
|
152
152
|
- lib/glib2/version.rb
|
153
153
|
- lib/gnome/rake/external-package.rb
|
@@ -210,7 +210,6 @@ licenses:
|
|
210
210
|
- LGPL-2.1+
|
211
211
|
metadata:
|
212
212
|
msys2_mingw_dependencies: glib2
|
213
|
-
post_install_message:
|
214
213
|
rdoc_options: []
|
215
214
|
require_paths:
|
216
215
|
- lib
|
@@ -225,8 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
224
|
- !ruby/object:Gem::Version
|
226
225
|
version: '0'
|
227
226
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
229
|
-
signing_key:
|
227
|
+
rubygems_version: 3.6.0.dev
|
230
228
|
specification_version: 4
|
231
229
|
summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
|
232
230
|
test_files: []
|