glib2 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1812eb3cf06d40dd8f6782704af94ae8bba43272e89d40f0775ab90f40977824
4
- data.tar.gz: 7c03f2c56640a2a17a6bdf7dbd74a83aa334105ad64be07dd6ee0dd2bd10aa49
3
+ metadata.gz: 880c60b1857d42be195a59210c7554cde027827815b0bab7c194c23ee2e90fd6
4
+ data.tar.gz: b8078d3598e4d413892cddf4fb5610fd52ab2bfe034f157e87af765e2570df07
5
5
  SHA512:
6
- metadata.gz: 6ab840f415951e0b3504c8c3f33f265d2908c9a6fcaf9a810490290e3bcb06f5baed4a241e51beb3052e0cd882a46948dbbd59d3119479721df47be1eecfbf73
7
- data.tar.gz: db5476956273f53e9e12d476b9a1c9718a809c27743a32992a7c4a43110fa9910bd7729716ca28a6c76101cbe8a84c5a39e2275c10fd836eeeaf522733cc44ce
6
+ metadata.gz: 71f855c543b4ce1895fa9ce2851b7442c4f40150233f383a574e72e1452aeda2bdc7fb2829f19ecd0c6b4fbfdcf160538e657364e203b4bc28a3ac8b941c0192
7
+ data.tar.gz: 5a29749b0b9d407f16131c0d12dd1a78457c71a69442095407600ef87318ebd01fffa872353de6d409c283c72ccf61c9b0518b15aeca5381b3571845d7ca1694
data/ext/glib2/rbglib.h CHANGED
@@ -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 0
36
+ #define RBGLIB_MICRO_VERSION 1
37
37
 
38
38
  #ifndef RB_ZALLOC
39
39
  # ifdef ZALLOC
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2016-2021 Ruby-GNOME Project Team
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
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2019 Ruby-GNOME Project Team
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);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2004-2019 Ruby-GNOME Project Team
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);
@@ -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
- /* deperecated */
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(int argc, VALUE *argv, VALUE self)
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
- class_name = rb_class2name(CLASS_OF(self));
709
- if (!holder->destroyed)
710
- s = g_strdup_printf("#<%s:%p ptr=%p>", class_name, (void *)self,
711
- holder->gobj);
712
- else
713
- s = g_strdup_printf("#<%s:%p destroyed>", class_name, (void *)self);
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
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2002-2022 Ruby-GNOME Project Team
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(mMetaInterface,
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
- rbg_define_method(mMetaInterface, "define_signal", gobj_s_define_signal, -1);
1058
- rb_define_alias(mMetaInterface, "signal_new", "define_signal");
1059
- rbg_define_method(mMetaInterface, "signals", gobj_s_signals, -1);
1060
- rbg_define_method(mMetaInterface, "signal", gobj_s_signal, 1);
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);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2002-2021 Ruby-GNOME Project Team
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 Qnil;
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 (RVAL2CBOOL(rb_obj_is_kind_of(type, rb_cInteger))) {
689
- gtype = NUM2SIZET(type);
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
- gtype = g_type_from_name(StringValuePtr(type));
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
- if (G_TYPE_INVALID == gtype)
697
- rb_raise(rb_eArgError, "invalid GType");
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
- rb_define_alias(CLASS_OF(RG_TARGET_NAMESPACE), "[]", "new");
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) 2011 Ruby-GNOME2 Project Team
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) 2011,2021 Ruby-GNOME Project Team
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);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2007-2022 Ruby-GNOME Project Team
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.50
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 GLIB_VERSION_2_50
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-2015 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2004 Masao Mutoh
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-2022 Ruby-GNOME Project Team
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 *poitner, size_t size);
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-2021 Ruby-GNOME Project Team
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 MetaInterface
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 decendants
191
- [self] + children.map{|t| t.decendants }.flatten
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 = stoped) : #{timer.elapsed}"
25
+ puts "stop (status = stopped) : #{timer.elapsed}"
26
26
 
27
27
  sleep(3)
28
- puts "after 3 sec (status = stoped) : #{timer.elapsed}"
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
- splited_strings = regex.split(string_to_split)
52
- assert_equal(["a", "bc"], splited_strings)
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
- splited_strings = regex.split(string_to_split, :start_position => 2)
59
- assert_equal(["bc"], splited_strings)
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
- splited_strings = regex.split(string_to_split, :max_tokens => 2)
66
- assert_equal(["a", "bc de fg"], splited_strings)
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
- splited_strings = regex.split(string_to_split)
72
+ split_strings = regex.split(string_to_split)
73
73
  assert_equal(["t", "o", "t", "o", " "],
74
- splited_strings)
75
- splited_strings = regex.split(string_to_split,
76
- :match_options => :notempty)
77
- assert_equal(["toto ", ""], splited_strings)
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
- splited_strings = GLib::Regex.split("\s", "a bc")
241
- assert_equal(["a", "bc"], splited_strings)
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
- splited_strings = GLib::Regex.split("a?b?", "toto ab")
246
- assert_equal(["t", "o", "t", "o", " "], splited_strings)
245
+ split_strings = GLib::Regex.split("a?b?", "toto ab")
246
+ assert_equal(["t", "o", "t", "o", " "], split_strings)
247
247
 
248
- splited_strings = GLib::Regex.split("a?b?",
248
+ split_strings = GLib::Regex.split("a?b?",
249
249
  "toto ab",
250
250
  :match_options => :notempty)
251
- assert_equal(["toto ", ""], splited_strings)
251
+ assert_equal(["toto ", ""], split_strings)
252
252
  end
253
253
  end
254
254
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016-2021 Ruby-GNOME Project Team
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
- assert_nil(GLib::Type.try_convert(nil))
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,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
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: 2023-08-19 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -148,6 +148,7 @@ files:
148
148
  - lib/glib2/deprecatable.rb
149
149
  - lib/glib2/deprecated.rb
150
150
  - lib/glib2/regex.rb
151
+ - lib/glib2/time-zone.rb
151
152
  - lib/glib2/variant.rb
152
153
  - lib/glib2/version.rb
153
154
  - lib/gnome/rake/external-package.rb
@@ -225,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
226
  - !ruby/object:Gem::Version
226
227
  version: '0'
227
228
  requirements: []
228
- rubygems_version: 3.5.0.dev
229
+ rubygems_version: 3.5.1
229
230
  signing_key:
230
231
  specification_version: 4
231
232
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.