glib2 3.3.0 → 3.3.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: 42560ee70c7312fba3da7de85a532df79ee25bf3e5b4349cd1fedffab6456b4d
4
- data.tar.gz: 0641f51f740794a4e5e766b4984b2cd2b7fdd614443c144b1515f6319f52065f
3
+ metadata.gz: ef469f628bed077a10e35ecb3522c274fe83d980616c75efd2730bcfef0d0c29
4
+ data.tar.gz: 20cadc5036763bb2c79d3acb439dda77a645088725ed30578a3fcbd1fade69b6
5
5
  SHA512:
6
- metadata.gz: 1e17958d37d49057439955c13049dd29b5b1ba935ec413f507de857fcb4c0696c0fef6dbfcd8577f7906b9647ba49f9016b95fcaf87b66f6bc42d90cfa64c737
7
- data.tar.gz: 4b13605e314b55f1319c76bc641a5299ffc596eb1dbbe5d8d5d28bee5c5226e1478406e54b6999007b62c882f84b3d31bf49dc32cdee33f81c217aae96215f0b
6
+ metadata.gz: 4546a38b2fa84f5d0b361d731501bd808243d8536764aeea6d93526b446895099a576950b8c7384e69c57b56af4da07088ac78ade8f1c9b48b64c30603d1de5f
7
+ data.tar.gz: 8cb1ed8bce4fb173ac04ac38e9746e3099cf746ce86d7b7ec583dd601e4c74310a9d452f161e1b85a810561481100ebe386a9ef3e5aa7430440b36c32fda98cc
data/Rakefile CHANGED
@@ -17,194 +17,10 @@
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
19
  $LOAD_PATH.unshift("./lib")
20
- require 'gnome2/rake/package-task'
21
-
22
- bin_dir = nil
23
- include_dir = nil
24
- glib2_include_dir = nil
25
- libffi_lib_dir = nil
26
-
27
- build_host = nil
20
+ require "gnome2/rake/package-task"
28
21
 
29
22
  package_name = File.basename(__dir__)
30
23
  spec = Gem::Specification.load("#{package_name}.gemspec")
31
24
 
32
- package_task = GNOME2::Rake::PackageTask.new(spec, __dir__) do |package|
33
- bin_dir = (package.windows.absolute_binary_dir + "bin").to_s
34
- include_dir = (package.windows.absolute_binary_dir + "include").to_s
35
- glib2_include_dir = File.join(include_dir, "glib-2.0")
36
- libffi_lib_dir = (package.windows.absolute_binary_dir + "lib").to_s
37
-
38
- build_host = package.windows.build_host
39
-
40
- package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
41
- package.windows.packages = []
42
- package.windows.dependencies = []
43
- package.external_packages = [
44
- {
45
- :name => "libiconv",
46
- :download_site => :gnu,
47
- :label => "libiconv",
48
- :version => "1.15",
49
- :windows => {
50
- :built_file => "bin/libiconv-2.dll",
51
- },
52
- },
53
- {
54
- :name => "gettext",
55
- :download_site => :gnu,
56
- :label => "gettext-runtime",
57
- :version => "0.19.8.1",
58
- :base_dir_in_package => "gettext-runtime",
59
- :windows => {
60
- :built_file => "bin/libintl-8.dll",
61
- },
62
- },
63
- {
64
- :name => "libffi",
65
- :download_base_url => "ftp://sourceware.org/pub/libffi",
66
- :label => "libffi",
67
- :version => "3.2.1",
68
- :windows => {
69
- :built_file => "bin/libffi-6.dll",
70
- },
71
- },
72
- {
73
- :name => "pcre",
74
- :download_base_url => "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre",
75
- :label => "PCRE",
76
- :version => "8.40",
77
- :windows => {
78
- :configure_args => [
79
- "--enable-unicode-properties",
80
- ],
81
- :built_file => "bin/libpcre-1.dll",
82
- },
83
- },
84
- {
85
- :name => "glib",
86
- :download_site => :gnome,
87
- :label => "GLib",
88
- :version => "2.58.1",
89
- :compression_method => "xz",
90
- :windows => {
91
- :built_file => "bin/libglib-2.0-0.dll",
92
- },
93
- },
94
- {
95
- :name => "gmp",
96
- :download_site => :gnu,
97
- :label => "GNU MP",
98
- :version => "6.1.2",
99
- :compression_method => "xz",
100
- :windows => {
101
- :configure_args => [
102
- "--disable-static",
103
- "--enable-shared",
104
- ],
105
- :built_file => "bin/libgmp-10.dll",
106
- },
107
- },
108
- {
109
- :name => "nettle",
110
- :download_base_url => "http://www.lysator.liu.se/~nisse/archive",
111
- :label => "Nettle",
112
- :version => "3.2",
113
- :windows => {
114
- :configure_args => [],
115
- :built_file => "bin/libnettle-6-2.dll",
116
- },
117
- },
118
- {
119
- :name => "libtasn1",
120
- :download_site => :gnu,
121
- :label => "Libtasn1",
122
- :version => "4.13",
123
- :windows => {
124
- :built_file => "bin/libtasn1-6.dll",
125
- },
126
- },
127
- {
128
- :name => "libidn2",
129
- :download_site => :gnu,
130
- :download_name => "libidn",
131
- :label => "Libidn2",
132
- :version => "2.0.5",
133
- :windows => {
134
- :built_file => "bin/libidn2-0.dll",
135
- },
136
- },
137
- {
138
- :name => "p11-glue/p11-kit",
139
- :download_site => :github,
140
- :label => "p11-kit",
141
- :version => "0.23.14",
142
- :windows => {
143
- :built_file => "bin/libp11-kit-0.dll",
144
- },
145
- },
146
- {
147
- :name => "gnutls",
148
- :download_base_url => "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4",
149
- :label => "GnuTLS",
150
- :version => "3.4.10",
151
- :compression_method => "xz",
152
- :windows => {
153
- :configure_args => [
154
- "--disable-cxx",
155
- "--disable-tools",
156
- "--disable-doc",
157
- ],
158
- :use_cc_environment_variable => false,
159
- :patches => [
160
- ],
161
- :built_file => "bin/libgnutls-30.dll",
162
- },
163
- },
164
- {
165
- :name => "glib-networking",
166
- :download_site => :gnome,
167
- :label => "glib-networking",
168
- :version => "2.58.0",
169
- :compression_method => "xz",
170
- :windows => {
171
- :meson_args => [
172
- "-Dlibproxy_support=false",
173
- "-Dgnome_proxy_support=false",
174
- ],
175
- :built_file => "lib/gio/modules/libgiognutls.dll",
176
- },
177
- },
178
- ]
179
- package.cross_compiling do |spec|
180
- if /mingw|mswin/ =~ spec.platform.to_s
181
- spec.add_runtime_dependency("cairo", ">= 1.15.9")
182
- end
183
- end
184
- end
185
- package_task.define
186
-
187
- namespace :windows do
188
- namespace :glib do
189
- pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig"
190
- pc_path = pkg_config_dir + "glib-2.0.pc"
191
- patched_path = pkg_config_dir + "patched"
192
- file patched_path.to_s do
193
- original_pc = pc_path.read
194
- new_pc = original_pc.gsub(/^Cflags:/) do |matched|
195
- "#{matched} -I${includedir}"
196
- end
197
- pc_path.open("w") do |pc_file|
198
- pc_file.write(new_pc)
199
- end
200
- touch(patched_path)
201
- end
202
-
203
- desc "Add include path for libintl.h"
204
- task :cross => patched_path.to_s
205
- end
206
-
207
- namespace :builder do
208
- task :after => "windows:glib:cross"
209
- end
25
+ GNOME2::Rake::PackageTask.define(spec, __dir__) do |package|
210
26
  end
@@ -19,11 +19,4 @@
19
19
  * MA 02110-1301 USA
20
20
  */
21
21
 
22
- #ifndef __RBGCOMPAT_H__
23
- #define __RBGCOMPAT_H__
24
-
25
- G_BEGIN_DECLS
26
-
27
- G_END_DECLS
28
-
29
- #endif
22
+ #pragma once
@@ -23,7 +23,9 @@
23
23
  static GHashTable *rbg_objects = NULL;
24
24
 
25
25
  static void
26
- gc_marker_mark_each(gpointer key, gpointer value, gpointer user_data)
26
+ gc_marker_mark_each(G_GNUC_UNUSED gpointer key,
27
+ gpointer value,
28
+ G_GNUC_UNUSED gpointer user_data)
27
29
  {
28
30
  VALUE rb_object = (VALUE)value;
29
31
  rb_gc_mark(rb_object);
@@ -41,7 +43,9 @@ gc_marker_free(void *data)
41
43
  {
42
44
  GHashTable *hash_table = data;
43
45
  g_hash_table_unref(hash_table);
44
- rbg_objects = NULL;
46
+ if (hash_table == rbg_objects) {
47
+ rbg_objects = NULL;
48
+ }
45
49
  }
46
50
 
47
51
  static const rb_data_type_t rbg_gc_marker_type = {
@@ -76,14 +80,75 @@ rbg_gc_unguard(gpointer key)
76
80
  g_hash_table_remove(rbg_objects, key);
77
81
  }
78
82
 
83
+ static VALUE
84
+ rbg_gc_marker_new_raw(GHashTable *rb_objects)
85
+ {
86
+ VALUE gc_marker;
87
+
88
+ gc_marker = TypedData_Wrap_Struct(rb_cData,
89
+ &rbg_gc_marker_type,
90
+ rb_objects);
91
+ return gc_marker;
92
+ }
93
+
94
+ VALUE
95
+ rbg_gc_marker_new(void)
96
+ {
97
+ GHashTable *rb_objects;
98
+
99
+ rb_objects = g_hash_table_new(g_direct_hash, g_direct_equal);
100
+ return rbg_gc_marker_new_raw(rb_objects);
101
+ }
102
+
103
+ void
104
+ rbg_gc_marker_guard(VALUE rb_gc_marker, VALUE rb_object)
105
+ {
106
+ GHashTable *rb_objects;
107
+
108
+ TypedData_Get_Struct(rb_gc_marker,
109
+ GHashTable,
110
+ &rbg_gc_marker_type,
111
+ rb_objects);
112
+ g_hash_table_insert(rb_objects,
113
+ (gpointer)rb_object,
114
+ (gpointer)rb_object);
115
+ }
116
+
117
+ void
118
+ rbg_gc_marker_unguard(VALUE rb_gc_marker, VALUE rb_object)
119
+ {
120
+ GHashTable *rb_objects;
121
+
122
+ if (!RB_TYPE_P(rb_gc_marker, RUBY_T_DATA))
123
+ return;
124
+ if (!RTYPEDDATA_P(rb_gc_marker))
125
+ return;
126
+
127
+ TypedData_Get_Struct(rb_gc_marker,
128
+ GHashTable,
129
+ &rbg_gc_marker_type,
130
+ rb_objects);
131
+ g_hash_table_remove(rb_objects, (gpointer)rb_object);
132
+ }
133
+
134
+ void
135
+ rbg_gc_marker_unguard_all(VALUE rb_gc_marker)
136
+ {
137
+ GHashTable *rb_objects;
138
+
139
+ TypedData_Get_Struct(rb_gc_marker,
140
+ GHashTable,
141
+ &rbg_gc_marker_type,
142
+ rb_objects);
143
+ g_hash_table_remove_all(rb_objects);
144
+ }
145
+
79
146
  void
80
147
  Init_glib_gc(void)
81
148
  {
82
149
  VALUE gc_marker;
83
150
 
84
151
  rbg_objects = g_hash_table_new(g_direct_hash, g_direct_equal);
85
- gc_marker = TypedData_Wrap_Struct(rb_cData,
86
- &rbg_gc_marker_type,
87
- rbg_objects);
152
+ gc_marker = rbg_gc_marker_new_raw(rbg_objects);
88
153
  rb_ivar_set(mGLib, rb_intern("gc_marker"), gc_marker);
89
154
  }
data/ext/glib2/rbglib.h CHANGED
@@ -36,7 +36,7 @@ extern "C" {
36
36
 
37
37
  #define RBGLIB_MAJOR_VERSION 3
38
38
  #define RBGLIB_MINOR_VERSION 3
39
- #define RBGLIB_MICRO_VERSION 0
39
+ #define RBGLIB_MICRO_VERSION 1
40
40
 
41
41
  #ifndef RB_ZALLOC
42
42
  # ifdef ZALLOC
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -33,8 +33,6 @@ static ID id_poll_func;
33
33
  static ID id_call;
34
34
 
35
35
  static VALUE mGLibSource;
36
- static ID id__callbacks__;
37
- static GHashTable *callbacks_table;
38
36
 
39
37
  static GThread *main_thread;
40
38
 
@@ -123,10 +121,6 @@ restore_poll_func(G_GNUC_UNUSED VALUE data)
123
121
  static VALUE
124
122
  source_remove(G_GNUC_UNUSED VALUE self, VALUE tag)
125
123
  {
126
- VALUE callback;
127
- callback = G_GET_RELATIVE(mGLibSource, id__callbacks__, tag);
128
- G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, tag);
129
- g_hash_table_remove(callbacks_table, (gpointer)callback);
130
124
  return CBOOL2RVAL(g_source_remove(NUM2UINT(tag)));
131
125
  }
132
126
 
@@ -137,15 +131,21 @@ source_current_source(G_GNUC_UNUSED VALUE self)
137
131
  }
138
132
 
139
133
  static gboolean
140
- invoke_source_func(gpointer data)
134
+ source_func(gpointer data)
141
135
  {
142
136
  callback_info_t *info = (callback_info_t *)data;
143
- gboolean ret;
144
137
 
145
- ret = RVAL2CBOOL(rb_funcall(info->callback, id_call, 0));
146
- if (!ret)
147
- G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, UINT2NUM(info->id));
148
- return ret;
138
+ return RVAL2CBOOL(rb_funcall(info->callback, id_call, 0));
139
+ }
140
+
141
+ static void
142
+ source_destroy_notify(gpointer data)
143
+ {
144
+ callback_info_t *info = data;
145
+
146
+ rbgobj_remove_relative(mGLibSource, (ID)0, info->callback);
147
+
148
+ xfree(info);
149
149
  }
150
150
 
151
151
  /*****************************************/
@@ -420,13 +420,14 @@ timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
420
420
  priority = NIL_P(rb_priority) ? G_PRIORITY_DEFAULT : NUM2INT(rb_priority);
421
421
  info = ALLOC(callback_info_t);
422
422
  info->callback = func;
423
- id = g_timeout_add_full(priority, NUM2UINT(interval),
424
- (GSourceFunc)invoke_source_func,
425
- (gpointer)info, g_free);
423
+ id = g_timeout_add_full(priority,
424
+ NUM2UINT(interval),
425
+ source_func,
426
+ info,
427
+ source_destroy_notify);
426
428
  info->id = id;
427
429
  rb_id = UINT2NUM(id);
428
- G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id);
429
- g_hash_table_insert(callbacks_table, (gpointer)func, info);
430
+ rbgobj_add_relative(mGLibSource, func);
430
431
  return rb_id;
431
432
  }
432
433
 
@@ -446,13 +447,12 @@ timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
446
447
  info->callback = func;
447
448
  id = g_timeout_add_seconds_full(priority,
448
449
  NUM2UINT(interval),
449
- (GSourceFunc)invoke_source_func,
450
- (gpointer)info,
451
- g_free);
450
+ source_func,
451
+ info,
452
+ source_destroy_notify);
452
453
  info->id = id;
453
454
  rb_id = UINT2NUM(id);
454
- G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id);
455
- g_hash_table_insert(callbacks_table, (gpointer)func, info);
455
+ rbgobj_add_relative(mGLibSource, func);
456
456
  return rb_id;
457
457
  }
458
458
  #endif
@@ -484,26 +484,16 @@ idle_add(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
484
484
 
485
485
  info = ALLOC(callback_info_t);
486
486
  info->callback = func;
487
- id = g_idle_add_full(priority, (GSourceFunc)invoke_source_func,
488
- (gpointer)info, g_free);
487
+ id = g_idle_add_full(priority,
488
+ source_func,
489
+ info,
490
+ source_destroy_notify);
489
491
  info->id = id;
490
492
  rb_id = UINT2NUM(id);
491
- G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id);
492
- g_hash_table_insert(callbacks_table, (gpointer)func, info);
493
+ rbgobj_add_relative(mGLibSource, func);
493
494
  return rb_id;
494
495
  }
495
496
 
496
- static VALUE
497
- idle_remove(G_GNUC_UNUSED VALUE self, VALUE func)
498
- {
499
- callback_info_t *info;
500
-
501
- info = g_hash_table_lookup(callbacks_table, (gpointer)func);
502
- G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, UINT2NUM(info->id));
503
- g_hash_table_remove(callbacks_table, (gpointer)func);
504
- return CBOOL2RVAL(g_idle_remove_by_data((gpointer)info));
505
- }
506
-
507
497
  static VALUE
508
498
  child_watch_source_new(G_GNUC_UNUSED VALUE self, VALUE pid)
509
499
  {
@@ -535,8 +525,6 @@ Init_glib_main_context(void)
535
525
  VALUE child_watch = rb_define_module_under(mGLib, "ChildWatch");
536
526
 
537
527
  id_call = rb_intern("call");
538
- id__callbacks__ = rb_intern("__callbacks__");
539
- callbacks_table = g_hash_table_new(NULL, NULL);
540
528
 
541
529
  g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
542
530
 
@@ -584,7 +572,6 @@ Init_glib_main_context(void)
584
572
  #endif
585
573
  rbg_define_singleton_method(idle, "source_new", idle_source_new, 0);
586
574
  rbg_define_singleton_method(idle, "add", idle_add, -1);
587
- rbg_define_singleton_method(idle, "remove", idle_remove, 1);
588
575
 
589
576
  rbg_define_singleton_method(child_watch, "source_new", child_watch_source_new, 1);
590
577
  rbg_define_singleton_method(child_watch, "add", child_watch_add, 1);
@@ -23,12 +23,9 @@
23
23
  * MA 02110-1301 USA
24
24
  */
25
25
 
26
- #include "ruby.h"
27
26
  #include "rbgprivate.h"
28
27
  #include <ctype.h>
29
28
 
30
- #include "rbgprivate.h"
31
-
32
29
  static ID id_relatives;
33
30
  static ID id_delete;
34
31
  static ID id_module_eval;
@@ -191,16 +188,16 @@ rbgobj_add_relative(VALUE obj, VALUE relative)
191
188
  if (rb_obj_is_kind_of(obj, mGLibObject)) {
192
189
  rbgobj_object_add_relative(obj, relative);
193
190
  } else {
194
- VALUE hash = Qnil;
191
+ VALUE rb_gc_marker = Qnil;
195
192
 
196
193
  if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives)))
197
- hash = rb_ivar_get(obj, id_relatives);
194
+ rb_gc_marker = rb_ivar_get(obj, id_relatives);
198
195
 
199
- if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
200
- hash = rb_hash_new();
201
- rb_ivar_set(obj, id_relatives, hash);
196
+ if (NIL_P(rb_gc_marker)) {
197
+ rb_gc_marker = rbg_gc_marker_new();
198
+ rb_ivar_set(obj, id_relatives, rb_gc_marker);
202
199
  }
203
- rb_hash_aset(hash, relative, Qnil);
200
+ rbg_gc_marker_guard(rb_gc_marker, relative);
204
201
  }
205
202
  }
206
203
 
@@ -253,26 +250,34 @@ rbgobj_get_relative_removable(VALUE obj, ID obj_ivar_id, VALUE hash_key)
253
250
  }
254
251
 
255
252
  void
256
- rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key)
253
+ rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE relative)
257
254
  {
258
255
  static VALUE cGLibObject = Qnil;
259
256
  if (NIL_P(cGLibObject)) {
260
257
  cGLibObject = rb_const_get(mGLib, rb_intern("Object"));
261
258
  }
262
259
 
260
+ if (obj_ivar_id == (ID)0) {
261
+ obj_ivar_id = id_relatives;
262
+ }
263
+
263
264
  if ((obj_ivar_id == id_relatives || obj_ivar_id == rbgobj_id_children) &&
264
265
  rb_obj_is_kind_of(obj, cGLibObject)) {
265
- rbgobj_object_remove_relative(obj, hash_key);
266
+ rbgobj_object_remove_relative(obj, relative);
266
267
  } else {
267
- VALUE hash = Qnil;
268
+ VALUE rb_gc_marker = Qnil;
268
269
 
269
270
  if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
270
- hash = rb_ivar_get(obj, obj_ivar_id);
271
+ rb_gc_marker = rb_ivar_get(obj, obj_ivar_id);
271
272
 
272
- if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
273
+ if (NIL_P(rb_gc_marker)) {
273
274
  /* should not happen. */
275
+ } else if (RB_TYPE_P(rb_gc_marker, RUBY_T_HASH)) {
276
+ /* For backward compatibility. */
277
+ VALUE relatives = rb_gc_marker;
278
+ rb_funcall(relatives, id_delete, 1, relative);
274
279
  } else {
275
- rb_funcall(hash, id_delete, 1, hash_key);
280
+ rbg_gc_marker_unguard(rb_gc_marker, relative);
276
281
  }
277
282
  }
278
283
  }
@@ -20,17 +20,14 @@
20
20
  * MA 02110-1301 USA
21
21
  */
22
22
 
23
- #ifndef __RBGOBJECT_H__
24
- #define __RBGOBJECT_H__
23
+ #pragma once
25
24
 
26
25
  #include <glib-object.h>
27
- #include "ruby.h"
26
+ #include <ruby.h>
28
27
  #include "rbglib.h"
29
28
  #include "rbgutil.h"
30
29
 
31
- #ifdef __cplusplus
32
- extern "C" {
33
- #endif /* __cplusplus */
30
+ G_BEGIN_DECLS
34
31
 
35
32
  /* macros */
36
33
 
@@ -169,7 +166,7 @@ extern VALUE rbgobj_create_object(VALUE klass); /* deprecated */
169
166
 
170
167
  extern VALUE rbgobj_get_ruby_object_from_gobject(GObject* gobj, gboolean alloc);
171
168
 
172
- /* For Ruby/Gstreamer */
169
+ /* For Ruby/GObjectIntrospection */
173
170
  extern void rbgobj_gobject_initialize(VALUE obj, gpointer cobj);
174
171
 
175
172
  /* deprecated */
@@ -335,10 +332,6 @@ typedef struct {
335
332
 
336
333
  extern void rbgobj_convert_define(const RGConvertTable *table);
337
334
 
338
- #ifdef __cplusplus
339
- }
340
- #endif /* __cplusplus */
341
-
342
- #endif /* __RBGOBJECT_H__ */
335
+ G_END_DECLS
343
336
 
344
337
  #include "rbgcompat.h"
@@ -18,8 +18,7 @@
18
18
  * MA 02110-1301 USA
19
19
  */
20
20
 
21
- #ifndef __RBGPRIVATE_H__
22
- #define __RBGPRIVATE_H__
21
+ #pragma once
23
22
 
24
23
  /*
25
24
  * CentOS 6: GLib 2.28
@@ -123,6 +122,13 @@ G_GNUC_INTERNAL void rg_enum_add_constants(VALUE mod, GType enum_type, const gch
123
122
  G_GNUC_INTERNAL void rg_flags_add_constants(VALUE mod, GType flags_type, const gchar *strip_prefix);
124
123
  G_GNUC_INTERNAL char *rg_obj_constant_lookup(const char *name);
125
124
 
125
+ G_GNUC_INTERNAL VALUE rbg_gc_marker_new(void);
126
+ G_GNUC_INTERNAL void rbg_gc_marker_guard(VALUE rb_gc_marker,
127
+ VALUE rb_object);
128
+ G_GNUC_INTERNAL void rbg_gc_marker_unguard(VALUE rb_gc_marker,
129
+ VALUE rb_object);
130
+ G_GNUC_INTERNAL void rbg_gc_marker_unguard_all(VALUE rb_gc_marker);
131
+
126
132
  G_GNUC_INTERNAL void Init_glib_gc(void);
127
133
 
128
134
  G_GNUC_INTERNAL void Init_gutil(void);
@@ -189,5 +195,3 @@ G_GNUC_INTERNAL void Init_gobject_gtypemodule(void);
189
195
  G_GNUC_INTERNAL void Init_gobject_gbinding(void);
190
196
 
191
197
  G_END_DECLS
192
-
193
- #endif
data/ext/glib2/rbgutil.h CHANGED
@@ -19,19 +19,16 @@
19
19
  * MA 02110-1301 USA
20
20
  */
21
21
 
22
- #ifndef __RBGUTIL_H__
23
- #define __RBGUTIL_H__
22
+ #pragma once
24
23
 
25
24
  #include <glib-object.h>
26
- #include "ruby.h"
25
+ #include <ruby.h>
27
26
  #include <ruby/encoding.h>
28
27
  #include "rbglib.h"
29
28
  #include "rbgutil_list.h"
30
29
  #include "rbgutildeprecated.h"
31
30
 
32
- #ifdef __cplusplus
33
- extern "C" {
34
- #endif /* __cplusplus */
31
+ G_BEGIN_DECLS
35
32
 
36
33
  #define RG_DEF_MODFUNC(method, argc) \
37
34
  rb_define_module_function(RG_TARGET_NAMESPACE, #method, rg_m_ ## method, argc)
@@ -114,8 +111,4 @@ RUBY_GLIB2_VAR ID rbgutil_id_module_eval;
114
111
  extern void rbgutil_glibid_r2g_func(VALUE from, GValue* to);
115
112
  extern VALUE rbgutil_sym_g2r_func(const GValue *from);
116
113
 
117
- #ifdef __cplusplus
118
- }
119
- #endif /* __cplusplus */
120
-
121
- #endif /* __RBGUTIL_H__ */
114
+ G_END_DECLS
data/lib/glib2.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2005-2017 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2005-2018 Ruby-GNOME2 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
@@ -114,20 +114,7 @@ module GLib
114
114
  end
115
115
  end
116
116
 
117
-
118
- base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
119
- vendor_dir = base_dir + "vendor" + "local"
120
- if vendor_dir.exist?
121
- require "cairo"
122
- end
123
-
124
- GLib.prepend_dll_path(vendor_dir + "bin")
125
- begin
126
- major, minor, _ = RUBY_VERSION.split(/\./)
127
- require "#{major}.#{minor}/glib2.so"
128
- rescue LoadError
129
- require 'glib2.so'
130
- end
117
+ require "glib2.so"
131
118
 
132
119
  module GLib
133
120
  module MetaInterface
@@ -269,8 +256,9 @@ GLib::Log.set_log_domain(GLib::Object::LOG_DOMAIN)
269
256
  GLib::Log.set_log_domain(GLib::Thread::LOG_DOMAIN)
270
257
  GLib::Log.set_log_domain(GLib::Module::LOG_DOMAIN)
271
258
 
272
- require 'glib2/version'
259
+ require "glib2/version"
273
260
  require "glib2/regex"
261
+ require "glib2/deprecated"
274
262
  =begin
275
263
  Don't we need this?
276
264
  ObjectSpace.define_finalizer(GLib) {
@@ -0,0 +1,23 @@
1
+ # Copyright (C) 2018 Ruby-GNOME2 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
+ module Idle
19
+ extend GLib::Deprecatable
20
+ define_deprecated_singleton_method :remove,
21
+ warn: "Use 'GLib::Source.remove(id)'."
22
+ end
23
+ end
data/lib/glib2/version.rb CHANGED
@@ -32,6 +32,5 @@ module GLib
32
32
  (version <=> [major, minor, micro]) >= 0
33
33
  end
34
34
  end
35
-
36
35
  end
37
36
  end
data/lib/mkmf-gnome2.rb CHANGED
@@ -115,24 +115,10 @@ def windows_platform?
115
115
  /cygwin|mingw|mswin/ === RUBY_PLATFORM
116
116
  end
117
117
 
118
+ # For backward compatibility
118
119
  def setup_windows(target_name, base_dir=nil)
119
120
  checking_for(checking_message("Windows")) do
120
- if windows_platform?
121
- import_library_name = "libruby-#{target_name}.a"
122
- $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
123
- $cleanfiles << import_library_name
124
- base_dir ||= Pathname($0).dirname.parent.parent.expand_path
125
- base_dir = Pathname(base_dir) if base_dir.is_a?(String)
126
- binary_base_dir = base_dir + "vendor" + "local"
127
- if binary_base_dir.exist?
128
- $INCFLAGS += " -I#{binary_base_dir}/include"
129
- pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
130
- PKGConfig.add_path(pkg_config_dir.to_s)
131
- end
132
- true
133
- else
134
- false
135
- end
121
+ windows_platform?
136
122
  end
137
123
  end
138
124
  # For backward compatibility
@@ -214,16 +200,13 @@ def add_depend_package_path(target_name, target_source_dir, target_build_dir)
214
200
  $INCFLAGS = "-I#{target_build_dir} #{$INCFLAGS}"
215
201
  end
216
202
 
217
- if windows_platform?
218
- library_base_name = "ruby-#{target_name.gsub(/-/, '_')}"
219
- case RUBY_PLATFORM
220
- when /cygwin|mingw/
221
- $LDFLAGS << " -L#{target_build_dir}"
222
- $libs << " -l#{library_base_name}"
223
- when /mswin/
224
- $DLDFLAGS << " /libpath:#{target_build_dir}"
225
- $libs << " lib#{library_base_name}.lib"
226
- end
203
+ library_base_name = target_name.gsub(/-/, "_")
204
+ case RUBY_PLATFORM
205
+ when /cygwin|mingw/
206
+ $libs << " " << File.join(target_build_dir, "#{library_base_name}.so")
207
+ when /mswin/
208
+ $DLDFLAGS << " /libpath:#{target_build_dir}"
209
+ $libs << " #{library_base_name}-$(arch).lib"
227
210
  end
228
211
  end
229
212
 
@@ -473,7 +456,7 @@ def required_pkg_config_package(package_info, native_package_info=nil)
473
456
  else
474
457
  required_package_info = [package_info]
475
458
  end
476
- if required_package_info.include?("gobject-introspection-1.0")
459
+ if required_package_info[0] == "gobject-introspection-1.0"
477
460
  setup_homebrew_libffi
478
461
  end
479
462
  return true if PKGConfig.have_package(*required_package_info)
data/sample/keyfile.rb CHANGED
@@ -9,8 +9,6 @@
9
9
 
10
10
  require 'glib2'
11
11
 
12
- $KCODE = "U"
13
-
14
12
  #
15
13
  # Create a GLib::KeyFile
16
14
  #
@@ -18,14 +16,14 @@ kf = GLib::KeyFile.new
18
16
  kf.set_value("Group 1", "value", "Hello World")
19
17
  kf.set_comment("Group 1", nil, "This file is generated by keyfile.rb")
20
18
  kf.set_string("Group 1", "string", "Hello World\nRuby-GNOME2")
21
- kf.set_locale_string("Group 1", "locale_string", "ja", "こんにちわ世界")
19
+ kf.set_locale_string("Group 1", "locale_string", "ja", "こんにちは、世界")
22
20
  kf.set_locale_string("Group 1", "locale_string", "en", "Hello World")
23
21
  kf.set_boolean("Group 1", "boolean", true)
24
22
  kf.set_integer("Group 1", "integer", 1)
25
23
  kf.set_double("Group 1", "double", 1.0)
26
24
  kf.set_string_list("Group 2", "string_list", ["foo", "bar"])
27
- kf.set_locale_string_list("Group 2", "locale_string_list", "ja", ["こんにちわ", "世界"])
28
- kf.set_locale_string_list("Group 2", "locale_string_list", "en", ["Hellow", "World"])
25
+ kf.set_locale_string_list("Group 2", "locale_string_list", "ja", ["こんにちは", "世界"])
26
+ kf.set_locale_string_list("Group 2", "locale_string_list", "en", ["Hello", "World"])
29
27
  kf.set_boolean_list("Group 2", "boolean_list", [true, false])
30
28
  kf.set_integer_list("Group 2", "integer_list", [1, 2, 3])
31
29
  kf.set_double_list("Group 2", "double_list", [1.2, 1.3, 1.45])
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.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -147,6 +147,7 @@ files:
147
147
  - lib/glib-mkenums.rb
148
148
  - lib/glib2.rb
149
149
  - lib/glib2/deprecatable.rb
150
+ - lib/glib2/deprecated.rb
150
151
  - lib/glib2/regex.rb
151
152
  - lib/glib2/version.rb
152
153
  - lib/gnome2-raketask.rb
@@ -220,8 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  - !ruby/object:Gem::Version
221
222
  version: '0'
222
223
  requirements: []
223
- rubyforge_project:
224
- rubygems_version: 3.0.0.beta1
224
+ rubygems_version: 3.0.2
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.