glib2 3.1.1 → 3.1.2

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
  SHA1:
3
- metadata.gz: eaabbfe21ac69c6585d82b569ebd6f2da7b5d3d0
4
- data.tar.gz: 94bb5881c554caa65395f55ed06e1c1995e1b5d3
3
+ metadata.gz: 6d462be0e4a6a612ec2225e654bb2d0a904a5e32
4
+ data.tar.gz: 98c1268474602947218d0ca851a97c6f6eaec874
5
5
  SHA512:
6
- metadata.gz: 99c21a1c2345607bc0cf02c3573eb32c62fa6bf140e69ba3d17e6e507b6a4b0695a84870c4cccdbd750d423b60a70517ef181bf88550b5789df35f32f902da77
7
- data.tar.gz: 14bc39e43f8ca0079af6732cc041f1d7616704ef614d4660aa639539343fa6cd166d69d4eb8506c20347c944e9b61648a3fa7e972e2df6e7c6d02690cba8a92f
6
+ metadata.gz: 7b223daf9866e5a09a3406dcc8370c016ffa6dc3c71b62cfa5d7c4b2592da785cc3f148550ebf53e85a42b2ee76ca20082cfb2c44c439305a45a947729a59138
7
+ data.tar.gz: e9fe1e88848f518f8cf04d72e2276828a02e7ac0b52ead04693ed6619a57af2a89c965e6a532a6484de0fc4d2be8569cc06c46fe8850a72e8fee25320552956d
data/Rakefile CHANGED
@@ -36,7 +36,10 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
36
36
 
37
37
  package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
38
38
  package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
39
- package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
39
+ package.dependency.gem.runtime = [
40
+ ["pkg-config", ">= 0"],
41
+ ["native-package-installer", ">= 0"],
42
+ ]
40
43
  package.dependency.gem.development = [["test-unit", ">= 2"]]
41
44
  package.windows.packages = []
42
45
  package.windows.dependencies = []
@@ -85,12 +88,13 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
85
88
  :name => "glib",
86
89
  :download_site => :gnome,
87
90
  :label => "GLib",
88
- :version => "2.50.2",
91
+ :version => "2.52.1",
89
92
  :compression_method => "xz",
90
93
  :windows => {
91
94
  :need_autoreconf => true,
92
95
  :patches => [
93
96
  "glib-2.48.0-add-missing-exeext.diff",
97
+ "glib-2.52.1-fix-build-error.diff",
94
98
  ],
95
99
  :built_file => "bin/libglib-2.0-0.dll",
96
100
  },
@@ -17,10 +17,10 @@ require 'mkmf-gnome2'
17
17
  setup_windows(module_name, base_dir)
18
18
 
19
19
  unless required_pkg_config_package([package_id, 2, 12, 0],
20
- :altlinux => "glib2-devel",
20
+ :alt_linux => "glib2-devel",
21
21
  :debian => "libglib2.0-dev",
22
22
  :redhat => "glib2-devel",
23
- :arch => "glib2",
23
+ :arch_linux => "glib2",
24
24
  :homebrew => "glib",
25
25
  :macports => "glib2")
26
26
  exit(false)
@@ -46,6 +46,8 @@ have_func("ruby_native_thread_p", ruby_header)
46
46
  have_func("rb_thread_call_with_gvl", ruby_header)
47
47
  have_func("rb_gc_register_mark_object", ruby_header)
48
48
  have_func("rb_exc_new_str", ruby_header)
49
+ # For Ruby 2.1. TODO: Remove this when we drop Ruby 2.1 support.
50
+ have_func("rb_enc_str_new_static", ruby_header)
49
51
 
50
52
  have_var("curr_thread", [ruby_header, "node.h"])
51
53
  have_var("rb_curr_thread", [ruby_header, "node.h"])
@@ -22,6 +22,7 @@ EXPORTS
22
22
  rbgobj_create_object
23
23
  rbgobj_gobject_new
24
24
  rbgobj_gobject_initialize
25
+ rbgobj_boxed_alloc_func
25
26
  rbgobj_boxed_create
26
27
  rbgobj_boxed_get
27
28
  rbgobj_boxed_get_default
@@ -47,6 +48,8 @@ EXPORTS
47
48
  rbgobj_get_enum
48
49
  rbgobj_make_flags
49
50
  rbgobj_get_flags
51
+ rbgobj_enum_alloc_func
52
+ rbgobj_flags_alloc_func
50
53
  rbgobj_register_g2r_func
51
54
  rbgobj_register_r2g_func
52
55
  rbgobj_register_class
@@ -54,6 +57,7 @@ EXPORTS
54
57
  rbgobj_register_property_setter
55
58
  rbgobj_class_init_func
56
59
  rbgobj_register_type
60
+ rbgobj_object_alloc_func
57
61
  rbgobj_set_signal_func
58
62
  rbgobj_get_signal_func
59
63
  rbgobj_set_signal_call_func
@@ -0,0 +1,78 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2017 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgprivate.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cBytes
24
+
25
+ #define _SELF(s) (RVAL2BOXED(s, G_TYPE_BYTES))
26
+
27
+ #if GLIB_CHECK_VERSION(2, 32, 0)
28
+ static VALUE RG_TARGET_NAMESPACE;
29
+
30
+ static VALUE
31
+ rg_initialize(int argc, VALUE *argv, VALUE self)
32
+ {
33
+ GBytes *bytes;
34
+ VALUE rb_data;
35
+
36
+ rb_scan_args(argc, argv, "01", &rb_data);
37
+ if (NIL_P(rb_data)) {
38
+ bytes = g_bytes_new(NULL, 0);
39
+ } else {
40
+ const gchar *data = RVAL2CSTR_PTR(rb_data);
41
+ bytes = g_bytes_new(data, RSTRING_LEN(rb_data));
42
+ }
43
+ G_INITIALIZE(self, bytes);
44
+
45
+ return Qnil;
46
+ }
47
+
48
+ static VALUE
49
+ rg_to_s(VALUE self)
50
+ {
51
+ GBytes *bytes;
52
+ gconstpointer data;
53
+ gsize size;
54
+ VALUE rb_data;
55
+
56
+ bytes = _SELF(self);
57
+ data = g_bytes_get_data(bytes, &size);
58
+ # ifdef HAVE_RB_ENC_STR_NEW_STATIC
59
+ rb_data = rb_enc_str_new_static(data, size, rb_ascii8bit_encoding());
60
+ rb_iv_set(rb_data, "@bytes", self);
61
+ # else
62
+ rb_data = rb_enc_str_new(data, size, rb_ascii8bit_encoding());
63
+ # endif
64
+ return rb_data;
65
+ }
66
+ #endif
67
+
68
+ void
69
+ Init_glib_bytes(void)
70
+ {
71
+ #if GLIB_CHECK_VERSION(2, 32, 0)
72
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BYTES, "Bytes", mGLib);
73
+
74
+ RG_DEF_METHOD(initialize, -1);
75
+ RG_DEF_METHOD(to_s, 0);
76
+ RG_DEF_ALIAS("to_str", "to_s");
77
+ #endif
78
+ }
@@ -1189,4 +1189,5 @@ union GDoubleIEEE754;
1189
1189
  Init_glib_matchinfo();
1190
1190
  Init_glib_date_time();
1191
1191
  Init_glib_time_zone();
1192
+ Init_glib_bytes();
1192
1193
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2002-2016 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2002-2017 Ruby-GNOME2 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
@@ -36,7 +36,7 @@ extern "C" {
36
36
 
37
37
  #define RBGLIB_MAJOR_VERSION 3
38
38
  #define RBGLIB_MINOR_VERSION 1
39
- #define RBGLIB_MICRO_VERSION 1
39
+ #define RBGLIB_MICRO_VERSION 2
40
40
 
41
41
  #ifndef RB_ZALLOC
42
42
  # ifdef ZALLOC
@@ -69,8 +69,10 @@ rg_s_now(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
69
69
  date = g_date_time_new_now_local();
70
70
  } else if (is_utc_timezone(rb_timezone)) {
71
71
  date = g_date_time_new_now_utc();
72
+ #if GLIB_CHECK_VERSION(2, 34, 0)
72
73
  } else if (is_timezone(rb_timezone)) {
73
74
  date = g_date_time_new_now(RVAL2GTIMEZONE(rb_timezone));
75
+ #endif
74
76
  } else {
75
77
  rb_raise(rb_eArgError,
76
78
  "timezone must be nil, :local, :utc or GLib::TimeZone: "
@@ -158,6 +160,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
158
160
  hour,
159
161
  minute,
160
162
  second);
163
+ #if GLIB_CHECK_VERSION(2, 34, 0)
161
164
  } else if (is_timezone(rb_timezone)) {
162
165
  GTimeZone *timezone = NULL;
163
166
 
@@ -169,6 +172,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
169
172
  hour,
170
173
  minute,
171
174
  second);
175
+ #endif
172
176
  } else {
173
177
  rb_raise(rb_eArgError,
174
178
  ":timezone must be nil, :local, :utc or GLib::TimeZone: "
@@ -22,6 +22,7 @@
22
22
  #define RG_TARGET_NAMESPACE cTimeZone
23
23
  #define _SELF(s) ((GTimeZone*)RVAL2BOXED(s, G_TYPE_TIME_ZONE))
24
24
 
25
+ #if GLIB_CHECK_VERSION(2, 34, 0)
25
26
  static VALUE
26
27
  rg_initialize(gint argc, VALUE *argv, VALUE self)
27
28
  {
@@ -68,10 +69,12 @@ rg_offset(VALUE self, VALUE rb_interval)
68
69
  gint interval = NUM2INT(rb_interval);
69
70
  return INT2NUM(g_time_zone_get_offset(_SELF(self), interval));
70
71
  }
72
+ #endif
71
73
 
72
74
  void
73
75
  Init_glib_time_zone(void)
74
76
  {
77
+ #if GLIB_CHECK_VERSION(2, 34, 0)
75
78
  VALUE RG_TARGET_NAMESPACE;
76
79
  RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIME_ZONE, "TimeZone", mGLib);
77
80
  RG_DEF_METHOD(initialize, -1);
@@ -79,4 +82,5 @@ Init_glib_time_zone(void)
79
82
  RG_DEF_SMETHOD(utc, 0);
80
83
  RG_DEF_METHOD(abbreviation, 1);
81
84
  RG_DEF_METHOD(offset, 1);
85
+ #endif
82
86
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2017 Ruby-GNOME2 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
@@ -52,8 +52,8 @@ boxed_free(boxed_holder *holder)
52
52
 
53
53
  /**********************************************************************/
54
54
 
55
- static VALUE
56
- rbgobj_boxed_s_allocate(VALUE klass)
55
+ VALUE
56
+ rbgobj_boxed_alloc_func(VALUE klass)
57
57
  {
58
58
  const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass);
59
59
  boxed_holder *holder;
@@ -147,7 +147,7 @@ rg_initialize_copy(VALUE self, VALUE orig)
147
147
  VALUE
148
148
  rbgobj_boxed_create(VALUE klass)
149
149
  {
150
- return rbgobj_boxed_s_allocate(klass);
150
+ return rbgobj_boxed_alloc_func(klass);
151
151
  }
152
152
 
153
153
  /**********************************************************************/
@@ -199,7 +199,7 @@ rbgobj_make_boxed_raw(gpointer p, GType gtype, VALUE klass, gint flags)
199
199
  VALUE result;
200
200
  boxed_holder *holder;
201
201
 
202
- result = rbgobj_boxed_s_allocate(klass);
202
+ result = rbgobj_boxed_alloc_func(klass);
203
203
 
204
204
  Data_Get_Struct(result, boxed_holder, holder);
205
205
 
@@ -254,7 +254,7 @@ rbgobj_boxed_unown(VALUE boxed)
254
254
 
255
255
  if (!holder->own) {
256
256
  rb_raise(rb_eArgError,
257
- "The boxed is already unowned: %p",
257
+ "The boxed is already unowned: %" PRIsVALUE,
258
258
  boxed);
259
259
  }
260
260
 
@@ -289,7 +289,7 @@ Init_gobject_gboxed(void)
289
289
  rbgobj_register_g2r_func(G_TYPE_BOXED, boxed_to_ruby);
290
290
  rbgobj_register_r2g_func(G_TYPE_BOXED, boxed_from_ruby);
291
291
 
292
- rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))rbgobj_boxed_s_allocate);
292
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, rbgobj_boxed_alloc_func);
293
293
  rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
294
294
  rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0);
295
295
  RG_DEF_METHOD(initialize, 0);
@@ -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-2017 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2004-2006 Ruby-GNOME2 Project Team
5
5
  * Copyright (C) 2002,2003 Masahiro Sakai
6
6
  *
@@ -254,8 +254,8 @@ rg_s_values(VALUE self)
254
254
  enum_s_values_ensure, (VALUE)args.gclass);
255
255
  }
256
256
 
257
- static VALUE
258
- enum_s_allocate(VALUE self)
257
+ VALUE
258
+ rbgobj_enum_alloc_func(VALUE self)
259
259
  {
260
260
  GType gtype = CLASS2GTYPE(self);
261
261
 
@@ -426,7 +426,7 @@ Init_gobject_genums(void)
426
426
  RG_DEF_SMETHOD(range, 0);
427
427
  RG_DEF_SMETHOD(values, 0);
428
428
 
429
- rb_define_alloc_func(RG_TARGET_NAMESPACE, enum_s_allocate);
429
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, rbgobj_enum_alloc_func);
430
430
 
431
431
  RG_DEF_METHOD(initialize, -1);
432
432
  RG_DEF_METHOD(to_i, 0);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2004-2015 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2004-2017 Ruby-GNOME2 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
@@ -201,8 +201,8 @@ rg_s_values(VALUE klass)
201
201
  return result;
202
202
  }
203
203
 
204
- static VALUE
205
- flags_s_allocate(VALUE self)
204
+ VALUE
205
+ rbgobj_flags_alloc_func(VALUE self)
206
206
  {
207
207
  GType gtype = CLASS2GTYPE(self);
208
208
 
@@ -533,7 +533,7 @@ Init_gobject_gflags(void)
533
533
  RG_DEF_SMETHOD(mask, 0);
534
534
  RG_DEF_SMETHOD(values, 0);
535
535
 
536
- rb_define_alloc_func(RG_TARGET_NAMESPACE, flags_s_allocate);
536
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, rbgobj_flags_alloc_func);
537
537
 
538
538
  RG_DEF_METHOD(initialize, -1);
539
539
 
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2015 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2017 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
5
5
  * Copyright (C) 2002-2003 Masahiro Sakai
6
6
  * Copyright (C) 1998-2000 Yukihiro Matsumoto,
@@ -77,8 +77,8 @@ holder_free(gobj_holder *holder)
77
77
  xfree(holder);
78
78
  }
79
79
 
80
- static VALUE
81
- gobj_s_allocate(VALUE klass)
80
+ VALUE
81
+ rbgobj_object_alloc_func(VALUE klass)
82
82
  {
83
83
  gobj_holder* holder;
84
84
  VALUE result;
@@ -96,7 +96,7 @@ gobj_s_allocate(VALUE klass)
96
96
  VALUE
97
97
  rbgobj_create_object(VALUE klass)
98
98
  {
99
- return gobj_s_allocate(klass);
99
+ return rbgobj_object_alloc_func(klass);
100
100
  }
101
101
 
102
102
  void
@@ -135,7 +135,7 @@ rbgobj_get_ruby_object_from_gobject(GObject* gobj, gboolean alloc)
135
135
  } else if (alloc) {
136
136
  VALUE obj;
137
137
 
138
- obj = gobj_s_allocate(GTYPE2CLASS(G_OBJECT_TYPE(gobj)));
138
+ obj = rbgobj_object_alloc_func(GTYPE2CLASS(G_OBJECT_TYPE(gobj)));
139
139
  gobj = g_object_ref(gobj);
140
140
  rbgobj_gobject_initialize(obj, (gpointer)gobj);
141
141
  return obj;
@@ -960,7 +960,7 @@ Init_gobject_gobject(void)
960
960
 
961
961
  RUBY_GOBJECT_OBJ_KEY = g_quark_from_static_string("__ruby_gobject_object__");
962
962
 
963
- rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))gobj_s_allocate);
963
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, rbgobj_object_alloc_func);
964
964
  RG_DEF_SMETHOD_BANG(new, -1);
965
965
 
966
966
  rbg_define_singleton_method(RG_TARGET_NAMESPACE, "property", &gobj_s_property, 1);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2002-2017 Ruby-GNOME2 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
@@ -175,6 +175,23 @@ rbgobj_lookup_class_by_gtype_without_lock(GType gtype, VALUE parent,
175
175
  cinfo->klass = rb_funcall(rb_cClass, id_new, 1, parent);
176
176
  }
177
177
 
178
+ switch (fundamental_type){
179
+ case G_TYPE_BOXED:
180
+ rb_define_alloc_func(cinfo->klass, rbgobj_boxed_alloc_func);
181
+ break;
182
+ case G_TYPE_OBJECT:
183
+ rb_define_alloc_func(cinfo->klass, rbgobj_object_alloc_func);
184
+ break;
185
+ case G_TYPE_ENUM:
186
+ rb_define_alloc_func(cinfo->klass, rbgobj_enum_alloc_func);
187
+ break;
188
+ case G_TYPE_FLAGS:
189
+ rb_define_alloc_func(cinfo->klass, rbgobj_flags_alloc_func);
190
+ break;
191
+ default:
192
+ break;
193
+ }
194
+
178
195
  cinfod = (RGObjClassInfoDynamic *)g_hash_table_lookup(dynamic_gtype_list,
179
196
  g_type_name(gtype));
180
197
  if (cinfod){
@@ -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,2017 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
5
5
  * Copyright (C) 2002,2003 Masahiro Sakai
6
6
  *
@@ -30,7 +30,7 @@ VALUE RG_TARGET_NAMESPACE;
30
30
  static VALUE
31
31
  rg_append_features(G_GNUC_UNUSED VALUE self, VALUE klass)
32
32
  {
33
- if (!rb_obj_is_kind_of(klass, cInstantiatable))
33
+ if (!RVAL2CBOOL(rb_class_inherited_p(klass, cInstantiatable)))
34
34
  rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
35
35
  return rb_call_super(1, &klass);
36
36
  }
@@ -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-2017 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2003,2006 Ruby-GNOME2 Project Team
5
5
  * Copyright (C) 2002,2003 Masahiro Sakai
6
6
  *
@@ -247,8 +247,10 @@ extern void rbgobj_register_property_setter(GType gtype, const char* prop_name,
247
247
  extern void rbgobj_register_property_getter(GType gtype, const char* prop_name, GValueToRValueFunc func);
248
248
  extern void rbgobj_class_init_func(gpointer g_class, gpointer class_data);
249
249
  extern void rbgobj_register_type(VALUE klass, VALUE type_name, GClassInitFunc class_init);
250
+ extern VALUE rbgobj_object_alloc_func(VALUE klass);
250
251
 
251
252
  /* rbgobj_boxed.c */
253
+ extern VALUE rbgobj_boxed_alloc_func(VALUE klass);
252
254
  extern VALUE rbgobj_boxed_create(VALUE klass); /* deprecated */
253
255
  extern gpointer rbgobj_boxed_get(VALUE obj, GType gtype);
254
256
  extern gpointer rbgobj_boxed_get_default(VALUE obj, GType gtype);
@@ -267,6 +269,8 @@ extern gint rbgobj_get_enum(VALUE obj, GType gtype);
267
269
  extern VALUE rbgobj_make_flags(guint n, GType gtype);
268
270
  extern guint rbgobj_get_flags(VALUE obj, GType gtype);
269
271
  extern void rbgobj_define_const(VALUE mod, const char *name, VALUE value);
272
+ extern VALUE rbgobj_enum_alloc_func(VALUE klass);
273
+ extern VALUE rbgobj_flags_alloc_func(VALUE klass);
270
274
 
271
275
 
272
276
  /* rbglib_mainloop.c */
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2007-2015 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2007-2017 Ruby-GNOME2 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
@@ -152,6 +152,7 @@ G_GNUC_INTERNAL void Init_glib_regex(void);
152
152
  G_GNUC_INTERNAL void Init_glib_matchinfo(void);
153
153
  G_GNUC_INTERNAL void Init_glib_date_time(void);
154
154
  G_GNUC_INTERNAL void Init_glib_time_zone(void);
155
+ G_GNUC_INTERNAL void Init_glib_bytes(void);
155
156
 
156
157
  G_GNUC_INTERNAL void Init_gobject_convert(void);
157
158
  G_GNUC_INTERNAL void Init_gobject_gtype(void);
@@ -123,14 +123,16 @@ module GNOME2
123
123
  s.author = @author
124
124
  s.email = @email
125
125
  s.homepage = @homepage
126
- s.licenses = ["LGPLv2.1+"]
126
+ s.licenses = ["LGPL-2.1+"]
127
127
  s.version = version
128
- extensions = FileList["ext/#{@name}/extconf.rb"]
128
+ extensions = FileList["ext/#{@name}/extconf.rb",
129
+ "dependency-check/Rakefile"]
129
130
  extensions.existing!
130
131
  s.extensions = extensions
131
132
  s.require_paths = ["lib"]
132
133
  files = FileList["ChangeLog", "README",
133
134
  "Rakefile", "extconf.rb",
135
+ "dependency-check/Rakefile",
134
136
  "lib/**/*.rb",
135
137
  "ext/**/depend",
136
138
  "ext/**/*.{c,h,def,rb}",
@@ -13,6 +13,7 @@ require 'English'
13
13
  require 'mkmf'
14
14
  require 'pkg-config'
15
15
  require 'glib-mkenums'
16
+ require "native-package-installer"
16
17
 
17
18
  $CFLAGS += " #{ENV['CFLAGS']}" if ENV['CFLAGS']
18
19
 
@@ -106,7 +107,7 @@ include_path = nil
106
107
  if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
107
108
  include_path = (ENV['GTK_BASEPATH'] + "\\INCLUDE").gsub("\\", "/")
108
109
  # $hdrdir += " -I#{include_path} "
109
- $CFLAGS += " -I#{include_path} "
110
+ $INCFLAGS += " -I#{include_path} "
110
111
  end
111
112
 
112
113
  def windows_platform?
@@ -123,7 +124,7 @@ def setup_windows(target_name, base_dir=nil)
123
124
  base_dir = Pathname(base_dir) if base_dir.is_a?(String)
124
125
  binary_base_dir = base_dir + "vendor" + "local"
125
126
  if binary_base_dir.exist?
126
- $CFLAGS += " -I#{binary_base_dir}/include"
127
+ $INCFLAGS += " -I#{binary_base_dir}/include"
127
128
  pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
128
129
  PKGConfig.add_path(pkg_config_dir.to_s)
129
130
  end
@@ -147,7 +148,8 @@ def find_gem_spec(package)
147
148
  end
148
149
 
149
150
  def setup_homebrew_libffi
150
- return unless package_platform == :homebrew
151
+ platform = NativePackageInstaller::Platform.detect
152
+ return unless platform.is_a?(NativePackageInstaller::Platform::Homebrew)
151
153
 
152
154
  PKGConfig.add_path("/usr/local/opt/libffi/lib/pkgconfig")
153
155
  end
@@ -463,127 +465,14 @@ def check_cairo(options={})
463
465
  add_depend_package("cairo", "ext/cairo", rcairo_source_dir, options)
464
466
  $defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
465
467
  end
466
- $CFLAGS += " -I#{rcairo_source_dir}/ext/cairo"
468
+ $INCFLAGS += " -I#{rcairo_source_dir}/ext/cairo"
467
469
  end
468
470
 
469
471
  PKGConfig.have_package('cairo') and have_header('rb_cairo.h')
470
472
  end
471
473
 
472
- def package_platform
473
- if File.exist?("/etc/debian_version")
474
- :debian
475
- elsif File.exist?("/etc/fedora-release")
476
- :fedora
477
- elsif File.exist?("/etc/redhat-release")
478
- :redhat
479
- elsif File.exist?("/etc/SuSE-release")
480
- :suse
481
- elsif File.exist?("/etc/altlinux-release")
482
- :altlinux
483
- elsif find_executable("pacman")
484
- :arch
485
- elsif find_executable("brew")
486
- :homebrew
487
- elsif find_executable("port")
488
- :macports
489
- else
490
- :unknown
491
- end
492
- end
493
-
494
- def super_user?
495
- Process.uid.zero?
496
- end
497
-
498
- def normalize_native_package_info(native_package_info)
499
- native_package_info ||= {}
500
- native_package_info = native_package_info.dup
501
- native_package_info[:fedora] ||= native_package_info[:redhat]
502
- native_package_info[:suse] ||= native_package_info[:fedora]
503
- native_package_info
504
- end
505
-
506
474
  def install_missing_native_package(native_package_info)
507
- platform = package_platform
508
- native_package_info = normalize_native_package_info(native_package_info)
509
- package = native_package_info[platform]
510
- return false if package.nil?
511
-
512
- package_name, *options = package
513
- package_command_line = [package_name, *options].join(" ")
514
- need_super_user_priviledge = true
515
- case platform
516
- when :debian, :altlinux
517
- install_command = "apt-get install -V -y #{package_command_line}"
518
- when :fedora, :redhat
519
- install_command = "yum install -y #{package_command_line}"
520
- when :suse
521
- install_command = "zypper --non-interactive install #{package_command_line}"
522
- when :arch
523
- install_command = "pacman -S --noconfirm #{package_command_line}"
524
- when :homebrew
525
- need_super_user_priviledge = false
526
- install_command = "brew install #{package_command_line}"
527
- when :macports
528
- install_command = "port install -y #{package_command_line}"
529
- else
530
- return false
531
- end
532
-
533
- have_priviledge = (not need_super_user_priviledge or super_user?)
534
- unless have_priviledge
535
- sudo = find_executable("sudo")
536
- end
537
-
538
- installing_message = "installing '#{package_name}' native package... "
539
- message("%s", installing_message)
540
- failed_to_get_super_user_priviledge = false
541
- if have_priviledge
542
- succeeded = xsystem(install_command)
543
- else
544
- if sudo
545
- prompt = "[sudo] password for %u to install <#{package_name}>: "
546
- sudo_options = "-p #{Shellwords.escape(prompt)}"
547
- install_command = "#{sudo} #{sudo_options} #{install_command}"
548
- succeeded = xsystem(install_command)
549
- else
550
- succeeded = false
551
- failed_to_get_super_user_priviledge = true
552
- end
553
- end
554
-
555
- if failed_to_get_super_user_priviledge
556
- result_message = "require super user privilege"
557
- else
558
- result_message = succeeded ? "succeeded" : "failed"
559
- end
560
- Logging.postpone do
561
- "#{installing_message}#{result_message}\n"
562
- end
563
- message("#{result_message}\n")
564
-
565
- error_message = nil
566
- unless succeeded
567
- if failed_to_get_super_user_priviledge
568
- error_message = <<-EOM
569
- '#{package_name}' native package is required.
570
- run the following command as super user to install required native package:
571
- \# #{install_command}
572
- EOM
573
- else
574
- error_message = <<-EOM
575
- failed to run '#{install_command}'.
576
- EOM
577
- end
578
- end
579
- if error_message
580
- message("%s", error_message)
581
- Logging.message("%s", error_message)
582
- end
583
-
584
- Logging.message("--------------------\n\n")
585
-
586
- succeeded
475
+ NativePackageInstaller.install(native_package_info)
587
476
  end
588
477
 
589
478
  def required_pkg_config_package(package_info, native_package_info=nil)
@@ -0,0 +1,36 @@
1
+ # Copyright (C) 2017 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
+ class TestGLibBytes < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ setup do
21
+ only_glib_version(2, 32, 0)
22
+ end
23
+
24
+ test "#to_s" do
25
+ data = "Hello"
26
+ bytes = GLib::Bytes.new(data)
27
+ string = bytes.to_s
28
+ assert_equal([data, Encoding::ASCII_8BIT],
29
+ [string, string.encoding])
30
+ end
31
+
32
+ test "#to_str" do
33
+ bytes = GLib::Bytes.new("Hello")
34
+ assert_equal(bytes.to_s, bytes.to_str)
35
+ end
36
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2016-2017 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
@@ -15,6 +15,8 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestDateTime < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
18
20
  def test_now_local
19
21
  now = GLib::DateTime.now(:local)
20
22
  format = "%Y-%m-%d-%H-%M"
@@ -74,6 +76,7 @@ class TestDateTime < Test::Unit::TestCase
74
76
  end
75
77
 
76
78
  test "timezone: local time zone" do
79
+ only_glib_version(2, 34, 0)
77
80
  time = Time.now
78
81
  tz = GLib::TimeZone.local
79
82
  datetime = GLib::DateTime.new(:timezone => tz,
@@ -92,6 +95,7 @@ class TestDateTime < Test::Unit::TestCase
92
95
  end
93
96
 
94
97
  test "timezone: UTC time zone" do
98
+ only_glib_version(2, 34, 0)
95
99
  time = Time.now.utc
96
100
  tz = GLib::TimeZone.utc
97
101
  datetime = GLib::DateTime.new(:timezone => tz,
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2017 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
@@ -15,6 +15,12 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestMatchInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ setup do
21
+ only_glib_version(2, 30, 0)
22
+ end
23
+
18
24
  def test_string
19
25
  regex = GLib::Regex.new("[A-Z]+")
20
26
  match_info = regex.match("abc def")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2017 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
@@ -15,6 +15,12 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestRegex < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ setup do
21
+ only_glib_version(2, 30, 0)
22
+ end
23
+
18
24
  def test_enum_match_flags
19
25
  assert_const_defined(GLib, :RegexMatchFlags)
20
26
  assert_kind_of(GLib::RegexMatchFlags, GLib::RegexMatchFlags::PARTIAL_HARD)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2016-2017 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
@@ -15,6 +15,12 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestTimeZone < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ setup do
21
+ only_glib_version(2, 34, 0)
22
+ end
23
+
18
24
  sub_test_case "new" do
19
25
  test "local" do
20
26
  local_1 = GLib::TimeZone.local
@@ -0,0 +1,38 @@
1
+ # Copyright (C) 2017 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
+ class TestTypeInterface < Test::Unit::TestCase
18
+ sub_test_case("#append_features") do
19
+ def test_not_instantiatable
20
+ plain_class = Class.new
21
+ assert_raise(TypeError.new("Not a subclass of GLib::Instantiatable")) do
22
+ plain_class.class_eval do
23
+ include GLib::TypePlugin
24
+ end
25
+ end
26
+ end
27
+
28
+ def test_instantiatable
29
+ gobject_class = Class.new(GLib::Object)
30
+ gobject_class.class_eval do
31
+ include GLib::TypePlugin
32
+ end
33
+ assert do
34
+ gobject_class.method_defined?(:use)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -111,6 +111,7 @@ class TestGLibVariantType < Test::Unit::TestCase
111
111
  end
112
112
 
113
113
  test "OBJECT_PATH_ARRAY" do
114
+ only_glib_version(2, 30, 0)
114
115
  assert_equal("ao", GLib::VariantType::OBJECT_PATH_ARRAY.to_s)
115
116
  end
116
117
 
@@ -123,6 +124,7 @@ class TestGLibVariantType < Test::Unit::TestCase
123
124
  end
124
125
 
125
126
  test "VARDICT" do
127
+ only_glib_version(2, 30, 0)
126
128
  assert_equal("a{sv}", GLib::VariantType::VARDICT.to_s)
127
129
  end
128
130
  end
@@ -13,7 +13,7 @@
13
13
  # You should have received a copy of the GNU Lesser General Public
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
-
16
+
17
17
  require 'tempfile'
18
18
 
19
19
  class TestGLibKeyFile < Test::Unit::TestCase
@@ -35,10 +35,14 @@ class TestGLibKeyFile < Test::Unit::TestCase
35
35
  end
36
36
  if GLib.check_version?(2, 31, 2)
37
37
  assert_equal(temp.path, key_file.load_from_dirs(base_name, search_dirs))
38
- else
38
+ elsif GLib.check_version?(2, 30, 0)
39
39
  assert_raise(GLib::KeyFileError::NotFound) do
40
40
  key_file.load_from_dirs(base_name, search_dirs)
41
41
  end
42
+ else
43
+ assert_raise(GLib::KeyFileError::Parse) do
44
+ key_file.load_from_dirs(base_name, search_dirs)
45
+ end
42
46
  end
43
47
  temp.puts(<<-EOK)
44
48
  [General]
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.1.1
4
+ version: 3.1.2
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: 2017-01-26 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: native-package-installer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: test-unit
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,7 @@ files:
52
66
  - ext/glib2/glib-enum-types.h
53
67
  - ext/glib2/glib2.def
54
68
  - ext/glib2/rbgcompat.h
69
+ - ext/glib2/rbglib-bytes.c
55
70
  - ext/glib2/rbglib-variant-type.c
56
71
  - ext/glib2/rbglib-variant.c
57
72
  - ext/glib2/rbglib.c
@@ -154,10 +169,12 @@ files:
154
169
  - test/glib-test-utils.rb
155
170
  - test/run-test.rb
156
171
  - test/test-binding.rb
172
+ - test/test-bytes.rb
157
173
  - test/test-date-time.rb
158
174
  - test/test-match-info.rb
159
175
  - test/test-regex.rb
160
176
  - test/test-time-zone.rb
177
+ - test/test-type-interface.rb
161
178
  - test/test-variant-type.rb
162
179
  - test/test-version.rb
163
180
  - test/test_enum.rb
@@ -178,7 +195,7 @@ files:
178
195
  - test/test_win32.rb
179
196
  homepage: http://ruby-gnome2.sourceforge.jp/
180
197
  licenses:
181
- - LGPLv2.1+
198
+ - LGPL-2.1+
182
199
  metadata: {}
183
200
  post_install_message:
184
201
  rdoc_options: []