glib2 3.4.3 → 3.5.1

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/ext/glib2/extconf.rb +1 -5
  4. data/ext/glib2/glib-enum-types.c +1233 -0
  5. data/ext/glib2/glib-enum-types.h +154 -0
  6. data/ext/glib2/glib2.def +2 -0
  7. data/ext/glib2/rbglib-bytes.c +1 -5
  8. data/ext/glib2/rbglib-gc.c +98 -52
  9. data/ext/glib2/rbglib-variant-type.c +1 -5
  10. data/ext/glib2/rbglib-variant.c +6 -7
  11. data/ext/glib2/rbglib.c +68 -1
  12. data/ext/glib2/rbglib.h +13 -3
  13. data/ext/glib2/rbglib_bookmarkfile.c +1 -1
  14. data/ext/glib2/rbglib_datetime.c +1 -5
  15. data/ext/glib2/rbglib_error.c +39 -12
  16. data/ext/glib2/rbglib_fileutils.c +1 -17
  17. data/ext/glib2/rbglib_iochannel.c +4 -4
  18. data/ext/glib2/rbglib_keyfile.c +1 -35
  19. data/ext/glib2/rbglib_maincontext.c +6 -32
  20. data/ext/glib2/rbglib_mainloop.c +2 -17
  21. data/ext/glib2/rbglib_matchinfo.c +1 -5
  22. data/ext/glib2/rbglib_messages.c +4 -5
  23. data/ext/glib2/rbglib_pollfd.c +1 -25
  24. data/ext/glib2/rbglib_regex.c +1 -13
  25. data/ext/glib2/rbglib_source.c +1 -39
  26. data/ext/glib2/rbglib_spawn.c +5 -10
  27. data/ext/glib2/rbglib_spawnerror.c +2 -2
  28. data/ext/glib2/rbglib_threads.c +2 -15
  29. data/ext/glib2/rbglib_timezone.c +1 -5
  30. data/ext/glib2/rbglib_unichar.c +46 -5
  31. data/ext/glib2/rbglib_unicode.c +1 -18
  32. data/ext/glib2/rbglib_utils.c +1 -14
  33. data/ext/glib2/rbglib_win32.c +3 -7
  34. data/ext/glib2/rbgobj_binding.c +1 -7
  35. data/ext/glib2/rbgobj_boxed.c +1 -1
  36. data/ext/glib2/rbgobj_closure.c +22 -9
  37. data/ext/glib2/rbgobj_enums.c +3 -2
  38. data/ext/glib2/rbgobj_flags.c +1 -1
  39. data/ext/glib2/rbgobj_object.c +117 -106
  40. data/ext/glib2/rbgobj_param.c +3 -9
  41. data/ext/glib2/rbgobj_paramspecs.c +6 -24
  42. data/ext/glib2/rbgobj_signal.c +105 -93
  43. data/ext/glib2/rbgobj_strv.c +2 -2
  44. data/ext/glib2/rbgobj_type.c +58 -67
  45. data/ext/glib2/rbgobj_typeinterface.c +38 -2
  46. data/ext/glib2/rbgobj_value.c +23 -8
  47. data/ext/glib2/rbgobj_valuetypes.c +14 -62
  48. data/ext/glib2/rbgobject.c +4 -6
  49. data/ext/glib2/rbgobject.h +2 -27
  50. data/ext/glib2/rbgprivate.h +10 -6
  51. data/ext/glib2/rbgutil.h +3 -2
  52. data/ext/glib2/rbgutil_callback.c +30 -27
  53. data/lib/glib2/deprecated.rb +22 -1
  54. data/lib/glib2.rb +54 -3
  55. data/lib/mkmf-gnome.rb +7 -6
  56. data/test/glib-test-utils.rb +22 -3
  57. data/test/run-test.rb +49 -15
  58. data/test/test-binding.rb +1 -11
  59. data/test/test-bytes.rb +1 -5
  60. data/test/test-date-time.rb +1 -3
  61. data/test/{glib-test-init.rb → test-error.rb} +25 -3
  62. data/test/test-file-utils.rb +1 -32
  63. data/test/test-iochannel.rb +3 -5
  64. data/test/test-key-file.rb +5 -6
  65. data/test/test-match-info.rb +1 -5
  66. data/test/test-regex.rb +1 -5
  67. data/test/test-source.rb +1 -14
  68. data/test/test-spawn.rb +4 -1
  69. data/test/test-time-zone.rb +1 -5
  70. data/test/test-timeout.rb +2 -3
  71. data/test/test-unicode.rb +16 -12
  72. data/test/test-utils.rb +2 -8
  73. data/test/test-variant-type.rb +1 -3
  74. data/test/test-win32.rb +6 -6
  75. metadata +6 -5
  76. data/ext/glib2/rbgobj_valuearray.c +0 -100
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2017 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2004 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -23,12 +23,19 @@
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 id_code_classes;
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;
31
36
 
37
+ G_DEFINE_QUARK(ruby-error-quark, rbgerr_ruby_error)
38
+
32
39
  VALUE
33
40
  rbgerr_gerror2exception(GError *error)
34
41
  {
@@ -42,13 +49,9 @@ rbgerr_gerror2exception(GError *error)
42
49
  exception_klass = rb_hash_aref(gerror_table, UINT2NUM(error->domain));
43
50
  if (NIL_P(exception_klass)) {
44
51
  exception_klass = generic_error;
45
- } else {
46
- VALUE code_class = Qnil;
47
- VALUE code_classes;
48
- code_classes = rb_ivar_get(exception_klass, id_code_classes);
49
- if (!NIL_P(code_classes)) {
50
- code_class = rb_hash_aref(code_classes, INT2NUM(error->code));
51
- }
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));
52
55
  if (!NIL_P(code_class)) {
53
56
  exception_klass = code_class;
54
57
  }
@@ -107,14 +110,19 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
107
110
  {
108
111
  VALUE error_class;
109
112
  VALUE code_classes;
113
+ VALUE rb_domain = rb_str_new_cstr(g_quark_to_string(domain));
114
+ rbgutil_string_set_utf8_encoding(rb_domain);
115
+ rb_obj_freeze(rb_domain);
110
116
 
111
117
  error_class = rb_define_class_under(module, name, parent);
112
- rb_include_module(error_class, error_info);
118
+ rb_define_const(error_class, name_CODE, Qnil);
119
+ rb_define_const(error_class, name_DOMAIN, rb_domain);
120
+ rb_prepend_module(error_class, error_info);
113
121
 
114
122
  rb_hash_aset(gerror_table, UINT2NUM(domain), error_class);
115
123
 
116
124
  code_classes = rb_hash_new();
117
- rb_ivar_set(error_class, id_code_classes, code_classes);
125
+ rb_define_const(error_class, name_CODE_CLASSES, code_classes);
118
126
 
119
127
  if (gtype != G_TYPE_INVALID) {
120
128
  GEnumClass* gclass = g_type_class_ref(gtype);
@@ -140,15 +148,28 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
140
148
  code_class_name,
141
149
  error_class);
142
150
  g_free(code_class_name);
151
+ rb_define_const(code_class, name_CODE, INT2NUM(entry->value));
152
+ rb_define_const(code_class, name_DOMAIN, rb_domain);
143
153
  rb_hash_aset(code_classes, INT2NUM(entry->value), code_class);
144
154
  }
145
155
 
146
156
  g_type_class_unref(gclass);
147
157
  }
148
158
 
159
+ rb_obj_freeze(code_classes);
160
+
149
161
  return error_class;
150
162
  }
151
163
 
164
+ static VALUE
165
+ rg_initialize(int argc, VALUE *argv, VALUE self)
166
+ {
167
+ VALUE klass = rb_obj_class(self);
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));
170
+ return rb_call_super(argc, argv);
171
+ }
172
+
152
173
  static VALUE
153
174
  rbg_error_to_ruby(const GValue *from)
154
175
  {
@@ -161,16 +182,22 @@ void
161
182
  Init_glib_error(void)
162
183
  {
163
184
  id_code = rb_intern("@code");
185
+ id_CODE = rb_intern(name_CODE);
164
186
  id_domain = rb_intern("@domain");
165
- id_code_classes = rb_intern("@code_classes");
187
+ id_DOMAIN = rb_intern(name_DOMAIN);
188
+ id_CODE_CLASSES = rb_intern(name_CODE_CLASSES);
166
189
  gerror_table = rb_hash_new();
167
190
  rb_global_variable(&gerror_table);
168
191
 
192
+ #define RG_TARGET_NAMESPACE error_info
169
193
  error_info = rb_define_module_under(mGLib, "ErrorInfo");
170
194
  rb_define_attr(error_info, "code", TRUE, FALSE);
171
195
  rb_define_attr(error_info, "domain", TRUE, FALSE);
196
+ RG_DEF_METHOD(initialize, -1);
172
197
 
173
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);
174
201
  rb_include_module(generic_error, error_info);
175
202
  }
176
203
 
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2004 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -49,15 +49,6 @@ void g_dir_rewind (GDir *dir);
49
49
  void g_dir_close (GDir *dir);
50
50
  */
51
51
 
52
- #if GLIB_CHECK_VERSION(2, 16, 0)
53
- static VALUE
54
- rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size)
55
- {
56
- return CSTR2RVAL_FREE(g_format_size_for_display(NUM2OFFT(size)));
57
- }
58
- #endif
59
-
60
- #if GLIB_CHECK_VERSION(2, 30, 0)
61
52
  static VALUE
62
53
  rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
63
54
  {
@@ -76,7 +67,6 @@ rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
76
67
  RVAL2GFORMATSIZEFLAGS(rb_flags)));
77
68
  }
78
69
  }
79
- #endif
80
70
 
81
71
  void
82
72
  Init_glib_fileutils(void)
@@ -108,12 +98,6 @@ Init_glib_fileutils(void)
108
98
  rb_define_const(RG_TARGET_NAMESPACE, "PERM", INT2NUM(G_FILE_ERROR_PERM));
109
99
  rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_FILE_ERROR_FAILED));
110
100
 
111
- #if GLIB_CHECK_VERSION(2, 16, 0)
112
- rbg_define_singleton_method(mGLib, "format_size_for_display",
113
- rbglib_m_format_size_for_display, 1);
114
- #endif
115
- #if GLIB_CHECK_VERSION(2, 30, 0)
116
101
  rbg_define_singleton_method(mGLib, "format_size",
117
102
  rbglib_m_format_size, -1);
118
- #endif
119
103
  }
@@ -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-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -84,7 +84,7 @@ rg_initialize(gint argc, VALUE *argv, VALUE self)
84
84
  }
85
85
 
86
86
  static VALUE
87
- ioc_close(VALUE self)
87
+ ioc_shutdown(VALUE self)
88
88
  {
89
89
  GError* err = NULL;
90
90
  GIOStatus status = g_io_channel_shutdown(_SELF(self), TRUE, &err);
@@ -114,7 +114,7 @@ rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
114
114
  #endif
115
115
  } else {
116
116
  GError* err = NULL;
117
- io = g_io_channel_new_file(RVAL2CSTR(arg1),
117
+ io = g_io_channel_new_file(RVAL2CSTR(arg1),
118
118
  NIL_P(arg2) ? "r" : RVAL2CSTR(arg2), &err);
119
119
 
120
120
  if (err != NULL) RAISE_GERROR(err);
@@ -123,7 +123,7 @@ rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
123
123
  rio = BOXED2RVAL(io, G_TYPE_IO_CHANNEL);
124
124
 
125
125
  if (rb_block_given_p()) {
126
- return rb_ensure(rb_yield, rio, ioc_close, rio);
126
+ return rb_ensure(rb_yield, rio, ioc_shutdown, rio);
127
127
  }
128
128
  return rio;
129
129
  }
@@ -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-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2006 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -21,34 +21,6 @@
21
21
 
22
22
  #include "rbgprivate.h"
23
23
 
24
- #if !GLIB_CHECK_VERSION(2,31,2)
25
- /************************************************/
26
- static GKeyFile*
27
- keyfile_copy(const GKeyFile* keyfile)
28
- {
29
- // GKeyFile* new_keyfile;
30
- g_return_val_if_fail (keyfile != NULL, NULL);
31
- /*
32
- new_keyfile = g_key_file_new();
33
- *new_keyfile = (GKeyFile*)*keyfile;
34
- return new_keyfile;
35
- */
36
- return (GKeyFile*)keyfile;
37
- }
38
-
39
- GType
40
- g_key_file_get_type(void)
41
- {
42
- static GType our_type = 0;
43
- if (our_type == 0)
44
- our_type = g_boxed_type_register_static("GKeyFile",
45
- (GBoxedCopyFunc)keyfile_copy,
46
- (GBoxedFreeFunc)g_key_file_free);
47
- return our_type;
48
- }
49
- /************************************************/
50
- #endif
51
-
52
24
  #define RG_TARGET_NAMESPACE cKeyFile
53
25
  #define _SELF(self) ((GKeyFile*)(RVAL2BOXED(self, G_TYPE_KEY_FILE)))
54
26
 
@@ -140,7 +112,6 @@ rg_load_from_data_dirs(int argc, VALUE *argv, VALUE self)
140
112
  return full_path ? CSTR2RVAL(full_path) : Qnil;
141
113
  }
142
114
 
143
- #if GLIB_CHECK_VERSION(2, 14, 0)
144
115
  static VALUE
145
116
  rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
146
117
  {
@@ -175,7 +146,6 @@ rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
175
146
 
176
147
  return CSTR2RVAL(full_path);
177
148
  }
178
- #endif
179
149
 
180
150
  static VALUE
181
151
  rg_to_data(VALUE self)
@@ -670,9 +640,7 @@ Init_glib_keyfile(void)
670
640
  RG_DEF_METHOD(load_from_file, -1);
671
641
  RG_DEF_METHOD(load_from_data, -1);
672
642
  RG_DEF_METHOD(load_from_data_dirs, -1);
673
- #if GLIB_CHECK_VERSION(2, 14, 0)
674
643
  RG_DEF_METHOD(load_from_dirs, -1);
675
- #endif
676
644
  RG_DEF_METHOD(to_data, 0);
677
645
  RG_DEF_METHOD(start_group, 0);
678
646
  RG_DEF_METHOD(groups, 0);
@@ -711,7 +679,6 @@ Init_glib_keyfile(void)
711
679
  G_DEF_CLASS(G_TYPE_KEY_FILE_FLAGS, "Flags", RG_TARGET_NAMESPACE);
712
680
  G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_KEY_FILE_FLAGS, "G_KEY_FILE_");
713
681
 
714
- #if GLIB_CHECK_VERSION(2, 14, 0)
715
682
  /* Defines for handling freedesktop.org Desktop files */
716
683
  rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_GROUP", CSTR2RVAL(G_KEY_FILE_DESKTOP_GROUP));
717
684
 
@@ -760,5 +727,4 @@ Init_glib_keyfile(void)
760
727
  CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_LINK));
761
728
  rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_DIRECTORY",
762
729
  CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_DIRECTORY));
763
- #endif
764
730
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
25
25
  # include <ruby/thread.h>
26
26
  #endif
27
27
 
28
- GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT;
28
+ GPrivate rg_polling_key = G_PRIVATE_INIT(NULL);
29
29
 
30
30
  /*
31
31
  static ID id_poll_func;
@@ -87,7 +87,7 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
87
87
  info.timeout = timeout;
88
88
  info.result = 0;
89
89
 
90
- g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL);
90
+ g_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE));
91
91
  if (g_thread_self() == main_thread) {
92
92
  #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
93
93
  rb_thread_call_without_gvl(rg_poll_in_blocking, &info,
@@ -99,7 +99,7 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
99
99
  } else {
100
100
  rg_poll_in_blocking_raw(&info);
101
101
  }
102
- g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
102
+ g_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE));
103
103
 
104
104
  return info.result;
105
105
  }
@@ -148,21 +148,6 @@ source_destroy_notify(gpointer data)
148
148
  xfree(info);
149
149
  }
150
150
 
151
- /*****************************************/
152
- #if !GLIB_CHECK_VERSION(2,30,0)
153
- GType
154
- g_main_context_get_type(void)
155
- {
156
- static GType our_type = 0;
157
- if (our_type == 0)
158
- our_type = g_boxed_type_register_static ("GMainContext",
159
- (GBoxedCopyFunc)g_main_context_ref,
160
- (GBoxedFreeFunc)g_main_context_unref);
161
- return our_type;
162
- }
163
- #endif
164
- /*****************************************/
165
-
166
151
  #define RG_TARGET_NAMESPACE cMainContext
167
152
  #define _SELF(s) ((GMainContext*)RVAL2BOXED(s, G_TYPE_MAIN_CONTEXT))
168
153
 
@@ -386,26 +371,23 @@ rg_remove_poll(VALUE self, VALUE fd)
386
371
  return self;
387
372
  }
388
373
 
389
- #ifdef HAVE_G_MAIN_DEPTH
390
374
  static VALUE
391
375
  rg_s_depth(G_GNUC_UNUSED VALUE self)
392
376
  {
393
377
  return INT2NUM(g_main_depth());
394
378
  }
395
- #endif
396
379
 
397
380
  static VALUE
398
381
  timeout_source_new(G_GNUC_UNUSED VALUE self, VALUE interval)
399
382
  {
400
383
  return BOXED2RVAL(g_timeout_source_new(NUM2UINT(interval)), G_TYPE_SOURCE);
401
384
  }
402
- #if GLIB_CHECK_VERSION(2,14,0)
385
+
403
386
  static VALUE
404
387
  timeout_source_new_seconds(G_GNUC_UNUSED VALUE self, VALUE interval)
405
388
  {
406
389
  return BOXED2RVAL(g_timeout_source_new_seconds(NUM2UINT(interval)), G_TYPE_SOURCE);
407
390
  }
408
- #endif
409
391
 
410
392
  static VALUE
411
393
  timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
@@ -431,7 +413,6 @@ timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
431
413
  return rb_id;
432
414
  }
433
415
 
434
- #if GLIB_CHECK_VERSION(2,14,0)
435
416
  static VALUE
436
417
  timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
437
418
  {
@@ -455,7 +436,6 @@ timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
455
436
  rbgobj_add_relative(mGLibSource, func);
456
437
  return rb_id;
457
438
  }
458
- #endif
459
439
 
460
440
  static VALUE
461
441
  idle_source_new(G_GNUC_UNUSED VALUE self)
@@ -526,7 +506,7 @@ Init_glib_main_context(void)
526
506
 
527
507
  id_call = rb_intern("call");
528
508
 
529
- g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
509
+ g_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE));
530
510
 
531
511
  main_thread = g_thread_self();
532
512
 
@@ -559,17 +539,11 @@ Init_glib_main_context(void)
559
539
  */
560
540
  RG_DEF_METHOD(add_poll, 2);
561
541
  RG_DEF_METHOD(remove_poll, 1);
562
- #ifdef HAVE_G_MAIN_DEPTH
563
542
  RG_DEF_SMETHOD(depth, 0);
564
- #endif
565
543
  rbg_define_singleton_method(timeout, "source_new", timeout_source_new, 1);
566
- #if GLIB_CHECK_VERSION(2,14,0)
567
544
  rbg_define_singleton_method(timeout, "source_new_seconds", timeout_source_new_seconds, 1);
568
- #endif
569
545
  rbg_define_singleton_method(timeout, "add", timeout_add, -1);
570
- #if GLIB_CHECK_VERSION(2,14,0)
571
546
  rbg_define_singleton_method(timeout, "add_seconds", timeout_add_seconds, -1);
572
- #endif
573
547
  rbg_define_singleton_method(idle, "source_new", idle_source_new, 0);
574
548
  rbg_define_singleton_method(idle, "add", idle_add, -1);
575
549
 
@@ -1,7 +1,7 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2005,2006 Masao Mutoh
3
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
4
+ * Copyright (C) 2005,2006 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
@@ -21,21 +21,6 @@
21
21
 
22
22
  #include "rbgprivate.h"
23
23
 
24
- /*****************************************/
25
- #if !GLIB_CHECK_VERSION(2,30,0)
26
- GType
27
- g_main_loop_get_type(void)
28
- {
29
- static GType our_type = 0;
30
- if (our_type == 0)
31
- our_type = g_boxed_type_register_static ("GMainLoop",
32
- (GBoxedCopyFunc)g_main_loop_ref,
33
- (GBoxedFreeFunc)g_main_loop_unref);
34
- return our_type;
35
- }
36
- #endif
37
- /*****************************************/
38
-
39
24
  #define RG_TARGET_NAMESPACE cMainLoop
40
25
  #define _SELF(s) ((GMainLoop*)RVAL2BOXED(s, G_TYPE_MAIN_LOOP))
41
26
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2015-2016 Ruby-GNOME2 Project Team
2
+ * Copyright (C) 2015-2021 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
@@ -22,7 +22,6 @@
22
22
  #define RG_TARGET_NAMESPACE cMatchInfo
23
23
  #define _SELF(s) ((GMatchInfo*)RVAL2BOXED(s, G_TYPE_MATCH_INFO))
24
24
 
25
- #if GLIB_CHECK_VERSION(2, 30, 0)
26
25
  static VALUE
27
26
  rg_regex(VALUE self)
28
27
  {
@@ -158,12 +157,10 @@ rg_expand_references(VALUE self, VALUE rb_string)
158
157
 
159
158
  return CSTR2RVAL_FREE(expanded_string);
160
159
  }
161
- #endif
162
160
 
163
161
  void
164
162
  Init_glib_matchinfo(void)
165
163
  {
166
- #if GLIB_CHECK_VERSION(2, 30, 0)
167
164
  VALUE RG_TARGET_NAMESPACE;
168
165
 
169
166
  RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MATCH_INFO, "MatchInfo", mGLib);
@@ -179,5 +176,4 @@ Init_glib_matchinfo(void)
179
176
  RG_DEF_METHOD(fetch_all, 0);
180
177
  RG_DEF_METHOD(next, 0);
181
178
  RG_DEF_METHOD(expand_references, 1);
182
- #endif
183
179
  }
@@ -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
- backtrace = rb_funcall(rb_mKernel, rb_intern("caller"), 0);
76
- rb_iterate(rb_each, backtrace,
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);
@@ -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-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -21,30 +21,6 @@
21
21
 
22
22
  #include "rbgprivate.h"
23
23
 
24
- #if !GLIB_CHECK_VERSION(2, 36, 0)
25
- static GPollFD*
26
- pollfd_copy(const GPollFD* pollfd)
27
- {
28
- GPollFD* new_pollfd;
29
- g_return_val_if_fail (pollfd != NULL, NULL);
30
-
31
- new_pollfd = g_new(GPollFD, 1);
32
- *new_pollfd = *pollfd;
33
- return new_pollfd;
34
- }
35
-
36
- GType
37
- g_pollfd_get_type(void)
38
- {
39
- static GType our_type = 0;
40
- if (our_type == 0)
41
- our_type = g_boxed_type_register_static ("GPollFD",
42
- (GBoxedCopyFunc)pollfd_copy,
43
- (GBoxedFreeFunc)g_free);
44
- return our_type;
45
- }
46
- #endif
47
-
48
24
  #define RG_TARGET_NAMESPACE cPollFD
49
25
  #define _SELF(s) ((GPollFD*)RVAL2BOXED(s, G_TYPE_POLLFD))
50
26
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2015-2019 Ruby-GNOME2 Project Team
2
+ * Copyright (C) 2015-2021 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
@@ -136,7 +136,6 @@ rg_split(gint argc, VALUE *argv, VALUE self)
136
136
  return STRV2RVAL_FREE(strings);
137
137
  }
138
138
 
139
- #if GLIB_CHECK_VERSION(2, 30, 0)
140
139
  static VALUE
141
140
  rg_match(gint argc, VALUE *argv, VALUE self)
142
141
  {
@@ -191,7 +190,6 @@ rg_match(gint argc, VALUE *argv, VALUE self)
191
190
  rb_iv_set(rb_match_info, "@string", rb_frozen_string);
192
191
  return rb_match_info;
193
192
  }
194
- #endif
195
193
 
196
194
  static VALUE
197
195
  rg_max_backref(VALUE self)
@@ -205,7 +203,6 @@ rg_capture_count(VALUE self)
205
203
  return INT2NUM(g_regex_get_capture_count(_SELF(self)));
206
204
  }
207
205
 
208
- #if GLIB_CHECK_VERSION(2, 34, 0)
209
206
  static VALUE
210
207
  rg_has_cr_or_lf_p(VALUE self)
211
208
  {
@@ -217,7 +214,6 @@ rg_max_lookbehind(VALUE self)
217
214
  {
218
215
  return INT2NUM(g_regex_get_max_lookbehind(_SELF(self)));
219
216
  }
220
- #endif
221
217
 
222
218
  static VALUE
223
219
  rg_string_number(VALUE self, VALUE string)
@@ -225,7 +221,6 @@ rg_string_number(VALUE self, VALUE string)
225
221
  return INT2NUM(g_regex_get_string_number(_SELF(self), RVAL2CSTR(string)));
226
222
  }
227
223
 
228
- #if GLIB_CHECK_VERSION(2, 30, 0)
229
224
  static VALUE
230
225
  rg_match_all(gint argc, VALUE *argv, VALUE self)
231
226
  {
@@ -423,7 +418,6 @@ rg_replace(gint argc, VALUE *argv, VALUE self)
423
418
 
424
419
  return CSTR2RVAL_FREE(modified_string);
425
420
  }
426
- #endif
427
421
 
428
422
  static VALUE
429
423
  rg_s_escape_string(G_GNUC_UNUSED VALUE self, VALUE string)
@@ -472,20 +466,14 @@ Init_glib_regex(void)
472
466
  RG_DEF_METHOD(compile_flags, 0);
473
467
  RG_DEF_METHOD(match_flags, 0);
474
468
  RG_DEF_METHOD(split, -1);
475
- #if GLIB_CHECK_VERSION(2, 30, 0)
476
469
  RG_DEF_METHOD(match, -1);
477
- #endif
478
470
  RG_DEF_METHOD(max_backref, 0);
479
471
  RG_DEF_METHOD(capture_count, 0);
480
- #if GLIB_CHECK_VERSION(2, 34, 0)
481
472
  RG_DEF_METHOD_P(has_cr_or_lf, 0);
482
473
  RG_DEF_METHOD(max_lookbehind, 0);
483
- #endif
484
474
  RG_DEF_METHOD(string_number, 1);
485
- #if GLIB_CHECK_VERSION(2, 30, 0)
486
475
  RG_DEF_METHOD(match_all, -1);
487
476
  RG_DEF_METHOD(replace, -1);
488
- #endif
489
477
 
490
478
  RG_DEF_SMETHOD(escape_string, 1);
491
479
  RG_DEF_SMETHOD(check_replacement, 1);