glib2 1.0.0-x86-mingw32 → 1.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -302,7 +302,8 @@ rbgobj_gc_mark_gvalue(GValue* value)
302
302
 
303
303
  /**********************************************************************/
304
304
 
305
- void Init_gobject_gvalue()
305
+ void
306
+ Init_gobject_gvalue()
306
307
  {
307
308
  id_to_s = rb_intern("to_s");
308
309
  qRValueToGValueFunc = g_quark_from_static_string("__ruby_r2g_func__");
@@ -12,46 +12,51 @@
12
12
  #include "rbgprivate.h"
13
13
 
14
14
  static VALUE
15
- value_array_to_ruby(const GValue* from)
15
+ value_array_to_ruby(const GValue *from)
16
16
  {
17
17
  VALUE ary;
18
- int i;
19
- GValueArray *val_array = (GValueArray*)g_value_get_boxed(from);
20
- if (!val_array)
18
+ guint i;
19
+
20
+ GValueArray *array = (GValueArray *)g_value_get_boxed(from);
21
+ if (array == NULL)
21
22
  return Qnil;
22
23
 
23
24
  ary = rb_ary_new();
24
- for (i = 0 ; i < val_array->n_values ; i++) {
25
- rb_ary_push(ary, GVAL2RVAL(g_value_array_get_nth(val_array, i)));
26
- }
25
+ for (i = 0; i < array->n_values; i++)
26
+ rb_ary_push(ary, GVAL2RVAL(g_value_array_get_nth(array, i)));
27
+
27
28
  return ary;
28
29
  }
29
30
 
30
31
  static void
31
- value_array_from_ruby(VALUE from, GValue* to)
32
+ value_array_from_ruby(const VALUE from, GValue *to)
32
33
  {
33
34
  int i;
34
- GValueArray * array;
35
+ GValueArray *array;
35
36
 
36
37
  if (NIL_P(from)) {
37
38
  g_value_set_boxed(to, NULL);
39
+
38
40
  return;
39
41
  }
40
42
 
41
43
  Check_Type(from, T_ARRAY);
42
44
 
43
- array = g_value_array_new(0);
45
+ array = g_value_array_new(RARRAY_LEN(from));
44
46
 
45
47
  for (i = 0; i < RARRAY_LEN(from); i++) {
46
- GValue v = { 0, };
47
- g_value_init(&v, RVAL2GTYPE(RARRAY_PTR(from)[i]));
48
- rbgobj_rvalue_to_gvalue(RARRAY_PTR(from)[i], &v);
49
- g_value_array_append(array, &v);
48
+ GValue v = { 0, };
49
+ g_value_init(&v, RVAL2GTYPE(RARRAY_PTR(from)[i]));
50
+ rbgobj_rvalue_to_gvalue(RARRAY_PTR(from)[i], &v);
51
+
52
+ g_value_array_append(array, &v);
50
53
  }
54
+
51
55
  g_value_set_boxed(to, array);
52
56
  }
53
57
 
54
- void Init_gobject_value_array()
58
+ void
59
+ Init_gobject_value_array()
55
60
  {
56
61
  /* ValueArray is treated as Array */
57
62
  rbgobj_register_g2r_func(G_TYPE_VALUE_ARRAY, value_array_to_ruby);
@@ -204,7 +204,8 @@ value_transform_any_ruby(const GValue *src_value,
204
204
  g_value_set_ruby_value(dest_value, GVAL2RVAL(src_value));
205
205
  }
206
206
 
207
- GType rbgobj_ruby_value_get_type()
207
+ GType
208
+ rbgobj_ruby_value_get_type()
208
209
  {
209
210
  static GType our_type = 0;
210
211
 
@@ -229,7 +230,7 @@ GType rbgobj_ruby_value_get_type()
229
230
  G_TYPE_PARAM,
230
231
  G_TYPE_OBJECT,
231
232
  };
232
- int i;
233
+ size_t i;
233
234
 
234
235
  our_type = g_boxed_type_register_static(
235
236
  "VALUE",
@@ -250,7 +250,7 @@ rbgobj_define_property_accessors(VALUE klass)
250
250
  {
251
251
  GType gtype;
252
252
  GParamSpec** pspecs = NULL;
253
- int i;
253
+ guint i;
254
254
  GString* source;
255
255
  guint n_properties = 0;
256
256
  gtype = CLASS2GTYPE(klass);
@@ -353,17 +353,17 @@ Init_gobject()
353
353
 
354
354
  /* Not defined properties. They are already used as methods of Object */
355
355
  prop_exclude_list = g_hash_table_new(g_str_hash, g_str_equal);
356
- g_hash_table_insert(prop_exclude_list, "class", "class");
357
- g_hash_table_insert(prop_exclude_list, "clone", "clone");
358
- g_hash_table_insert(prop_exclude_list, "dup", "dup");
359
- g_hash_table_insert(prop_exclude_list, "extend", "extend");
360
- g_hash_table_insert(prop_exclude_list, "freeze", "freeze");
361
- g_hash_table_insert(prop_exclude_list, "hash", "hash");
362
- g_hash_table_insert(prop_exclude_list, "method", "method");
363
- g_hash_table_insert(prop_exclude_list, "methods", "methods");
364
- g_hash_table_insert(prop_exclude_list, "object_id", "object_id");
365
- g_hash_table_insert(prop_exclude_list, "taint", "taint");
366
- g_hash_table_insert(prop_exclude_list, "untaint", "untaint");
356
+ g_hash_table_insert(prop_exclude_list, (gpointer)"class", (gpointer)"class");
357
+ g_hash_table_insert(prop_exclude_list, (gpointer)"clone", (gpointer)"clone");
358
+ g_hash_table_insert(prop_exclude_list, (gpointer)"dup", (gpointer)"dup");
359
+ g_hash_table_insert(prop_exclude_list, (gpointer)"extend", (gpointer)"extend");
360
+ g_hash_table_insert(prop_exclude_list, (gpointer)"freeze", (gpointer)"freeze");
361
+ g_hash_table_insert(prop_exclude_list, (gpointer)"hash", (gpointer)"hash");
362
+ g_hash_table_insert(prop_exclude_list, (gpointer)"method", (gpointer)"method");
363
+ g_hash_table_insert(prop_exclude_list, (gpointer)"methods", (gpointer)"methods");
364
+ g_hash_table_insert(prop_exclude_list, (gpointer)"object_id", (gpointer)"object_id");
365
+ g_hash_table_insert(prop_exclude_list, (gpointer)"taint", (gpointer)"taint");
366
+ g_hash_table_insert(prop_exclude_list, (gpointer)"untaint", (gpointer)"untaint");
367
367
 
368
368
  /* IDs */
369
369
  id_relatives = rb_intern("__relatives__");
@@ -11,6 +11,10 @@
11
11
  #include "rbgobject.h"
12
12
  #include "glib-enum-types.h"
13
13
 
14
+ #ifndef HAVE_RB_ERRINFO
15
+ # define rb_errinfo() (ruby_errinfo)
16
+ #endif
17
+
14
18
  G_BEGIN_DECLS
15
19
 
16
20
  typedef struct {
@@ -28,6 +28,20 @@ extern "C" {
28
28
  "def " name "=(val); set_" name "(val); val; end\n"))
29
29
  #define G_DEF_SETTERS(klass) rbgutil_def_setters(klass)
30
30
 
31
+ #define G_REPLACE_SET_PROPERTY(klass, name, function, args) \
32
+ rb_undef_method(klass, "set_" name); \
33
+ rb_define_method(klass, "set_" name, function, args); \
34
+ rb_undef_method(klass, name "="); \
35
+ G_DEF_SETTER(klass, name)
36
+
37
+ #define G_REPLACE_GET_PROPERTY(klass, name, function, args) \
38
+ rb_undef_method(klass, name); \
39
+ rb_define_method(klass, name, function, args)
40
+
41
+ #define G_REPLACE_ACTION(klass, name, function, args) \
42
+ rb_undef_method(klass, name); \
43
+ rb_define_method(klass, name, function, args)
44
+
31
45
  #define G_SET_PROPERTIES(self, hash) (rbgutil_set_properties(self, hash))
32
46
  #define G_SET_SYMBOL_PROPERTY(gtype, name) \
33
47
  rbgobj_register_property_getter(gtype, name, rbgutil_sym_g2r_func)
@@ -12,20 +12,19 @@
12
12
 
13
13
  #include "rbgprivate.h"
14
14
 
15
- #ifdef HAVE_UNISTD_H
16
- # include <unistd.h>
17
- #endif
18
- #ifdef HAVE_IO_H
19
- # include <io.h>
20
- # define pipe(phandles) _pipe(phandles, 128, _O_BINARY)
15
+ #ifdef G_OS_WIN32
16
+ # ifdef HAVE_IO_H
17
+ # include <io.h>
18
+ # define pipe(phandles) _pipe(phandles, 128, _O_BINARY)
19
+ # endif
20
+ #else
21
+ # ifdef HAVE_UNISTD_H
22
+ # include <unistd.h>
23
+ # endif
21
24
  #endif
22
25
  #include <fcntl.h>
23
26
  #include <errno.h>
24
27
 
25
- #ifndef HAVE_RB_ERRINFO
26
- # define rb_errinfo() (ruby_errinfo)
27
- #endif
28
-
29
28
  #ifndef HAVE_RUBY_NATIVE_THREAD_P
30
29
  # define ruby_native_thread_p() is_ruby_native_thread()
31
30
  #endif
@@ -119,10 +118,18 @@ mainloop(void)
119
118
  static void
120
119
  queue_callback_request(CallbackRequest *request)
121
120
  {
121
+ ssize_t written;
122
+
122
123
  g_async_queue_push(callback_request_queue, request);
123
- write(callback_pipe_fds[1],
124
- CALLBACK_PIPE_READY_MESSAGE,
125
- CALLBACK_PIPE_READY_MESSAGE_SIZE);
124
+ written = write(callback_pipe_fds[1],
125
+ CALLBACK_PIPE_READY_MESSAGE,
126
+ CALLBACK_PIPE_READY_MESSAGE_SIZE);
127
+ if (written != CALLBACK_PIPE_READY_MESSAGE_SIZE) {
128
+ rb_warn("couldn't write all callback pipe ready message: "
129
+ "message-size: %d, written: %" G_GSSIZE_FORMAT,
130
+ CALLBACK_PIPE_READY_MESSAGE_SIZE,
131
+ written);
132
+ }
126
133
  }
127
134
 
128
135
  static VALUE
@@ -211,7 +218,8 @@ rbgutil_stop_callback_dispatch_thread(void)
211
218
  #endif
212
219
  }
213
220
 
214
- void Init_gutil_callback()
221
+ void
222
+ Init_gutil_callback()
215
223
  {
216
224
  id_exit_application = rb_intern("exit_application");
217
225
  rbgutil_eGLibCallbackNotInitializedError =
Binary file
Binary file
@@ -33,29 +33,39 @@ module GLib
33
33
  end
34
34
 
35
35
  def __add_one_arg_setter(klass)
36
- #for Instance methods.
37
- ary = klass.instance_methods(false)
38
- ary.each do |m|
39
- if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.instance_method(m).arity == 1
40
- begin
41
- klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end\n")
42
- rescue SyntaxError
43
- $stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
36
+ # for Instance methods.
37
+ method_names = klass.instance_methods(false)
38
+ method_names.each do |method_name|
39
+ next if /\Aset_/ !~ method_name
40
+ property_name = $POSTMATCH
41
+ next if klass.method_defined?("#{property_name}=")
42
+ next if klass.instance_method(method_name).arity != 1
43
+ begin
44
+ klass.module_eval("def #{property_name}=(val); set_#{property_name}(val); val; end\n")
45
+ rescue SyntaxError
46
+ if $DEBUG
47
+ $stderr.puts "Couldn't create #{klass}\##{property_name}=(v)."
44
48
  end
45
49
  end
46
50
  end
47
- #for Class methods/Module functions.
48
- if Object.method(:methods).arity == -1
49
- ary = klass.methods(false)
51
+
52
+ # for Class methods/Module functions.
53
+ if klass.method(:methods).arity == -1
54
+ method_names = klass.methods(false)
50
55
  else
51
- ary = klass.methods
52
- end
53
- ary.each do |m|
54
- if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.method(m).arity == 1
55
- begin
56
- klass.module_eval("def self.#{$1}=(val); set_#{$1}(val); val; end\n")
57
- rescue SyntaxError
58
- $stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
56
+ method_names = klass.methods
57
+ end
58
+ singleton_klass = (class << klass; self; end)
59
+ method_names.each do |method_name|
60
+ next if /\Aset_/ !~ method_name
61
+ property_name = $POSTMATCH
62
+ next if singleton_klass.method_defined?("#{property_name}=")
63
+ next if klass.method(method_name).arity != 1
64
+ begin
65
+ klass.module_eval("def self.#{property_name}=(val); set_#{property_name}(val); val; end\n")
66
+ rescue SyntaxError
67
+ if $DEBUG
68
+ $stderr.puts "Couldn't create #{klass}.#{property_name}=(v)."
59
69
  end
60
70
  end
61
71
  end
@@ -83,7 +93,7 @@ base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
83
93
  vendor_dir = base_dir + "vendor" + "local"
84
94
  GLib.prepend_environment_path(vendor_dir + "bin")
85
95
  begin
86
- major, minor, micro, = RUBY_VERSION.split(/\./)
96
+ major, minor, _ = RUBY_VERSION.split(/\./)
87
97
  require "#{major}.#{minor}/glib2.so"
88
98
  rescue LoadError
89
99
  require 'glib2.so'
@@ -79,7 +79,9 @@ end
79
79
  def add_depend_package(target_name, target_srcdir, top_srcdir, options={})
80
80
  begin
81
81
  require 'rubygems'
82
- gem_spec = Gem.source_index.find_name(target_name).last
82
+ gem_spec = (Gem::Specification.respond_to?(:find_by_name) ?
83
+ Gem::Specification.find_by_name(target_name) :
84
+ Gem.source_index.find_name(target_name)).last
83
85
  if gem_spec
84
86
  target_source_dir = File.join(gem_spec.full_gem_path, "ext/#{target_name}")
85
87
  target_build_dir = target_source_dir
@@ -383,7 +385,9 @@ def check_cairo(options={})
383
385
  if rcairo_source_dir.nil?
384
386
  begin
385
387
  require 'rubygems'
386
- cairo_gem_spec = Gem.source_index.find_name("cairo").last
388
+ cairo_gem_spec = (Gem::Specification.respond_to?(:find_by_name) ?
389
+ Gem::Specification.find_by_name('cairo') :
390
+ Gem.source_index.find_name('cairo')).last
387
391
  if cairo_gem_spec
388
392
  rcairo_source_dir = cairo_gem_spec.full_gem_path
389
393
  end
@@ -1,4 +1,5 @@
1
1
  $VERBOSE = true
2
2
 
3
+ require "rubygems"
3
4
  gem 'test-unit'
4
5
  require 'test/unit'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - The Ruby-GNOME2 Proejct Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-13 00:00:00 Z
18
+ date: 2011-09-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: pkg-config